Code works if USB connection from computer, but not if USB power from wall

I’m trying to report data from two thermocouples to Ubidots using an Code works fine when powered by a USB connection to my computer. However, when I connect to power using a 5.2V 1A wall plug, or when I used a USB 2A power adapter (no computer) I get a pulsing red/orange* led and there doesn’t seem to be any functional connection - no post to Ubidots, and the Spark.variables I declare are not accessible.

However, if I comment out the line, the program works whether powered by computer USB port or wall plug. There’s no pulsing red/orange, and I can see the Spark.variables being updated.

I have a program reporting just one thermocouple reading on a different spark core, and it’s been working fine with wall 5V power. This program is different in that there’s a toggle to post the 1st reading, wait 2 seconds, then post the 2nd reading.

Throwing this out there in case anyone has encountered anything like this**. Thanks for any ideas!

*FYI - when you’re color blind like me, diagnosing using the led color codes is incredibly difficult].

**Also, this doesn’t seem to be the same problem as in ‘Works on USB power. Fails when using VIN [SOLVED]’ since that seemed to be a case of an insufficient power supply.

1 Like

If you happen to have a multimeter, can you measure the voltage on the 3v3 to ground? :slight_smile:

Yup, 3.3V all around, whatever the power supply.
I would think it’s some assembly mistake on my part, too, but the weird computer USB -> works fine, wall USB power -> fails, is getting to me. Has something to do with interaction with the, so it’s probably some subtle code thing I have no clue about yet. Will update if I figure it out.

Solved the issue by changing the interval between the two requests I was using to post to Ubidots. Previously, had a 2s delay() between sending the thermocouple A and B measurements. This worked when USB was connected to my computer but failed with external (USB or wall wart) power.

Changed the interval to a 30s delay() and now all is well. Works for me. (The short interval was only really needed initially to check that the hardware was working and the temps being returned were legit.)

Still, would love to understand why whether the code worked at all depended on what the device was connected to.


I had a similar issue today and managed to fix it. Hoping this post helps anyone else in the same boat.

My code doesn’t use HTTP posts’s but rather I use SEMI AUTOMATIC and a finite state machine (FSM) to control the connection, based on code from @rickkas7 (thank you!).

Issue was that in my code the Electron was rebooting after calling Cellular.on().

I have external circuitry on a carrier board that accepts 12v input and regulates down to 5v for the Electron. When I had plugged in external power AND the usb cable for serial.print debugging the Cellular.on() call worked fine. BUT once I removed the usb cable and powered only from the DC external adapter the Electron would reboot immediately after calling Cellular.on(). Weird.

I initially thought must be 5v USB related but triple checked all my schematics and I’m not using 5V from the USB anywhere.

Adding a small non-blocking delay of 500ms after Cellular.on and before the next command fixed the issue for me. Not sure how this is related to USB but glad it worked. It works fine now running off just the external power.