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 outcomeDefinitely the outcome was haywired! 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.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 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.

ab

You can input any voltage between 0 and 5 volts 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, you read it right. It can be done and quite easily. Click on the link below to know the dark secret.

 

FADING ON A NON-PWM PIN OF ARDUINO

My next post is on HOW TO REUSE A DAMAGED ARDUINO. Follow the post to stay tuned.

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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s

Powered by WordPress.com.

Up ↑

%d bloggers like this: