A Phone Controlled Rover (Intel Edison + Blynk + Arduino)

by bneo99 in Circuits > Remote Control

4601 Views, 66 Favorites, 0 Comments

A Phone Controlled Rover (Intel Edison + Blynk + Arduino)

P1100018.JPG
P1100019.JPG
P1100015.JPG
P1090957.JPG
P1100020.JPG
P1100017.JPG
P1100016.JPG
Backstory: (IF you are too lazy to read skip this)

It was May (year 2015). A student in his Form 4 (10th grade?) just came back home from school and he powered on his computer, as a daily routine, to check on posts on the social media he frequents, watch videos from channels he subscribes to, and also to check on his email. He started by checking his email as the videos on the sites buffer... and top on the list was...

Announcing the Intel IoT Invitational

He read the title and thought what was that thing, and so he clicked on that mail and read it from top. After reading the mail he found out that Intel and Instructables is going to give out a bunch of cool stuff to the community for them to learn and have fun. He got excited reading the items they might give so he scrolled to the bottom and clicked on the link that said

USE THIS FORM TO APPLY TO THIS PRODUCT OFFERING

He wrote down a bunch of ideas he can think out of the top of his head and submitted it with hopes of getting one of the development kits.

Two months later, he checked his email again as always and he saw an email titled:


Congratulations! You're getting a Robotics kit from Intel + Instructables

He read the email and his spirits got up again, excited to begin to build with what he will be given.
He submitted his address and waited patiently for his dev kit. A few days later it arrived. He was so excited to start developing with his dev kit and he did it, albeit taking a few months, facing trails such as sending a faulty dev board for RMA, learning new programming language, learning more about Linux, learning more about building rovers in general. But in the end he did it, building his first robotics project, his first rover. He had fun, and now he is here to show you what he had build, the final product was far from what he initially imagined it to be but he knows deep in his heart, that only people that never gives up can go to places, yeah, places.


Too lazy, didn't read? No probs.

With the backstory done we can begin.

This instructable is about a rover built by a 16 year old teenager which uses Intel Edison and Arduino and is programmed with NodeJS and the standard Arduino language. It is controlled from a smartphone using Blynk to provide flexibility and simplicity.

This isn't the best rover out there but it was a first for me so please bear with me.

The Parts Used

P1090842.JPG
P1090843.JPG
P1090941.JPG
P1090829.JPG
3ac50a997c78858b8f960475f878e369.image.530x397.jpg
Planet Geared Motor F280_01.jpg
P1090833.JPG
I've used these parts and materials when building this rover:

Intel Edison with Arduino breakout board

DIY arduino clone

Li-ion battery charger with protection circuit from Ebay

Buck-Boost converter (we're only using the boost mode) from Ebay

Grove I2C Motor Driver from Seeed Studio

Planet Geared Motor F280 from Seeed Studio

DIY 3.7V Li-ion battery pack from 4 18650 batteries

A piece of acrylic/plexiglass as the base for the whole
rover

2 big and 2 small wheels salvaged from toy cars


For the arduino clone I used:

ATMega328p microcontroller

16Mhz crystal oscillator with its capacitors (22pf x2)

LED's for Rx, Tx, Power and pin 13.

Header connectors for I2C, UART, ICSP, and some GPIO's

Preparing the Edison

2015-11-07-141445_1280x800_scrot.png
2015-11-07-141539_1280x800_scrot.png
2015-11-07-182344_1280x800_scrot.png
Download the latest version of the Yocto image and flash it into the Edison with the flashall.sh script.

Once the flashing is complete, connect to the Edison via the internal USB to serial chip and set it up with configure_edison.

Once the wifi is set up and the Edison is connected to the internet do:

npm install mraa blynk-library

to install the required libraries.

To increase the reaction speed of Blynk and also to enable it to be run offline I hosted blynk-server directly on the Edison and modified my client to connect to it. I downloaded the Blynk server package from it's github page and put it in a folder. I run the server and modified a few things in my client to have it connect to itself locally and have my smartphone connect to it via my home wifi network or to the Edison's access point.

Launch the Blynk server with

java -jar PATH_TO_SERVER_JAR_FILE -dataFolder SERVER_DIRECTORY

In my case I used this command

java -jar /home/root/blynk/server-0.10.2.jar -dataFolder /home/root/blynk

Do check your java version with java -version before setting up the server as you need Java 8 to run the server.

The Working Concept

P1100026.JPG
This is how the whole thing works.

A smartphone with the Blynk app sends commands to the Blynk server(in the Edison) which then relays it to the client which is also on the Edison. The simple NodeJS script then checks the incoming command and sends it out though it's UART port to the Arduino. The Arduino then checks the incoming signal and commands the motor driver to drive the motors.

When the Arduino receives a command to change speed, it changes its speed and sends back its current speed via UART to the Edison. The Edison then checks the incoming data and relays it back to the blynk server which finally goes back to the Blynk app on the smartphone. The different speeds are displayed with three virtual LEDs on the screen.

I tried to connect the Edison directly to the motor driver but somehow I cant send commands to the motor driver via I2C so I went with the Arduino to further relay the data. I do plan to fix this but writing my own code to the motor driver's microcontroller to eliminate the Arduino currently used.

Edison Side Software

2015-11-07-225723_1280x800_scrot.png
2015-11-07-230610_1280x800_scrot.png
The code for relaying the data is very simple (This is like my first time coding in NodeJS) and might be inefficient. Do give me advices on how I can improve in it.

I'm not sure if there's other way to set the Blynk client to connect to a custom server in the script so I modified the file blynk-node.js in the "node_modules/blynk-library/" folder. In specific I changed the server address from cloud.blynk.cc to edison.local for the TCP client so that it will connect to the local server.

Downloads

Arduino Sketch

2015-11-08-132307_1280x800_scrot.png
The Arduino sketch receives data from the Edison through UART and uses switch case to check which command to send to the I2C Motor driver.

As for the LED control the sketch will flip the output pin, if it's currently on, switch it off, if it's currently off, switch it on...

As for the speed control, the sketch checks the current speed and steps it up by one and sends the new speed back to the Edison.

For the pro Arduino/C++ coders out there do give me advice on how I can better implement these functions.

Blynk! or Is It Blink?

Screenshot_2015-11-07-18-07-36.png
Screenshot_2015-11-07-18-12-37.png
Install Blynk app into your smartphone through the iOS App Store or the Google Play Store.

Launch it and create an account:

If you're using the Blynk cloud server just directly create an account.

If you're using your own local server make sure the server settings is set to custom and provide your Edison's IP address.

After creating your account, set up your buttons and LED's according to how you want it to be. Make sure they are connected to the correct virtual pins as the ones in the Edison.

Also get the authentication code from the app and insert it into your NodeJS script.

Test Run + Final Words?

P1100008.JPG
P1100009.JPG
Smartphone controlled Rover (Intel Edison + Arduino + Blynk)
P1100011.JPG
P1100012.JPG
P1100013.JPG
With the software complete and uploaded into the Edison and the Arduino, it's time to have some fun. Watch the video to see how it works. I particularly likes the way it spins. I haven's tested its run time yet but it should last for quite a while.

This rover is actually quite far from what I imagined it to be. It was supposed to have more cool stuff on it but due to financial problems(what do you expect from a 16 year old student) I was not able to implement it.

My original idea that I submitted to Instructables was quite ambitious (see below)

I would use the Robotics kit to build a small IoT rover. I would use the sensors provided to build a rover capable of line following, edge detection, and other functions. I will also add this laser controller I've made (https://www.instructables.com/id/Rechargeable-Bluetooth-Pan-and-Tilt-Laser-Controll/) and attach a camera to the laser so I can move it together. The Edison haves a USB port so I can use a USB webcam to take pictures or videos for me. Since the Edison also have integrated WiFi and Bluetooth I can use my tablet to control it wirelessly. It would be better if i have a GPS module... I can have it move from a place to another place automatically. I can also add batteries and some solar panels to charge it during daytime... I can use the Mosfet to drive a High power IR LED to illuminate the camera during night time. I can add Neopixels to it also and show them to my friends. Could make it sound reactive too if i add a microphone to it...

The final thing was just the platform to add all the awesome stuff I proposed to do. But I'm still statisfied as I've actually made a working rover for the first time in my life.

That's probably all from me for this Instructable, do look at my other projects like the Rechargeable Bluetooth Pan and Tilt Laser Controller.

Thank you for reading and have a good day. God bless!