Simple Arduino Voltage Monitoring

by MrSirLRD in Circuits > Arduino

4965 Views, 21 Favorites, 0 Comments

Simple Arduino Voltage Monitoring

Board.jpg

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.

What You Will Need

Board.jpg

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

Putting It Together

DiodeR.jpg
SetUp.jpg
Diode.jpg
20140603_094053.jpg

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.

Code / How It Works

SetUp.jpg

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!

Downloads