Introduction: Easiest Way to Control Your Arduino With a Mobile Device!

About: Building and coding is what I do.

Many projects like this involve requiring a WiFi shield, or a Bluetooth Module. However, thanks to Blynk, as that is still possible, it is no longer necessary. This tutorial will explain in depth on how to control your Arduino (simply connected via USB to the computer) from your phone!

Step 1: Configure Blynk

The first thing you will need to do is download Blynk from the App Store or Google Play store on a mobile device. When you open the app, you will be prompted to make an account. Do it! Make sure you sign up with an email you can easily access.

Then, once you do that, it's time to make your first project. Click on the new project. Give the project a name, and select the board you are using. Then, click the 'Email' button so that authorization code is emailed to you. You will need it later!

Now that you have a blank project, click anywhere on the screen so you see a menu on the side. Select a button, and then tap it and enter the settings as shown in the third picture. This will give it a name (so it's user interface is more friendly), and then sets the pin it will control to D13.

This is all you need to do on the phone! Pretty easy, right? Let's move on!

Step 2: Install the Blynk Library

Now, we will need to install the Blynk Library in the Arduino IDE. To do this, go to:

Sketch > Include Library > Manage Libraries

Then, all you need to do is search 'Blynk' and then Install the latest version.

Step 3: Arduino Code

Now, go to File > Examples > Blynk > Boards_USB_Serial > Arduino_Serial_USB .

Check your email for the auth token you sent yourself earlier, and copy and paste it like so:

Before:

char auth[] = "YourAuthToken";

After:

char auth[] = "t1h2i3s4i5s6a7n8e9x0a1m2p3l4e";

Make sure to keep the "" marks. Once you did that, upload the sketch to the Arduino! We are almost done!

Step 4: LX Terminal

Now for the last step! All you have to do is entering the following to your LXTerminal.

*** MAC / LINUX ***

1. Create a path to the folder with 'blynk-ser.sh' in it using the cd ./ command. Example:

cd ./Documents/Arduino/libraries/Blynk/scripts

2. Enter the following command:

bash ./blynk-ser.sh

3. Many different things could happen at this step, especially if you are doing this for the first time. Skip around to see what case you got.

3a

"This script uses socat utility, but could not find it"

If you get this error, you need to enter the following:

sudo port install socat

and follow along with the terminal. However, you might need to install MacPorts first.

3b

[ Press Ctrl+C to exit ]
/dev/tty.usbmodem not found.

Select serial port [ /dev/tty.usbmodem411 ]:

If that happens, copy and paste whats inside of the brackets [] right after the colon, and hit enter.

4. After you get past step three, you should be prompted with this (or similar). If so, you did it! If not, comment below what your issue is!

Resetting device /dev/tty.usbmodem411...
Warning: Server connection may be insecure!

Connecting: GOPEN:/dev/tty.usbmodem411,raw,echo=0,clocal=1,cs8,nonblock=1,ixoff=0,ixon=0,ispeed=9600,ospeed=9600,crtscts=0 <-> TCP:blynk-cloud.com:8442,nodelay                                         2016/06/05 10:56:41 socat[842] N opening character device "/dev/tty.usbmodem411" for reading and writing                                                                                                2016/06/05 10:56:41 socat[842] N opening connection to LEN=16 AF=2 45.55.130.102:8442               2016/06/05 10:56:41 socat[842] N successfully connected from local address LEN=16 AF=2 192.168.1.8:50398                                                                                                2016/06/05 10:56:41 socat[842] N starting data transfer loop with FDs [5,5] and [6,6]

*** WINDOWS ***

1. Open cmd.exe

2. Write (put your path to the blynk-ser.bat folder):

cd C:\blynk-library\scripts

3. Write (COM4 is port with your Arduino):

blynk-ser.bat -c COM4 

4. And press "Enter", press "Enter" and press "Enter"

Step 5: You Did It!

Now, open up the Blynk app again, and hit the triangle button in the top right corner. After that, click and hold down on the button, and the LED on the board should turn on! To see this better, attach the positive end of an LED to pin 13, and the negative to GND right next to it.

For information, go to the Blynk Forum to post a question I didn't/couldn't answer!

Hope this helped! Comment your results below!

Internet of Things Contest 2016

Participated in the
Internet of Things Contest 2016

Sensors Contest 2016

Participated in the
Sensors Contest 2016

Automation Contest 2016

Participated in the
Automation Contest 2016