Difference between revisions of "ESP8266"
m |
(Add category Category:Homeassistant) |
||
(15 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
=ESP8266 = | =ESP8266 = | ||
+ | ==My ESP8266 adventures history== | ||
+ | * 14 July 2016 - Ohh snap! Discovered homie arduino / MQTT goodness for ESP8266. Implemented mqttwarn to rewrite topics | ||
+ | * 12 July 2016 - Began working with Nodemcu using esplorer | ||
+ | * 19 September 2015 connected a ESP8266-01 to an arduino as a serial terminal. | ||
+ | |||
==Resources== | ==Resources== | ||
+ | *[https://github.com/arendst/Sonoff-Tasmota/wiki/Esptool Sonoff-Tasmota Esptool] | ||
+ | *Decent writeup on [http://www.esp8266.com/viewtopic.php?f=9&t=820 FTDI config] with RTS and DTR | ||
+ | *[https://github.com/jpmens/mqttwarn mqttwarn] | ||
+ | *[https://github.com/marvinroger/homie-esp8266 Arduino for ESP8266 implementation of Homie] | ||
+ | *[https://github.com/esp8266/Arduino Arduino core for ESP8266] | ||
+ | *[http://esp8266.ru/esplorer/ ESPLorer] | ||
*[https://sites.google.com/site/terminalbpp/ Terminal] com port development tool | *[https://sites.google.com/site/terminalbpp/ Terminal] com port development tool | ||
*[http://www.electrodragon.com/w/ESP8266 ESP8266] at Electrodragon | *[http://www.electrodragon.com/w/ESP8266 ESP8266] at Electrodragon | ||
*[https://cdn.sparkfun.com/assets/learn_tutorials/4/0/3/4A-ESP8266__AT_Instruction_Set__EN_v0.30.pdf Good command reference] | *[https://cdn.sparkfun.com/assets/learn_tutorials/4/0/3/4A-ESP8266__AT_Instruction_Set__EN_v0.30.pdf Good command reference] | ||
+ | *[http://signusx.com/esp8266-windows-compilation-tutorial/ Esp8266 – Windows compilation tutorial for n00bs] | ||
+ | *[https://nurdspace.nl/ESP8266 NURDs ESP8255] Added 12/2/2015 | ||
+ | *[http://www.esp8266.com/ ESP8266 community forum] Added 12/2/2015 | ||
===Arduino as serial terminal=== | ===Arduino as serial terminal=== | ||
Line 41: | Line 55: | ||
</source> | </source> | ||
− | AT+UART_DEF=9600,8,1,0,0 | + | ===Change and save default baud rate=== |
+ | I want to lower the baud rate because the arduino doesn't keep up with 115200 in the soft serial. I tried to issue the command "AT+UART_DEF=9600,8,1,0,0" to change and '''SAVE''' the baud rate but couldn't due to the unreliability of the soft serial at that speed. I was able to change the current baud rate (a shorter string) with "AT+CIOBAUD=9600" Then change baud rate for mySerial in the code, and then write with: "AT+UART_DEF=9600,8,1,0,0" Don't disturb the power while doing this. Then check by disconnecting power and restarting with the terminal set to 9600. | ||
+ | |||
+ | ===Find some SSIDs=== | ||
+ | <source lang="text"> | ||
+ | ready | ||
+ | AT | ||
+ | |||
+ | |||
+ | OK | ||
+ | AT+CWMODE=3 | ||
+ | |||
+ | |||
+ | OK | ||
+ | AT+CWLAP | ||
+ | |||
+ | +CWLAP:(4,"ADP",-39,"b4:75:0e:60:c2:3a",6) | ||
+ | +CWLAP:(4,"ADP_EXT_Desk",-57,"e6:f4:c6:d7:84:00",6) | ||
+ | +CWLAP:(3,"WindyCity",-90,"a4:2b:8c:8f:31:f6",7) | ||
+ | +CWLAP:(3,"Myrcenary",-82,"24:a2:e1:f1:99:1a",11) | ||
+ | +CWLAP:(4,"CenturyLink2902",-81,"20:76:00:5a:eb:d5",11) | ||
+ | |||
+ | OK | ||
+ | </source> | ||
+ | |||
+ | =Home Assistant= | ||
+ | [[File:Soft and Hard Switches.jpg|600px]] | ||
+ | * RF Key fob push button | ||
+ | * RF push buttons | ||
+ | * Stream Deck | ||
+ | * Home Assistant web interface | ||
+ | |||
+ | =Sonoff / Tasmota= | ||
+ | <syntaxhighlight lang="bash"> | ||
+ | mosquitto_pub -t cmnd/sonoff/ipaddress -m '' | ||
+ | </syntaxhighlight> | ||
+ | |||
+ | ==Flash esp-01== | ||
+ | [[File:Esp-01 Programming Jig.jpg|600px]] | ||
+ | ===esptool.py=== | ||
+ | <syntaxhighlight lang="bash"> | ||
+ | esptool.py --port COM21 flash_id | ||
+ | esptool.py --port COM21 erase_flash | ||
+ | esptool.py --port COM21 write_flash 0x1000 .\sonoff.bin | ||
+ | esptool.py --port COM21 write_flash -fs 1MB -fm dout 0x0 sonoff-classic.bin | ||
+ | </syntaxhighlight> | ||
+ | |||
+ | |||
+ | [[Category:Tasmota]] | ||
+ | [[Category:Homeassistant]] | ||
+ | [[Category:HomeAmation]] | ||
+ | [[Category:IoT]] | ||
+ | [[Category:diy]] |
Latest revision as of 09:20, 24 July 2021
Contents
ESP8266
My ESP8266 adventures history
- 14 July 2016 - Ohh snap! Discovered homie arduino / MQTT goodness for ESP8266. Implemented mqttwarn to rewrite topics
- 12 July 2016 - Began working with Nodemcu using esplorer
- 19 September 2015 connected a ESP8266-01 to an arduino as a serial terminal.
Resources
- Sonoff-Tasmota Esptool
- Decent writeup on FTDI config with RTS and DTR
- mqttwarn
- Arduino for ESP8266 implementation of Homie
- Arduino core for ESP8266
- ESPLorer
- Terminal com port development tool
- ESP8266 at Electrodragon
- Good command reference
- Esp8266 – Windows compilation tutorial for n00bs
- NURDs ESP8255 Added 12/2/2015
- ESP8266 community forum Added 12/2/2015
Arduino as serial terminal
/*
jha 9/9/2015
eXperiment with Esp8266
Use the arduino as a terminal to check / program the ESP8266
found the soft serial code here: https://www.arduino.cc/en/Tutorial/SoftwareSerialExample
"Works on my machine"
*/
#include <SoftwareSerial.h>
SoftwareSerial mySerial(10, 11); // RX, TX
void setup() {
Serial.begin(115200);
mySerial.begin(115200); // the ESP8266 I bough on Amazon defaulted to 115,200 baud rate.
}
// the loop function runs over and over again forever
void loop() {
if (mySerial.available()) {
Serial.write(mySerial.read());
}
if (Serial.available()) {
mySerial.write(Serial.read());
}
}
Change and save default baud rate
I want to lower the baud rate because the arduino doesn't keep up with 115200 in the soft serial. I tried to issue the command "AT+UART_DEF=9600,8,1,0,0" to change and SAVE the baud rate but couldn't due to the unreliability of the soft serial at that speed. I was able to change the current baud rate (a shorter string) with "AT+CIOBAUD=9600" Then change baud rate for mySerial in the code, and then write with: "AT+UART_DEF=9600,8,1,0,0" Don't disturb the power while doing this. Then check by disconnecting power and restarting with the terminal set to 9600.
Find some SSIDs
ready
AT
OK
AT+CWMODE=3
OK
AT+CWLAP
+CWLAP:(4,"ADP",-39,"b4:75:0e:60:c2:3a",6)
+CWLAP:(4,"ADP_EXT_Desk",-57,"e6:f4:c6:d7:84:00",6)
+CWLAP:(3,"WindyCity",-90,"a4:2b:8c:8f:31:f6",7)
+CWLAP:(3,"Myrcenary",-82,"24:a2:e1:f1:99:1a",11)
+CWLAP:(4,"CenturyLink2902",-81,"20:76:00:5a:eb:d5",11)
OK
Home Assistant
- RF Key fob push button
- RF push buttons
- Stream Deck
- Home Assistant web interface
Sonoff / Tasmota
mosquitto_pub -t cmnd/sonoff/ipaddress -m ''
Flash esp-01
esptool.py
esptool.py --port COM21 flash_id
esptool.py --port COM21 erase_flash
esptool.py --port COM21 write_flash 0x1000 .\sonoff.bin
esptool.py --port COM21 write_flash -fs 1MB -fm dout 0x0 sonoff-classic.bin