Offline
Newbie
Karma: 0
Posts: 38
|
 |
« on: May 07, 2012, 11:29:37 am » |
How do I get an Arduino to monitor its own voltage levels? I'm getting occasional dips / spikes in the voltage output of a humidity sensor and would like to know whether the noise observed in the output voltage is due to variations in the source voltage.
|
|
|
|
|
Logged
|
|
|
|
|
Massachusetts, USA
Offline
Tesla Member
Karma: 96
Posts: 6372
|
 |
« Reply #1 on: May 07, 2012, 11:36:10 am » |
How do I get an Arduino to monitor its own voltage levels?
Use a voltage divider to bring the VCC voltage below 1V, connect it to an analog input, and use the internal 1.1V reference of the ATmega328P: analogReference(INTERNAL);
|
|
|
|
|
Logged
|
|
|
|
|
Manchester (England England)
Offline
Brattain Member
Karma: 277
Posts: 25506
Solder is electric glue
|
 |
« Reply #2 on: May 07, 2012, 11:47:34 am » |
Alternative, you can measure the internal reference voltage which should be 1.1V, then work out what value the Vref is from the value you read the 1.1V from.
See the processor data sheet for how to switch the analogue input to read the internal 1.1V.
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 38
|
 |
« Reply #3 on: May 07, 2012, 04:47:44 pm » |
Use a voltage divider to bring the VCC voltage below 1V, connect it to an analog input, and use the internal 1.1V reference of the ATmega328P:
The sensor I'm using is powered by the Arduino's 5V supply. What's the reason for dropping the voltage and using a 1.1V reference instead of the 5V default? Alternative, you can measure the internal reference voltage which should be 1.1V, then work out what value the Vref is from the value you read the 1.1V from.
I understand the part about measuring the internal reference voltage, but I don't understand what you mean when you say to "work out what value the Vref is from the value you read the 1.1V from."
|
|
|
|
|
Logged
|
|
|
|
|
Manchester (England England)
Offline
Brattain Member
Karma: 277
Posts: 25506
Solder is electric glue
|
 |
« Reply #4 on: May 08, 2012, 03:40:25 am » |
The sensor I'm using is powered by the Arduino's 5V supply. What's the reason for dropping the voltage and using a 1.1V reference instead of the 5V default? The point is that once you change to the internal referance only voltages below that will be measured, so you have to use a potential divider to do that. Say you have a five to one divider, then exactly five volts on the power will give you one volt you can measure. As the five volt supply changes then so will your reading, because the referance is fixed. but I don't understand what you mean when you say to "work out what value the Vref is from the value you read the 1.1V from." If you use the supply voltage as a referance voltage it will always read the same value if you try and measure it. However the 1.1V is fixed, so if you measure it with a changing referance it's value will appere to change even though it is a fixed voltage. By looking how the value you read changes you can work out what is happening to the referance voltage, that is your supply voltage. Simple high school maths.
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 38
|
 |
« Reply #5 on: May 08, 2012, 01:39:19 pm » |
The point is that once you change to the internal referance only voltages below that will be measured, so you have to use a potential divider to do that. Say you have a five to one divider, then exactly five volts on the power will give you one volt you can measure. As the five volt supply changes then so will your reading, because the referance is fixed. Does this mean I can count on the internal reference voltage not to change even if my Arduino's 5V rail were indeed unstable? I've measured the 5V rail with a multimeter and the voltage appears to be stable at 4.9V, but I don't know whether the dips and spikes I'm getting are too brief to register on the multimeter.
|
|
|
|
« Last Edit: May 08, 2012, 01:44:31 pm by AdrianLopez »
|
Logged
|
|
|
|
|
Manchester (England England)
Offline
Brattain Member
Karma: 277
Posts: 25506
Solder is electric glue
|
 |
« Reply #6 on: May 08, 2012, 01:47:38 pm » |
Does this mean I can count on the internal reference voltage not to change even if my Arduino's 5V rail were indeed unstable? Yes. but I don't know whether the dips and spikes I'm getting are too brief to register on the multimeter. They normally are. However, I am not sure you will see it with the analogue read either, you have to look often to catch brief excursions.
|
|
|
|
|
Logged
|
|
|
|
|
Offline
God Member
Karma: 3
Posts: 812
|
 |
« Reply #7 on: May 08, 2012, 01:59:28 pm » |
The sensor I'm using is powered by the Arduino's 5V supply. What's the reason for dropping the voltage and using a 1.1V reference instead of the 5V default?
Because if your reference is the 5V rail, and if the problem is that the 5V rail is not reliable, then a reading relative to the 5V rail will just follow along with the variations, showing "no relative change." The 1.1V internal reference is fixed at 1.1V, no matter what the supply voltage is. Also, just to trouble-shoot your sensor: Try adding a 100 uF or 470 uF electrolytic capacitor between 5V and GND to stabilize the supply, if that's indeed what the problem is.
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 38
|
 |
« Reply #8 on: May 09, 2012, 12:00:54 pm » |
Driving down the voltage to 0.86 volts using a voltage divider and scaling back up to 4.9 in software shows none of the dips and peaks I'm getting with the sensor attached. This rules out the Arduino's 5V rail as being the problem, so either the behavior I'm seeing is normal for the sensor I'm using or else I have a bad sensor. I'll start a new thread in the sensors forum for feedback on the particular sensor I'm using.
Thank you all for your help.
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 38
|
 |
« Reply #9 on: May 11, 2012, 03:02:49 pm » |
It looks like I may have ruled out electrical noise a bit too early: The ADC Noise of Netduino.
|
|
|
|
« Last Edit: May 11, 2012, 03:24:04 pm by AdrianLopez »
|
Logged
|
|
|
|
|
Austin, TX
Offline
Faraday Member
Karma: 41
Posts: 5172
CMiYC
|
 |
« Reply #10 on: May 11, 2012, 03:57:21 pm » |
The only thing in common between an Arduino and Netduino are the letters "duino". So I'm not sure how much of the article is relevant.
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 38
|
 |
« Reply #11 on: May 11, 2012, 04:40:42 pm » |
The only thing in common between an Arduino and Netduino are the letters "duino". So I'm not sure how much of the article is relevant. They are certainly more different than they are similar, but why would the Arduino's ADCs not be susceptible to electrical noise the way the Netduino's are?
|
|
|
|
|
Logged
|
|
|
|
|
Offline
God Member
Karma: 3
Posts: 812
|
 |
« Reply #12 on: May 11, 2012, 05:26:25 pm » |
The sources of the noise as discussed in that article are almost entirely due to the specifics of the hardware on the Netduino. The hardware on the Arduino is very different. The same kinds of problems may still exist, but you'd have to do a similar level of diagnostics to figure out what the actual cause is. If you have an oscilloscope, now's the time to break it out!
|
|
|
|
|
Logged
|
|
|
|
|
United Kingdom
Online
Faraday Member
Karma: 131
Posts: 4676
|
 |
« Reply #13 on: May 12, 2012, 07:10:20 am » |
I'm getting occasional dips / spikes in the voltage output of a humidity sensor...
What is the Arduino driving? If it is switching anything that takes more than a small amount of current, then you need to be very careful about your ground wiring, otherwise the switched current will induce a voltage on the ground line, which may feed back to the analog inputs. To avoid or at least reduce this problem, dedicate one of the Arduino ground pins as "analog ground". Connect the ground side of your analog sensors to this ground, along with the ground sides of any capacitors you are using to smooth the analog inputs. Use the other Arduino ground pins for everything else, such as power to the Arduino and the ground sides of any output devices.
|
|
|
|
|
Logged
|
Formal verification of safety-critical software, software development, and electronic design and prototyping. http://www.eschertech.com
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 38
|
 |
« Reply #14 on: May 12, 2012, 11:55:24 am » |
The only thing connected to the Arduino at the moment is an analog humidity sensor. Connections are 5V, GND and A0.
|
|
|
|
|
Logged
|
|
|
|
|
|