Five cool facts your arduino hid so long

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,

  1. 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-

pinMode(A0, OUTPUT)
digitalWrite(A0,HIGH)

Yes, it’s that simple.

But a word of caution here: Next time you use this pin to read a sensor, better set it to INPUT mode or you may not read the sensor correct.

  1. Input Pull_down and Pull_up resistors: Have you ever connected a push button to arduino?  Did the serial monitor show the expected outcome?Definitely the outcome was haywired! What your serial monitor shows is just a column of random readings, which might fluctuate with the slightest movement  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.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 :

pinMode(7, INPUT_PULLDOWN)
pinMode(7,INPUT_PULLUP)

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.

asssazz

  1. Analog Reference : Analog reference or its acronym,  AREF decides the reference voltage of analog pins. Arduino UNO uses Atmega 328 as its microcontroller which has an in-built Analog to digital converter(ADC). Microcontrollers work only on digital signals, so how come analog inputs get processed? the key to this mystery is ADC. Any analog signal input to  Arduino,  first passes through ADC, gets converted to digital form and is finally made available for processing.  Every ADC has a pin for reference voltage.It decides the maximum voltage an ADC can convert. By default,  this voltage is 5V and any voltage greater than 5 is not converted to its digital form.AREF allows us to change reference voltage to any value less than 5 volts.  Every ADC has a pin for ‘reference voltage’. Whatever voltage you input to AREF pin becomes new reference voltage for ADC. Let’s assume AREF voltage is 3v and analog input is 2 volts,  serial monitor shows a reading less than 1023. But if analog inout is 3 volts or more it shows 1023.

ab

You can input any voltage between 0 and 5 into the AREF pin.

To set AREF voltage, use the instruction:

analogReference(EXTERNAL)

To set the default voltage, use :

analogReference(INTERNAL)

  1. 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.a
  2. PWM on any digital IO pin: Yes, it can be made possible. It can be done and quite easily with a simple piece of code. Click on the link below to access the code. 

 

FADING ON A NON-PWM PIN OF ARDUINO

My next post is on HOW TO REUSE A DAMAGED ARDUINO. Follow ArduiGeek’s fb page to get latest updates.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s

Powered by WordPress.com.

Up ↑

%d bloggers like this: