Community
OpenEnergyMonitor

Community

Flashing WiFi MQTT Control Relay Thermostat

relay
esp8266
Tags: #<Tag:0x00007f1fec34a478> #<Tag:0x00007f1fec349f78>

(Yannick Guérin) #1

Hi,

I bought a wifi control relay from OpenEnergyMonitor’s shop one year ago. SInce then I use it as is, controlling the relay with MQTT.

I’m trying to flash espurna on it since 2 weeks, without success. I’m following this page :
https://guide.openenergymonitor.org/integrations/mqtt-relay/#firmware

as stated in this espurna wiki:

I’m using the advanced method with an USB FTDI cable (3.3V). With this cable, i can execute commands like esptools chid_id or flash_id whithout problem:

esptool.py v2.5.1
Serial port COM4
Connecting........_____.
Detecting chip type... ESP8266
Chip is ESP8266EX
Features: WiFi
MAC: 60:01:94:0c:6c:c3
Uploading stub...
Running stub...
Stub running...
Chip ID: 0x000c6cc3
Hard resetting via RTS pin...

and flash_id:

esptool.py v2.5.1
Serial port COM4
Connecting........_____.
Detecting chip type... ESP8266
Chip is ESP8266EX
Features: WiFi
MAC: 60:01:94:0c:6c:c3
Uploading stub...
Running stub...
Stub running...
Manufacturer: c8
Device: 4015
Detected flash size: 2MB
Hard resetting via RTS pin...

The error when I try to flash the image is:

File  md5: 3a7aebd1104043132e36dd1eee112ecf
Flash md5: dc77d004e3e50c32d3c910a5924a25f7
MD5 of 0xFF is e0f309dbdc22c3d233ded1b6a7a717a4
A fatal error occurred: MD5 of file does not match data in flash!

After that, if I boot the esp normally, it loads the original firmware like nothing was done.

Something is wrong with the procedure and I see that the board I have, is not the same as in the documentation (I have no J5 for example).

the Flash md5 is always the same at each retry, so it looks like it’s write protected, is it possible?

If someone could show me a direction, it would be very helpful.

Thanks,This text will be hidden
update:
here is the firmware actually loaded:

Firmware version: 3190 / Oct 20 2017 11:09:48 , SDK: 2.1.0(7106d38), User bin: 0, bootloader version: 6.

Free heap size:28040

Running user1.bin

Uptime: 0 days, 0 hours, 0 minutes, 0 seconds


(Paul Reed) #2

Which relay board was it, the single relay or the 3 relay version?
The older 3 relay version uses an old ESP 03 chip which would probably not have enough capacity for uploading that sketch.
I’m not sure which ESP chip is in the single relay version.


(Paul Reed) #3

Also, just remembered! There is a switch on the 3 relay board to put the panel in upload mode, is there one on the single relayboard too?


(Yannick Guérin) #4

Hi,
thanks for your answers.

It’s the single relay version. I’m pretty new to esp world, I can read ESP-VROOM-02 on the chip on the board. Does it help in knowing which esp it is?

And yes! There is a switch on the side of the board. I have to push it once, after launching esptools. It then enter the mode which could execute the chip_id and flash_id commands.

Is there a special sequence/time to push on the button?

In my case, here is a complete flashing session with the command listed in openergymonitor docs:

esptool.py.exe --port COM4 --baud 460800 write_flash --flash_freq 80m --flash_mode qio --flash_size 16m-c1 0x1000 espurna-1.13.2-openenergymonitor-mqtt-relay.bin
WARNING: Flash size arguments in megabits like ‘16m-c1’ are deprecated.
Please use the equivalent size ‘2MB-c1’.
Megabit arguments may be removed in a future release.
esptool.py v2.5.1
Serial port COM4
Connecting…_____. >> here I pushed then released the button <<
Detecting chip type… ESP8266
Chip is ESP8266EX
Features: WiFi
MAC: 60:01:94:0c:6c:c3
Uploading stub…
Running stub…
Stub running…
Changing baud rate to 460800
Changed.
Configuring flash size…
Compressed 478656 bytes to 342451…
Wrote 478656 bytes (342451 compressed) at 0x00001000 in 8.0 seconds (effective 477.3 kbit/s)…
File md5: 3a7aebd1104043132e36dd1eee112ecf
Flash md5: dc77d004e3e50c32d3c910a5924a25f7
MD5 of 0xFF is e0f309dbdc22c3d233ded1b6a7a717a4

A fatal error occurred: MD5 of file does not match data in flash!


(Paul Reed) #5

The chip appears to be a ESP-WROOM-02

Unfortunatly, I’ve never had much luck with esptool, and much prefer to work with the Arduino IDE, so can’t really help you.
.
When I re-flashed my 3 relay board (shop bought a few years ago), I found it easier to start from scratch and build in features that I needed, and it was a great learning experience - especially as it was just the second time I’d touched a ESP8266.

The designer - Martin Harizanov is usually very helpful, and can be contacted here.

Paul


(Yannick Guérin) #6

Thanks for the links!
I’ll look into these next week. In the mean time, perhaps can someone from openenergymonitor confirm the board changed and adapt the flashing procedure?

I tried other flashing tools today, without success. It looks like nothing is written to the flash

Regards,