Differences

This shows you the differences between two versions of the page.

Link to this comparison view

iotcluj:labs:05 [2016/07/12 14:34]
ioana_maria.culic
iotcluj:labs:05 [2016/07/13 12:33] (current)
ioana_maria.culic [Exercises]
Line 20: Line 20:
 In the Wyliodrin STUDIO interface you have two tabs referring to **SOFTWARE** and **FIRMWARE**. So far, you used only the **SOFTWARE** tab, as you wrote applications for the Raspberry Pi solely. Now, select the **FIRMARE** tab and there is where you can write code which will be run on the Arduino. In this case, you will import an existing project. In the Wyliodrin STUDIO interface you have two tabs referring to **SOFTWARE** and **FIRMWARE**. So far, you used only the **SOFTWARE** tab, as you wrote applications for the Raspberry Pi solely. Now, select the **FIRMARE** tab and there is where you can write code which will be run on the Arduino. In this case, you will import an existing project.
  
-{{ :iotcluj:​labs:​select-firmata.png?​300 |}}+{{ :iot:​labs:​select-firmata.png?​300 |}}
  
 Hit the **Show examples** button and select **Arduino**. Then **use** the **Firmata/​StandardFirmata** example. Now that you have the software to run on the Arduino, once you hit the **run** button, you will be asked the tyype of the Arduino board and if you want to flash it or not. Select the board you are using and **RUN AND FLASH**. The **StandardFirmata** firmware will be deployed on the Arduino. Hit the **Show examples** button and select **Arduino**. Then **use** the **Firmata/​StandardFirmata** example. Now that you have the software to run on the Arduino, once you hit the **run** button, you will be asked the tyype of the Arduino board and if you want to flash it or not. Select the board you are using and **RUN AND FLASH**. The **StandardFirmata** firmware will be deployed on the Arduino.
  
 As you know, any micro-controller,​ including the Arduino, once flashed, runs the same firmware until another one is uploaded on the board. Thus, you don't have to flash the board each time you run a new Raspberry Pi application. If you are confident that the Arduino is running **StandardFirmata**,​ you can skip this step. As you know, any micro-controller,​ including the Arduino, once flashed, runs the same firmware until another one is uploaded on the board. Thus, you don't have to flash the board each time you run a new Raspberry Pi application. If you are confident that the Arduino is running **StandardFirmata**,​ you can skip this step.
-{{ :iotcluj:​labs:​flash-arduino.png?​300 |}}+{{ :iot:​labs:​flash-arduino.png?​300 |}}
  
 ===== Street Lightning ===== ===== Street Lightning =====
Line 42: Line 42:
 ==== The Setup ==== ==== The Setup ====
  
-{{ :iotcluj:​labs:​light_sensor_schematics.png?​600 |}}+{{ :iot:​labs:​light_sensor_schematics.png?​600 |}}
  
 The photocell works just like resistor with a variable resistance. Depending on the amount of light it receives, its resistance gets higher or lower. As a result, you can connect it in a voltage divider, as well. The photocell works just like resistor with a variable resistance. Depending on the amount of light it receives, its resistance gets higher or lower. As a result, you can connect it in a voltage divider, as well.
Line 55: Line 55:
 ==== The Code ==== ==== The Code ====
  
-{{ :iotcluj:​labs:​street_lights_code.png?​400 |}}+{{ :iot:​labs:​street_lights_code.png?​400 |}}
  
 First of all, you need to use an **Arduino in** node in order to read the values from the sensor. This node gets triggered each time the value on the pin it reads from changes. To actually configure the node's behavior you need to set its properties. ​ First of all, you need to use an **Arduino in** node in order to read the values from the sensor. This node gets triggered each time the value on the pin it reads from changes. To actually configure the node's behavior you need to set its properties. ​
  
-{{ :iotcluj:​labs:​arduino_in_properties.png?​400 |}}+{{ :iot:​labs:​arduino_in_properties.png?​400 |}}
  
 The first property allows you to set the Raspberry Pi connection to the Arduino board so the Raspberry Pi knows the port through which it should send the messages. Usually, the port is **/​dev/​ttyACM0**. However, in order to make sure, go to the **Shell** tab and type **dmesg**. There you should see messages stating that an FTDI cable has been connected to the board and the port it is connected to. Concatenate that value to **/dev/** and place the value as the first property of the node. The first property allows you to set the Raspberry Pi connection to the Arduino board so the Raspberry Pi knows the port through which it should send the messages. Usually, the port is **/​dev/​ttyACM0**. However, in order to make sure, go to the **Shell** tab and type **dmesg**. There you should see messages stating that an FTDI cable has been connected to the board and the port it is connected to. Concatenate that value to **/dev/** and place the value as the first property of the node.
  
 +<​note>​When you configure the Arduino port set the it to **global**</​note>​
 +{{ :​iotcluj:​labs:​arduino-global.png?​400 |}}
 Further on, you need to specify which pin you want to read from. In this case, the pin is 0 and is an analog pin. Afterwards, you will use a **range** node in order to map the read values to values that should light up the LED. For this, you need to adapt the system to your environment. Depending on the regular amount of light, usually you will read a value of around 400. So in this case, the range scales values going from 400 to 1024 to 0 to 255. However, if the regular value is different, you will need to scale a different range. Further on, you need to specify which pin you want to read from. In this case, the pin is 0 and is an analog pin. Afterwards, you will use a **range** node in order to map the read values to values that should light up the LED. For this, you need to adapt the system to your environment. Depending on the regular amount of light, usually you will read a value of around 400. So in this case, the range scales values going from 400 to 1024 to 0 to 255. However, if the regular value is different, you will need to scale a different range.
  
-{{ :iotcluj:​labs:​range-light.png?​400 |}}+{{ :iot:​labs:​range-light.png?​400 |}}
  
 The last node to use is **Arduino out**. This node acts just like the **digital write** node used in the previous chapters. However, you still need to select the port for the Arduino board and you can choose from analog or digital write. As you want to make the LED light up brighter or dimmer, you will set the type to **analog** and the **pin** property has to be 3.  The last node to use is **Arduino out**. This node acts just like the **digital write** node used in the previous chapters. However, you still need to select the port for the Arduino board and you can choose from analog or digital write. As you want to make the LED light up brighter or dimmer, you will set the type to **analog** and the **pin** property has to be 3. 
Line 76: Line 78:
  
 ===== Exercises===== ===== Exercises=====
 +  - Connect a potentiometer and send the read values to the dashboard.
   - Display the values coming from the light sensor in the dashboard using the **gauge** graph.   - Display the values coming from the light sensor in the dashboard using the **gauge** graph.
   - Connect all the sensors in the kit to the Arduino and display the values you read in the dashboard. **Note:** Do not connect the Hall sensor, which works in a different way.   - Connect all the sensors in the kit to the Arduino and display the values you read in the dashboard. **Note:** Do not connect the Hall sensor, which works in a different way.
   - Search the temperature sensor'​s datasheet online (TMP36) and transform the read values to celsius degrees.   - Search the temperature sensor'​s datasheet online (TMP36) and transform the read values to celsius degrees.
 +  - Use the gas sensor and display the read value on a graph.
  
iotcluj/labs/05.1468323297.txt.gz ยท Last modified: 2016/07/12 14:34 by ioana_maria.culic
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