Feedback on a voltmeter/ammeter design

Discussion in 'Embedded Systems and Microcontrollers' started by gch, Apr 3, 2011.

  1. gch

    Thread Starter New Member

    Apr 3, 2011
    4
    0
    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.
     
  2. beenthere

    Retired Moderator

    Apr 20, 2004
    15,815
    282
    How is the network of R1 - R4 supposed to work? What magnitudes of voltage and current do you expect to handle?
     
  3. gch

    Thread Starter New Member

    Apr 3, 2011
    4
    0
    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 :)
     
  4. gch

    Thread Starter New Member

    Apr 3, 2011
    4
    0
    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.
     
  5. beenthere

    Retired Moderator

    Apr 20, 2004
    15,815
    282
    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?
     
  6. be80be

    Senior Member

    Jul 5, 2008
    431
    57
    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.
     
  7. eblc1388

    Senior Member

    Nov 28, 2008
    1,542
    102
    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.

    [​IMG]
     
  8. be80be

    Senior Member

    Jul 5, 2008
    431
    57
    It looked like a 68 K I can see the 6.8 in your SCH the divider would work then.
     
  9. gch

    Thread Starter New Member

    Apr 3, 2011
    4
    0
    Thanks so much for the input be80be, eblc1388, beenthere :) It's been a huge help. Precision isn't a huge deal for my application 100ish ma would probably be sufficient. I'm using fairly high tolerance resistors so it should be good enough.

    I'll keep you guys posted on my progress once the parts arrive.

    Cheers
     
Loading...