Introduction to Arduino (Sensor)

Digital Sensors

Digital sensors are the sensors that gives 2 state (on/off, 5V/0V). You will connect them to digital Pins and set it as INPUT.

Push Button
inside of a push button

How to connect push button: Pull Down Resister
pulldown 107w, 128w, 1001w" sizes="(max-width: 364px) 100vw, 364px" />

*pull up resistor should be 10k ohm or bigger

Try the example sketch: File/ Examples/ Digital/ Basics/ DigitalReadSerial

If the above is done, add LED and control its state with Button. Use example sketch examples/Digital/button sketch. You can also try StateChangeDetection sketch as well. Compare the difference.

*pull up resistor should be 10k ohm or bigger

Analog Sensors

Analog sensors on the other hand, gives range. You connect this types of Analog sensors to Analog Input pins which is measuring the incoming voltage between 0V-5V*. Arduino converts this incoming voltage into the number between 0-1023.

*If you are operating your Arduino with 3.3V, such as Lilypad or Arduino Mini with Lipo Battery, the analog pis refers to the range of 0V-3.3V instead.

“A potentiometer, informally a pot, is a three-terminal resistor with a sliding contact that forms an adjustable voltage divider. If only two terminals are used, one end and the wiper, it acts as a variable resistor or rheostat.”
from wikipedia

inside of a potentiometer

“A photoresistor or light-dependent resistor (LDR) or photocell is a light-controlled variable resistor. The resistance of a photoresistor decreases with increasing incident light intensity; in other words, it exhibits photoconductivity.”
from wikipedia

How to connect analog sensors: Voltage Divider:
You can divide the voltage by using 2 resisters.
If you have 2 exactly same resistors, the voltage gets half in the middle, like the first diagram.
As the ratio between two resisters changes, the voltage you get in the middle (between the resisters) changes accordingly.

As the analog input pins are reading the voltage input changes, we need to change the voltage that goes into the analog pins by changing the resistance connected to the analog input pin. Potentiometer is acting as voltage divider, between left pin and middle pin as one resister, and the middle pin and right pin as another. As you turn the knob, the ratio of two resisters change, thus the voltage flowing into the middle pin changes.


or if this was connected on the breadboard, it will be something like this

Try example sketch: File/examples/basic/AnalogReadSerial
Open the serialMonitor and see which input number you receive.
Add LED on one of the digital Pins with PWM and try to control its intensity with different kinds of sensors.

The sensors we have…

Push button
Tilt sensor
Hall Effect sensor

PIR motion sensor
pulse sensor

Flex sensor
soft potty

piezo sensor

muscle sensor
Distance Sensor
Ultra Sonic distance sensor
3 axis Accelerometer
3 axis Accelerometer MMA7361


Capacitive Sensing

Capacitive sensing is also an interesting technique of sensing.
“capacitive sensing is a technology, based on capacitive coupling, that takes human body capacitance as input. Capacitive sensors detect anything that is conductive or has a dielectric different from that of air.” (from Wikipedia)
The nice thing about the capacitive sensing is that you need only one connection to a sensor (electrode), and any conductive material can be made into a sensor. Also, the user does not have to touch the electrode. It can be covered with another types of materials.

There is a very nice library and tutorial on capacitive sensing with Arudino. Go to the following link and try it >>

Firmata Library

Firmata a generic protocol for communicating with microcontrollers like the Arduino from software on a host computer. (from Arduino Playground)
For example you can access the sensor data on Arduino from Processing or PureData using Firmata Library.]
Download the firmata library for Processing and try to read out the data from Arduino. You can then use this value to draw or to play music… however you like

And firmata for PD (called Pduino) is here

One thought on “Introduction to Arduino (Sensor)

Comments are closed.