Wait (50) // small wait to allow to stabalise after sleep. Sleep(sleepTime) // sleep until next scheduled check UplinkCheck() // call function to send data Present(ID_S_MULTIMETERV, S_MULTIMETER) // Register Sensor to gateway SendSketchInfo("Vehicle Battery Sensor", "1.1") // Send the sketch version information to the gateway and Controller MyMessage msg_S_MULTIMETERv(ID_S_MULTIMETERV,V_VOLTAGE) Int voltSenseMax = 23460 // set to the maximum voltage in millivolts of your voltage divider input Int voltagePin = A0 // analog pin voltage sensor or voltage divider is connected to Unsigned long sleepTime = 60000*60 // Sleep time between reads (in milliseconds) (Set to 1 hour at present) I recommend keeping a good stock of car batteries charged. #define ID_S_MULTIMETERV 1 // Multimeter device for voltage measurement Defend Your Base with Simple Circuits, Arduino, and Raspberry Pi Simon Monk. #define MY_PARENT_NODE_IS_STATIC // force connection to parent node only. #define MY_PARENT_NODE_ID 1 // set the parent node #define MY_RF24_CHANNEL 84 // set channel used #define MY_TRANSPORT_WAIT_READY_MS 3000 //set how long to wait for connection to establish before moving on. #define MY_RADIO_NRF24 // Enable and select radio type attached #define MY_DEBUG // Enable debug prints to serial monitor It takes the input from a AA or AAA or rechargeable battery or any voltage source 5 volts and below, calculates it into a value the Arduino can understand and. * The node monitors battery voltage and reports back to the controller. The sketch /*Sketch for a MySensor node to monitor a 12v aux battery in a 4wd ute The node sleeps most of the time only waking for a few seconds every hour to check and send data. A simple voltage divider is used to sample the battery voltage.Īs the node will be fitted to a vehicle that will spend some part of the day away from home the sketch first checks for the gateway's presence before sending the information. This node has just one job to do, that is simply to monitor and report the voltage present at the second battery. This will allow my Domoticz controller to keep any eye on how it is going and let me know if it strays too far from the norm. So I thought it time to give it the attention it deserves by fitting a MySensors node to monitor the battery voltage. This second battery sadly gets little attention paid to it in between trips, though it is connected to the car charging circuit to keep it topped up. Arduino Step-by-Step Projects Build 25 Arduino projects with our course. We rely on a second battery fitted in the 4wd to power our fridge and provide lighting. Final circuit Power ESP32 with Solar Panels battery level monitoring. We enjoy getting away and camping in remote areas whenever we get the chance.
0 Comments
Leave a Reply. |