This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
| en:iot-open:remotelab:itt:remotelights [2017/11/09 13:12] – created pczekalski | en:iot-open:remotelab:itt:remotelights [2020/07/20 09:00] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | This is a template for the hands-on-lab description for IO3. | + | ===== ITT RGB LED module ===== |
| - | This document overviews a laboratory, not a scenario (hands-on lab). | + | This laboratory is located |
| - | Scenarios are in different document, see template here: [[en: | + | |
| - | <note important> | + | |
| - | <note important> | + | |
| - | <note warning> | + | |
| - | Everything above this line (and including this line) is to be removed in final version. | + | ==== Introduction |
| + | This laboratory consists of an RGB LED module connected | ||
| - | {{:iot-open.eu:io3:logotyp_1_.png?nolink&200|}} | + | {{:en:iot_homelab_kit:hardware: |
| - | ====== [Laboratory name] ====== | + | |
| - | //Give an information, | + | |
| - | ===== Introduction | + | ==== Prerequisites |
| - | //Here provide some general idea of the laboratory. Do not use very complicated phrases. It is to be understood by people with limited understanding of the technology. Photos, schematic and drawings may be attached as well. | + | General knowledge |
| - | Write objectives for the laboratory i.e. "its purpose is to model ...." or " | + | |
| - | ===== Prerequisites ===== | + | ==== Technical details |
| - | //Describe prerequisite readings, software, hardware (if any) - note - only those that apply to ALL scenarios, knowledge necessary to understand. I case single scenario requires some extra knowledge/ | + | This laboratory conisists of a ITT IoT controller module connected |
| - | ===== Technical details ===== | + | === Actuators |
| - | //Provide technical details on the construction of the laboratory, both hardware, and software. Use technical words and sentences. It is to be understood by technology-related people. Consider it as a kind of laboratory hardware and eventually software implementation. Sections below (remove section if not present) present details. Provide circuit, essential mechanical schema, if necessary | + | This laboratory |
| - | ==== Sensors | + | === Specifications |
| - | //Describe sensors (if any). Provide details on measured values, connection details, accuracy, protocols, its relation to the physical/ | + | |
| - | ==== Actuators ==== | + | * LED size: 5050 |
| - | //Describe actuators, their impact on the physical/ | + | * Colors: 16777216 |
| - | ==== Software, libraries and externals | + | === Electrical connection |
| - | //Provide list of software, software libraries and external resources (i.e. files) necessary during code development. Please note, write here only common for all hand-on-labs scenarios (there is relevant section in scenario template. Remove this section if empty.// | + | |
| - | ==== Communication ==== | + | Connected |
| - | //Describe communication if it is implemented and sealed (not intended | + | |
| - | ==== Limits ==== | + | === Software, libraries and externals |
| - | //Provide information about limits on usage, i.e. need for maintenance/ | + | To control WS2812B RGB LED the following libraries are used: |
| + | * ITTIoT libary - used to program the controller module. | ||
| + | * Adafruit NeoPixel libary - used to control the RGB LED. | ||
| - | ===== Hands-on labs ===== | + | === Communication |
| - | //List study scenarios (hands-on labs), linking | + | The user can connect |
| - | * Beginners | + | |
| - | * Undergraduates | + | |
| - | * Masters | + | |
| - | * Professionals | + | |
| - | Note, assume that more professional group automatically contains less professional ones. Note - use language and for appropriate to the target group, i.e.:// | + | |
| - | < | + | |
| - | * Beginners: Elementary operations on the Arduino 2x16 LCD screen. | + | |
| - | * Undergraduates: | + | |
| - | * Masters: Using power saving states to limit power consumption. | + | |
| - | </ | + | |
| - | ===== Support ===== | + | |
| - | //Give some information how to access help, how to get support in case of the trouble etc.// | + | |
| - | ===== Project information ===== | + | === Limits |
| - | This Intellectual Output was implemented under the Erasmus+ KA2: Strategic Partnership | + | At the same time, one user can program the controller. But all users connected to the Distancelab MQTT broker can control the RGB LED, assuming they use the topic described |
| - | Project IOT-OPEN.EU – Innovative Open Education on IoT: improving higher education for European digital global competitiveness.\\ | + | |
| - | Project number: 2016-1-PL01-KA203-026471. | + | |
| - | **__Erasmus+ Disclaimer__**\\ | + | ==== Hands-on labs ==== |
| - | This project has been funded with support from the European Commission. \\ | + | |
| - | This publication reflects the views only of the author, and the Commission cannot be held responsible for any use which may be made of the information | + | === Example code === |
| + | <code c> | ||
| + | #include <Arduino.h> | ||
| + | #include < | ||
| + | #include < | ||
| + | |||
| + | #define PIN D2 | ||
| + | |||
| + | // When we setup the NeoPixel library, we tell it how many pixels, | ||
| + | // and which pin to use to send signals. | ||
| + | // Note that for older NeoPixel strips you might need to change | ||
| + | // the third parameter--see the strandtest | ||
| + | // example for more information | ||
| + | Adafruit_NeoPixel pixels = Adafruit_NeoPixel(1, | ||
| + | |||
| + | // https:// | ||
| + | String getValue(String data, char separator, int index) | ||
| + | { | ||
| + | int found = 0; | ||
| + | int strIndex[] = {0, -1}; | ||
| + | int maxIndex = data.length()-1; | ||
| + | |||
| + | for(int i=0; i< | ||
| + | { | ||
| + | if(data.charAt(i)==separator || i==maxIndex) | ||
| + | { | ||
| + | found++; | ||
| + | strIndex[0] = strIndex[1]+1; | ||
| + | strIndex[1] = (i == maxIndex) ? i+1 : i; | ||
| + | } | ||
| + | } | ||
| + | |||
| + | return found> | ||
| + | } | ||
| + | |||
| + | // Change RGB LED color | ||
| + | // mosquitto_pub -u test -P test -t " | ||
| + | void iot_received(String topic, String msg) | ||
| + | { | ||
| + | Serial.print(" | ||
| + | Serial.print(topic); | ||
| + | Serial.print(" | ||
| + | Serial.println(msg); | ||
| + | |||
| + | String r = getValue(msg,';', | ||
| + | String g = getValue(msg,';', | ||
| + | String b = getValue(msg,';', | ||
| + | |||
| + | Serial.print(" | ||
| + | Serial.println(r); | ||
| + | |||
| + | Serial.print(" | ||
| + | Serial.println(g); | ||
| + | |||
| + | Serial.print(" | ||
| + | Serial.println(b); | ||
| + | // Moderately bright green color. | ||
| + | pixels.setPixelColor(0, | ||
| + | |||
| + | pixels.show(); | ||
| + | } | ||
| + | |||
| + | void iot_connected() | ||
| + | { | ||
| + | Serial.println(" | ||
| + | iot.subscribe(" | ||
| + | iot.log(" | ||
| + | } | ||
| + | |||
| + | void setup() | ||
| + | { | ||
| + | Serial.begin(115200); | ||
| + | Serial.println(" | ||
| + | |||
| + | iot.printConfig(); | ||
| + | iot.setup(); | ||
| + | |||
| + | pixels.begin(); | ||
| + | } | ||
| + | |||
| + | void loop() | ||
| + | { | ||
| + | iot.handle(); | ||
| + | delay(200); | ||
| + | } | ||
| + | </ | ||
| - | **__Copyright Notice__**\\ | + | ==== Support ==== |
| - | This content was created by the IOT-OPEN.EU consortium, 2016, | + | info@ittgroup.ee |
| - | The content is Copyrighted and distributed under CC BY-NC [[https:// | + | |
| - | <figure label> | + | |
| - | {{: | + | |
| - | </ | + | |
| - | In case of commercial use, please contact IOT-OPEN.EU consortium representative. | + | |