I don't know that total project details are needed, but feel free to ask whatever questions you may have for me What I'm wondering is - I'm thinking about using the AREF pin on my Mega 2560 because I have an external 5v power board (Pololu Step-Down Voltage Regulator D15V70F5S3) that I'm using to power all of my 5v sensors. However, the power board is outputting 5.04 volts. I'm curious if that is close enough to the tolerances of the AREF pin to not screw things up? The Arduino itself is powered by a separate dedicated 7.1 volt power supply via the barrel connector, and all 4 of my power boards (3v3, 5v, 7v1, and 12v) share a common ground.
This is what I was looking at:
EXTERNAL: the voltage applied to the AREF pin (0 to 5V only) is used as the reference.
Is there anything else that I need to be aware of with the potential use of this setup? (The reason for looking at the external AREF is I'm trying to narrow down some small variations in the readings of some of my analog sensors (two TMP36, three voltage dividers, and an ACS711 current sensor.) Doing the double-read with a 10ms delay in between the readings definitely helped, but there's still some oddity there occasionally.)
The other caution you should consider is if your external +5vdc sensor power is ever active but the arduino supply is turned off it's possible damage could result from high ref pin current.
If the Arduino gets no power, and the external power supply is 5.04, current will flow into the AREF pin. A protection resistor of about 4k7 would be nice.
Can you power the Arduino with the external power supply ? In that case, you can use the DEFAULT voltage reference.
(while I was typing this, retrolefty wrote the same)
That's definitely a good thing to be aware of; since the arduino is on a different power supply than the rest of the system. I'm already isolating my Beaglebone Black's serial lines from the Arduino using a tri-state buffer to make sure that the BBB doesn't get a serial signal when it's powered off; would the 4k7 resistor be sufficient to protect the arduino, or should I try to do something similar with the AREF connection on the arduino that I am with the BBB? If so, I'm assuming that I'd just stick the 4k7 resistor inline with the AREF feed?
Out of curiosity, will it work to power the arduino with 5v through the barrel connector? I'd read that it was possible, but could have some less-than-desirable results. So that's why I was using a separate 7v supply. Or would I just need to supply 5v directly through the power pins, bypassing the internal regulator?
On an aside, I'm still getting some weird readings from the TMP36's. I could understand the values being a bit off before because the sensors were getting 5.07 volts, but the AREF pin on the arduino was delivering 4.97v., so there was almost a 0.1v difference between the two. I'd hoped that using the AREF would eliminate that, but I know that at least the outside temperature sensor isn't accurate all the time; earlier this morning it was saying that it was 50 degrees outside when it was closer to 70. Any thoughts about how I could get this to be more accurate?
A list of the last outputs of all of my analog sensors:
Sensor Value Location Last Refreshed
Battery Amperage -0.15A Basement 2014-07-08 08:54:00
Battery Voltage 13.52VDC Basement 2014-07-08 08:54:00
System Voltage 13.60VDC Basement 2014-07-08 08:54:00
Utility Voltage 122.12VAC Basement 2014-07-08 08:54:00
Outside Temp 50.21° Outside 2014-07-08 08:54:00
You better make a function to read the temperature.
In that function you can add averaging. For example the average of 5 to 1000 samples. Do you have mains voltage noise of 50/60Hz ?
Those DTH sensors have a temperature sensor, do you use that ?
Oh, and, there shouldn't be 60Hz noise on the line. The power supply has an extra emi/RFI filter on its ac input, and that plugs into an APC SmartUPS, which is connected to its own dedicated circuit, so I'm hoping that that would catch any noise that might crop up.
float readAnalog(int sensorNum) {
 //We poll twice to help offset the charge delay.
 //http://forums.adafruit.com/viewtopic.php?f=25&t=11597
 analogRead(aSensors[sensorNum]);
 delay(10);
 float sumOfReadings;
 int numReadings = 0;
Â
 //Take the average of 10 readingsÂ
 for (int loops = 0; loops <= 10; loops++) {
  sumOfReadings += analogRead(aSensors[sensorNum]);
  delay(10);
  numReadings++;
 }
Â
 float result = (sumOfReadings / numReadings) * (5.0 / 1023.0);
 return result;
}
and I'm calling it like this:
float sensorVoltage = readAnalog(curAs);
Instead of delay(10), you can do many more samples without delay. Use long integer if the result won't fit in a normal integer.
I think that delay(10) is very long, at least make it delay(1).