I need to do a project of constructing a Dc Voltmeter and DC ammeter (with 3 digits of 7 segment LED display for both voltmeter and ammeter) display using UNO R3.
Both V & I displays are mounted –one above the other – on a single PCB and both reading will have to be sequentially multiplexed at a fast rate (persistence of vision). I will use potential divider and current shunt for both V & I for scaling down.
I request to guide me on this with a code.
Thanks
What range of volts and amps are you looking at measuring? Do you have to have a 7 segment display or can you have other displays?
at any rate....
measuring voltage from your voltage divider is a matter of connecting it to an analog pin and reading the 10 bit value then converting it to a voltage then scaling it up.
something like this
in setup()
pinMode(A0, INPUT);
in loop()
double volts = analogRead(A0) * 1024.0 / 5.0;
volts = volts * VOLTAGE_DIVIDER_VALUE
// your shunt current sensor will probably need and op amp to amplify the small voltage drop but
// do something similar to measure its voltage drop
// or use a hall-effect current sensor
Like this...
Please note that both meters must have a common '-' (Gnd) connection. A hall sensor for current measurement will remove this restriction.