Overview
Analog Uno has up to six analog input pins ranges from A0 to A5. Since the ADC module of ATMega328P is 10-bit resolution, the digital reading result ranges from 0 to 1023. By default the reference voltage of the Arduino module is internally connected to the +5V VDD.
With the analogRead() function, it return the 10-bit analog reading from any channel between A0 and A5. The argument of this function counts from 0 to 5, representing the A0 to A5 analog channel.
SH1106 OLED GLCD is a modern easy to use with a simple shared library. The interfacing to this display from Arduino requires only four pins.
Arduino Interfacing And Programming
In this example I use the analogRead() function to read the analog input voltage fed to A0. A POT as shown in the picture below varies the input voltage from 0 to 5 V.
A picture of this programming example |
Without any voltage divider circuit to scale down the input voltage, the maximum voltage reading is 5 V. I wish to make a simple 100 V DC voltmeter at next post.
Schematic Diagram |
I add a by pass capacitor C1 to eliminate noise. The capacitance could be a 10 nF or a 100 nF.
Arduino sketch lists below.
I took a screen shot of sketch due to lack of code formatting in blog |
You can click here to download archive of this example.
No comments:
Post a Comment