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/22 18:57] – pczekalski | en:iot-open:remotelab:sut:roboarm [Unknown date] (current) – external edit (Unknown date) 127.0.0.1 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | {{: | + | ====== VREL #5: Roboarm IoT Laboratory |
| - | + | ||
| - | ===== 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 consists of a mechanical robot arm with two degrees of freedom. Using two actuators user can change the position of the arm, especially, can move the tail section of the arm, at beside ground of the node. For better impression on the ground there are bricks on the rail, which can be pushed with the robotic arm left and right. You can observe the arm position via camera and also read its position via embedded IMUs (one per each movable piece of the arm). | + | The lab consists of a mechanical robot arm with two degrees of freedom. Using two actuators user can change the position of the arm, especially, can move the tail section of the arm, at beside ground of the node. For a better impression on the ground, there are bricks on the rail, which can be pushed with the robotic arm left and right. You can observe the arm position via camera and also read its position via embedded IMUs (one per each movable piece of the arm). |
| - | ==== Prerequisites ==== | + | ===== Prerequisites |
| The user needs to know: | The user needs to know: | ||
| Line 17: | Line 15: | ||
| * the way IMU (particularily accelerometer) works. | * the way IMU (particularily accelerometer) works. | ||
| - | ==== Technical details ==== | + | ===== Technical details |
| - | Robo arm is set of two arms. The first part of the arm is fixed to the axle of step motors that is fixed 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 part of the 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: 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 board, there are only two input: DIR and STEP, so the overall control process is simplified. | 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 board, there are only two input: DIR and STEP, so the overall control process is simplified. | ||
| {{: | {{: | ||
| - | === 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> | + | <note important> |
| - | ==== Hands-on labs ==== | + | ===== Support ===== |
| - | * Beginners | + | 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.\\ |
| - | * * move the step motor, observe effect by the accelerometer | + | 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): |
| - | * * move the servomotor, observe effect by the accelerometer | + | <code c> |
| - | * Undergraduates: | + | #include <Arduino.h> |
| - | * * move set of arms beetwen | + | #include < |
| - | * * Registering temperature, humidity and flap position, period long time, and display these (as graph) on Arduino | + | |
| - | | + | |
| - | * * Make data sequences, which will give effect moving flap with assumtions characteristic (period) in Rx laboratory. | + | |
| - | ==== Support ==== | + | |
| - | gabriel.drabik@polsl.pl | + | LiquidCrystal_I2C lcd(0x3F, |
| + | 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. | ||