In this Instructable we utilize the analog pins on the Arduino to make a simple power monitoring system that will detect the voltage on the 5v rail and perform an action if it gets too low. This could be used to shut off non essential devices that are drawing a lot of current to conserve battery power.
Step 1: What You Will Need
- Arduino uno (or what ever you are using)
- Hook up wire
- 1x 60k ohm Resistor
- 1x 1N4004 diode - or similar
- Hook up wire
- Small piece of prototype PCB (you could just make in on a bread board)
- Soldering Iron
Step 2: Putting It Together
The diode and the resistor need to be simply connected together in series with a wire coming from the junction of the two going to the analog pin of the Arduino.
The resistor end needs to be connected to 5V and the diode to GND. Make sure you connect the diode the right way around.
Note: the Resistor value should be high so that not too much current is being drawn.
Step 3: Code / How It Works
This system works by reading in the voltage across the diode (which should be fairly constant) and comparing it to Vref (which defaults to the 5v rail)
The analogRead Val=(Vin/Vref)*1023
If Vin is a constant we can find the real value of Vref
This is assuming Vref is > Vin but because Vin is so low (0.44V) we should be able to achieve this.
This code outputs the Vref value to the serial monitor and turns on the LED on pin 13 when the voltage drops below 4V
Thanks for reading!
Participated in the
Epilog Contest VII