Introduction: Simple Arduino Voltage Monitoring

About: I like to make everything and anything! from electronics to food! and i'll be showing you all the things i come up with here! Twitter: @ERILtech

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

General

  1. Arduino uno (or what ever you are using)
  2. Solder
  3. Hook up wire

Voltage Reference

  1. 1x 60k ohm Resistor
  2. 1x 1N4004 diode - or similar
  3. Hook up wire
  4. Small piece of prototype PCB (you could just make in on a bread board)

Equipment

  1. 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

Vref=(Vin*1023)/Val

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!

Epilog Contest VII

Participated in the
Epilog Contest VII