Differences

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

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
en:iot-open:remotelab:sut:roboarm [2018/10/22 19:04] pczekalskien:iot-open:remotelab:sut:roboarm [Unknown date] (current) – external edit (Unknown date) 127.0.0.1
Line 1: Line 1:
-{{:en:iot-open:remotelab:logotyp_1_.png?nolink&200|}} +====== 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 better impression on the groundthere 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 "wall" of the laboratory. On the end of the first arm, there is a servo motor that drives the second, tail part of the arm. Thus, for full operation of the robot arm, user have to control for two different devices: step motor and servomotor. To control the position of the brick, on each end of rail (left and right wall), there is a binary proximity sensor, to recognize the utmost position of bricks. For feedback, the user can check the position of the arm using accelerometer sensors fixed on each arm (IMU).+Robo arm is set of two arms. The first part of the arm is fixed to the axle of step motors that are fixed to the "wall" of the laboratory. On the end of the first arm, there is a servo motor that drives the second, tail part of the arm. Thus, for full operation of the robot arm, the user has to control for two different devices: step motor and servomotor. To control the position of the brick, on each end of the rail (left and right wall), there is a binary proximity sensor, to recognize the utmost position of bricks. For feedback, the user can check the position of the arm using accelerometer sensors fixed on each arm (IMU).
  
-{{:en:iot-open:remotelab:sut:iotra.jpg?500|}}+{{:en:iot-open:remotelab:sut:iotra.jpg?470|}}
  
-=== Sensors ===+{{:en:iot-open:remotelab:sut:arm_geom.jpg?470|}} 
 + 
 +{{:en:iot-open:remotelab:sut:arm_equ.jpg?470|}} 
 + 
 +===== 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' rail   * 2 proximity sensor on bricks' rail
  
-=== 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. 
  
 {{:en:iot-open:remotelab:sut:iotra_sch.jpg?500|}} {{:en:iot-open:remotelab:sut:iotra_sch.jpg?500|}}
  
-=== 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, writing directly to the I2C registers, but we do suggest using a library first. As there are many universal libraries, and many of them are incompatible with this display, we strongly recommend using [[https://github.com/tonykambo/LiquidCrystal_I2C|''LiquidCrystal_I2C by Tony Kambourakis'']]. 
 +The LCD I2C control library can be imported to the source code via: 
 +<code c> 
 +#include <LiquidCrystal_I2C.h> 
 +</code> 
 +Then configure your LCD controller: 
 +<code c> 
 +LiquidCrystal_I2C lcd(0x3F,20,4);  // set the LCD address to 0x3F  
 +                                   // for a 20 chars and 4 line display 
 +</code>
  
  
-=== Communication ===+To read data from the MPU6050 IMMUs, you may use ''I2Cdevlib-MPU6050'' library. You must include related I2C library as well: 
 +<code c> 
 +#include "I2Cdev.h" 
 +#include "MPU6050.h" 
 +... 
 +//IMU 
 +MPU6050 accelgyro(0x68);  //hand gyro (servo) 
 +MPU6050 accelgyro2(0x69); // arm gyro (motor) 
 +</code> 
 +Note: I2C addresses for the MPUs: 
 +  * 0x68 - for the IMU on the "hand" (segment **b** on the image above) 
 +  * 0x69 - for the IMU located on the arm (segment **a** on the image above) 
 + 
 +To control servomotor, standard Arduino's Servo library is suitable: 
 +<code c> 
 +#define SERVO_PIN D8 
 +... 
 +#include "Servo.h" 
 +... 
 +</code> 
 + 
 +Finally, to control the step motor, we suggest using ''StepperDriver'' library: 
 +<code c> 
 +#include "BasicStepperDriver.h" 
 +... 
 +//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, DIR, STEP, SLEEP); 
 +... 
 +</code> 
 + 
 +=== Platformio.ini === 
 +<code c> 
 +; PlatformIO Project Configuration File 
 +
 +;   Build options: build flags, source filter 
 +;   Upload options: custom upload port, speed and extra flags 
 +;   Library options: dependencies, extra library storages 
 +;   Advanced options: extra scripting 
 +
 +; Please visit documentation for the other options and examples 
 +; http://docs.platformio.org/page/projectconf.html 
 + 
 +[env:d1_mini] 
 +platform = espressif8266 
 +board = d1_mini 
 +framework = arduino 
 +lib_deps = Wire, EmonLib, Adafruit NeoPixel, Encoder,DHT sensor library,  
 +Adafruit Unified Sensor, LCD, PubSubClient,  
 +KS0108_PCF8574, CoAP simple library, I2Cdevlib-MPU6050, StepperDriver 
 +</code> 
 + 
 +===== 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/subscribe to the messages once you connect your ESP to the existing wireless network (this network does not provide access to the global internet and is separated but please note there are other developers and IoT nodes connected to this access point: Using your Node, you can access it and publish/subscribe to the messages once you connect your ESP to the existing wireless network (this network does not provide access to the global internet and is separated but please note there are other developers and IoT nodes connected to this access point:
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, and the credentials to publish / subscribe are: +  * MQTT server is available under the fixed address: 192.168.90.5, and the credentials to publish/subscribe are: 
     * User: vrel     * User: vrel
     * Password: vrel2018     * Password: vrel2018
  
-=== Limits ===+===== Limits =====
  
 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. 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>Robotic arm is a pretty powerful device and you can eventually break it if operated out of reasonable constraints (speed, momentum</note>+<note important>Robotic arm is a pretty powerful device and you can eventually break it if operated out of reasonable constraints (speed, momentum)</note>
  
-==== Hands-on labs ==== +===== Support ===== 
-  * Beginners +In case the LCD display hangs and you are sure that your code should work but it does notit may be the case the I2C bus is stuck and hang the I2C to LCD controller converter.\\ 
-    * move the step motorobserve effect by the accelerometer +In this caseplease use the following code to reset the I2C bus (you can embed it to your source code or run separatelythen run your original codeagain)
-    * move the servomotor, observe effect by the accelerometer +<code c> 
-  * Undergraduates:  +#include <Arduino.h> 
-    *  move set of arms between  +#include <LiquidCrystal_I2C.h>
-    * Registering temperaturehumidity and flap positionperiod long timeand display these (as graphon Arduino screen.  +
-    * 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 ====+
  
-gabriel.drabik@polsl.pl+LiquidCrystal_I2C lcd(0x3F,20,4);  
  
 +void setup()
 +{
 +  pinMode(4,OUTPUT);
 +  pinMode(5, OUTPUT);
 +  digitalWrite(4,LOW);
 +  digitalWrite(5,LOW);
 +  delay(2000);
 +  pinMode(5, INPUT);       // reset pin
 +  pinMode(4, INPUT);
 +  delay(2050);
 +  lcd.init(D2,D1);
 +  lcd.backlight();
 +  lcd.home();
 +  lcd.print("Hello world...");
 +}
 +void loop()
 +{
 +  
 +}
 +</code>
 +Finally, you should see Hello World message on the LCD and I2C bus should be recovered now.
en/iot-open/remotelab/sut/roboarm.1540235094.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