Differences

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

Link to this comparison view

Next revision
Previous revision
en:iot-open:remotelab:itt:remotelights [2017/11/09 13:12] – created pczekalskien: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 in the office of ITT Group in TallinnEstonia.
-Scenarios are in different document, see template here: [[en:iot-open:remotelab:templates:scenariotemplate]] +
-<note important>Use it as copy-paste. Do not edit this file, please!</note> +
-<note important>Italic text below should be replaced with yours. Italic text below is just to let you find out easily, what chapters are to be covered when creating document - to distinguish from yours, regular text.</note> +
-<note warning>Paragraphs below (in regularnon-italic) should be left as is, eventually adapted if necessary. Project information section should be left as is.</note>+
  
-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 to the ITT IoT controller module. The module contains one RGB LED. This node can be used to create very basic MQTT systems but can also be used as a signalling part of other more complicated systems.
  
-{{:iot-open.eu:io3:logotyp_1_.png?nolink&200|}} +{{:en:iot_homelab_kit:hardware:led2.png?200 |}}
-====== [Laboratory name] ====== +
-//Give an information, where laboratory is located (partner name) and very short description (like one sentence).//+
  
-===== 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. Photosschematic and drawings may be attached as well. +General knowledge of MQTT protocol: topicsbrokerssubscribe, publish.
-Write objectives for the laboratory i.e. "its purpose is to model ...." or "simulate"or simply to "practice". Write some objectives. Provide a link to the live video stream (if any).//+
  
-===== 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/prerequisites, provide it within scenario document, not here.//+This laboratory conisists of a ITT IoT controller module connected to a RGB LED module.
  
-===== 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 kind of laboratory hardware and eventually software implementationSections below (remove section if not presentpresent detailsProvide circuit, essential mechanical schema, if necessary to use the laboratory and understand its physics/mechanics, etc.//+This laboratory involves WS2812B RGB LEDRGB LEDs are basically three LEDs (red, green, bluethat are built inside one shellThey include a WS2812 driver that makes it possible to use only one pin to control them.
  
-==== Sensors ==== +=== Specifications ===
-//Describe sensors (if any). Provide details on measured values, connection details, accuracy, protocols, its relation to the physical/mechanical part of the laboratory (if any). Add photos and schematics, where the sensor is located. In case the sensor is virtual, do not expose it - present as physical until it is essential to know it regarding study (i.e. code implementation, timings, etc.). Provide links to external resources regarding i.e. necessary libraries, protocol definition, etc.//+
  
-==== Actuators ==== +  * LED size: 5050 
-//Describe actuators, their impact on the physical/mechanical part of the laboratory device, limits, connections, etc. Add photos and schematics, where the actuator is located. In case actuator is virtual, do not expose it - present as physical until it is essential to know it regarding study (i.e. code implementation, timings, etc.). Provide links to external resources regarding i.e. necessary libraries, protocol definition, etc.//+  * 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 to port GPIO4.
-//Describe communication if it is implemented and sealed (not intended to be implemented by students, or provided i.e. as default code). Present data flow. Describe protocols and details i.e. key-value pairs, etc. Provide how exceptions are handled.//+
  
-==== Limits ==== +=== Software, libraries and externals === 
-//Provide information about limits on usage, i.e. need for maintenance/service break, access mode (parallel, booking, etc.), manual mechanical reset, etc.//+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 to the Dokuwiki pages with hands-on labs descriptions (there should be a separate page for each scenario). Classify each scenario and refer to the target group using starting keywords: +The user can connect to this controller using the Distancelab environment
-  * 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.:// +
-<code> +
-  * Beginners: Elementary operations on the Arduino 2x16 LCD screen. +
-  * Undergraduates: Visualizing temperature and humidity on the remote screen. +
-  * Masters: Using power saving states to limit power consumption. +
-</code> +
-===== 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 in the Field of Education, Training, and Youth - Higher Education.\\ +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 in the controller program.
-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 contained therein.+=== Example code === 
 +<code c> 
 +#include <Arduino.h> 
 +#include <ittiot.h> 
 +#include <Adafruit_NeoPixel.h> 
 + 
 +#define PIN            D2 
 + 
 +// When we setup the NeoPixel librarywe 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 on possible values. 
 +Adafruit_NeoPixel pixels = Adafruit_NeoPixel(1, PIN, NEO_GRB + NEO_KHZ800); 
 + 
 +// https://stackoverflow.com/questions/9072320/split-string-into-string-array 
 +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<=maxIndex && found<=index; i++) 
 +  { 
 +    if(data.charAt(i)==separator || i==maxIndex) 
 +    { 
 +        found++; 
 +        strIndex[0] = strIndex[1]+1; 
 +        strIndex[1] = (i == maxIndex) ? i+1 : i; 
 +    } 
 +  } 
 + 
 +  return found>index ? data.substring(strIndex[0], strIndex[1]) : ""; 
 +
 + 
 +// Change RGB LED color 
 +// mosquitto_pub -u test -P test -t "ITT/IOT/3/rgb" -m "51;255;153" 
 +void iot_received(String topic, String msg) 
 +
 +  Serial.print("MSG FROM USER callback, topic: "); 
 +  Serial.print(topic); 
 +  Serial.print(" payload: "); 
 +  Serial.println(msg); 
 + 
 +  String r = getValue(msg,';',0); 
 +  String g = getValue(msg,';',1); 
 +  String b = getValue(msg,';',2); 
 + 
 +  Serial.print("R: "); 
 +  Serial.println(r); 
 + 
 +  Serial.print("G: "); 
 +  Serial.println(g); 
 + 
 +  Serial.print("B: "); 
 +  Serial.println(b); 
 +  // Moderately bright green color. 
 +  pixels.setPixelColor(0, r.toInt(), g.toInt(), b.toInt());  
 + 
 +  pixels.show(); // This sends the updated pixel color to the hardware. 
 +
 + 
 +void iot_connected() 
 +
 +  Serial.println("MQTT connected callback"); 
 +  iot.subscribe("rgb"); 
 +  iot.log("IoT NeoPixel example!"); 
 +
 + 
 +void setup() 
 +
 +  Serial.begin(115200); 
 +  Serial.println("Booting"); 
 + 
 +  iot.printConfig(); // print json config to serial  
 +  iot.setup(); 
 + 
 +  pixels.begin(); // This initializes the NeoPixel library. 
 +
 + 
 +void loop() 
 +
 +  iot.handle(); 
 +  delay(200); 
 +
 +</code>
  
-**__Copyright Notice__**\\ +==== Support ==== 
-This content was created by the IOT-OPEN.EU consortium, 2016,2019.\\ +info@ittgroup.ee
-The content is Copyrighted and distributed under CC BY-NC [[https://en.wikipedia.org/wiki/Creative_Commons_license|Creative Commons Licence]], free for Non-Commercial use.  +
-<figure label> +
-{{:en:iot-open:ccbync.png?100|CC BY-NC}} +
-</figure> +
-In case of commercial use, please contact IOT-OPEN.EU consortium representative.+
  
en/iot-open/remotelab/itt/remotelights.1510233166.txt.gz · Last modified: 2020/07/20 09:00 (external edit)
CC Attribution-Share Alike 4.0 International
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