LM317 variable power supply
Turn a 12 V adapter into an adjustable 1.25–10 V supply for your experiments.
Shop by category
Shop all componentsThe ACS723 measures current with a Hall sensor around a copper path, so the measured circuit is isolated from the Arduino. The 5 A version gives 400 mV per amp around a zero point of half the supply. A resistor divider brings the panel voltage into the Nano's range. The Nano measures its own zero at start-up with no current, then shows V, A and W on an OLED.
Tick anything you already have and the total updates.
ACS723 5 A Hall current sensor breakout
Follow the colours: red is power, dark grey is ground, blue is a signal.
USB for the Nano. The panel circuit is separate except the shared ground for the divider.
solar_meter.inoVerify & upload in Electrolark#include <Wire.h>
#include <Adafruit_SSD1306.h>
Adafruit_SSD1306 oled(128, 64, &Wire, -1);
void big(const String& top, const String& value, const String& unit) {
oled.clearDisplay(); oled.setTextColor(WHITE);
oled.setTextSize(1); oled.setCursor(0, 0); oled.print(top);
oled.setTextSize(3); oled.setCursor(0, 20); oled.print(value);
oled.setTextSize(1); oled.print(" "); oled.print(unit);
oled.display();
}
const float VREF = 5.0, SENS = 0.400; // V per A for the 5 A ACS723
const float DIV = (47.0 + 10.0) / 10.0; // divider ratio
float zero = 2.5;
float readV(int pin) { long s = 0; for (int i = 0; i < 64; i++) s += analogRead(pin); return s / 64.0 * VREF / 1023.0; }
void setup() {
oled.begin(SSD1306_SWITCHCAPVCC, 0x3C);
delay(500);
zero = readV(A0); // must be no current at start-up
}
void loop() {
float amps = (readV(A0) - zero) / SENS;
if (fabs(amps) < 0.02) amps = 0;
float volts = readV(A1) * DIV;
oled.clearDisplay(); oled.setTextColor(WHITE); oled.setTextSize(2);
oled.setCursor(0, 0); oled.print(volts, 2); oled.print(" V");
oled.setCursor(0, 22); oled.print(amps, 2); oled.print(" A");
oled.setCursor(0, 44); oled.print(volts * amps, 1); oled.print(" W");
oled.display();
delay(500);
}
Re-upload or reset with no current flowing so the zero is measured again.
Swap the IP+ and IP- connections.
Measure your two resistors and set DIV to (top + bottom) / bottom.
The sensor can, but working on mains needs an electrician; stay with low-voltage DC here.
About 1-2% after zero calibration, good enough to compare panels and weather.
Use a higher-range Hall sensor and change SENS to its mV/A.
7 parts: Generic Nano CH340 Development Board (Soldered), SparkFun ACS723 Current Sensor Breakout – 5A AC/DC Hall Effect, 400mV/A Sensitivity, Resistor Assortment Kit (30 Values), 0.96" OLED Display 128x64, Solar Panel, Solderless Breadboard and Dupont Jumper Wires (40 pcs). On this page you can tick the parts you already have and add only the rest to your cart.
It is a intermediate project and takes about 2 hours. The build on this page has 6 steps.
No. This page has the complete, tested code (solar_meter.ino).
About ₹2,199 for the parts at the prices on this page. Quantity price breaks lower the cost when you build several.
Hall-effect current sensing and isolation; Zero-offset calibration; Voltage dividers for higher voltages.
Turn a 12 V adapter into an adjustable 1.25–10 V supply for your experiments.
Build your own USB power bank and learn how lithium charging works.
Free power for outdoor sensors: sunlight in, 5 V USB out.
Beeps when the mains goes off at night, so the fridge and the alarm clock do not quietly die.
Lessons are free to read. Maker (₹499/month) and Pro add quizzes, worked problems and certificates, paid with your Geekobot account. See plans
Learning project. Check every circuit and the datasheet of each part before you power it up.