Arduino have 6 analog pins labeled as Analog 0 to 5. Analog pins are mostly used to read analog sensors and sent to the 6 channels Analog Digital Converter (ADC). The ADC will convert the voltage (0V to 5V) to integers from 0 to 1023 (10 bit resolution). This can be accomplished using the analogRead() function. If the analog sensors have a narrow voltage range, you can use the analogReference() to change the input range and resolution.
The analogReference() can be change from the default analog reference of 5V ( or 3.3V for some boards ) to either an INTERNAL analog reference or EXTERNAL analog reference.
Internal analog reference will use the internal 1.1V when converting from voltage of integer of 0 - 1023. If the AREF (Analog Reference) pins is connected, it will USE the external reference voltage even if you issue the command analogReference(INTERNAL);
External analog reference will use the external AREF pin and take the reference voltage of whatever voltage that pins is connected to. You can use this method with a voltage divider to get 2.5V for the analog reference voltage. An example is to connect two resistors of same value (example 100 ohm each) to the 5V pin and tap in the middle to get the 2.5V into the AREF pin. As normal resistor have a 5% tolerance value, it is not very accurate unless you use metal-film resistors with 1% tolerance value for better accuracy.
All the 6 analog pin can be used as General Purpose Input/Output (GPIO) pins like digital pin using label of A0 to A5. Use the command, pinMode(A0, OUTPUT) to set the analog pin to OUTPUT mode. After the mode is set to OUTPUT, you can use the digitalWrite() functions for these pins.
*** analogRead will not work correctly when set to OUTPUT due to the internal pull-up resistor. You need to use the pinMode to set it back to INPUT before using the analogRead() function.
This blog is into Arduino and electronics for Beginners from Malaysia. I will be focusing on what projects you can use the Arduino for, Arduino shields, physical computing and interaction with the real world using various types of sensors and actuators. Some focus would be on Arduino in Malaysia like where to obtain electronics parts, gathering, workshops and meetups. Please join the facebook group for discussions, additional project photos and information sharing among beginners.
Pages
▼
Sunday, January 16, 2011
Wednesday, January 12, 2011
Arduino Documentary is finally done.
I do not usually post current events or news articles but this is an important event for Arduino, the Arduino Documentary. The documentary talks about how it all started, open source hardware, some cool projects and how easy it is to work with a microcontroller without any knowledge in electronics and focus on what you trying to get done.
Source :Adafruit
Arduino The Documentary (2010) English HD from gnd on Vimeo.
Source :Adafruit