Control an Arduino Project Through a Customisable Android / Iphone App With Blynk and Wemos D1: THE 2016 SUPER NOOB FRIENDLY WAY

57,837

172

39

Posted in TechnologyArduino

Introduction: Control an Arduino Project Through a Customisable Android / Iphone App With Blynk and Wemos D1: THE 2016 SUPER NOOB FRIENDLY WAY

The aim of this instructable is to teach you how to create wifi connected arduino projects the simplest and fastest way possible. If you want to make an arduino project that you can control from your smartphone and that only costed 4 eurs in hardware, then this project is for you! Do not rely on older instructables that use outdated arduino shields and complicated programs, bootloaders, outdated versions of the esp8266 etc. In 2016 it is possible to setup an arduino / wifi project with a fancy app that you can sell in only a matter of minutes! Interested? Ready? Great! then follow the steps below and your arduino project will be controlled through your smartphone or tablet in no time!

UPTDATE: If you want to control AC 100 to 250 Volts applications with this setup, check out my other instructable!
https://www.instructables.com/id/How-to-Hack-Your-Hot-Girlfriends-Nightlight-With-Y/

Step 1: Getting the Right Arduino Board for the Job

If you want to make an arduino project that is connected to the internet over wifi, you need a board that can connect to wifi. It's that simple. The arduino uno, nano, micro, mega... cannot connect to wifi without the addition of expensive and outdated shields. So save yourself a lot of time and money and don't to this unless you have a good reason to. I learned the hard way... ESP8266 boards are great but often do not support arduino out of the box. A lot of headache is often involved in getting these to work with arduino and their size makes them hard to work with.

Instead get a wemos D1 or Wemos mini board from www.wemos.cc. The wemos D1 is a clone of the arduino uno but uses the esp8266 chip, features full wifi capabilities out of the box and costs only $4,00. Thats right, four dollars for a microprocessor that connects to wifi! It features all the things you know and love about the uno like: digital pins, analog pins, vin, GND, 3,3 v output, power supply connector, 5V output and a fast and easy micro usb connector to upload your sketches.

If you need a smaller board, go for the new wemos mini.

Step 2: Set Up Your Wemos Board and Get the Right Files for the Arduino IDE

1. Install latest version of arduino IDE www.arduino.cc

2. follow the steps on the wemos site to configure your arduino IDE to support wemos boards: http://www.wemos.cc/wiki/doku.php?id=en:arduino_g...

I strongly recommond following the "Installing with Boards Manager" method

3. download the wemos D1 example sketches

from https://github.com/wemos/D1_mini_Examples/archive/...

4. Unzip the downloaded file
5. Copy all files in your arduino examples directory: (usually C:\Program Files (x86)\Arduino\examples)
6. open arduino IDE, select file - examples - D1 mini examples - basics - blink
7. under tools, select your wemos board and the right com port (this is the usb port you are using, usually only one option will be available)
8. upload your sketch, if your board's led blinks, you did good, if not, you missed one of the above steps.

Step 3: Creating Your Android / Iphone App With Blynk

To make our app we will be using blynk. Blynk is a simple tool that allows you to create apps on your phone and share those apps with other people. www.blynk.cc. It is a drag and drop system so no programming language is required and it takes direct control of your arduino's pins. It started as a kickstarter in 2015 but quicly grew to be a professional and highly useful tool. the best part: your app will be created in just one minute and will be fully customisable! Join the blynk forums if you need help or want to contribute.

1. download the latest blynk library from http://www.blynk.cc/getting-started/, unzip and copy it to your arduino library directory (usually: C:\Program Files (x86)\Arduino\libraries).

2. Download blynk app for android or iphone ( it's in the apple / google play store for free) and make your first app. go to settings and chose esp8266.

3. under "settings" in the app you will find "auth token" email this to yourself, you will need it later (see image above)

4. open arduino IDE
5. under file, examples, choose blynk, "esp8266 standalone"

6. in the sketch, add the auth token from step 3 where it says auth token. SSID is geek language for the name of your wifi connection and password is the password to your wifi network. Fill these three in in the sketch in their respective places (see picture). There is no need to further edit the sketch. Just with this code you will have full control over all your board's pins through the app.Take my word for it, it will be great!

Step 4: TEST Your Blynk App!

1. Add an led to GND and pin 13 on your wemos board
(I want to mention that the proper way to do this, is with a resistor between pin 13 and the LED. Your LED will not live a very long life without)
2. in the app on your phone or tablet, add a slider connected to pin gpO14.
(notice that the pins on the board are not the same as the pins in the app. For a full overview, consult the diagram above, Also notice that I/O pins on wemos boards are 3,3 volt, not 5 volt like on the arduino uno. Do not send 5 volts through them!)
3. hit the play button in the top right corner of your blynk app. CONGRATULATIONS !!!!
YOU NOW MADE A FULLY SMARTPHONE CONTROLLED ELECTRONICS PROJECT !!!!
move the slider to the right to make the led go brighter, to the left for dimmer.




Happy Hacking!

Step 5: Some Important Remarks

- DISCLAIMER: I am not associated with Blynk or wemos. I created this guide because I struggled for a long time to make wifi enabled arduino projects and wanted to give back to the community.

Any comments, remarks and questions are welcome. I am entering this instructables in some contests so if you liked it, please help me win. Every vote means a lot! ;)

https://www.instructables.com/contest/fsl2016/

https://www.instructables.com/contest/arduinoallthe...

- As mentionned before in step 4 the pins of the board do not match the app, check the wemos site for the pin layout of your specific board. It is likely that in the near future blynk will add wemos support ofcourse, then select your board in app and the pins will match. For the wemos D1 layout, check the previous step in this instructable.

- 3.3 v is all the i/o pins of wemos support. You will break your board if you send more through it. A simple resistor or voltage divider circuit can help you if you were to be stuck with 5v input that needed converting.

- The wemos only has one analog pin. If you need a lot more, this guide might not be for you.

I will try to answer to any questions and comments, this was my first instructable so please educate me if you believe I could improve certain aspects in the future.


HAPPY HACKING!

5 People Made This Project!

Recommendations

  • Woodworking Contest

    Woodworking Contest
  • Casting Contest

    Casting Contest
  • Microcontroller Contest

    Microcontroller Contest
user

We have a be nice policy.
Please be positive and constructive.

Tips

Questions

39 Comments

Hi!

looking to make such a thing to switch off electronics over the house during the night or when not home. I'm thinking, what happens if the phone looses connection to the network the device is connected to? Will the outputs remain latched when connection is gone?

hi there, i got some problem that the port cannot be detected. Do you have the solution to this problem? tq

How can I control an Arduino Uno with D1 mini via a mobile phone? basically like an RC car.

I have a question. When I setup all like it is written here and I juse the slide controle for one output pin I get at the ull slide (255) only a Voltage of 0,82V at the output. At 124 I get 0,47V. I expect values in between 0 and 3.3V. Where is my mistake?

Thank you in advanced.

1 reply

Wemos D1 operates on a PWM range of 0-1024

really great job!

One important step is missing. You have to sellect Wemos D1 under Tools/Boards in Arduino application and change Upload speed to 115200. If you do not have it listed, you have to install it using Boards manager:

1. Install Arduino 1.6.7 from the Arduino website.

2. Start Arduino and open Preferences window.

3. Enter
http://arduino.esp8266.com/stable/package_esp8266c...

into Additional Boards Manager URLs field. You can add multiple URLs, separating them with commas.

4. Open Tools→Board:xxx→Boards Manager and install esp8266 by ESP8266 Community (and don't forget to select your ESP8266 board from Tools > Board menu after installation).
(steps copied from http://www.wemos.cc/tutorial/get_started_in_arduino.html)

Hi Ruben,

I have installed the Blynk library and can see it in the IDE list but there are no examples for Blynk in my list. What have I done wrong here?

Cheers

Mark

Hey Ruben! Looks pretty nice and inspiring (as well as your other instructables). :-) I was wondering if it is possible to make some sort of wireless sensor out of the WeMos D1 mini (adding some shields, obviously). Thinking about checking temperature, moisture and acidity of my composting bins and reading the values on my smartphone... Any suggestion would be VERY appreciated ;-)

4 replies

Hey, thanks!

My bins are in a shack (pretty cold up here in Finland, so I don't want my compost to freeze) with electric power available, so maybe it's wiser to find some solution that's not depending upon batteries. Thanks for the advice ;-) I ordere a WeMos D1 mini, an OLED and the DHT22 for the start. Hope I can get something working with that... If it's OK, I'll shout for help if I'm stuck... ;-)

Hey again,

I am in Norway, so I totally get what you are talking about. Check out my other instructable: https://www.instructables.com/id/How-to-Hack-Your-H...

I added a new step today explaining how to best use the DHT22, it s all the way at the bottom. I also explain in detail how to use power from the wall outlet to power your wemos. YOu need an ac to dc converter. Links are included. Wall power is def the way to go for permanent sensors. Shout out if you need more ;)

PS: Vote for my other instructable in the link if you find it helpful pls ;)

hey there,

Thanks for the kind feedback!
The wemos when connected to wifi drains up to 200 ma. therefore it is unwise to run it completely wireless on a battery for a long time. A car battery however would do the trick if thats an option?

Well thank goodness for you! Well done and thank you very much indeed Ruben for making this introduction to the Wemos d1 r2 board as painless and user-friendly as possible. So painless and user-friendly in fact, that even I managed to get it working on the very 20th or-so attempt! ;) Brilliant! Well done!

2 replies

Thanks for the kind feedback! 20 aint so shabby ;). Dont forget to check out the sequel to this instructable on my profile ;)

HEy Ruben March Speybrouck I need u'r help in a project... Please Reply

1 reply

This is absolutely fantastic! Thank you very much for your clear and easy to follow instructions. I got my D1 Saturday and followed your lead...it works great. The only bump in the road was the fact that my board shows no pin 13; it is D5. I've got all kinds of ideas now. Thanks again Ruben...You're the MAN!!!

1 reply

Hey Carl,

Your kind words finally got me to sit down and write the follow up instructable to this one. Thank you for inspiring me and giving me the motivation to spend my time usefully. Please check it out and tell me what you think! It is the next step in learning IOT.

https://www.instructables.com/id/How-to-Hack-Your-Hot-Girlfriends-Nightlight-With-Y/


PS: I ll fix the remarks you made on the pins