Have you ever needed a power meter for your Arduino or your Raspberry Pi? Here is a tutorial on making a multi function power meter for 5v circuits--using material found in the Arduino Starter Kit!
Making the Power MeterGather the materials listed in the Components and Supplies section and assemble them together as shown in the "Main Project" picture in the Schematics section. If the "Main Project" picture is not clear in showing how to connect a LCD, use the LCD Setup picture to help.
What the Setup is Supposed To DoThe LCD is used to project the calculated data. The potentiometer is used as a knob to change between the five modes: Off, 5v Volt Meter, Analog Read/Write values, Resistor calculator, and Conductivity. The three wires at the bottom are used as input, output, and GND wires.
The Code ExplainedMode two is a 5v Volt Meter; using analog input you can calculate the voltage of the input.
float vv = analogRead(in) * (5.0 / 1023.0);
Mode three is the Analog Read/Write values; by read the analog pin, you can calculate the power output in analog(Read) value (0-1023) or analogWrite value (0-255).
int aR = analogRead(in);// 0-1023
int aW = map(aR, 0, 1023, 0, 255);// 0-255
Mode four is a resistor calculator that outputs in ohms; you can calculate the resistor using Ohms Law, Resistor = Volts / Current: Volts is the inputted voltage, and current is 20mA (because the Arduino's output current is about 20mA).
float vv = analogRead(in) * (5.0 / 1023.0);
float rr = vv / 20.0; // volt / current = resistor
Mode five is a simple conductivity checker; anything bellow 5v would be counted as disconnect.
if(digitalRead(in) == HIGH)
lcd.print("Connect");
else
lcd.print("Disconnect");
This project can only be used on equipment that handles 5v. If not, the equipment could be burned and may not be usable after.
If the input/output wires aren't connected to anything, the wires would be calculating whatever is in the air so don't be surprised if random numbers are flashing on the LCD when the wires are not connected to anything.
Please leave comments and feedback about this tutorial,
Thank you!!
Comments
Please log in or sign up to comment.