This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| en:iot-open:remotelab:sut:roboarm [2018/10/17 10:42] – pczekalski | en:iot-open:remotelab:sut:roboarm [Unknown date] (current) – external edit (Unknown date) 127.0.0.1 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | {{: | + | ====== |
| - | + | ||
| - | ====== Roboarm IoT Laboratory ====== | + | |
| The laboratory is located at Silesian Technical University, Poland, Gliwice Akademicka 16, room 310. | The laboratory is located at Silesian Technical University, Poland, Gliwice Akademicka 16, room 310. | ||
| ===== Introduction | ===== Introduction | ||
| - | The lab consist | + | The lab consists of a mechanical |
| ===== Prerequisites ===== | ===== Prerequisites ===== | ||
| The user needs to know: | The user needs to know: | ||
| - | * PWM control method | + | * PWM control method, |
| - | * working od servo-motors | + | * working od servo-motors, |
| - | * working of step-motors | + | * working of step-motors, |
| - | * basic of inverse kinematics problem | + | * basic of inverse kinematics problem, |
| - | * working of proximity sensor | + | * the way proximity sensor |
| - | * working of accelerometer | + | * the way IMU (particularily |
| ===== Technical details ===== | ===== Technical details ===== | ||
| - | Robo arm is set of two arms. The first arm are fixed to the axle of stepmotos fix to the " | + | Robo arm is a set of two arms. The first part of the arm is fixed to the axle of step motors that are fixed to the " |
| - | {{: | + | {{: |
| - | ==== Sensors ==== | + | {{: |
| + | |||
| + | {{: | ||
| + | |||
| + | ===== Sensors | ||
| There are 4 sensors in the lab: | There are 4 sensors in the lab: | ||
| - | * 2 accelerometer sensor on each arm | + | * 2 accelerometer sensor on each part of the arm (MPU6050) |
| * 2 proximity sensor on bricks' | * 2 proximity sensor on bricks' | ||
| - | ==== Actuators ==== | + | ===== Actuators |
| - | There are two actuators: | + | There are two actuators: step motor and servomotor. Control of step-motos is simplified, using the dedicated proxy drive board. The user does not need to understand how the step motor works on the low level (i.e. control separate coils), because thanks for the proxy driver |
| {{: | {{: | ||
| - | ==== Software, libraries and externals ==== | + | ===== Software, libraries and externals ===== |
| + | LCD display requires a dedicated library. Of course, you can control it on the low-level programming, | ||
| + | The LCD I2C control library can be imported to the source code via: | ||
| + | <code c> | ||
| + | #include < | ||
| + | </ | ||
| + | Then configure your LCD controller: | ||
| + | <code c> | ||
| + | LiquidCrystal_I2C lcd(0x3F, | ||
| + | // for a 20 chars and 4 line display | ||
| + | </ | ||
| - | ==== Communication ==== | + | To read data from the MPU6050 IMMUs, you may use '' |
| + | <code c> | ||
| + | #include " | ||
| + | #include " | ||
| + | ... | ||
| + | //IMU | ||
| + | MPU6050 accelgyro(0x68); | ||
| + | MPU6050 accelgyro2(0x69); | ||
| + | </ | ||
| + | Note: I2C addresses for the MPUs: | ||
| + | * 0x68 - for the IMU on the " | ||
| + | * 0x69 - for the IMU located on the arm (segment **a** on the image above) | ||
| + | |||
| + | To control servomotor, standard Arduino' | ||
| + | <code c> | ||
| + | #define SERVO_PIN D8 | ||
| + | ... | ||
| + | #include " | ||
| + | ... | ||
| + | </ | ||
| + | |||
| + | Finally, to control the step motor, we suggest using '' | ||
| + | <code c> | ||
| + | #include " | ||
| + | ... | ||
| + | //Motor and Stepper Driver | ||
| + | #define MICROSTEPS 1 | ||
| + | #define MOTOR_STEPS 200 | ||
| + | #define RPM 120 | ||
| + | #define DIR D5 | ||
| + | #define STEP D6 | ||
| + | #define SLEEP D7 | ||
| + | BasicStepperDriver stepper(MOTOR_STEPS, | ||
| + | ... | ||
| + | </ | ||
| + | |||
| + | === Platformio.ini === | ||
| + | <code c> | ||
| + | ; PlatformIO Project Configuration File | ||
| + | ; | ||
| + | ; Build options: build flags, source filter | ||
| + | ; | ||
| + | ; | ||
| + | ; | ||
| + | ; | ||
| + | ; Please visit documentation for the other options and examples | ||
| + | ; http:// | ||
| + | |||
| + | [env: | ||
| + | platform = espressif8266 | ||
| + | board = d1_mini | ||
| + | framework = arduino | ||
| + | lib_deps = Wire, EmonLib, Adafruit NeoPixel, Encoder,DHT sensor library, | ||
| + | Adafruit Unified Sensor, LCD, PubSubClient, | ||
| + | KS0108_PCF8574, | ||
| + | </ | ||
| + | |||
| + | ===== Communication | ||
| You can connect your ESP8266 microcontroller via its integrated WiFi interface to the separated IoT network. Then you can communicate with other, already connected devices and even provide some information to the cloud. In details, there is a dedicated MQTT broker waiting for you. You can also set up your own soft Access Point and connect another node directly to yours. | You can connect your ESP8266 microcontroller via its integrated WiFi interface to the separated IoT network. Then you can communicate with other, already connected devices and even provide some information to the cloud. In details, there is a dedicated MQTT broker waiting for you. You can also set up your own soft Access Point and connect another node directly to yours. | ||
| The communication among the devices can be done using MQTT messages, exchanging data among other nodes (M2M) and you can even push them to the Internet. | The communication among the devices can be done using MQTT messages, exchanging data among other nodes (M2M) and you can even push them to the Internet. | ||
| - | |||
| - | __Reference data__ | ||
| Using your Node, you can access it and publish/ | Using your Node, you can access it and publish/ | ||
| Line 46: | Line 113: | ||
| * Passkey: IoTlab32768 | * Passkey: IoTlab32768 | ||
| * Setup your microcontroller for DHCP, to automatically obtain an IP address, your ESP will obtain the address from the 192.168.90.X pool. | * Setup your microcontroller for DHCP, to automatically obtain an IP address, your ESP will obtain the address from the 192.168.90.X pool. | ||
| - | * MQTT server is available under fixed address: 192.168.90.5, | + | * MQTT server is available under the fixed address: 192.168.90.5, |
| * User: vrel | * User: vrel | ||
| * Password: vrel2018 | * Password: vrel2018 | ||
| - | ==== Limits ==== | + | ===== Limits |
| - | At the same time, only one user can be programming the controller, although analysing the signal by others (unlimited number) the user has sense. Model is provided to continuously work, without service breaks. | + | At the same time, only one user can be programming the node, although analysing the signal by others (unlimited number) the user makes sense. Model is provided to continuously work, without service breaks. |
| + | |||
| + | <note important> | ||
| - | ===== Hands-on labs ===== | ||
| - | * Beginners | ||
| - | * * move the stepmotor, observe effect by accelerometer | ||
| - | * * move the servomotor, observe effect by accelerometer | ||
| - | * Undergraduates: | ||
| - | * * move set of arms beetwen | ||
| - | * * Registering temperature, | ||
| - | * * Send date to Tx lab and check correlation with effect in Rx laboratory. | ||
| - | * * Make data sequences, which will give effect moving flap with assumtions characteristic (period) in Rx laboratory. | ||
| ===== Support ===== | ===== Support ===== | ||
| + | In case the LCD display hangs and you are sure that your code should work but it does not, it may be the case the I2C bus is stuck and hang the I2C to LCD controller converter.\\ | ||
| + | In this case, please use the following code to reset the I2C bus (you can embed it to your source code or run separately, then run your original code, again): | ||
| + | <code c> | ||
| + | #include < | ||
| + | #include < | ||
| - | gabriel.drabik@polsl.pl | + | LiquidCrystal_I2C lcd(0x3F,20,4); |
| - | + | ||
| - | ===== Project information ===== | + | |
| - | This Intellectual Output was implemented under the Erasmus+ KA2: Strategic Partnership in the Field of Education, Training, and Youth - Higher Education.\\ | + | |
| - | 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__**\\ | + | |
| - | 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. | + | |
| - | + | ||
| - | **__Copyright Notice__**\\ | + | |
| - | This content was created by the IOT-OPEN.EU consortium, 2016, | + | |
| - | 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. | + | |
| + | void setup() | ||
| + | { | ||
| + | pinMode(4, | ||
| + | pinMode(5, OUTPUT); | ||
| + | digitalWrite(4, | ||
| + | digitalWrite(5, | ||
| + | delay(2000); | ||
| + | pinMode(5, INPUT); | ||
| + | pinMode(4, INPUT); | ||
| + | delay(2050); | ||
| + | lcd.init(D2, | ||
| + | lcd.backlight(); | ||
| + | lcd.home(); | ||
| + | lcd.print(" | ||
| + | } | ||
| + | void loop() | ||
| + | { | ||
| + | | ||
| + | } | ||
| + | </ | ||
| + | Finally, you should see Hello World message on the LCD and I2C bus should be recovered now. | ||