Friday, 30 October 2015

ARDUINO TUTORIAL 1: Reading analog sensor


ARDUINO TUTORIAL 1: READING ANALOG SENSOR

ANALOG SENSOR:
Analog sensor

There are different types analog sensors are here. The basic types of sensors are:
  •     variable current output
  •     variable voltage output
In industry,they use current analog sensors ,its is the rating of (4-20)mA.
But here,we gonna see about the voltage analog sensor and how to interface with arduino.
Basically,the voltage analog sensor varies its output range from 0v to 5v.
0v means no detection in the analog sensor , 5v means high detection in the sensor and the intermediate values are proportional to the detection.

Example: LDR(light dependent resistor) is an analog sensor,its output is  proportional to light and its resistance is indirectly proportional to light.
   If  more light falls on the sensor,its resistance goes 0ohm,then it gives the high output(as per we given) and vice versa.

ARDUINO ADC:

  • Arduino have 6 analog input pins on the left bottom of that.
  • The first analog pin is A0,second is A1 and so on.
  • It has a inbuilt 10bit ADC in analog pins.so your analog values are converted into digital by ADC.
  • Suppose,if you want measure the light intensity of the room using LDR. Presumably, a good LDR gives the varying output accordance with the light intensity of the room.Reading the analog values directly is not possible.so you can use the inbuilt ADC in arduino.
  • The accuracy of ADC is determined by the resolution.In case of arduino ,it have a 10bit ADC (i.e) 2^10=1024
  • so your analog values 0-5v is split into 1024.
  • 0v gives 0000,5v gives 1023(because 0000-1023 is 1024 values)
  • if it's 2.5v ,ADC gives 512 and so on  .
ARDUINO COMMANDS:
  •  I hope ,now you got better understanding about ADC and analog sensors.
  • Now you can integrate this into your arduino.
  • The arduino commands to read analog value is analogRead(a0).
  • Here a0 is analog pin.
so,on my next tutorial i'll explain about how to write program (on your own) for arduino .If you have any douts, ask me in comment box
To get more updates follow me on facebook
Learn Electronics- Facebook

No comments:

Post a Comment