diff --git a/Flash-Sonoff-using-Raspberry-Pi.md b/Flash-Sonoff-using-Raspberry-Pi.md index 33fc7460..6795cfde 100644 --- a/Flash-Sonoff-using-Raspberry-Pi.md +++ b/Flash-Sonoff-using-Raspberry-Pi.md @@ -11,8 +11,14 @@ So, I will summarize the process and needed adoptions based on the above blog, p `sudo pip install esptool` -2. Prepare serial connection -(This is adopted for RaspberryPi 3, before it was ttyAMA0) +2. Prepare serial connection. + +_Note: Use the correct serial connection as per your version of the Raspberry Pi._ + +| Device | Serial Connection | +| ------------- |---------------| +| RaspberryPi 1/2 | /dev/ttyAMA0 | +| RaspberryPi 3 | /dev/ttyS0 | `sudo systemctl stop serial-getty@ttyS0.service` @@ -48,20 +54,82 @@ This is how it looks in real-life 😆 # Flashing the firmware 1. Erase flash memory: -Connect 3,3V while button pressed to enter flash-mode: +Connect 3,3V while button pressed for about 10 seconds to enter flash-mode. Then release and run: -`esptool.py --port /dev/ttyS0 erase_flash` +```bash +# if using Raspberry Pi 1/2 use +# esptool.py --port /dev/ttyAMA0 erase_flash + +# if using Raspberry Pi 3 use +esptool.py --port /dev/ttyS0 erase_flash +``` +You should see output like this: + +```bash +➜ ~ esptool.py --port /dev/ttyAMA0 erase_flash +esptool.py v2.5.1 +Serial port /dev/ttyAMA0 +Connecting.... +Detecting chip type... ESP8266 +Chip is ESP8285 +Features: WiFi, Embedded Flash +MAC: dc:4f:22:ab:5e:dc +Uploading stub... +Running stub... +Stub running... +Erasing flash (this may take a while)... +Chip erase completed successfully in 3.3s +Hard resetting via RTS pin... +➜ ~ +``` 2. Flash .bin, which you can download from the [release-section](https://github.com/arendst/Sonoff-Tasmota/releases): -Again connect 3,3V while pressing button: +Again connect 3,3V while pressing button for 10 seconds. Then release and run: -`esptool.py --port /dev/ttyS0 write_flash -fm dout 0x0 /path/to/downloaded/sonoff.bin` +```bash +# if using Raspberry Pi 1/2 use +# esptool.py --port /dev/ttyAMA0 write_flash -fm dout 0x0 /path/to/downloaded/sonoff.bin + +# if using Raspberry Pi 3 use +esptool.py --port /dev/ttyS0 write_flash -fm dout 0x0 /path/to/downloaded/sonoff.bin +``` + +You should see output like this: + +```bash +➜ ~ esptool.py --port /dev/ttyAMA0 write_flash -fm dout 0x0 sonoff-basic.bin +esptool.py v2.5.1 +Serial port /dev/ttyAMA0 +Connecting..... +Detecting chip type... ESP8266 +Chip is ESP8285 +Features: WiFi, Embedded Flash +MAC: dc:4f:22:ab:5e:dc +Uploading stub... +Running stub... +Stub running... +Configuring flash size... +Auto-detected Flash size: 1MB +Compressed 456000 bytes to 312426... +Wrote 456000 bytes (312426 compressed) at 0x00000000 in 29.2 seconds (effective 124.8 kbit/s)... +Hash of data verified. + +Leaving... +Hard resetting via RTS pin... +➜ ~ +``` 7. Setup Wifi: -Reboot your sonoff after flashing(toggle power wire) and run a command +Reboot your sonoff after flashing(toggle power wire) and connect to serial console via miniterm: -`miniterm.py /dev/ttyS0 115200 -e` +```bash +# if using Raspberry Pi 1/2 use +# miniterm.py /dev/ttyAMA0 115200 -e + +# if using Raspberry Pi 3 use +miniterm.py /dev/ttyS0 115200 -e +``` You will see some output, after pressing enter.