3

As soon as I unplug my Arduino from USB and only use the VIN pin with my 9 V power supply, the analog readings from my Arduino start to get unstable, which means the value fluctuates much more than with USB connected. When I reconnect USB again, the readings are stable again.

I'm trying to build a load scale using a load cell, an INA125P and the Arduino, using this setup here: Instrument Amplifier Calibration.

Therefore I need stable readings. For example, I wrote some code to convert the analogRead() value to grams. While USB and VIN (9 V) connected, I get a stable reading of about 8.3 to 8.7 grams when I put a weight of 8.5 grams on the scale. As soon as I unplug USB, the LCD shows values from 7.8 grams up to 9 grams.

Unfortunately, I don't have any other power supply which I could use to test. I've already tried to use a 9 V battery with the same results. Do I maybe need some additional de-coupling capacitors?

4
  • 1
    Hard to say without checking ripple with an oscilloscope. It definitely sounds like some sort of a reference issue. The AVR controllers use an analog reference pin that is used to compare against the ADC input lines. That said, it sound either like a reference ripple or insufficient capacitive bypassing at the AREF pin. If you have access to an oscilloscope I would first check the supply and then the voltage present at AREF, which I think is pin 8 on the UNO. There is already a 100nF bypass present, so it's likely the supply.
    – sherrellbc
    Mar 15, 2015 at 13:41
  • 2
    It's more likely that you need a beefier regulator. The on-board regulator on an Arduino can only supply a tiny amount of current (a few tens of mA) at 5V to external circuitry (beyond what the Arduino itself needs). When the USB cable is plugged in, the USB host can supply at least 500 mA (probably more) at 5V without any problem.
    – Dave Tweed
    Mar 15, 2015 at 16:45
  • 1
    First of all what is your board? 'cause different boards have different regulators. And then... If you need precise values, avoid using the supply voltage as reference: it is really noisy and unprecise. Use the internal analog reference if it suits your needs, or otherwise use an external voltage reference. Use the power supply reference only when you don't need precision or you have a ratiometric sensor (e.g. a potentiometer)
    – frarugi87
    Jan 20, 2016 at 15:21
  • I got the same issue where too much ripple from power supply, I saw this article bit late where I used an digital sensor to get away with analog read. May 21, 2017 at 2:48

5 Answers 5

5

I solved a similar issue by adding a pin from supply to AREF and it's now stable. This fixed a frustrating pH meter issue on my Mega that every time I plugged USB in it would be right, but as soon as I dropped the USB cable it changed the readings.

2
  • This answer was reported as "not an answer", I find that false. He just provided an example before his solution (rearranged that now). If his answer is not useful, please use the This answer is not useful button instead of the Flag button.
    – Avamander
    Jun 6, 2017 at 9:10
  • 1
    OK @Avamander. Understood. Jun 6, 2017 at 13:12
3

Does your arduino have a switch-mode regulator when converting 9V to 5V? If that's the case, then you must have some voltage ripple on your 5V power line. I'm guessing you are probably using analogRead which uses that 5V reference. If there is a ripple in your reference voltage, you will get a ripple in your readings.

Can you use the internal 1.1V reference of Atmega328p chip? That reference voltage is (as far as I know) the most stable you can provide for ADC.

If that doesn't work, then you need to find a very stable 5V adapter for your 9V sources.

3

Load cell signals are very small and without proper shielding are be susceptible to noise. The USB power connector is likely earth grounded (the clue was battery operation is noisy, exact opposite of expectations!) I suggest testing this hypothesis:

  1. Check with ohm meter if exposed metal on USB connector is connected to earth (chassis on your PC is usually earth connected).
  2. Touch an earth grounded conductor to the signal ground of the load cell amplifier and see of the readings become more accurate.

The final solution is to use properly shielded signal wires between the load cell and the amplifier. Also the signal wires between load cell and amplifier should be a 'twisted pair' to further reduce noise.

2

I would say that this may be related to the analog reference. Try AnalogReference and see if it helps.

0

Without much information (software, schematic, hardware, measurements ...) It is hard to tell.

My guess would be that you used vcc as a dc reference and the circuit draws too much current from the battery than it can deliver so bcc dips, leading to a rise and instability in the reading.

Good luck debugging it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.