Intel Do-It-Yourself Challenge Sensors





0/5 (0 vote)
Our goal is to get familiar with simple sensors, wires and the board connectivity.
Interacting with sensors
Digital and Analog sensors
Lots of sensors are available. It’s important to know which ones are compatible with Galileo : do they need extra components to work ?
Get information from sensors
Galileo can communicate with digital pins and analog inputs with sensors.
We’ll use …
An Intel Galileo board and network connectivity
We assume you are familiar with communicating with the embedded OS and performing GPIO commands.
Advance sensor set for Arduino (by DFRobot)
A set of 30 sensors and accessories for Arduino. http://www.dfrobot.com/index.php?route=product/product&product_id=725
Jumper wires F/M and M/M and prototyping board
To easily plug sensors and accessories on your Galileo.
Digital and Analog Sensors
Digital sensors
A digital sensor interacts with the physical environment and returns us a binary information.
For example, a digital push button is pressed, or not. It has two states, 0 or 1.
Three wires can be connected :
- A black one, for the ground.
- A red one, for input voltage.
- A green one, transmitting the information.
Analog sensors
An analog sensor interacts with the physical environment and sends us a physical value, which is almost always a voltage.
For example, an analog linear temperature sensor is a circuit involving a resistor. Its value changes linearly with the temperature. According to Ohm’s law, voltage also changes and this is the value we get and measure.
As a digital sensor, common analog sensors have three pins:
- As usual, black on ground and red on voltage input.
- And a blue one, corresponding to the voltage returned by the sensor.
Which sensor to choose?
Our first set of sensors :
Advance sensor set for Arduino by DFRobot.
Pros:
- Variety of sensors.
- Easy to use, just plug them.
- Good enough to start or for prototyping.
Cons:
- Not exactly what you need for your project.
- Not flexible and scalable
What else do I need?
Jumper wires Female/Male and Male/Male are useful to connect various components to the Galileo. Prototyping board keeps things tidy !
This is the minimum for prototyping. See our slides on Advanced sensors and Project integration to go further.
A first circuit
Our goal is to get familiar with simple sensors, wires and the board connectivity.
Important facts:
- We’ll use the 5V pin as input voltage for all sensors and accessories in this course.
- Next to the 5V pin is the ground pin we will connect to all our sensors too.
- Don’t connect directly these two pins together ! It would damage your board.
Connect these components, refering to the following figure:
You’ll need:
- Intel Galileo Board
- A LED module
- Ambient light sensor
- Wires
- A prototyping board
Move your hand slowly over the light sensor. Intensity of LED light should vary.
Explanations
The light sensor forwards its input voltage to the LED control pin according to the ambient light intensity.
A lower light intensity will reduce voltage sent to the LED.
From the LED module point of view, current is sent to the LED according to the voltage value on the control pin.
Try another sensor instead of the ambient light sensors, it will work the same!
Get Informations from Sensors
Let’s implement this circuit
You’ll need:
- Intel Galileo Board
- The Joystick module
- Wires
- A prototyping board
X axis signal is connected to analog input 1. Y axis signal is connected to analog input 2.
Read information
- Create a bash file on your computer
touch joystick_info.sh
- Copy/Paste the code from the next slide and save your file
- Send your file to the Galileo board
scp joystick_info.sh root@192.168.1.XXX:~
- Connect to your Intel Galileo embedded system with SSH
ssh root@192.168.1.XXX
- Change access right on your file to run it
chmod 755 joystick_info.sh ./joystick_info.sh
- Move the joystick and you’ll see voltage input values on your screen!
- The program will terminate if you push the joystick to the max x value.
- The same program can be used to test accelerometers and gyroscopes.
- The same program can be written in a C program instead of a bash script.
- The z axis on the joystick is a push button.
#! /bin/bash # please refer to slides about GPIO for pin mapping echo -n "36" > /sys/class/gpio/export echo -n "23" > /sys/class/gpio/export echo -n "out" > /sys/class/gpio/gpio36/direction echo - gpio/gpio23/direction echo -n "strong" > /sys/class/gpio/gpio36/drive echo - gpio/gpio23/drive echo -n "0" > /sys/class/gpio/gpio36/value echo -n "0" > /sys/class/gpio/gpio23/value xvolt=`cat /sys/bus/iio/devices/iio\:device0/in_voltage1_raw` yvolt=`cat /sys/bus/iio/devices/iio\:device0/in_voltage2_raw` #while xvolt value is lower than 4V while [ $xvolt -le 4000 ] do #Print values echo "xvolt" $xvolt echo "yvolt" $yvolt echo " " #Update values xvolt=`cat /sys/bus/iio/devices/iio\:device0/in_voltage1_raw` yvolt=`cat /sys/bus/iio/devices/iio\:device0/in_voltage2_raw` #Wait 500ms usleep 500000 done echo -n "36" > /sys/class/gpio/unexport echo -n "23" > /sys/class/gpio/unexport
Other Sensors
Here’s how they work
Digital tilt sensor: put the sensor on a table, wait a minute, hit the table. Digital magnetic sensor: move a magnet close to the sensor. Flame sensor: switch on a lighter, at 20cm of the sensor.
Analog linear temperature sensor: read the value with an analog input. Piezo disk vibration sensor: read the value with an analog input. Soil moisture sensor: soak extremities of the two bands in a glass of water.
Analog gaz sensor: use the screw to adapt the sensibility. To test, approach the sensor to the top of a bottle of medical alcohol at 70%. Set the sensor sensibility to its max value.
Relay module: voltage is between NO and COM when voltage is present on green wire. Otherwise, voltage is between NC and COM?
Analog voltage divider: scale the input voltage from range 0-25V to an Arduino compatible range of value (0-5V).