This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
| en:iot-open:remotelab:itt:servo [2018/11/15 06:21] – created rim.puks | en:iot-open:remotelab:itt:servo [2020/07/20 09:00] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | ===== Servo module ===== | + | ===== ITT Servo module ===== |
| - | //Give an information, | + | This laboratory is located |
| ==== 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 | + | This laboratory |
| - | Write objectives for the laboratory i.e. "its purpose is to model ...." or " | + | |
| + | {{: | ||
| ==== Prerequisites ==== | ==== Prerequisites ==== | ||
| - | //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/ | + | For this laboratory, the student should |
| ==== Technical details ==== | ==== Technical details ==== | ||
| - | //Provide technical details on the construction | + | This laboratory consists |
| === Sensors === | === Sensors === | ||
| - | //Describe sensors (if any). Provide details on measured values, connection details, accuracy, protocols, its relation to the physical/ | + | This laboratory |
| - | === Actuators | + | === Specifications |
| - | //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 | + | <table Ref.Tab.1.1> |
| + | < | ||
| + | ^ Specification ^ Value ^ | ||
| + | | Speed at 6V | 0,07 sec/60°| | ||
| + | | Stall torque at 6V | 0,042 N-m | | ||
| + | | Speed at 4,8V | 0,09 sec/60°| | ||
| + | | Stall torque at 4,8V | 0,028 N-m | | ||
| + | </ | ||
| + | |||
| + | === Electrical connection === | ||
| + | |||
| + | The signal lead of the servo is connected | ||
| === 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. |
| + | * Servo libary | ||
| === Communication === | === Communication === | ||
| - | //Describe communication if it is implemented | + | The user can connect |
| === Limits === | === Limits === | ||
| - | //Provide information about limits on usage, i.e. need for maintenance/ | + | At the same time, only one user can program the controller. But all users connected to the Distancelab MQTT broker can subscribe and publish to topics specified. |
| ==== Hands-on labs ==== | ==== Hands-on labs ==== | ||
| - | //List study scenarios | + | |
| - | | + | === Example code === |
| - | | + | |
| - | | + | <code c> |
| - | | + | /* |
| - | Note, assume that more professional group automatically contains less professional ones. Note - use language and as appropriate to the target group, i.e.:// | + | * IoT Servo example |
| - | < | + | * |
| - | | + | * This example subscribe to the " |
| - | | + | * change servo position |
| - | | + | * |
| + | * Created 11 Sept 2017 by Heiko Pikner | ||
| + | */ | ||
| + | |||
| + | #include < | ||
| + | #include < | ||
| + | #include < | ||
| + | |||
| + | //Pin definition for the Servo (D3) | ||
| + | #define SERVO_PIN | ||
| + | |||
| + | Servo myservo; | ||
| + | |||
| + | // Change | ||
| + | // mosquitto_pub | ||
| + | // = this calls servo motor to change position | ||
| + | |||
| + | void iot_received(String topic, String msg) | ||
| + | { | ||
| + | Serial.print(" | ||
| + | | ||
| + | | ||
| + | | ||
| + | |||
| + | | ||
| + | | ||
| + | |||
| + | myservo.write(msg.toInt()); | ||
| + | } | ||
| + | |||
| + | // Function started after the connection to the server is established | ||
| + | void iot_connected() | ||
| + | { | ||
| + | | ||
| + | | ||
| + | iot.subscribe(" | ||
| + | | ||
| + | } | ||
| + | |||
| + | void setup() | ||
| + | { | ||
| + | Serial.begin(115200); | ||
| + | Serial.println(" | ||
| + | |||
| + | // Print json config | ||
| + | iot.printConfig(); | ||
| + | // Initialize IoT library | ||
| + | iot.setup(); | ||
| + | |||
| + | myservo.attach(SERVO_PIN); | ||
| + | } | ||
| + | |||
| + | void loop() | ||
| + | { | ||
| + | // IoT behind the plan work, it should be periodically called | ||
| + | iot.handle(); | ||
| + | delay(200); | ||
| + | } | ||
| </ | </ | ||
| + | |||
| ==== Support ==== | ==== Support ==== | ||
| - | //Give some information on how to access help, how to get support in case of the trouble etc.// | + | info@ittgroup.ee |