ESP8266/Ideas: Difference between revisions
No edit summary |
|||
| Line 15: | Line 15: | ||
<htmlet>ESP8266-DiagramDraft02</htmlet> | <htmlet>ESP8266-DiagramDraft02</htmlet> | ||
== Connecting ESP8266 to Raspberry Pi == | |||
Turn off aLaMode (don’t know if this is necessary) | |||
Connect Tx, Rx, GND directly to GPIO pins | |||
Connect VCC, CH_PD, to 3v3 | |||
Device is accessible via /dev/ttyS0 on 9600 baud. Used Arduino IDE serial monitor. | |||
Used a variety of AT commands. Verified that I could connect to its Access Point (open wifi) | |||
Connected it to home wifi network | |||
Pinged repeatedly. Power off/on time is < 1 second | |||
____________ | |||
Flashing ESP from RPi using NODEMCU firmware | |||
Steps: | |||
# Ensure /dev/ttyS0 port is a functioning serial port | |||
This may already be setup. Mine was configured when installing aLaMode ArduinoIDE support. | |||
# Install python library pyserial (used by firmware uploader tool) | |||
sudo pip install serial | |||
# Baud rate. This presented a problem the first time around. But the nodemcu firmware uploader tool is open source so I was able to figure out the problem myself. Here’s the code that prevented the firmware from uploading to my ESP: | |||
#Default baudrate. The ROM auto-bauds, so we can use more or less whatever we want. | |||
ESP_ROM_BAUD = 115200 | |||
(Might want to check the assumption on this one.) | |||
My ESP has the original firmware installed and does not auto-sense baud rate like some of the later versions do. The NODEMCU tool uses 115200, so I had to change the baud rate from 9600 (default) to 115200. | |||
AT+CIOBAUD=115200 | |||
#. Start a new clone of nodemcu-firmware from git | |||
sudo git clone https://github.com/nodemcu/nodemcu-firmware | |||
Or if this is already done update the repo (from nodemcu-firmware folder) | |||
sudo git pull | |||
# If necessary, change directory to the nodemcu-firmware project | |||
cd /nodemcu-firmware/ | |||
# Put ESP8266 into flash mode by connecting GPIO-0 to ground and then apply power (or power cycle) | |||
Note: connecting GND and GPIO0 to different grounds on RPi (pins 6 and 14) did not register as GPIO0=low (went into some sort of non responsive mode). Therefore, GND and GPIO0 should use a common ground (be directly connected) | |||
# Run uploader specifying the serial port and firmware that was included in the git clone (from the nodemcu-firmware root folder): | |||
sudo tools/esptool.py --port /dev/ttyS0 write_flash 0x00000 pre_build/latest/nodemcu_latest.bin | |||
Success! | |||
Connecting... | |||
Erasing flash... | |||
Writing at 0x00060a00... (100 %) | |||
Leaving... | |||
The ESP is now ready to be configured for lua scripting. I’ll be taking advantage of MQTT for sending simple messages around my home. | |||
Revision as of 02:24, 14 April 2016
working with Windows
Driver for FTDI interface
Applications to program the ESP8266
NODElua
ESP8266 as an Arudino device
Options
Connecting ESP8266 to Raspberry Pi
Turn off aLaMode (don’t know if this is necessary) Connect Tx, Rx, GND directly to GPIO pins Connect VCC, CH_PD, to 3v3
Device is accessible via /dev/ttyS0 on 9600 baud. Used Arduino IDE serial monitor.
Used a variety of AT commands. Verified that I could connect to its Access Point (open wifi) Connected it to home wifi network
Pinged repeatedly. Power off/on time is < 1 second
____________
Flashing ESP from RPi using NODEMCU firmware
Steps:
- Ensure /dev/ttyS0 port is a functioning serial port
This may already be setup. Mine was configured when installing aLaMode ArduinoIDE support.
- Install python library pyserial (used by firmware uploader tool)
sudo pip install serial
- Baud rate. This presented a problem the first time around. But the nodemcu firmware uploader tool is open source so I was able to figure out the problem myself. Here’s the code that prevented the firmware from uploading to my ESP:
#Default baudrate. The ROM auto-bauds, so we can use more or less whatever we want. ESP_ROM_BAUD = 115200
(Might want to check the assumption on this one.)
My ESP has the original firmware installed and does not auto-sense baud rate like some of the later versions do. The NODEMCU tool uses 115200, so I had to change the baud rate from 9600 (default) to 115200. AT+CIOBAUD=115200
- . Start a new clone of nodemcu-firmware from git
sudo git clone https://github.com/nodemcu/nodemcu-firmware
Or if this is already done update the repo (from nodemcu-firmware folder)
sudo git pull
- If necessary, change directory to the nodemcu-firmware project
cd /nodemcu-firmware/
- Put ESP8266 into flash mode by connecting GPIO-0 to ground and then apply power (or power cycle)
Note: connecting GND and GPIO0 to different grounds on RPi (pins 6 and 14) did not register as GPIO0=low (went into some sort of non responsive mode). Therefore, GND and GPIO0 should use a common ground (be directly connected)
- Run uploader specifying the serial port and firmware that was included in the git clone (from the nodemcu-firmware root folder):
sudo tools/esptool.py --port /dev/ttyS0 write_flash 0x00000 pre_build/latest/nodemcu_latest.bin
Success!
Connecting... Erasing flash... Writing at 0x00060a00... (100 %)
Leaving...
The ESP is now ready to be configured for lua scripting. I’ll be taking advantage of MQTT for sending simple messages around my home.