This is an old revision of the document!


Lab 7: Digital sensors

You have already used a number of sensors, which you connected to the analog pins. You will see now another type of sensor. This digital sensor provides linearized, calibrated signals in I²C format.

Accelerometer

Wiring

You can connect the accelerometer either by SPI or I2C. The easiest way will be the I2C connection. SDA and SCL pins go to the respective ones on the board, GND to Ground and VCC to 3.3V.

The code

Using streams, the code is just as easy to write. For the simplest application, just add a visual node where you will measure and return, in the payload, the acceleration on one of the axis, the one you chose. The visual blocks for the accelerometer can be found under Sensors, in the side menu, in section Accelerometer. There is one slight change you have to make. You don't need the default set block to initialise the sensor. You want the initialisation block, which can be found in the Functions section, under the name Initialise…

So the nodes you are going to use are run , followed by the visual node and then you can send a signal with the value, via the corresponding node, or print it on the screen, using print

Humidity sensor

You can use it both for temperature and humidity. It is easy to connect to the board, as you see in the example above.

The code

As for the code, you only need a visual node to extract the data from the sensor.

Make sure that when you go under sensors and humidity sensor and drag the initialisation block, you extract only the blue, init block. Instead of putting it inside a set block, you choose from function the initialise block. This way, the values from the sensor will be stable.
In case you want to extract the humidity as well, you can use a change node.
Hint Double check to have the same name of the variable where the sensor was initialised and in the blocks where you take the values.

Exercises

Now, that you got friends with the sensors, you can make a variety of applications using it.

After you wired correctly and understood how the sensor works, start solving the following exercises,

  1. For each axis, show the value of the acceleration on an LCD
  2. Find the angle of inclination. You have to move the sensor on a single angle and apply the formula to find the angle.
    angle=arcsin(A/g) , where A is the measured acceleration, g Earth gravity vector.
  3. Connect an LED to the Edison. Put the sensor on the desk and hit the desk. The sensor will register the vibrations from the collision and light up the LED.
  4. Identify the movement's frequency on one of the axis using fft .
  5. Show the difference of temperature between a thermistor's value and the one given by the humidity sensor. Put the two on the same graphics and see the variation.
    Hint you can find the function for the thermistor and the wiring in the sensors lab.
  6. Use this graphics to apply a signal filter in a filter design software. (Matlab, Octave )
  7. Calculate the difference between the values of the two sensors and show it on a chart.
  8. Create a low pass filter with the cutoff frequency wc, using a filter design software.
  9. Apply this filter to the signal sent by the thermistor.
iot/labs/07.1438244620.txt.gz · Last modified: 2015/07/30 11:23 by madalina.tanea
CC Attribution-Share Alike 3.0 Unported
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0