unstable AnalogReadings when powered from external PSU

Hi there,
I have an ongoing project including:

  • single wire keypad
  • I2C LCD
  • current sensor (ACS712)
  • temperature (LM35)
  • digital IR emitter / receiver for a tachometer
  • a 10k pot
  • a high power motor driver (module with 2 BTN7960 half h-bridges) to power à 24v/120w motor
  • all controlled with a Chinese nanoV3 328
  • a 24V/10A AC-DC PSU
  • a buck converter (based on a LM2596) to step-down the 24v to 5v

in the current setup I power the nano via the 5V pin (so no regulator) and ALL the elements directly from the buck converter.

now, it happens that the potentiometer gives me a very much stable readings when powered by the PC USB (even if the buck converter is also plugged) and probably this was making even worse my readings stability for the current and temperature sensors (that I "solved) by code.

so, questions:

1- Any way to force the power to be taken by the buckConv and avoid the nano to supply power? (I guess this is what's happening when I plug both at the same time)

2- I've seen this a lot, getting no convincing answer, so here it goes, are the 2 ground pins the same? or should I reserve one only for analog inputs

3- would it be a good idea to change the AREF to external and supply it with the buckConv voltage?

4- I tried putting a 0.1µF ceramic cap between gnd and output of the pot, I guess it changed nothing when USB was plugged,, it makes it worse when the buckConv is plugged).

5- I'm a newbie in electronics, if you have an advise of any "good practice" I might be missing, it will be highly appreciated

Thank you all!

So many possibilities it hard for anyone to give a clear answer to your specific project.

When such problems arise then a variety of testing and solutions may be needed.

First , define what you mean by unstable, eg what reading variations do you get when the pots is mid way and should be returing a nominal reading of 512.

How far from the nano is the pot located ; connected via screened cable ?

Does this only happen when your motor driver is connected or even when it and the motor are unpowered ?

A picture of your set up can be invaluable.

To me it sounds like you have a power line problem, but is it affecting the nano, the pot or both ?

Apart from the 100nf , have you used any large electrolytic caps on the power line by the nano ?

My way of identifying the problem , without expensive test equipment , is first go back to a very simple nano only hardware set up and test just the pot, but instead of your buck converter, use a linear regulator like a 7805 or a 7812 into the nanos 5v regulator and see how that works.
You could do the same with a 9 or 12v battery which should give a stable result.

For your basic project I would connect the motor driver and motor direct to the psu 0v on one line and all the nanos 0v /sensors /pots 0v commoned together by the nano and then one wire to the psu 0v.
Not technically correct but should work good enough for you use when using a wired up rig rather than a proper pcb.

Can you observe the various supplies using an oscilloscope?

Switchmode supplies can generate significant noise, and also need a minimum load to work properly

( typically 5-10% of their rated output current)

regards

Allan.

ricky101:
First , define what you mean by unstable, eg what reading variations do you get when the pots is mid way and should be returing a nominal reading of 512.

with external PSU & USB about +-9 (0-1023) and some peaks of 10-12
only with USB +-2

ricky101:
How far from the nano is the pot located ; connected via screened cable ?

about 20cm, not screened jumper wires for the time being

ricky101:
Does this only happen when your motor driver is connected or even when it and the motor are unpowered ?

motor unpowered, so I'm guessing no EMI... by the motor, motor driver

ricky101:
A picture of your set up can be invaluable.

I'll post it quite soon (as soon as I figure out how to do it)

ricky101:
To me it sounds like you have a power line problem, but is it affecting the nano, the pot or both ?

how to tell? unstable analog reads... I guess is the line, but I have no oscilloscope to check.

ricky101:
Apart from the 100nf , have you used any large electrolytic caps on the power line by the nano ?

Nope... I wouldn't know how to dimension it...

ricky101:
My way of identifying the problem , without expensive test equipment , is first go back to a very simple nano only hardware set up and test just the pot, but instead of your buck converter, use a linear regulator like a 7805 or a 7812 into the nanos 5v regulator and see how that works.
You could do the same with a 9 or 12v battery which should give a stable result.

I have not linear regulators, however with the USB is quite stable, so... I guess with the linears will be as well. But I would like to avoid linears to drop from 24v to 5v... it seems like a big waste to me, but I might be wrong.

ricky101:
For your basic project I would connect the motor driver and motor direct to the psu 0v on one line and all the nanos 0v /sensors /pots 0v commoned together by the nano and then one wire to the psu 0v.
Not technically correct but should work good enough for you use when using a wired up rig rather than a proper pcb.

If I got it right, that's what I have...

allanhurst:
Can you observe the various supplies using an oscilloscope?

no, cannot... sorry... an oscilloscope is on my xmas list... :wink:

allanhurst:
Switchmode supplies can generate significant noise, and also need a minimum load to work properly
( typically 5-10% of their rated output current)

connected to few LED strips it seems quite stable (I guess these low power leds are quite sensitives to variations... but the oscillations might be out of my visual frequencies...) but I do have some cemented resistances, so I could try

some comments on the pictures:

  • the small green protoboard carries the LM35 DZ with a 1µF cap and 75Ohm resistor as suggested in the datasheet (in order to smooth the output)
  • bottom left corner : is not the final motor, just another 24v motor for testing
  • to the right a remote control based on PT2272/PT2262 that I couldn't get working... then with a different remote that doesn't use the 8 pins to pair emitter and receiver, I got it working (even though I Ignore how the signal is coded, if it is)...

Try powering the Nano through V-in with the buck converter set to 6-6.5volt.
Run all 5volt devices from the Nano's 5volt pin.

Things will be different on USB, because the USB backflow diode drops ~0.4volt.
So the Nano will run on ~4.6volt on USB, and on ~5volt on external power.

Some older Nano clones had bad decoupling on the onboard regulator (oscillating).
A 10-47uF cap from 5volt to ground fixes that.
Leo..

Wawa:
Try powering the Nano through V-in with the buck converter set to 6-6.5volt.
Run all 5volt devices from the Nano's 5volt pin.

I'd second that - DC-DC converters aren't the best for analog stuff, and often unusable for audio.
Dropping the voltage most of the way with a DC-DC converter and then using a low-dropout
regulator is a good stategy that gets you efficient clean power.

I wish more DC-DC converter chips had output LDO's built-in as a standard feature - there if you
want it. You can add passive output filtering instead, but capacitors, inductors and ferrite
beads are all extra board area and cost, and in general if it can be done in silicon that's usually
best.

I prefer the newer smaller micro-power buck converters over the older LM2596 type of converter.
Higher frequency (easier to filter), smaller (less stray), and all ceramic cap (no electrolytics).
Example here.

Leo..

Some simple practical things as you have no other means of identifying your problems.

Build your circuit onto some strip board or similar, long wires and breadboards nearly always give problems.

Put an electrolytic capacitor 220uf to 1000uf 16v or greater as close to the Nanos power rails as possible; across the existing 100nf

Any +5v and 0v wires to devices, keep them short as possible and twist them tightly together to help reduce interference.

Use an Averaging routine on the ADC result.

Wawa:
Try powering the Nano through V-in with the buck converter set to 6-6.5volt.
Run all 5volt devices from the Nano's 5volt pin.

I'll try that, I was just trying not to put all the load on the Arduino regulator... don't you think that my setup might be closer to the 800mA?

Wawa:
Some older Nano clones had bad decoupling on the onboard regulator (oscillating).
A 10-47uF cap from 5volt to ground fixes that.

Electronics newbie question, the cap basically goes across the +&- terminals of the buckconverter, right?

MarkT:
Dropping the voltage most of the way with a DC-DC converter and then using a low-dropout
regulator is a good stategy that gets you efficient clean power.

So I guess making 24-to-7 with the buck converter, putting 7 on the Vin of the nano and a 7-to-5 LDO on my 5v rail to supply all the others components might work? I kind of lean for this.

Wawa:
I prefer the newer smaller micro-power buck converters over the older LM2596 type of converter.
Higher frequency (easier to filter), smaller (less stray), and all ceramic cap (no electrolytics).
Example here.
https://www.pololu.com/product/2843
Leo..

They look nice, but I'm in France and have no experience with pololu... I'll see if I can get my hands on one of those

ricky101:
Put an electrolytic capacitor 220uf to 1000uf 16v or greater as close to the Nanos power rails as possible; across the existing 100nf

ricky101:
Any +5v and 0v wires to devices, keep them short as possible and twist them tightly together to help reduce interference.

I can keep everything relatively close, escept for the LM35 and the IR module (since this last one is digital, I guess it will give me no problem) but how should I twist the cables? because, almost every time there are 3 of them 5v, sig, & gnd.. should I just twist the 3 of them? In my reduced understanding, it should be paired so the +peak will be compensated by the -peak in the other...

ricky101:
Use an Averaging routine on the ADC result.

That was my first and current approach, since I'm more confident at my coding that with my electronics assembling skills... and please remark that I'm not a great coder :wink:

So, I order some L7805 LDO, 0.33µF cap, and 0.1µF cap (in order to make the assembly as described on the datasheet)... from china, so I won't be able to tell you any time soon if it works, but eventually I'll tell...

Do you think is the way to go?

Are you living on top of the French Alps ? surely you can buy a regulator and caps locally or mail order within France? - no ?

Have you not got a multimeter that will measure DC current ?
Again they are so common, you can even buy basic ones in supermarkets or car spares shops very cheaply or even the China ones.

IF you have then what does the current from the +5v output from the buck converter show; I would not think it is more than 100 -200ma.

If so, then as suggested, place all +5v rails on the +5v pin of the nano and feed the +7 or +8 volts from the buck converter to the nanos VIN pin.

The regulator on the Nano is a Linear type and can easily handle 100 -200ma so it should make a difference to your readings and save ordering that 7805 from china.

Give it a try and let us know....

ricky101:
Are you living on top of the French Alps ?

Nope, even worse, same problems, without the fresh air or the great view... I'm like in the middle, is like a french NoMan'sLand

ricky101:
surely you can buy a regulator and caps locally or mail order within France? - no ?

Locally, no way, my best option go to Paris where few stores are left and be happy with what I get...
This is a map of electronics components stores in the whole Paris, and if you read the comments at the bottom, at least 6 closed out or are only selling for companies. Mail order, only for companies, by farnell or RadioSpares, so I only got left ebay, amazon, aliexpress. I lived in the states and the cultural difference is huge!

Ok, so I changed the setup, I put the buck converter to 7.1V and connected it to the Vin pin. All components are powered by the 5v pin of the nano...
My maximum readings are about 97mA (nicely seen @ricky101).

And readings seem more stable... however it goes a bit crazy when I plug the USB.

Should I try something like what @wawa said of putting a "...10-47uF cap from 5volt to ground..." ???

jorgemarmo:
I'll try that, I was just trying not to put all the load on the Arduino regulator... don't you think that my setup might be closer to the 800mA?

They look nice, but I'm in France and have no experience with pololu...

Some older Nano clones had bad decoupling on the onboard regulator (oscillating).
A 10-47uF cap from 5volt to ground fixes that.

I thought the setup was running ok on USB supply (<=500mA).
Best to measure current with a DMM.
At 6.5volt in (that's all the low drop regulator on a Nano needs), the regulator has to burn 0.75watt@500mA.

Plenty of clones on ebay.

Close to (on the pins) of the Nano. Only if it's a problem though.

[/quote]

jorgemarmo:
So, I order some L7805 LDO, 0.33µF cap, and 0.1µF cap (in order to make the assembly as described on the datasheet)... from china, so I won't be able to tell you any time soon if it works, but eventually I'll tell...

Do you think is the way to go?

Bad idea. The 7805 is an old style regulator and has/needs 2volt drop between in and out.
The L version is only good for 100mA.
The regulator on the Nano has a dropout voltage <1.1volt@800mA.
Leo..

For this project I beleive the internal regulator of the arduino would be the way to go.

@wawa, if I got it right the L7805 is rated for 1.5A... but yes, it has a minimum drop of 2v. The 78L05 is the one for 100mA.
Still, for future projects, what ldo would you recommend?

I did the measurement with the dmm (digital multi meter right?) And I got maximum 97mA... sorry, I have no notions of electronics consumptions....
In that line of thoughts, 0,75W is it low (I assume)?

Surprised you have such a poor choice of outlets, what about local ebayers, we seems to have lots selling locally here in the uk.

Why are you connecting to USB power, is it instead of your buck converter or at the same time?

While USB power seems ok do not rely on it 100% as it can cause problems.

As to future power supplies, often the on board regualtor is all thats needed, but for long term use, how about building a simple linear psu with 3,5 and 12v fixed outlets and a lm317 for variable.
An interesting project and a power supply you know is sound.

Is the forum on a go slow for everyone or just my local connection ?

jorgemarmo:
For this project I beleive the internal regulator of the arduino would be the way to go.

@wawa, if I got it right the L7805 is rated for 1.5A... but yes, it has a minimum drop of 2v. The 78L05 is the one for 100mA.
Still, for future projects, what ldo would you recommend?

I did the measurement with the dmm (digital multi meter right?) And I got maximum 97mA... sorry, I have no notions of electronics consumptions....
In that line of thoughts, 0,75W is it low (I assume)?

Yes.

If it's a TO-220 package, then it can handle 1A (1.5 absolute max). Maybe an LM7805?
The 7805 type regulators are ok if you have to drop more than 2volt. e.g. 9volt to 5volt.

Power (heat) in the regulator is volt drop (difference) * current.
So if difference is 2volt, and you draw ~100mA, then the power generated in the regulator is 2*0.1= 0.2watt.
You will barely notice it getting warmer. I would say 1watt is about max for a Nano (hot).

Forum problems here.
http://forum.arduino.cc/index.php?topic=421943.0
Leo..

jorgemarmo,

Had my arduinos out so decided to try and replicate your analogue error.

Took the clone Nano board, a 10k pot from the junk box, a lcd and a boost/buck converter like yours.
No extra caps and the wires left loose and longish like your set up.

Software, simple analogue read and Print, with a 2 second delay between readings; monitored to 2 -3 minutes

  1. USB power from Desktop PC - errors rate + - 1, but only changing say every 20 readings.

  2. Linear PSU to +5v rail no error

  3. Linear PSU at +7.5v to VIN no error

  4. Linear PSU at +7.5v to BB module to +5v rail no error

  5. Linear PSU at +24 v to BB module to +5v rail - error rate + - 3 changing values almost every reading.

  6. Linear PSU at +24 v to BB module set to 7.5v into VIN no error

perhaps you can go back to these basics and see if you can replcate these figures - it may be a faulty pot, or very noisy psu or buck module ..?

Also important to separate the analogue grounds from all other grounds.
Not easy with a Nano, since you have only two.

The ACS712, LM35, and 10k pot can all share the GND pin between D2 and RST, and the rest the GND pin near V-in. Star-ground the wires close to the Nano pin.
Leo..

ricky101:
Surprised you have such a poor choice of outlets, what about local ebayers, we seems to have lots selling locally here in the uk.

Not here... I mean, there are a few but normally when I need something to be delivered quickly I order it from uk ebayers, like alice####

ricky101:
Why are you connecting to USB power, is it instead of your buck converter or at the same time?

I would like to log measured values... For a period of time, then depending on my acquisitions I might log to an sd card....

ricky101:
Is the forum on a go slow for everyone or just my local connection ?

Dedly slow since I opened this subject.... In my case is only this forum....

Wawa:
Yes.

If it's a TO-220 package, then it can handle 1A (1.5 absolute max). Maybe an LM7805?
The 7805 type regulators are ok if you have to drop more than 2volt. e.g. 9volt to 5volt.

Power (heat) in the regulator is volt drop (difference) * current.
So if difference is 2volt, and you draw ~100mA, then the power generated in the regulator is 2*0.1= 0.2watt.
You will barely notice it getting warmer. I would say 1watt is about max for a Nano (hot).

Forum problems here.
Forum slow + 502 Bad Gateway - Website and Forum - Arduino Forum
Leo..

Thanks!! As translated from french "today I can go to bed less stupid"

@ricky101 thanks for taking the time to run those simple tests... Indeed case 5. Is my case...
@wawa thanaks againg for the wiring tips. Any tip about how to "twist" the 3cables of thr lm35?