Introduction: Arduino Ohm Meter and Voltmeter Displaying on LCD Tutorial
In this tutorial I’ll be teaching you how to build your very own ohm meter and voltmeter only using your Arduino uno board and some additional components. This project can be used for various purposes such as, extending this project to build your very own Multi-meter. Its far more fun and exciting to build your own multi-meter rather than buying one which is already built from stores. This project will expand your knowledge in terms of how to build a circuit which is similar to building a multi-meter from scratch using your Arduino uno board and some additional components. This project is very easy to build and to understand, so please don’t let the wiring of the project scare you.
If you’re interested on how this project works and you want to see it in action, please click on this link:
1. Arduino uno board
2. LCD (16×2)
3. 10K pot resistor
3. Push button x2
4. 10K Ohm resistor x3
5. 100K Ohm resistor
6. 3K3 Ohm resistor
7. PC board
////////Explanation for each components used in this project:////////
1.Push button: We use a pull-down resistor at the push button so it can pull down the voltage to 0 volts. Without pull-down resistor the micro controller thinks the push button is still being pressed even though the push button has been released. The electrons in the Arduino pin get active when the the push button is pressed, that’s why we use pull-down resistor of 10K ohm. This resistor causes the electrons in the Arduino pin to be inactive when the push button is released, without the 10K ohm resistor the electrons in the Arduino pin will remain active even though the push button is no longer being pressed. The two push buttons in the circuit are meant to change pages on the LCD display. One button is responsible for going up(page 1,page 2 and page 3) and the other button is meant to down. Display pages from page 3, page 2 and page 1.
2.LCD(Liquid Crystal Display): The LCD component in this prioject is mainly used to display the measurement values of the ohm meter and voltmeter. The first page of the LCD displays the readings of the ohm meter, the second page of the LCD displays the readings of the voltmeter and third page of the LCD is only there to show that you can add anything on that page, Maybe in the next tutorial we will display current. In that case, we will display 3 major readings such resistance, voltage and current. LCD command register is used to send commands such as clear display and data register is used to send data which is to be displayed on the 16×2 LCD.
3.10K Ohm variable resistor: A variable resistor is used in this project so it can control the contrast of the LCD. Middle pin of the variable resistor is connected to the VEE pin of the LCD and the other pins of the variable resistor is connected to Vcc and ground.
////////Circuit explanation: voltmeter////////
1. Arduino voltmeter explanation: The Arduino board is a 10-bit converter, meaning that the output value will range from 0-1023. We will obtain these values using a code line such as “analogRead()”. If you know thw reference voltage you can easily calculate the voltage present at the analog input.
2. Voltage divider circuit is used to calculate and measure input voltage using Arduino uno.
////////Circuit explanation : Ohm meter////////
1. Calculating resistance using Arduino uno: In order to calculate resistance using Arduino uno board, we use a formula called “voltage divider”. The formula/equation looks like this, Vout=Vin(R2/R2+R1). In order to measure the unknown resistor with our circuit, we made R2 the unknown resistor and R1 the know resistor. By manipulating the voltage divider equation by making R2 subject of the equation, The updated equation will look like this, R2 = Vout*R1/(Vin-Vout). R2 = unknown resistor, R1=known resistor, Vin=voltage produced at the 5V pin arduino and Vout=voltage at R2 with respect to ground.
2. Analog voltage at the register AO pin of the Arduino uno pin is converted to digital value (0-1023) and stored in a variable.
3. digital value (0-1023) is converted into voltage.
4. buffer = a2d_data*Vin;
5. Vout = buffer/1024.0;
6. The Arduino uno ADC is of 10-bit resolution, so the integer values from 0-1024. This means that it will map input voltage between 0-5V into integer values of between 0-1023.
////////Creating multiply screens with an LCD////////
1. To get multiply screens using LCD we will create a variable called “page_counter”. The default value is 1 (first page or home page). int page_counter = 1; This line of code is used to move between pages.
2. With the two buttons we will add or subtract 1 and move the counter up or down(1 to 3 or 3 to 1)
3. The buttons are using a pull-down resistors which are connected to ground. The buttons initial state is LOW. So when the button is pressed it will connect to 5V (HIGH).
4. Create a custom function to read pins and watch if the states of pins has changed (from LOW to HIGH) and return what pin state has changed. Custom functions are not in the void loop() function or void setup() function.
5. When you press the button the LCD is clear to print the new page. At the end, always store the last state of buttons!(last_up=current_up;)
6. The main point here is to assign the entire page to “page_counter” number. Further explanation shall be shown on the Arduino IDE program below.
////////Here’s the code////////
Please feel free to ask me any questions concerning this project and I’ll try to answer all your questions as soon as possible.