To connect the nodemcu to the NRF24L01+
transceiver, use the following pins:
NODEMCU PIN | NRF24L01+ PIN |
---|---|
3V (NOT Vin) | VCC |
G | GND |
D0 | CE |
D5 | (HSCLK) SCK |
D6 | (HMISO) MISO |
D7 | (HMOSI) MOSI |
D8 | (HCS) CSN |
The pins of the NRF2401+
:
The pins of the NodeMCU
:
Install esptool from Expressif through pip or by downloading a recent-ish release (mine is from last year but still suffices)
The current version I used is the latest stable release from github: 1.6.5
.
Go to esp_milight hub releases to download a newer bin file.
Download the prebuild bin file for the esp8266 version of your choice. In this case the nodemcuv2
:
URL="https://github.com/sidoh/esp8266_milight_hub/releases/download/1.7.0-dev3/esp8266_milight_hub_nodemcuv2-1.7.0-dev3.bin"
wget -O /tmp/milight.bin "$URL"
To flash the nodemcu, connect it to your usb port. I recommend using a powered USB hub in between when you are using a laptop, as these little fuckers need a stable power source when flashing. If your upload fails with undetermined errors, try again using a powered USB hub ;)
You might need to install the CP210X
USB to UART Bridge VCP Drivers first
to connect to the serial device of the NodeMCU.
To flash the firmware, use the following command:
esptool.py --port /dev/cu.SLAB_USBtoUART write_flash -fm dio 0x00000 /tmp/milight.bin
If you have multiple serial devices connected, the /dev/cu.SLAB_USBtoUART
device might have a slighlty different name like /dev/cu.SLAB_USBtoUART_114
or something.
For more information about flashing, check the flashing page in the nodemcu manual
To test if you serial connectivity is functional, you can read the chip_id
of the nodemcu:
esptool.py --port /dev/cu.SLAB_USBtoUART chip_id
In case of undefined errors while running and or errors when flashing, most of the times it helps if you do a erase_flash
(hard reset)
To do this, use the following command:
esptool.py --port /dev/cu.SLAB_USBtoUART erase_flash
After this you'll have to re-upload the bin file
If the esptool.py method doesn't work, you can try PlatformIO
alternatively.
This is a little more work, and takes a bit longer, but is a more robust and stable way to flash the esp_milight_hub firmware.
To use the platformio method you need install nodejs with npm, python and python-dev
To use platformio to flash the firmware:
# install platformio
pip install -U https://github.com/platformio/platformio-core/archive/develop.zip
# clone repo
git clone https://github.com/sidoh/esp8266_milight_hub.git && cd esp8266_milight_hub
# flash firmware
export ESP_BOARD=nodemcuv2
platformio run -e $ESP_BOARD --target upload
To connect the milight lights to home-assistant, use the instructions from the author of the esp milight hub Chris Mullins.
More instructions of how to use the esp_milight_hub
, have a look at the github wiki of the project.
To find out how to connect any es8266 board with a NRF2401 module, have a look in the documentation from mysensors