Sleek Voltmeter-cum-Battery monitor
The simple circuit presented here can measure DC voltage from 0V to +50V in a sleek enclosure with independent power supply option. The circuit may be used to monitor the voltage of battery (up to 12V battery). The power supply for the circuit may be derived from a general purpose 9V battery (or 8V to 12V DC power source).
ATTINY85 is eight pin MCU sufficiently powerful for the project, with 8KB flash + 512B RAM + 512B EEPROM and 1MHz default clock frequency, is heart of the system. The MCU continuously measures Voltage through its one of the ADC pins (ADC3). The ADC values are processed by the MCU and converted to Voltage value, then displayed on OLED accordingly.
OLED display is small display of 0.96” size, 5VDC supply, I2C connector, with 128x64 pixel resolution. It has 4 pins, out of which 2 for power supply, 1 for serial data (SDA pin) and 1 for the clock (SCL pin). The value is displayed in one row only using big font. To display the text in big font, the code is set for 32 pixel height and 24 pixel width.
The Voltmeter of the circuit can measure and display maximum voltage up to 50Volts DC. If the voltage exceeds 50V DC, the display shows moving squares, which indicates OVERFLOW. To protect the MCU ATTINY85, the measurement should be limited to 50V.
Refer full circuit diagram:
Working of the circuit :
When SW1 is switched ON, the 9VDC from the battery is step-down to 5VDC by voltage regulator IC 7805, which is the power supply for the MCU,ATTINY85 and OLED. All the pixels of the OLED (display) will glow for a while, as a self test and then blank screen for a while. Then, the program enters in a loop to read voltage at ADC pin (pin 2 of IC2) and displays the voltage accordingly.
Initial Setup:
Once the PCB is ready (general purpose PCB is used here), write/burn SleekVoltMeter.HEX to the MCU ATTINY85, using any AVR programmer and insert it to its IC base on the PCB. Otherwise, the SleekVoltMeter.HEX may be written to the MCU ATTINY85, using in-system programmer also.
Connect 9V battery (or other DC source less than 12V), connect jumper J1, then switch on SW1. Once, the voltage is displayed on the OLED, adjust the VR1 to match the displayed voltage with the source voltage. Now, disconnect the testing voltage source.
Now, the circuit is ready for use, which can read and display DC voltage upto 50V when jumper J1 is removed or display Source Battery voltage up to 12V battery with jumper J1 is connected. The OLED (display) automatically refreshes for every 2 to 3 seconds of measurement, for clearing display distortions, if any.
Enjoy . . . Have a nice day.
List of Important Components used in the Project:
ATTINY85, AVR micro controller (8pin)
OLED module, 0.96" size, 128x64 pixels, IIC controlled (4pin)
7805, 5VDC output regulator IC (3pin)
20K trimpot
Doides 1N4007, 1Amp capacity (or equivalent)
Capacitors: 10uF electrolytic , 0.1uF disc capacitor
SPST switch
Resistances: 3.3K, 10K, 33K (all 0.25W)
LED 3mm size, yellow and red
9V battery or other DC source
Miscellaneous : PCB, wires, jumpers, IC base etc.
click the link / attachment to download the file and rename as SleekVoltmeter.HEX , then upload to ATMEGA8 using any suitable AVR programmer.