The words you are searching are inside this book. To get more targeted content, please make full-text search by clicking here.
Discover the best professional documents and content resources in AnyFlip Document Base.
Search
Published by WEE SIUW SIA (PSMZA), 2024-06-19 22:58:54

EMBEDDED ROBOTIC LABSHEET

EMBEDDED ROBOTIC LABSHEET

Keywords: arduino,wemos,autonomous,dc motor

5. When the WEMOS board is connected to smart phone, the offline word will disappear. 49 6. Click at Setup Dashboard to setup the mobile dashboard. 7. Click at the icon to add new widget.


9. Select the Button icon to change the setting 8. Select Button to add a virtual button. 50 based on your DataStream from Blynk console Write in the title, select the data stream same as in the Blynk. Cloud, change the MODE from PUSH to SWITCH. 10.


51 Press the back button on your mobile Blynk apps until the pages below. Press the button and observed the LED on MORDET Board. 11.


EXPERIMENT PROCEDURE: WIRELESS COMMUNICATION WITH BLYNK PRACTICAL WORK 4.1 On board WeMos D1R2 pin Digital DataStream Pin in Blynk concole Tx 1 Rx 3 D1 16 5 4 0 2 14 12 13 15 D0 D2 D3 D4 D5 D6 D7 D8 Table 1 On board Wemos D1R2 pin to setup Pin on Digital Datastream on Blynk Console 52 Connect the D1 board to LED as Figure 4.2 below. Make sure that your LED is connected based on pin setting at Blynk console Datastream (see step 8: GETTING 1. Figure 4.2 Connection WeMos D1 board with 1 LED Refer Table 1 to see equivalent pin between on board D1R2 pin with Digital DataStream Pin in Blynk console 2.


**Remember to switch on your mobile data on your smart phone and make sure your phone is connected to the D1 board 53 PRACTICAL WORK 4.2 1 Connect the MORDET board with 4 LED as Figure 4.3 Figure 4.3 Connection WeMos D1 board with 4 LEDs 3. Observe the result and write in Table 2. Now, you can open your Blynk IOT on your smart phone and explore your practical work. 3. In Blynk console and smart phone, add another three buttons to control the LEDs separately. You may explore the switching from SWITCH to PUSH and vice-versa in your setting to identify the function taken. 2.


RESULT: PRACTICAL WORK PROGRAMMING CODE (PASTE YOUR CODING / SCREENSHOT HERE) OBSERVATION MARKS Setup Blynk console & smart phone TOTAL /30 Table 2 4.1 (1 LED) 4.2 (4 LED) /5 (Device Info) /5 (coding) /5 (Apps) /5 (datastream) /5 (Apps) /5 (datastream) 54


1. Connect a DC motor via L298N motor driver module as figure below: What have you achieved / learnt in this practical work? CONCLUSION: ANALYSIS / DISCUSSION: 2. Explore the switching on your smartphone to ON and OFF the motor. Figure 4.3 Connection WeMos D1 board with 4 LEDs 55 IN1 = D5 IN2 = D4 GND = GND 5V = 5V Screen shoot Datastream from Blynk console and button on Blynk apps and paste in the report. 3. 4. Explain the differences between PUSH and SWITCH function in Button on Blynk apps.


R E A D I N G D A T A U SI N G BL Y N K PRACTICAL WORK 5 DEC 50122 EMBEDDED ROBOTIC 56


PRACTICAL WORK ASSESSMENT (80%) – CLO3, PLO5, P4 PRACTICAL SKILL ASSESSMENT STUDENT 1 Student able to assembles the circuit correctly Student able to write the coding correctly Student able to manipulates the coding correctly Result Housekeeping / Video presentation NO 1. 2. 3. 4. 5. /10 /10 /10 /30 /10 STUDENT 2 /10 /10 /10 /10 /30 LAB REPORT ASSESSMENT (20%) – CLO3, PLO5, P4 PRACTICAL SKILL ASSESSMENT Discussion (hardware) Conclusion NO 1. 2. /10 Discussion (software) /10 3. /10 STUDENT 1 STUDENT 2 /10 /10 /10 Total marks MATRIC NUMBER STUDENT NAME PRACTICAL WORK 5: READING DATA USING BLYNK 57


Investigate the concept and fundamentals of mobile robotic, embedded controller, sensors and actuators based on land mobile robot design. Design the concept of robot positioning, identification and communication in mobile robot control according to a standard robot organization regulation. Manipulate the application of sensor and actuator, robot identification and communication during practical work based on land mobile robot design. Demonstrate good ability in managing a well-defined engineering-based project in a cost effective manner. 1. 2. 3. 4. APPARATUS / EQUIPMENT : LEARNING OUTCOME : → 58 MORDET Trainer Jumper Wires Smartphones 1. 2. 3.


However, we need to make sure that we can read the condition of the sensor first before connecting Blynk and we can simply use digital or analog pin (A0) to carry out this operation. (Refer previous Practical Work 2 for further understanding). One of the ways to read data from our hardware and display the condition using Value Display widget in Blynk app is as below: Read the sensor Send the data to Blynk App With Blynk we can visualize data from any switch or sensor. All we need to do is: INTRODUCTION / THEORY: Figure 5.1 Reading input with Blynk void switchstate() { buttonstate = digitalRead(D1); // can be changed to analogRead(A0) if we are using analog sensor if (buttonstate == LOW) { Blynk.virtualWrite(V2, "CLOSED"); // Value Display widget } } 59 Before we try to visualize the sensor data in Blynk app, we need to make sure that the reading of the sensor can be printed to Serial Monitor. There is a LED widget in the Blynk app. It can be used to show which input pin has been pressed (if the pin is connected to a push button switch). WidgetLED led1(V1); \\ assign the WidgetLED to the virtual pin V1 with a name “led1” Led1.on(); \\ to ON the WidgetLED


EXPERIMENT PROCEDURE: READING DATA USING BLYNK PRACTICAL WORK 5.1 1. Connect an input switch to pin D2 WeMos D1R2 board as below. Figure 5.2 Connection of Arduino D1R2 board to a push button PHYSICAL BUTTON CONTROL AND VIRTUAL LED A. CIRCUIT CONNECTION B. BLYNK CONSOLE 1. Add new template 60


Select virtual pin to add virtual widget such as LED, LCD and others. 2. Go to Datastreams and click + New Datastream to add new data. 61 Type a name for virtual LED. Select any Virtual pin for the LED above 3. Create and Save the template. 4. Go to Search icon


6. Copy and store the template id, name and auth code for later use. 5. Click and pick from template and choose your template. 62 7. To setup Web dashboard, click at Templates button and select your template.


8. Click at Web Dashboard and Edit icon. 9. Select LED Widget beside the Widget box and drag into the canvas. 63 10. Click at Settings of the LED Widget


64 13.Press the physical button on MORDET Board. Observe the result in Web dashboard. At Datastream column, select Choose Datastream and select the virtual pin that you assign before. 11. Write the coding below in ARDUINO IDE (next page). Replace the template ID, NAME and AUTH_TOKEN that provide in Blynk console. Verify and upload the coding. 12.


#define BLYNK_TEMPLATE_ID "XXXXXXXXXXXXXX" #define BLYNK_DEVICE_NAME "XXXXXXXXXXXXXXXX" #define BLYNK_AUTH_TOKEN “XXXXXXXXXXXXXXXXXXXXXXX" #define BLYNK_PRINT Serial #include <ESP8266WiFi.h> #include <BlynkSimpleEsp8266.h> char auth[] = BLYNK_AUTH_TOKEN; char ssid[] = "-------------------"; // Your WiFi credentials. char pass[] = "-----------------"; // Set password to " " for open networks. const int btnPin = D1; // Select your pin with physical button WidgetLED led3(V0); // virtual pin must same with Virtual Pin in Blynk Console BlynkTimer timer; boolean btnState = false; void buttonLedWidget() { boolean isPressed = (digitalRead(btnPin) == LOW); if (isPressed != btnState) { if (isPressed) { led3.on(); } else { led3.off(); } btnState = isPressed; } } void setup() { Serial.begin(115200); // Debug console Blynk.begin(auth, ssid, pass); pinMode(btnPin, INPUT_PULLUP); timer.setInterval(500L, buttonLedWidget); } void loop() { Blynk.run(); timer.run(); } 65


PRACTICAL WORK 5.2 Connect ultrasonic sensor pin TRIG to D3 and ECHO to D2 wemosD1R2 board as Figure 5.3 below: 1. Figure 5.3 Connection Of Arduino D1R2 board to Ultrasonic ULTRASONIC SENSOR MEASURE DISTANCE & DISPLAY VALUE IN APPS A. CIRCUIT CONNECTION B. BLYNK CONSOLE 1. Add new template TRIG = D7 ECHO = D6 VCC and GND had been connected internally. 66


Select virtual pin to add virtual widget such as LED, LCD and others. 2. Go to Datastreams and click + New Datastream to add new data. 67 3. Fill in the name , pin number, data type, units as below. The units are choose based on the sensor we use. For example, the units that ultrasonic measure is Centimeter, cm The max value for ultrasonic is set at 600


3. Create and Save the template. 4. Go to Search icon 68 6. Copy and store the template id, name and auth code for later use. 5. Click and pick from template and choose your template. Write the coding below in ARDUINO IDE (next page). Replace the template ID, NAME and AUTH_TOKEN that provide in Blynk console. Verify and upload the coding. 7.


#define BLYNK_TEMPLATE_ID "XXXXXXXXXXXXXX" #define BLYNK_DEVICE_NAME "XXXXXXXXXXXXXXXX" #define BLYNK_AUTH_TOKEN “XXXXXXXXXXXXXXXXXXXXXXX" #define BLYNK_PRINT Serial #include <ESP8266WiFi.h> #include <BlynkSimpleEsp8266.h> char auth[] = BLYNK_AUTH_TOKEN; char ssid[] = "-------------------"; // Your WiFi credentials. char pass[] = "-----------------"; // Set password to " " for open networks. #define trigD7 #define echoD6 long duration; int distance; void setup() { // Debug console Serial.begin(115200); pinMode(trig, OUTPUT); // Sets the trigPin as an Output pinMode(echo, INPUT); // Sets the echoPin as an Inpu // Blynk.begin(auth, ssid, pass); // You can also specify server: Blynk.begin(auth, ssid, pass, "blynk.cloud", 80); //Blynk.begin(auth, ssid, pass, IPAddress(192,168,1,100), 8080); timer.setInterval(1000L, sendSensor); } void loop() { Blynk.run(); timer.run(); } void sendSensor() { digitalWrite(trig, LOW); // Makes trigPin low delayMicroseconds(2); // 2 micro second delay digitalWrite(trig, HIGH); // tigPin high delayMicroseconds(10); // trigPin high for 10 micro seconds digitalWrite(trig, LOW); // trigPin low duration = pulseIn(echo, HIGH); //Read echo pin, time in microseconds distance = duration * 0.034 / 2; //Calculating actual/real distance Serial.print("Distance = "); //Output distance on arduino serial monitor Serial.println(distance); Blynk.virtualWrite(V2, distance); delay(1000); //Pause for 3 seconds and start measuring distance again } 69


1. Click at the icon C. BLYNK APPS IN SMART PHONES 2. Make sure the PRACTICAL 5B dashboard is online Click at the template 70 4. Click the LCD widget to change the setting. Select the widget you want to add in. In this practical work, choose LCD to display the ultrasonic distance. 3.


Back button 71 The LCD will display. Press back button to view result. Screenshot the result and paste in Table 1 5.


Figure 5.3 Connection of Arduino D1R2 board to Ultrasonic PRACTICAL WORK 5.2 Connect the Wemos D1 board, MQ2 and buzzer as Figure 5.4 below. Make sure that your sensor is connected in the right way. 1. GAS SENSOR, DISPLAY VALUE IN WEB DASHBOARD & BLYNK APPS A. CIRCUIT CONNECTION B. BLYNK CONSOLE 1. Add new template 72


Select virtual pin to add virtual widget such as gauge to display value. 2. Go to Datastreams and click + New Datastream to add new data. 3. Fill in the name , pin number, data type and units as below. Save the pin DataStream. Type a name for Virtual Pin The unit are choose based on the sensor used. Gas sensors use ppm The max value for gas sensor is set at 1024 73 4. Create and Save the template. 5. Go to Search icon


74 7. Copy and store the template id, name and auth code for later use. 6. Click and pick from template and choose your template. 8. To setup Web dashboard, click at Templates button and select your template. 9. Click at Web Dashboard and Edit icon. Double click or drag the Gauge into the canvas.


10. Click at the setting button. Name the Gauge and select Datastream 75 12.Observe the result and write in the Table 1. Write the coding below in ARDUINO IDE (next page). Replace the template ID, NAME and AUTH_TOKEN that provide in Blynk console. Verify and upload the coding. 11.


#define BLYNK_TEMPLATE_ID "XXXXXXXXXXXXXX" #define BLYNK_DEVICE_NAME "XXXXXXXXXXXXXXXX" #define BLYNK_AUTH_TOKEN “XXXXXXXXXXXXXXXXXXXXXXX" #define BLYNK_PRINT Serial #include <ESP8266WiFi.h> #include <BlynkSimpleEsp8266.h> char auth[] = BLYNK_AUTH_TOKEN; char ssid[] = "-------------------"; // Your WiFi credentials. char pass[] = "-----------------"; // Set password to " " for open networks. int buzzer = D4; int redLed = D5; int smokeA0 = A0; int sensorThres = 400; void setup() { // Debug console Serial.begin(9600); pinMode(redLed, OUTPUT); pinMode(buzzer, OUTPUT); pinMode(smokeA0, INPUT); Blynk.begin(auth, ssid, pass, "blynk.cloud", 80); } void loop() { Blynk.run(); int analogSensor = analogRead(smokeA0); Serial.print("Pin A0: "); Serial.println(analogSensor); Blynk.virtualWrite(V3, analogSensor); if (analogSensor > sensorThres) // Checks if it has reached the threshold value { digitalWrite(redLed, HIGH); tone(buzzer, 1000); // Send 1KHz sound signal... delay(1000); // ...for 1 sec noTone(buzzer); // Stop sound... delay(1000); // ...for 1sec } else { digitalWrite(redLed, LOW); } delay(100); } 76


RESULT: PRACTICAL WORK PROGRAMMING CODE (PASTE YOUR CODING / SCREENSHOT HERE) OBSERVATION MARKS 5.1 TOTAL /30 Table 1 5.2 5.3 /3 (Web Dashboard) /3 (Device Info) /3 (coding) /3 (Web Dashboard) /3 (Device Info) /3 (coding) /3 (Web Dashboard) /3 (Blynk Apps) /3 (Device Info) /3 (coding) 77


Flashing the LED widget according to the distance sensed by an ultrasonic sensor as below: What have you achieved / learnt in this practical work? CONCLUSION: ANALYSIS / DISCUSSION: DISTANCE LED WIDGET < 7 cm 1ST LED ON > 7 cm and < 15 cm 2ND LED ON >15 cm and < 25 cm 3RD LED ON 78


P R A C T I C A L WO R K 6 DEC50122 EMBEDDED ROBOTIC 79


PRACTICAL WORK ASSESSMENT (80%) – CLO3, PLO5, P4 PRACTICAL WORK 6: MOBILE ROBOT DESIGN Total marks STUDENT NAME : MATRIK NUMBER : PRACTICAL SKILL ASSESSMENT MARKS REMARKS Student able to identify, choose and use component correctly. Student able to assembles the circuit correctly Student able to write the coding correctly Student able to manipulates the coding correctly Result Housekeeping / Video presentation NO 1. 2. 3. 4. 5. 6. /10 /10 /10 /10 /30 /10 LAB REPORT ASSESSMENT (20%) – CLO3, PLO5, P4 PRACTICAL SKILL ASSESSMENT MARKS REMARKS Analysis / Discussion Conclusion NO 1. 2. /10 /10 80


Investigate the concept and fundamentals of mobile robotic, embedded controller, sensors and actuators based on land mobile robot design. Design the concept of robot positioning, identification and communication in mobile robot control according to a standard robot organization regulation. Manipulate the application of sensor and actuator, robot identification and communication during practical work based on land mobile robot design. Demonstrate good ability in managing a well-defined engineering-based project in a cost effective manner. 1. 2. 3. 4. APPARATUS / EQUIPMENT : LEARNING OUTCOME : → 81 MORDET Trainer Jumper Wires Smartphones 1. 2. 3.


A mobile robot is a machine controlled by software that use sensors and other technology to identify its surroundings and move around its environment. Mobile robots function using a combination of artificial intelligence (AI) and physical robotic elements, such as wheels, tracks and legs. Mobile robots are becoming increasingly popular across different business sectors. They are used to assist with work processes and even accomplish tasks that are impossible or dangerous for human workers. INTRODUCTION / THEORY: 82


EXPERIMENT PROCEDURE: MOBILE ROBOT DESIGN PRACTICAL WORK 6.1 DESIGN A MOBILE ROBOT PRACTICAL WORK 6.2 MOBILE ROBOT CONTROL BY ULTRASONIC 1. Connect the circuit according to block diagram 2. Modify the program coding according to the condition given in the Table 1 below: Distance from Object Output Condition 15 cm & above > 5cm & < 15 cm < 5 cm FORWARD REVERSE STOP Table 1 ULTRASONIC WeMos D1R2 MOTOR DRIVER MOTOR 83 PRACTICAL WORK 6.3 MOBILE ROBOT CONTROL BY BLYNK 1. Draw a differential drive mobile robot. Build the differential drive mobile robot by using recycle material. The mobile robot size must less than 30cm X 20cm. 2. 4. Observe the result and write in the Table 2. Disconnect the ultrasonic sensor. Remain the WeMos D1R2 and motor driver connection. 1. Control the DC motors through Blynk app by pressing the buttons. The button should able to drive the mobile robot FORWARD, REVERSE, TURN LEFT AND TURN RIGHT. 2. With the same coding, test and control the differential drive mobile robot in practical work 6.1. 3.


RESULT: PRACTICAL WORK PROGRAMMING CODE (PASTE YOUR CODING / SCREENSHOT HERE) OBSERVATION MARKS 6.1 TOTAL /30 Table 2 6.2 6.3 /10 (Design) /5 (Circuit Connection) /5 (Coding) /5 (Circuit Connection) /5 (Coding) 84


Design a wireless home mobile robot according to the experiment discussed above. What have you achieved / learnt in this practical work? CONCLUSION: ANALYSIS / DISCUSSION: 85


REFERENCES: Braunl, T.(2008). Embedded Robotics Mobile Robot Design and Application with Embedded System, 3rd Ed: Springer Predko, M.(2003). 123 Robotics Experiments for the Evil Genius: The McGraw-Hill Companies Keramas, J., G. (1999). Robot Technologies Fundamentals: Delmar Publishers Jainrk. (n.d.). Programming the ESP8266 WeMos D1R2 using Arduino Sorftware/IDE., from https://www.instructables.com/Programming-the-WeMos-Using-Arduino-SoftwareIDE/ Jabbaar. A., A. (2019, September 17). Ultrasonic Sensor HC-SR04 with Arduino Tutuorial ., from https://create.arduino.cc/projecthub/abdularbi17/ultrasonic-sensor-hc-sr04-witharduino-tutorial-327ff6 Patel. A. (2020, July 12). Using IR Sensor (TCRT 5000) with Arduino., from https://create.arduino.cc/projecthub/abdularbi17/ultrasonic-sensor-hc-sr04-witharduino-tutorial-327ff6 Cytron. (n.d). MQ2 Smoke LPG CO Sensor Module., from https://my.cytron.io/c-sensor/cgas-sensor/p-mq2-smoke-lpg-co-sensor-module?r=1 Cytron. (n.d). MQ2 Light Dependent Resistor (LDR) Module., from https://www.cytron.io/coptical-infrared-sensor/ampp-ldr-small Nasir.S., Z. (2017 July 18). Introduction to L298., from https://www.theengineeringprojects.com/2017/07/introduction-to-l298.html Blynk. (n.d). How Blynk Works., from https://docs.blynk.cc/


Click to View FlipBook Version