Posted on January 13, 2017January 14, 2017 by electromaniaweb
This is a very simple project that introduces you to the world of analogWrite feature of arduino.
Hardware required :-
- AA battery
- Arduino Uno
- 2 x Jumper cables.
Looking at the hardware that we are going to use in this experiment you can deduce it yorself that it is a very easy project and is uploaded for the understanding the function of analog pins present in arduino uno so we can use them gregariously in our future complex projects.
HOW YOUR CIRCUIT SHOULD LOOK LIKE :-
- This is a DIY(do it yourself) project for you. The circuit is very simple so I am going to just explain the circuit design and you will have to try to make it by yourself. Comment if you come across any problem while doing it yourself.
- On the left side of your Arduino Uno you can see 6 Analog-In pins(.A0, A1, A2, A3, A4, A5) An analog signal is one that can take on any number of values, unlike a digital signal which has only two values: HIGH and LOW. To measure the value of analog signals, the Arduino has a built-in analog-to-digital converter (ADC). The ADC turns the analog voltage into a digital value. The function that you use to obtain the value of an analog signal is analogRead(pin). This function converts the value of the voltage on an analog input pin and returns a digital value from 0 to 1023, relative to the reference value. The reference is 5V on most Arduinos, 7V on the Arduino Mini and Nano, and 15V on Arduino Mega. It has one parameter which is the pin number.
- Insert a jumper wire in the A0 pin of your arduino
- Connect the other jumper wire to the ground.
- Connect the A0 jumper to the positive terminal of the battery you are measuring.
- Connect the other jumper to the negative terminal of the battery.
- Your circuit is ready! simple as that.!
After uploading the code open the serial monitor of your arduino by pressing—-> ctrl + shift +M
I have explained each line of code.
Although I have not mentioned one very important detail.
DO NOT CONNECT MORE THAN 5V battery TO YOUR ARDUINO. The analog pins and every input pin in the arduino has a threshold of maximum 5V. Any voltage above it will PERMANENTLY DAMAGE your uno.
Comments
Please log in or sign up to comment.