Powering Arduino with Vin causing bad analog reads

Howdy! I have a bit of a strange question regarding analog pin reads: when using 5V through the USB to power my Arduino Nano 33 IOT, I get reasonable readings that make sense, but when I use 12V through the Vin pin, I get... unreasonable readings. To illustrate, a quick voltage divider circuit:


When I power it with USB the readings I get look like this (values are 10 point SMA):


Calculating it out (1V0 AREF, 12 bit ADC) gives (245/4096) = ~60mV, from the calculated 3.3*(100/(5100+100)) = ~63mV (not bad considering the chintzy breadboard and resistors I'm using!)

However, when I power the Arduino with 12V, it's not so rosy:


177/4096 = ~43mV, which is nasty but still usable, I'm more looking for signal than accurate readings at this point.

The story changes when I try to do something a bit more complicated: I've set up a current transformer with a filtered half-wave rectifier to be able to detect when a very small load is placed on an AC circuit (<1W):



With the Arduino powered by USB, things look great:


I start recording, count to 5, flip on the power to the device, count to five, then turn it off again, count to 5.

I'll let the 12V graph speak for itself:


Awful!

I am new to the world of electronics and hardware, my background being exclusively in software. I'm stumped as to why this might be happening. Three different Arduino Nano 33 IoTs have reacted exactly the same way, and I've used three different 12V power supplies, all with the same results. The one used in the graph is used to power an external hard drive enclosure and is rated for 2A.

Maybe the voltage regulator is having a really hard time going from 12V to 3V3? Is the solution to externally regulate it down (maybe to 6V?) before feeding it in? Any suggestions are greatly appreciated. Thanks for reading!

What are you using to power it via Vin? How does the supply noise look, it sounds bad to me.


These are two of the power supplies I've tried, with identical results. The one on the right normally powers an external HDD enclosure, and I HOPED that if it was a noise issue, at least that one would be a bit more consistent. As far as how noisy they are, I unfortunately don't have a scope to properly analyze their signals. If they were noisy, would there be something I could do to clean them up before feeding them into Vin to test that out?

EDIT: Well the picture is garbage so basically they are just two wall-warts that provide 12VDC, 1A on the left and 2A on the right. Nothing special, but I had hoped they weren't complete junk!

12v is really pushing the onboard voltage regulator. Chop the voltage on Vin down or put +5 on the 5V pin.

My understanding is that 12V is well within the range of acceptable voltage input for the 33 IoT:

On-board DC-DC power supply enables the board to be powered up to 21V maintaining high efficiency and offering a lot of current to external devices without overheating. This is a big improvement over other products on the market that have LDO and heat up quite a bit when powered at high voltages.

Also, the 33 IoT doesn't have a 5V input pin, the 5V pin isn't even connected normally and acts as 5V out when powering the device with USB after you short the pads on the underside.

I am, however, definitely going to try to power it with a lower-voltage power supply tomorrow and see if that helps the situation. I'm also shopping around for bench power supplies. Thank you for the response!

Have you looked at the "12V" supply with a 'scope? There could be a lot of noise on it and I dont see any decoupling on the breadboard.

Why do you think the Vin limit is 12V and not the 20V that the regulator can take? Because 12V limits the max current to only what the card needs - no reserve. Higher source voltages can only deliver LESS current, as the higher voltage causes it to go into thermal limit at a lower current. (Remember that Power = V Γ— A) At anything higher than 12V, the current is insufficient to power the card. Cutting the source voltage at Vin will help.

I haven't, unfortunately. I've been putting off buying a scope until I actually "need" one, so now I'm thinking it may be time. As far as decoupling goes, my ceramic caps are arriving in the mail tomorrow so I'll definitely try that as well. Thank you for the suggestions!

That makes sense, and I will definitely test lower voltages on the Vin pin to see if that helps. I appreciate the explanation.

You can get a feel for the noise on the 12V line without a 'scope, by using your voltage meter. After checking that 12V is actually 12V on the 20VDC scale, switch to the 2V VAC scale, or even the 200mVAC scale, and you can directly read the "noise" floating on the DC. Now this is not super accurate, but a SOLID 12VDC supply should read essentially zero, even on the most sensitive VAC scale. If you're getting "bouncing" VAC readings, you've got a noise issue.

1 Like

Do t forget the A/D is using the chip supply voltage as it’s reference.
If the regulator is heating up that reference may shift , use the internal reference.
Your voltage divider should use resistors in the 1-22k range .
Does the CT have a burden resistor ?’
Bread boards are well known for bad connections .

I'm not sure if it's related to the noise issue, but you MUST have a burden resistor directly on the secondary of the current transformer. Otherwise with higher currents you can get very high voltages. Typical value would be around 1k.

Just expand on this. If there are N turns on the core, say 100, and the current flowing in the wire carrying the current to measured was say 10A, then the CT would try to force 10A/100 = 100mA through whatever it's connected to. If there is a very high impedance then a very high voltage could result. A burden of 1k would give a voltage of 0.1A x 1000 ohms = 100v which is already uncomfortably large for anything connected to Arduino. So for 10A maybe a better choice would be say 50 ohms which would give 5V max.

1 Like

For supply decoupling you need electrolytics - say 100uF with a good voltage margin above your intended. A "12V" (average) can be a LOT more esp if only half wave rectified.

I see that several are assuming that 12volt is too much and the regulator will be heating up.
This is a Nano 33 IOT, which does not have a linear regulator.

I see bad soldering on the analogue pin.

It's a bad idea to ground the voltage divider or CT to the power ground rail.
Try grounding them to a different ground of the Arduino, not shared with power ground.

Tell us more about that "very small AC load". Using a current transformer without burden resistor can be deadly to the Arduino pin. Why don't you measure AC voltage with the processor instead of rectifying it first (with a diode with a 0.5volt threshold).
Leo..

1 Like

@godred
All of your basic voltage divider calculations are wrong.
The voltage at pin A7 = 3.3V x 5.1K/(5.1K+100) = 3.24V NOT 63 mV

1 Like

I use Vin almost all of the time, generally with 8-12V because of the additional protection and filtering. External devices are powered by an external power supply. Your setup is a bit confusing, your first schematic looks OK but needs some decoupling.

Waking up to lots of awesome posts, thank you, just wanted to say I'm going to be getting to these through the day and in the evening after work. Really appreciate all of the input.

Very cool suggestion, my cheap little multimeter just reports OL unfortunately, so it's another bit of missing accoutrements that I finally have a good reason to fix.

I'm actually using the internal 1V0 reference for these measurements, I didn't make too big of a mention of it though, just in the calculation, sorry! I don't have a burden resistor, just looked that up and I think I've gotten away with it so far because the load on the primary winding is so minuscule. I'll definitely get one in there though, thank you for the suggestion. As far as the breadboards go, if they are known for bad connections, mine is almost certainly having bad connections, it's a chepo that came with a cheapo kit so I'll see what I can do about getting a better one (or just dead bugging the components.)

Thank you for the suggestion, I didn't realize about the burden resistor. As I mentioned to hammy I think the only reason it hasn't fried my poor little dude is because I have such a tiny load on the primary side, it's pulling MAYBE 5-10mA tops. Product sheet says 1W but that is definitely an overestimate given the readings I've seen.

Ah well that means I need to do a lot more learning first, big gap in knowledge showing through. Good news is I have a big box of electrolytics on hand.

I will definitely reflow that solder, and some of the other pins look like they need some help as well. My soldering definitely leaves much to be desired, still practicing!

I will try separating out the grounding, in general should the power circuit grounds not be attached to any of the grounds "on the other side" so to speak of the Arduino?

The AC load is this guy:

I didn't know you could hook up AC directly to Arduino pins, I will have to investigate that further, thanks for the tip.

Sorry, that was the wrong schematic I uploaded, I had tested it with both R1=100 and R1=5K1. The graph of the input on pin A7 is using R1=5K1.

Decoupling has been the order of the day, so definitely going to be doing that. Which part of the setup is confusing? I'll explain as best as I can. Thanks for the suggestions.

Er, I doubt this would work because most DMMs do not have AC coupling on their AC input. You could however insert a suitable series capacitor to block the DC and then put the DMM on a low AC range.

All of your basic voltage divider calculations are wrong.
The voltage at pin A7 = 3.3V x 5.1K/(5.1K+100) = 3.24V NOT 63 mV

Sorry Jim, I uploaded the wrong schematic, I originally tested it in that configuration but in the configuration I measured with the graph (and used for the calculation) I had R1=5K1 and R2=100, so they are swapped in the schematic.

That trick works. DMM's must be AC coupled in order to read AC. If the OP's DMM is reading OL on the low AC settings, then there is a TON of noise on that line -- poorly filtered pulsating DC.
The power module shown has "universal" input range, that means its a switching power supply. Switchers generally need a minimum load of around 10% to maintain regulation. Additionally, they are a noisy source with the switching noise poorly filtered.
The module is rated 12V at 2A, 10% of 2A is 200mA. Bet your draw isn't enough to keep it in regulation.

1 Like