-
Notifications
You must be signed in to change notification settings - Fork 0
NodeMCU Part 1 Make it Blynk
The NodeMCU is a super-cheap (~$7) board that can control lights, motors, servos, and other stuff, and you can talk to it from your phone with WiFi!
There are several ways to program NodeMCU boards - for this project, we'll use the Arduino IDE.
You'll need a computer with the Arduino IDE and the CP210x Virtual Com Port Driver (VCP) installed. Someone with Admin privileges will do this:
Install Arduino IDE
Install CP210x VCP Driver
In the Arduino IDE, go to File > Preferences, and add: "http://arduino.esp8266.com/stable/package_esp8266com_index.json" to Additional Boards Manager URLs.
Note: If that link doesn't work (sometimes it is blocked), you can use:_ "https://github.com/esp8266/Arduino/releases/download/2.5.2/package_esp8266com_index.json"
In Tools > Board, select NodeMCU 1.0 (ESP-12E Module).
In Tools select:
- Upload Speed: "921600"
- CPU Frequency: "80Mhz"
- Flash Size : "4M (3M SPIFFS)"
- Debug Port : "Disabled"
- Debug Level: "None"
- IWIP Variant: "V2 Lower Memory"
- Erase Flash: "Only Sketch"
Connect the NodeMCU board to the computer USB port. Windows will pick a port number. In Tools > Port, select a likely port number. There may be a couple of port numbers to choose from - when you choose the right one, the Arduino IDE will show a message like this: "NodeMCU 1.0 (ESP-12E Module) on COM4" in the lower right corner. (Your COM port number may be different.)
Now you can make an LED blink (to test that everything is working OK so far). Upload an Example sketch to the NodeMCU board:
In Files > Examples > ESP8266, select the Blink Example, and upload it. The onboard blue LED should start to blink.
###Great! The NodeMCU is working, and you can make an onboard LED blink from code in the Arduino IDE.###
###Next, control the NodeMCU from a mobile phone### We're going to use an Internet of Things (IoT) platform to connect them together.
For this project, we'll use the Blynk platform, because it's free, easy, and it has apps for Android and iOS phones.
- Go to blynk.io and click the GET STARTED NOW button.
- Follow the directions on the Blynk page. Here is a summary of the steps:
- Install the Blynk app on your mobile device.
- Create a Blynk account (if you already have a Google account, you can sign in to Blynk with Google).
- Open "New Project".
- Give a name for the project - I'm calling it "4Switches".
- Open "Choose Device".
- Scroll down, select "NodeMCU" and tap "Create".
An authentication token will be sent to you via Gmail. Now press "OK". Now you should see an empty design screen for your control panel. Tap anywhere, Tap "Button", which will add a button to your control panel. Now, 3 more times. Now you will see 4 buttons on the screen which you can touch and hold to drag around.
For each button:
-
Tap the button. This will open button settings.
-
Give a name to the button. I'm giving mine boring temporary names "D0", "D1", "D2", and "D3" (since I can go back later and edit the names).
-
Select a pin. Here I have selected "D0" because I will connect a wire to digital output pin D0 on the board.
-
Now toggle the Mode to "PUSH" (This means the switch will normally be off, except when your finger is touching it).
Next, on your computer, follow these steps to install the Blynk libraries for the Arduino IDE: help.blynk.cc/en/articles/512105-how-to-install-blynk-library-for-arduino