The introduction to Arduino labs at Malmö University. These slides have been handed down since the beginning of Arduino. They have more authors then i can remember and should by no means be considered mine.
2. SENSOR
• Device measuring information from the environment (the
world) and translating the values into data understandable
by our computers
• We can classify the sensors into two different groups,
according to how they send information back to the
microprocessors:
– ANALOG SENSORS: those that interface
microprocessors through the analog inputs, offering
signals varying between 0 and 5Volts
– COMPLEX SENSORS: those that communicate using
either digital pins with PWM, serial communication, I2C
or SPI (FYI: the last two methods are special types of
serial communication)
3. ANALOG SENSORS
• ANALOG SENSORS: within this group we distinguish two modalities:
– RESISTIVE/CAPACITIVE SENSORS: those that contain a
resistive/capacitive component that varies its value with light,
temperature, etc.
• LDR – Light Dependant Resistors
• Potentiometer: angle/stretch sensor
• NTC – Negative Temperature Coefficient (Temp. var. resistor)
• Flex-sensors
• Pressure sensors
• Piezo Elements: can act as knock sensors
– SIMULATED ANALOG SENSORS: complex sensors offering a
simple interface to microcontrollers.
• ACCELEROMETERS: to measure tilt, and movement
• InfraRed: to measure distances from 1mm to 80cm
• Humidity
4. COMPLEX SENSORS
Their main characteristic are that they communicate using
either digital pins with PWM, serial communication, I2C or
SPI (FYI: the last two methods are special types of serial
communication)
There are many sensors within this group of complex sensors:
– ACCELEROMETERS: the classic is the MEMSIC2125
broadly used in prototypes, lately people are hacking Wii
controllers
– GPS: sends strings over a Serial connection
– PING, SRF04/05: ultrasound devices measuring the
distance to objects using sonar technology
– Precise Temperature sensors
5. SENSOR vs. ACTUATOR
Keep in mind the following statement:
EVERY ANALOG SENSOR CAN BE USED AS
AN ACTUATOR AND VICEVERSA
•For instance the piezo element that will also act as knock
sensor
•This can be applied at low level only (simple sensors), so this
does NOT apply for complex sensors and simulated analog
sensors
•Actuators will also act as sensors, e.g. a DC motor is also a
dynamo, what makes it into an analog sensor to detect
movement
6. A COUPLE OF TRICKS
If, after connecting your components to an Arduino board...
•you lack some digital inputs for your buttons, you can always use
analog inputs and detect values over/under 512 instead of HIGH
or LOW
•you lack some analog inputs for an analog sensor that you only
use with a threshold, you can put it into a digital input, knowing
that you will only read HIGH or LOW and that the threshold will be
at 2,5 Volts, to change it, you can use a potentiometer instead of a
pull-up resistor for your sensor
•you lack pins in general, to use as inputs, you can always use
multiplexer circuits to add extra inputs. A recommended circuit to
use is the 4051, which is broadly documented, or the tlc5940
which has some very nice libraries and is also well documented
7. PRESENCE vs. DISTANCE
• Many projects aim to determine whether there are people or not
in a space
• Other projects try to determine the distance of people to objects
• Different types of sensors allow to measure both presence and
distance
• However we have to keep in mind that:
– presence implies to distinguish animated from inanimate
objects: THIS IS VERY COMPLICATED
– distance implies multi-resolutive systems: THIS IS VERY
COMPLICATED
• As designers we just make prototypes and we look into some
features from sensors that allow us to simulate the desired
functionality ... BUT WE WON'T MAKE IT WORK FOR REAL!
8. DISTANCE
There are different types of sensors that act very well
depending on the distance (range) we want to measure:
– InfraRed is very precise under 1m, there are some
sensors that concentrate in just 3cm!!
– Ultrasound is very precise up to 10m, but it is a slow
technology, we can only measure 5 samples/second
with the kind of technology we use for prototyping
(empirical values when using the sensor data in
software programs)
– LDRs can be used for rough measuring of touch
(many use it in their projects to simulate touch sensors)
or distances smaller than 5cm, but it has very low
accuracy
9. ACCELEROMETER
• Accelerometers are sensors that can measure different
things, among others they can measure the tilt of an
object carrying the sensor, if the object moves, how quick
it moves, etc.
• Accelerometers are very noisy sensors, therefore their
data is not very accurate, however with a correction it is
possible to make them very useful for 3-D positioning
• An example of a corrected sensor is the Wiimote, or basic
Wii's game controller. It contains a 3-D accelerometer with
an infrared camera that will measure the position of the
screen correcting the possible errors made by the
accelerometer
• Even if noisy, accelerometers can be very useful for quick
prototypes within interaction design
12. Both jumpers on selects a range of +/-1.5g;
GS1 jumper on and GS2 jumper off selects: +/-2g;
GS1 jumper off and GS2 jumper on selects: +/-4g;
both jumpers off selects a range of +/-6g.
ACCELEROMETER
13. EXERCISE ►ACCELEROMETER
• Connect one of the Accelerometer sensors
to your Arduino board
• Test to see if it works
• Modify the code so that it sends the
following strings to the computer:
“LEFT”, “RIGHT”, “UP”, “DOWN” ...
basically you should transform your Arduino
into a tilt-pad
14. ULTRASOUND
• Ultrasound is a technology used for submarines, accurate
measuring of forms through human tissue, etc.
• Technically it is called SONAR
• We will use a cheap sensor (either PING or SRF05) to measure
the distance to objects
• The basic functionality works like this:
– the sensor emits a burst (signal)
– it enters listening mode
– the burst bounces on any objects and the signal travels back
– the sensor estimates the time it takes for the signal to come
back
– it sends a pulse to the microprocessor which width is in relation
to the signals flying time and therefore to the distance to the
object
17. The difference between the SRF05 and the PING))) sensor is in
the amount of pins they have:
– the SRF02 sensor has one input and one output pin, as well
as a mode pin that allows to use it as the PING sensor
– the PING sensor only has three pins: 5V, GND, signal and
therefore it requires to use a pin both as input and as output
ULTRASOUND
19. ULTRASOUND: COVERAGE
• The concept of coverage of a sensor is used to determine
the physical range where it will gather data
• E.g. a remote control will only communicate if it is pointing
towards the TV, this means that the coverage area of the
remote is only in front of it.
• Each sensor has a characteristic (unique) coverage range
• The coverage area of ultrasound sensors is not very narrow.
They have an opening angle of 20-60 degrees depending on
the type. The ones we use in class have an angle of about
50 degrees
• This means that we have to be careful when mounting the
sensor. It has to be almost sticking out of the object we
mount it on
21. A matrix is used in LED displays to control many
outputs (LED’s) with few pins
Showing something on the LED display is done by
using a special pattern
This pattern makes use of the LEDs polarity (Its
ability to only conduct electricity in one direction)
LED displays are expandable by linking them to each
other
Instructables has a good instruction on how to do this
MULTIPLE OUTPUTS
23. Turning one row of LED’s HIGH and one column LOW
will light up one LED
Switch between the rows really fast and the human
eye will think all of them are on all the time.
MULTIPLE OUTPUTS
Source: http://letsmakerobots.com/node/23980 Source: http://tacticaldesign.mit.edu/page/2
24. Multiple outputs
• You can create an LED display and interact with
it using an accelerometer.
• This can be done with either The Dawn board
or a Matrix board
25. USEFUL RESOURCES
• Shops:
– Sparkfun
– Electrokit
– Elfa
– Adafruit
• Information:
– Arduino
– Arduino playground
– Led wizard
– Instructables
– Resistor Calculator
– Analog Circuits
– Educypedia
• Inspiration:
– Youtube
– Flickr
– Google
– Yanko design
– We make money not art
– FFFFF
– Graffiti Research Lab
Notes de l'éditeur
Encourage people to interrupt you so you can help them immediately. Explain they do you a favor.
It’s good to time the duration of the presentation.
Analog sensors use a difference in resistance to generate values.
Complex sensors use some form of communication protocol.
With an ordinary analog sensor you read the values directly from the sensor.
I2C is a one wire communication protocol also known as master and slave communication
The master can communicate to all slave devices.
An accelerometer actually transfers a digital signal into an analog sensor, the same with the infrared sensor.
GPS returns two strings: longitude and latitude.
NTC’s give resistive value. Temperature sensors give the temperature as value.
Complex sensors only work as sensors.
D/C motors can be used to generate movement. If you connect them the other way around they generate power.
The dynamo on your bike is actually a dc motor. If you would apply power to it it would actually spin by itself.
Tilt sensors are basically buttons which are activated by tilting them.
Distance is to measure distance between two points.
Multi-resolutive systems: making a grid of sensors to detect motion
Faking is good.
Ultrasound is good for up to 10 meters.
Infra red is good for up two 1 meter.
LDR’s are good for measuring shadow level.
Accelerometers are used for 3D positioning. You can use them to track the speed and direction an object is moving in and to determine where an object is in space. But this last thing is difficult to do because you have to calibrate it’s starting position.
Only use the 3.3 volt power pin to power the accelerometer otherwise you will fry it.
You have to connect the SLEEP pin to 3.3 volt to HIGH (3,3volt) aswell otherwise it not work
It’s called active HIGH, it’s used to save power.
When it’s level the value is 350, when you tilt it the value becomes higher or lower.
The accelerometer can only measure 180 degrees. If you turn it upside down it will go back to 350 again.
You have to use a marker variable to track if it’s upside down or not when calculating the rotation.
GS1 and GS2 have to do with higher or lower G forces.
Change this slide to an InfraRed sensor slide
Sharp IR sensor from electrokit. Find a tutorial.
Write a similar explanation on how it works, how to hook it up.
Tell them they have to recalculate the values from the sensor to centimeters.
Introduce the ‘map’ function here, do the calculation the old school way with some flexible rulers.
There is an explanation of the map function in lab 6 or another one.
It sends out infrared light. When it sees something, it blinks at a super high speed. It measures the difference in time between sending the signal and seeing the dot.
Change title to IR sensor
Switch pictures.
Change to closeup picture of IR sensor ports
Change to: compare ultrasonic sensor to ir sensor in coverage area.
Ultrasound would not be able to see a pole in front of a wall because the sound bounces of the round pole.
IR sensor does work on the pole.
The bad thing is, you can only have one LED on at a time. The good thing is that the Arduino can perform a few million instructions per second.
This is why when you take a picture of a bus sign you will see half of the dots missing.
It only works with diodes because the power can only run in one direction. LED’s are diodes.
Don’t do the example, just explain the concept. If someone needs to do it, help them out side of class.
Change to: assignment with LED’s and accellerometers.
4 LED’s which burn depending on the movement direction of the accelerometer.