# Feedback on a voltmeter/ammeter design

#### gch

Joined Apr 3, 2011
4
I'm an experienced programmer, but I'm just venturing into electronics. I'm building a circuit based on an Amtel atmega168 to measure both voltage and the current drawn by a load. Specifically it will be connected between a pedal powered generator and a charge controller for charging lead acid batteries. I've cobbled together a circuit design from several internet sources and I'm looking for some feedback on it.

If you guys could give any tips on if the circuit is sufficient and if not on ways to improve it I'd be very much appreciative. See the attached for a schematic.

#### Attachments

• 13.3 KB Views: 41

#### beenthere

Joined Apr 20, 2004
15,819
How is the network of R1 - R4 supposed to work? What magnitudes of voltage and current do you expect to handle?

#### gch

Joined Apr 3, 2011
4
If my calculations are correct then the circuit should be safe up to an absolute max of 80V. This is fine for me because the voltages I'm expecting will not exceed 24Volts. On the other hand, and this is where I'm unsure I'm dealing with potentially high currents of max 30Amps at 12Volts I figure.

Pin 23 will be used for monitoring voltage and pin 24 for current. I'm just not confident that the circuit can handle high current.

Thanks

#### gch

Joined Apr 3, 2011
4
Basically P3 and P4 act as a voltage divider and will convert a max of 80 volts in to a max of 5V for the microcontroller ADC. The R1 0.47ohm 5watt resistor acts as the load to measure the current, while R2 protects against voltage I believe.

#### beenthere

Joined Apr 20, 2004
15,819
What does the entire circuit look like? Having the voltage divider and the current sensing resistor intermingled may not work - at least it is hard to tell with a partial schematic.

What precision does your measurement require? Will you get that from the internal A to D?

#### be80be

Joined Jul 5, 2008
2,072
There no way that divider will work at 80 volt's he will be sending 32 volts to the adc pin
at 24 it would be 9 volts.

#### eblc1388

Joined Nov 28, 2008
1,542
There no way that divider will work at 80 volt's he will be sending 32 volts to the adc pin
at 24 it would be 9 volts.
Nope. It will work. That's 6k8, not 68K in the voltage divider.

@gch,

You have chosen to use Vcc as ADC reference. That would means the full scale ADC input is Vcc which is 5V.

This is good for voltage measurement but undesirable for current measurement because you would need 5V voltage drop across the current sensing resistor to give you 10-bit ADC result. The 5V drop is definitely too much and impractical as energy is wasted unnecessarily on the sensing resistor. You should aim to reduce this voltage drop as much as possible.

This would mean you have to use the lowest ADC reference voltage that you can use, as the sensing resistor value = ADC.ref / Current. The Mega8(Mega168) provides an 2.56V internal reference and using this will cut both the sensing voltage and power waste by half. The lowest you can go is 2V by using an external reference.

If you want to use internal 2.56V reference or external reference, you would need to disconnect the connection of AREF pin to Vcc and place an additional 1uF capacitor from the AREF pin to GND. Then you will have to make the correct Vref selection by setting bits in register ADMUX.

The original 100K series resistor value for ADC1 input is too high and I have reduced it to 4K7. You would also need to place two 22pF capacitors as the loading capacitor for the crystal.

#### Attachments

• 10.1 KB Views: 50

#### be80be

Joined Jul 5, 2008
2,072
It looked like a 68 K I can see the 6.8 in your SCH the divider would work then.