
Gw.Don’t worry about next time your board suddenly powers-down! The Crowtail- LiPo Fuel Gauge connects your battery to your project and uses a sophisticated algorithm to detect relative state of charge and direct A/D measurement of battery voltage. Gw.begin() // Startup and initialize MySensors library. Sensors.begin() // Start up the onewire library MyMessage msg_S_MULTIMETERc1(ID_S_MULTIMETERC1,V_CURRENT) MyMessage msg_S_MULTIMETERc(ID_S_MULTIMETERC,V_CURRENT) MyMessage msg_S_MULTIMETERv(ID_S_MULTIMETERV,V_VOLTAGE) OneWire oneWire(ONE_WIRE_BUS) // Setup a oneWire instance to communicate with any OneWire devices (not just Maxim/Dallas temperature ICs)ĭallasTemperature sensors(&oneWire) // Pass our oneWire reference to Dallas Temperature. Int voltSenseMax = 25000 // set to the maximum input voltage in millivolts of your voltage divider input Int voltagePin = A0 // analog pin voltage sensor or voltage divider is connected to Int lastVoltage = 30000 // set to an arbitary number outside of expected voltage sensor range to ensure a change when first run Unsigned char sample_count = 0 // current sample number Int sum = 0 // sum of voltage samples taken Int ACSPin = A4 // Analog pin number the ACS712 data pin connects toįloat lastTemperature //Array to hold the last temp readings sent to gateway, only send new data if different Int VQ = 0 //Placeholder for quiescent voltage calculations Int lastmilli = 25000 // set to an arbitary number outside of expected current sensor range to ensure a change when first runįloat sensitivity = 100 //change this to 185 for ACS712-5 or to 100 for ACS712-20A or to 66 for ACS712-30A Unsigned long SLEEP_TIME = 30000 // Sleep time between reads (in milliseconds) Int buttonState = 0 // variable for reading the pin status Int buttonPin = 5 // the input pin for offset pushbutton #define NUM_SAMPLES 10 // number of analog voltage samples to take per reading #define ID_S_MULTIMETERC1 5 // Multimeter device for negative current measurement #define ID_S_MULTIMETERC 4 // Multimeter device for positive current measurement #define ID_S_MULTIMETERV 3 // Multimeter device for voltage measurement #define ID_S_TEMPB 1 // second temp device #define ID_S_TEMPA 0 // First temp device #define ONE_WIRE_BUS 3 // Ds18b20 data wire is connected to digital pin 3 on the Arduino * 1 x LED connected via a 330 ohm resistor to pin 6 * 1 x nRF24L01+ 2.4ghz tranceiver connected as per the MySensors web site. * 1 x 25v voltage sensor module connected to arduino analog pin A0 * 1 x ACS712 current sensor module connected to arduino analog pin A4 * 2 x DS18b20 dallas temperature ic's their data pins connected to arduino digital pin 3 * The node monitors battery voltage,current into and out of the battery, ambient temperature and battery temperature. The Sketch: /*Sketch for a MySensor node to monitor a 12v battery with a solar panel for charging During construction I found powering the circuit from the usb port to give unreliable results and opted for a dedicated 5v supply instead. The 20A ACS712 shows a change of only 100mv for every 1A so you can see even small fluctuations can cause sizable errors in your readings. When using the analog inputs of the Arduino it is very important that you have a very stable 5v supply voltage. That means when the module sees 25v on its input the output of the module will be 5v.ġ x LM2596 regulator module or some other regulator able to supply 5v I have used a module that has a maximum reading of 25v.
ARDUINO LIPO VOLTAGE MONITOR CODE
Only one line of code needs to be modified to suit your selected device.ġ x Voltage sensing module or 2 x resistors to be used as a voltage divider. Choose whichever current fills your needs.
ARDUINO LIPO VOLTAGE MONITOR PRO
My notes are based on my breadboard version which was built around an Arduino nano, In the final I used a Pro Mini.ġ x Arduino I have used a Nano but other types or OK tooġ x ACS712 Current sensing Module. I have included the temperature monitors after a friend had his battery develop an internal short and melt in his caravan, not a pretty sight. it monitors battery voltage, Charge current, Dis-charge current, Ambient temp and battery Temp.

Ok this node has been running for a few weeks now so thought i would share it with others. To date it has been used to run a system of night lights and reading lamps but now that I have found Mysensors I hope it will soon be powering a lot more. When we built our home I ran a 12v Backbone as well so we can access the low voltage power all over. The power system consists of a 200w panel on the roof and a 105AH battery located in our server cabinet.

I have installed a node to monitor our 12v auxiliary supply for our home.
