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:relay [2018/11/15 06:21] – created rim.puksen:iot-open:remotelab:itt:relay [2020/07/20 09:00] (current) – external edit 127.0.0.1
Line 1: Line 1:
-===== Relay module ===== +===== ITT Relay module ===== 
-//Give an information, where laboratory is located (partner name) and very short description (like one sentence).//+This laboratory is located in the office of ITT Group in Tallinn, Estonia.
  
 ==== Introduction  ==== ==== Introduction  ====
-//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+This laboratory can be used to practice controlling the relay module attached to the controller
-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).//+ 
 +{{:en:iot_homelab_kit:hardware:relee.png?300|}}
  
 ==== Prerequisites ==== ==== Prerequisites ====
-//Describe prerequisite readingssoftwarehardware (if any) - note - only those that apply to ALL scenariosknowledge necessary to understandI case single scenario requires some extra knowledge/prerequisites, provide it with scenario document, not here.//+For this laboratorythe student should understand basic MQTT concepts like topicsbrokersubscribing and publishingAlso the basics of relays and where they can be used.
  
 ==== Technical details ==== ==== Technical details ====
-//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 detailsProvide circuit, essential mechanical schema, if necessary to use the laboratory and understand its physics/mechanics, etc.//+This laboratory consists of a relay module attached to the ITT IoT controller module. The relay module is an electrically operated switch of the mains voltage. It means that it can be turned on or off, letting the current go through or not. Many relays use an electromagnet to mechanically operate the switch and provide electrical isolation between two circuits.
  
 === Sensors === === Sensors ===
-//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.//+This laboratory does not have any sensors.
  
-=== Actuators === +=== Specifications === 
-//Describe actuatorstheir 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.//+  * 5V 1-Channel Relay interface board 
 +  * Relay: SRD-05VDC-SL-C (AC 250V 10ADC 30V 10A NO/NC) 
 + 
 +=== Electrical connection === 
 + 
 +The signal lead of the servo is connected to GPIO5 pin of the controller.
  
 === Software, libraries and externals === === Software, libraries and externals ===
-//Provide a list of software, software libraries and external resources (i.e. files) necessary during code development. Please note, write here only common for all hands-on-labs scenarios (there is a relevant section in scenario template. Remove this section if empty.//+  * ITTIoT libary used to program the controller module.
  
 === Communication === === Communication ===
-//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.//+The user can connect and program this controller using the Distancelab environment.
  
 === Limits === === Limits ===
-//Provide information about limits on usagei.eneed for maintenance/service break, access mode (parallel, booking, etc.), manual mechanical reset, etc.//+At the same timeonly one user can program the controllerBut all users connected to the Distancelab MQTT broker can subscribe and publish to topics specified.
  
 ==== Hands-on labs ==== ==== Hands-on labs ====
-//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+ 
-  * Beginners +=== Example code === 
-  * Undergraduates + 
-  * Masters +<code c> 
-  * Professionals + 
-Noteassume that more professional group automatically contains less professional onesNote - use language and as appropriate to the target group, i.e.:// +#include <Arduino.h> 
-<code> +#include <ittiot.h> 
-  * Beginners: Elementary operations on the Arduino 2x16 LCD screen+ 
-  * Undergraduates: Visualizing temperature and humidity on the remote screen+#define RELAY_PIN 5 
-  * Masters: Using power saving states to limit power consumption.+ 
 +// If the message received switch relay 
 +void iot_received(String topic, String msg) 
 +
 +  Serial.print("MSG FROM USER callbacktopic: "); 
 +  Serial.print(topic)
 +  Serial.print(" payload"); 
 +  Serial.println(msg); 
 +  if(msg == "1") 
 +  
 +    digitalWrite(RELAY_PIN, HIGH); 
 +  } 
 + 
 +  if(msg == "0"
 +  { 
 +    digitalWrite(RELAY_PINLOW); 
 +  } 
 +
 + 
 +void iot_connected() 
 +
 +  Serial.println("MQTT connected callback"); 
 +  iot.subscribe("relay"); 
 +  iot.log("IoT relay example!"); 
 +
 + 
 +void setup() 
 +{ 
 +  Serial.begin(115200); 
 +  Serial.println("Booting"); 
 + 
 +  iot.printConfig(); // print json config to serial 
 +  iot.setup(); 
 +  pinMode(RELAY_PIN, OUTPUT); 
 +
 + 
 +void loop() 
 +
 +  iot.handle();   
 +  delay(200); 
 +
 + 
 </code> </code>
 +
 ==== Support ==== ==== Support ====
-//Give some information on how to access help, how to get support in case of the trouble etc.//+info@ittgroup.ee
  
en/iot-open/remotelab/itt/relay.1542262914.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