ESP8266/Ideas

From Playful Exploration
Revision as of 02:24, 14 April 2016 by 45.31.182.136 (talk)
Jump to navigation Jump to search


working with Windows

Driver for FTDI interface

Applications to program the ESP8266

NODElua

ESP8266 as an Arudino device

Options

image/svg+xml DHT 11 100 uFCap as close to board as possible Software configured:GPIO,SPI,I2C orSerial Temperatur and Humidity LED control 220ohm TFT Display Barometric Preasure BMP180 low-power-schottky diode- drops voltage to 3.3V- protects from reverse poling- avoids voltage regulator USB to Serialto unbrick + - + Qty 3 1.2 V Rechargable + Qty 2 1.5 V Alkaline + - power switch + Power options Device options/examples AMS1117-3.3 USB or4.8V-15V -RXTX+ -data+ -on/off+ -??+ -???+

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:

  1. Ensure /dev/ttyS0 port is a functioning serial port

This may already be setup. Mine was configured when installing aLaMode ArduinoIDE support.

  1. Install python library pyserial (used by firmware uploader tool)
sudo pip install serial
  1. 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

  1. . 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
  1. If necessary, change directory to the nodemcu-firmware project
cd /nodemcu-firmware/
  1. 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)

  1. 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.