I'm trying to monitor my off grid power setup using an arduino and raspberry pi.
I've got a 48v lithium battery that I'd like to monitor so I've got a voltage divider attached to the analog pin. The voltage divider is currently sending 4.10 volts (measured at the pin with a multimeter) which should give a reading of (4.10 /5)* 1024 = ~839 but I'm getting a value of ~870 using diditalRead()
Mu crystal ball sees a classic Nano on USB supply, which has a diode in series with USB power.
5volt could be 4.1 * 1024 / 870 = 4.826volt insead of 5volt.
If this is a Nano, then you should be using a voltage divider to 1volt,
and the more stable internal 1.1volt Aref.
Leo..
I have seen much discussion on this in the past in the forum. There are, of course, 1024 steps between 0 and 1023 but 1023 is the highest possible value
The semantics are beyond me so I will maintain a watching brief in this topic
FWIW the granularity change between 1024 and 1023 steps makes absolutely no meaningful difference in my application - particularly since I'm averaging 500 samples for each data point to smooth out signal noise that's almost an order of magnitude bigger.
I'm pretty new to all this and the two processors are what I had on hand (and basically I just wanted to see if I could get them to talk to each other). No doubt there are many different ways to skin this cat.
Eventually I want to control a bunch of relays to turn various pumps and heaters on depending on what time it is, what the sun is doing, what the battery is doing and how full my water tanks are etc. I'll probably have more than one Arduino monitoring various things in the end and the Pi doing the processing.
Note that the internal '1.1V' reference is more stable, but only about 10% accurate (somewhere between 1.0V and 1.2V). You have to measure it at the Aref pin, just like any other voltage reference.
In the fullness of time you might be right, but I've got at least 4 different systems in mind that will require the monitoring of multiple sensors.
Since this will ultimately be running fundamental systems in my house - water, heating, power, sewerage, irrigation and the fact that I'm 100% off grid, I feel like having a dedicated controller for each system means that if one goes down the rest of them can still run, and I can work on them independently.
I'm guessing I'll need to be constantly monitoring at least 40 sensors once everything is done.
Turns out I was getting lots of instability in the voltage supplied by the Pi. I had a 12v power supply lying around that I have now used to power the Arduino and the noise was significantly reduced. This solved a few other issues I was also having with the Pi and Arduino, and I'm pretty sure was the source of the problem that made me start this topic in the first place as now my AREF pin consistently reads 5.00 volts.
Hi,
I think its is about time we got a schematic diagram.
Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png?
Hand drawn and photographed is perfectly acceptable.
Please include ALL hardware, component names and pin labels.