In this project we will connect Robot Car to WIFI and Use an APP to control the car through Internet. This is a typical Internet of Things(IoT) Application. Phone APP controls the car movement, and temperature & humidity sensor module sends temperature and humidity to your phone.
Please prepare the following parts to complete this project
NOTE:
1.the color of the building block is subject to the actual product, which does not affect the use.
2. ALL OSOYOO PRODUCTS FOR ARDUINO ARE THIRD PARTY BOARD WHICH IS FULLY COMPATITABLE WITH ARDUINO
Before you build the robot with blocks, please install OSOYOO basic board for Arduino under OSOYOO Magic I/O shield as following (Attention please : the pins of I/O shield is aligned with the port of basic the board firstly, then press the shield tightly on the board).
Please follow the building steps to build this robot car, If you want to get clear PDF building steps, please download from https://osoyoo.com/picture/Building_Robot_Car/lesson7/lesson7.pdf
Note: If you have built the robot car for lesson6, please skip to the step58 in this PDF.
Please connect motors and 9V battery case as lesson1.
Then connect the middle four pins of OSOYOO WIFI Module connect to VCC/GDN/D2/D3 slot of Magic I/O shield, connect servo motor to D4 port as following (Attention please: there are six jumper caps on ENA/ENB/IN1/IN2/IN3/IN4)
Note: This lesson use Arduino IDE as programming tool.
Step 1: Install Arduino IDE. Download Arduino IDE from https://www.arduino.cc/en/Main/Software?setlang=en , then install the software. If you have install Arduino IDE, please skip this step.
Step 2: Install WifiEsp-master library into IDE (If you have already installed WifiEsp-master library, please skip this step)
Download WifiEsp-master library from https://osoyoo.com/driver/WiFiEsp-master.zip, then import the library into IDE (Open IDE-> click Sketch->Include Library->Add .Zip Library)
Step 3: Install OsoyooIOT Library into IDE (If you have already installed OsoyooIOT Library, please skip this step)
Download OsoyooIOT Library from https://osoyoo.com/driver/wifi-iot/OsoyooIOT.zip, then import the library into IDE (Open IDE-> click Sketch->Include Library->Add .Zip Library)
Step 4: Install DHT Sensor Library into IDE (If you have already installed DHT Sensor Library, please skip this step)
Download DHT Sensor Library from https://osoyoo.com/wp-content/uploads/samplecode/DHT.zip then import the library into IDE (Open IDE-> click Sketch->Include Library->Add .Zip Library)
Step 5:Download sample code from https://osoyoo.com/picture/Building_Robot_Car/lesson7/wifi-block-car.zip, and unzip the downloaded zip file wifi-block-car.zip, you will see a folder called wifi-block-car.
Step 6: Connect OSOYOO basic board for Arduino to PC with USB cable, Open Arduino IDE -> click file -> click Open -> choose code “wifi-block-car.ino” in wifi-block-car folder, load the code into Arduino. (Notice: Please turn off power when your Robot is connected to Personal Computer or Laptop via USB cable)
Step 7: You need change the code Line 38 and Line 39 as your router wifi ssid name and password :
char ssid[] = “***”; // replace *** with your router wifi SSID (name)
char pass[] = “***”; // replace *** with your router wifi SSID (password)
Step 8: Choose corresponding board and port for your project, upload the sketch to the board.
Step 9: click the Serial monitor window in upper right corner of IDE, you will see following result (Note: your PC and the robot are connected with the same LAN network):
TIPS:
If you find the speed for the car is slow or fast, please open the code and change the value of line33 to line35 as the following:
#define FAST_SPEED 180
#define MID_SPEED 130
#define SPEED 120
APP Installation and Setting:
Step 1) Download OSOYOO Iot udp APP by searching OSOYOO Iot udp APP from Apple Store(iPhone/iPad) or Google Play Store(Android device).
Step 2): Install the OSOYOO Iot udp APP in your Phone and make sure your Cell phone is connected with the same LAN Network of your robot car for Arduino.
Step 3): Set IP Address in APP
1)Open APP, click Setting button in upper right corner
2)Use the IP address you get in serial monitor window (For our robot is 192.168.0.8) to replace default IP 192.168.1.255
3)keep default port number 8888 without changing
4)turn on the switch of UDP Response Text Display
5)Click Save button to save the changes you just made
6)Click Back Arrow to go back APP front UI
Control the robot car:
You can use the Arrow keys to control the car movement and see the temperature and humidity detected by the DHT11 sensor in your car when you click any button.
▲ | Move Forward |
▼ | Move Backward |
◄ | Left Turn |
► | Right Turn |
[] | Stop |
DownLoad Url osoyoo.com