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!
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
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.
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! ;)
- 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.
Participated in the
Arduino All The Things! Contest
Participated in the
Full Spectrum Laser Contest 2016