Arduino Nano 33 IoT behaves differently by different power sources

Hi There,

I currently connect two gas sensors to the Arduino Nano 33 IoT. The board collects the data from the two gas sensors and sends them to the computer wirelessly. The code also sets the gas sensors to sleep for 50min and wake up for 10 min to form a one hour schedule to save the batter life. When I tested the arduino via USB cable from laptop, the code works and the gas sensors can be put to sleep but when I connected the board via USB cable from a power bank, the sensors cannot be put to sleep despite the code has not been changed.

I don’t know why. Is it a power decoupling thing? How do I solve it?


1 Like

Photos of your wiring and code? Which sensors are they?

1 Like

Hi Lee.
I haven’t had extensive experience with a lot of different power banks but I believe they are designed to charge batteries in phones etc, which they do.
If you have access to an oscilloscope the results when looking at the 5V can be interesting. One I have does not “clean up” until it is supplying about 500mA. I think most of them actually switch off when the current drops to 100mA or so. If your drain is small could it be switching on and off?
Suggestion. Try temporarily connecting a 10Ω resistor across the power bank with your set up and see if that fixes your problem. This will add 500mA to the load but will dissipate 2.5W so about a 5W resistor will be required.
Cheers Bob


Hi All
Add on from above:
Lee has a problem when trying to operate his Nano from a power bank. The first comment is as I mentioned above. These power banks are not a “power supply” as such and as far as I am aware they are not advertised to be so. They are an emergency source to charge a phone or any other 5V device on the road or when another charger is not available. In this application they seem to work quite well. I have one which has a fair bit of saw tooth shape on top of the 5V until it is supplying 500mA plus and the whole supply switches off when the output falls to about 100mA. Now to charge another battery these 2 situations do not really matter. But as a power supply OUCH!!!

I think the lesson here is to use a piece of equipment for what the designers intended. This applies to anything. If you want to charge a battery a power bank is OK. if you want a power supply use one.

A small supply is not hard to knock up. I use a couple. An 18650 battery and holder, a bit of double sided tape and one of those little boost converters with 5V on a USB connector stuck to the side of the battery holder. I don’t even have an on/off switch. I just pop the battery out of the holder when not in use.

These things work pretty well and are good for about 500mA which is adequate for most small experiments. If I need any more grunt I use a bench supply.

I guess what I am trying to say here is if you use something that is designed for the job you are less likely to experience strange outcomes. If you have to use something else be aware of that equipments limitations. This applies to most anything. Especially power sources and test equipment. These are really both ends of an experiment with the DUT (device under test) in the middle.

Cheers Bob


Hi Bob. Thanks for your replies! You were right about the power supplies. I did encounter this problem but I solved it by finding a power bank on the market that does not turn it off when the current draw is low, i.e. 100mA. This Xiaomi power bank works well as I tested - it lasts for one week and the arduino board is nonstopply powered by it. I did a bit of search and found someone mentioning power noise. Now I am using a 10 uF capacitor in parallel with the sensor to stabilize the voltage. But it does not work. Any thoughts?
Also, the way I turned off the sensor is by sending a RS232 cmd to the sensor. And then by the light of the sensor I can tell if it is off. My problem is the sensor cannot be turned off. It may be because the arduino is not sending the cmd to the sensor.

Hi Lee

Possible. But you say in your initial post that all is well with Arduino powered from computer. An oscilloscope here would be an invaluable tool. Failing that a LED and resistor may give an indication like the TX/RX LEDs on the Arduino which flicker when uploading a sketch. Size the resistor for about 5mA or less so you don’t load the signal. 600Ω or 1kΩ should still light most LEDs.
Exactly what sensors are they. This question has been asked but you have not enlightened anyone yet.
Even though they are not turning off do the sensors still report data OK? You have not indicated. This would help decide if your communication line is working with this power supply.
I know it is a long shot but would it be that somehow the computer is sending the sleep signal. Like I say a long shot but stranger things have happened.

Exactly where is this capacitor connected? Across the supply to the sensor or across the signal line.
10µF will not necessarily get rid of higher frequency noise. At higher frequencies it could be more inductor than capacitor. Depends a lot on physical construction. You would be better off with about 0.1µF cap for this purpose.

All too often I have noticed people doing or suggesting throwing a capacitor across a wire or connection to tame perceived “noise”. In my experience it is not a good idea to throw capacitors around in a random fashion as I have mentioned in previous posts. In a lot of cases you could make any real or imaginary problem worse. I say imaginary because even a long earth lead on an oscilloscope probe or similar can INTRODUCE problems which are not really there.

I will explain why random caps are not a good idea. Consider a piece of wire, 50mm or 50metres, does not matter. Draw this wire on sheet of paper. Now draw 2 caps to ground, one at each end of the wire. Now replace that wire with a coil (inductance). See what this has become. A TUNED CIRCUIT. Any piece of wire will have some inductance. Now if you have any sort of noise or interference at or about the resonant point of this tuned circuit you will have a real problem.In Spades.
The technique to avoid this problem is if a filter (cap or RC filter) is required you only put it AT ONE END ONLY. Now most problems on this forum and other places deal with sensors, breakout boards, Ardino/Pi and other networks on little boards. These boards may already have caps to ground on some of these connections and putting extras at other points could prove worse than the initial problem. It is because of this tuned circuit problem that you only have ONE filter on any one wire.
Hope this may explain some of the problems you can create instead of fix.
Cheers Bob

1 Like

Hi Bob.

The schematic is below.

The code uses Adafruit_Sleepydog.h to sleep the board. In the beginning of the project, as I noticed, once the board sleeps, the sensor doesn’t. So I included the line of code to send a cmd “M2” to the sensor to manually switch it off and wake it up by sending a cmd “M0”. The code works as designed - gas sensor streaming for 10 min and data is collected wirelessly and the board and sensor sleep for 50 min and so on. But if I power it by USB from the power bank it doesn’t.

I am now using a 10uF capacitor sitting at V+ and GND of the sensor (in parallel with sensor). But the sensor still doesn’t sleep.

I can send you the code but if I don’t want to share it publicly. Can we contact via emails?

There are several things I noticed may indicate the problem. 1) not every time did I find that when the arduino is connected to laptop it works as expected - sometimes streaming for 5 min only and sometimes the sensor still refuses to sleep. And sometimes the board doesn’t send data to laptop. 2) But I never found the sensor sleeping when connected to power bank. 3) the problem might have something to do with the sensor being turned off and failed to turn on?


Hi Lee

It should not do much harm there. Probably not doing any good either.

You could have some sort of intermittent problem. The worst kind. You will have to pin it down by trial and error. Don’t forget the USB cables. Are you using the same cable for both scenarios or different ones. These cables can be quite prone to faults. You will have to go through this logically to pin down the problem. One bit at a time, no good trying to start in the middle. One tip. WRITE EVERYTHING DOWN. This I think is going to be difficult to trouble shoot remotely.

No good sending it to me. May as well write it in Swahili. Not a coding Guru but manage to get by. When experimenting I use 2 monitors. Arduino IDE on one and Arduino Reference on the other.
If you can’t post your code publicly I don’t see how you are going to get any help from those that are able to take it apart and analyse where you may have got it wrong.

No matter what, you are going to have to establish EXACTLY what works and what doesn’t…
Cheers Bob