Every time you thought, you knew your arduino well!, you were betrayed(I kind of liked that feeling).Well, let’s just hope this post does it for once and all. So, here my friends I give to you those five things,
- Output voltage from analog pins: Surprised? ..Well, right from this moment you have 13+6 GPIO pins. The question is how! You just have to say the magic word or rather type it-
Yes, it’s that simple.
But, a word of caution here, next time you use this pin to read sensor, better set it to INPUT mode, or you may not read the sensor correct.
- Input Pull_down and Pull_up resistors: When you connect push buttons directly to your arduino ,things never go as expected. What your serial monitor shows is just a column of random readings, which might depend on the proximity of your hand to the button. Yes , that’s frustrating!
This cool ( frustrating as well) magical thing happens due to the presence of noise pulses in the air from the nearby electronics or your hand. When the button is not pressed(the circuit is open), the values are floating between high and low state, same reason.The solution to this problem is hidden right inside your board : PULL-UP and PULL-DOWN resistors.To set the pull-up and pull-down resistor , use the following instructions :
When the button is not pressed it sets it to either high or low, thus stopping the random readings from popping up.Note that when you connect 5v volt to arduino through switch , use pull down resistor and when you connect gnd( 0 volts) to arduino through switch, use pull up resistor.
- Analog Reference : Analog reference or its acronym AREF , decides the pinout voltage of all the digital pins. This means, that any voltage you give into the AREF pin will now become the pinout voltage of all the digital pins and not the default 5 volts.Plus, it also the decides the reference voltage of analog pins and this just means that when you try to read sensors from your analog pins, the reference voltage for the ADC (analog to digital conversion) will be the voltage input at the AREF pin. Let’s just say that AREF voltage is 3v.Now, if the reading voltage given by the sensor is less than 3v , (say 2v) serial monitor will show a reading less than 1023. At a reading voltage of 3v or greater, it will show just 1023.In the normal case (without AREF), at only 5v the reading was 1023.
You can input any voltage between 0 and 5 volts into the AREF pin.
To set AREF voltage, use the instruction:
To set the default voltage, use :
- Serial Plotter: This tool is available in latest arduino IDE update.As the name suggests, it lets you plot your sensor data and analyse it better. To access it go to tools.
- PWM on any digital IO pin: Yes, you read it right. It can be done and quite easily. Click on the link below to know the dark secret.
My next post is on HOW TO REUSE A DAMAGED ARDUINO. Follow the post to stay tuned.