Introduction: Linkit One Blynk Servo

In the last instructable I showed you how to control a servo using Linkit One, both locally and over the internet. In this instructable I will show you how to control it using an android phone. We will be using the Blynk library and android app. Blynk is a Library for various micro-controllers which allow easy access to get started with your IoT project. I will be using a servo which is 5V and arduino compatible.

Step 1: Components

Here is a list of all the components required to get started, make sure you collect all the components first before proceeding to other steps-

Servo Wires

Battery

WiFi Antenna

Step 2: Schematics

The schematics for are similar to that of the previous instructable, make sure you are using a servo which is compatible with the Linkit One.

The schematics can be found in the picture above, I had to use an arduino to represent the linkit one as Fritzing doesn't have a library for the Linkit one yet.

Step 3: Program

Make sure you enter in you WiFi credentials in the code to connect the board to your WiFi network.

To upload the program you need to install the Linkit one plugin along with the arduino IDE. You can find instructions on how to do that in the official website. You can also download the IDE with the Linkit One plugin pre-installed from GitHub.

#define ARDUINO 150 // to avoid Blynk library use yield() in function run(), without this. system will crash!
#include

#include

#include

#include #define ard_log Serial.printf

int i; Servo myservo;

// You should get Auth Token in the Blynk App. // Go to the Project Settings (nut icon). char auth[] = "6d333bb1ef4b46cd9a53c5f01c2a74e9";

#define WIFI_AP "SSID" #define WIFI_PASSWORD "PASSWORD" #define WIFI_AUTH LWIFI_WPA // choose from LWIFI_OPEN, LWIFI_WPA, or LWIFI_WEP according to your WiFi AP configuration

void setup() {

Serial.begin(9600);

Blynk.begin(auth, WIFI_AP, WIFI_PASSWORD, WIFI_AUTH);

Serial.println("System start!");

myservo.attach(9);

}

BLYNK_WRITE(3) { myservo.write(param.asInt()); }

uint16_t loop_id=0;

void loop() {

loop_id++;

Serial.println(loop_id);

Blynk.run(); }

BLYNK_READ(0) {

Serial.println("Blynk comes to read!");

Blynk.virtualWrite(0, loop_id);

}

Step 4: App

The Blynk app can be downloaded from the android play store, make sure you enter the access token genrated by the app in the code of the Linkit One. Then you need to add a Sliding bar and set it to send values to virtual pin 3 and a maximum value of 180 degrees. Then upload the code to the Linkit one and power it on once it is connected to the WiFi network. You can move the slider and watch the servo move along.