- ESP8266 NodeMCU board.
- Common annode RGB LED.
- Jumpers or copper wires.
-
Development Tools:
- esptool.py
- NodeMCU-Tool.
- Linux
screen
command installed for serial communication.
If you have issues with any of the above mentioned tools, you can refer to these alternatives:
-
Create at NodeMCU firmware at NodeMCU Build:
- Specify an email where you'll get the firmware binaries.
- It must point to the
release
branch of the NodeMCU repository. - Whitelist the following modules:
file
,HTTP
,net
,node
,pwm2
,sjson
,timer
, andwifi
. - Wait until you get the binaries via email and once you receive them, download the one that ends with
float.bin
into theapp/
directory.
-
Flash the firmware and test it.
-
Set permissions over the
/dev/ttyUSB0
port and register your linux user into thedialog
group. This will allow you to use thenodemcu-tool
properly (if it fails, reboot your computer to refresh the system changes):sudo chmod -R 777 /dev/ttyUSB0 sudo usermod -a -G dialout <user> # if you whish to remove the user from 'dialout' group sudo gpasswd -d <user> dialout
-
Erase flash:
esptool.py --port /dev/ttyUSB0 erase_flash
-
Flash NodeMCU firmware:
esptool.py --port /dev/ttyUSB0 \ write_flash 0x00000 \ app/nodemcu-release-9-modules-XXXX-XX-XX-XX-XX-XX-float.bin
-
Open the NodeMCU shell:
sudo screen /dev/ttyUSB0 115200
-
Reboot your ESP8266 and you should see a similar output as the following:
��l����n�|r��N|�l�$`c����|{��$�n��N�l`��r�l�l�l ��s�p��$�$ ��r�d���$l NodeMCU 3.0.0.0 built on nodemcu-build.com provided by frightanic.com branch: release commit: d4ae3c364bd8ae3ded8b77d35745b7f07879f5f9 release: release DTS: 202105102018 SSL: false build type: float LFS: 0x0 bytes total capacity modules: file,http,net,node,pwm2,tmr,wifi build 2021-05-26 18:11 powered by Lua 5.1.4 on SDK 3.0.1-dev(fce080e) >
-
-
To upload the app into the device, exit the
screen
session (Ctrl + A, K, Y
) and then run the following command:nodemcu-tool upload app/src/*
-
Open the NodeMCU shell to monitor logs:
sudo screen /dev/ttyUSB 115200
To avoid hardcoded Wi-Fi credentials, you'll need to connect to your ESP8266's Access Point following these steps:
- Go to your phone's Network Settings and locate the LightBulb-ESP8266 network.
- One you're connected successfully, open your phone's browser and go to
192.168.4.1
to set up the credentials of your device's network (refer to ./src/config.lua). - At the
screen
session, you should see some logs as soon as your device gets authenticated at the access point. - Switch back to your main network, to stay synced with your Hub and proceed to install your driver.
To test if your device has been connected properly, you can access the device's
built-in controller at 192.168.X.XX/control
. Notice that the IP will depend on
your phone's current network, i.e. if you're connected to the LightBulb-ESP8266
network, the controller will be at 192.168.4.1/control
.
Also, I recommend you to test this feature after the device has been integrated into the SmartThings ecosystem, this way you'll be able to see bidirectional communication.