You can download the user manual from:  

https://osoyoo.com/manual/2021005400.pdf

Buy from US Buy from UK Buy from DE Buy from FR Buy from IT Buy from ES Buy from JP

Introduction

Here we will use OSOYOO IoT kit and Blynk APP to remotely control the door.

In this lesson, we actually simulate opening and closing the door by remotely controlling the rotation of the servo. By using the Blynk button widget, we press the button on the phone, the door will be opened, and press the button again, the door will be closed. By sliding the Slider widget on the Blynk APP, we can control the opening and closing range of the door

HARDWARE

SOFTWARE

First, please plug OSOYOO MEGA-IoT Extension Board into MEGA2560 board:

Build the circuit as below:

Prerequisite:
You need to install Local Blynk Server, Blynk APP, Arduino IDE, Blynk Libraries before running the code of this lesson.  We suppose you have installed them in previous lessons.  If you haven’t done these installations, please read following contents in lesson2-1 link:

https://osoyoo.com/2021/04/29/osoyoo-smart-home-iot-blynk-lesson-2-1-simple-control/#prerequisite

You also need to install the Servo library as above operations.

If you haven’t done servo test in lesson 2-5, please read  Door Servo Test and do the servo test first. If you have adjusted the servo before, please skip this step.

After you complete library installation and servo adjustment, you can go to next stage:

Download and Edit Lesson2-7 Arduino Code file

Step 5 Download the code from following link, unzip it:
https://osoyoo.com/driver/Smart_House_IoT_Learning_Kit_V2.0_code/Lesson2-7.zip

Step 6 After above operations are completed, connect OSOYOO MEGA2560 Board to PC with USB cable.

Notice: Shut off your battery or unplug your power adapter when upload sketch code to Arduino.

Step 7 Open Arduino IDE:  Choose corresponding board type and port type for you project.

Step 8  Arduino IDE:  Click file – Open, then choose code in the folder, load up the  sketch onto your Arduino.

You need to edit the code as following:

**********************************************************

Note: In the  sketch, find these code in line 14,15 as following:

char auth[] =”0ByWpc50cmOJ5O6OyHMaK4OSHkDvUeI-”;
char server_ip[]=”192.168.1.81″; // replace this line with your Blynk Server IP addres;

Replace 0ByWpc50cmOJ5O6OyHMaK4OSHkDvUeI- with your local Blynk Token.
Replace 192.168.1.81 with your local Blynk Server LAN IP address.
If you don’t know how to get token and Server IP address, read this article.

In   lines 19,20 and replace *** with your wifi ssid/password

char ssid[] = "***";//replace this line with your wifi ssid
char pass[] = "***"; //replace this line with your wifi password

please replace the *** with your correct wifi SSID and password, otherwise your project can not connect to Internet.

Upload the sketch to the board. Wait until you see something like this:

Done uploading

Now open your Serial Monitor, you will see Arduino is trying to talk to Blynk server. After 20 to 30 seconds, your Serial monitor will finally shows Arduino’s IP address and a “Ready (ping: 25ms)” ending message.

Congratulations! You are all ready! Your hardware is now connected to the Blynk server.

Add a Widget in Blynk APP

Open your project page and press the “+” button to add  the “Slider” Widget.

Slider Widget Settings

Name Column: Door

OUTPUT:  V9 | 0~180

After you finished all above operations, open the serial monitor,then open the Blynk APP, press the PLAY button. This will switch you from EDIT mode to PLAY mode where you can interact with the hardware. While in PLAY mode, you won’t be able to drag or set up new widgets, press STOP and get back to EDIT mode.

Now, you’ll see the servo turning with the slider!

 

While in PLAY mode, you won’t be able to drag or set up new widgets, press “”  and get back to EDIT mode.

If you find the device is offline, please check your code, wiring and app settings, and try again.

Button widget to open the door remotely

Download the code from this link:

https://osoyoo.com/driver/Smart_House_IoT_Learning_Kit_V2.0_code/lesson2-7-button.zip

Then follow above Step 5 – Step 8 to edit and upload the code.

Here, we will show how to use the button widget on Blynk to open and close the door remotely. The preparation and hardware wiring are the same as the previous experiments.

Open your project page and press the “+” button to add  the “Button” Widget.

Button Widget settings:

Name Column: Door

OUTPUT: V8 |  1-0 (V stands for virtual)

MODE: We choose the Switch mode here.

You can modify other options according to your own habits or keep them as default.

Running Result

After you finished all above operations, open the serial monitor,then open the Blynk APP, press the PLAY button. This will switch you from EDIT mode to PLAY mode where you can interact with the hardware. While in PLAY mode, you won’t be able to drag or set up new widgets, press STOP and get back to EDIT mode.

Now, press the “Door” button on the APP, the door will be opened, and press the button again, the door will be closed.

If you find the device is offline, please check your code, wiring and app settings, and try again.

No. Picture Device Qty. Link
1 OSOYOO MEGA2560 Board 1 Click here to buy
2 OSOYOO MEGA-IoT Extension Board 1 Click here to buy
3 Photosensitive Sensor 1 Click here to buy
4 Temp & Hum Sensor 1 Click here to buy
5  OSOYOO Active Buzzer Module 1 Click here to buy
6 Flame Detection Sensor 1 Click here to buy
7 Fan Motor Module 1 Click here to buy
8 Micro Servo Motor 1 Click here to buy
9 RGB Module 1 Click here to buy
10 Ultrasonic Sensor 1 Click here to buy
11 PIR Motion Sensor 1 Click here to buy
12 Microphone Module 1 Click here to buy
13 1602 I2C LCD Screen 1 Click here to buy
14 RFID Module 1 Click here to buy
15 White LED Module 1 Click here to buy
16 Red LED Module 1 Click here to buy
17 Colorful Light 1 Click here to buy
18 Red Button Module 1 Click here to buy
19 Blue Button Module 1 Click here to buy
20 Philips Screwdriver 1 Click here to buy