Flash EmonESP to ESP8266 Huzzah Wifi - firmware and SPIFFS

Hello
I have an emonTx for remote sensing and have sourced an esp Huzzah wifi unit to enable wifi communication.
As the Huzzah units are no longer sold preloaded with EmonESP, I need to flash EmonESP to this unit.
I am familier with the Arduino IDE but first got stuck compiling as I cannot track down StreamSpy.h that is in the code under the debug.h tab.

I have since tried using Esptool using the following guide:

I have flashed firmware.bin to the Huzzah using a Raspberry pi via an FTDI USB/Serial board.
This was successful, however when I connect the hotspot to the emonTx, the hotspot it is generating is named ‘wifirelay2065’ rather than ‘emonESP_XXX’ as per the guide.

More concerning is that if I navigate to the hotspot in a browser, I can then see the message “/home.html not found, have you flashed the SPIFFS?”

The guide does not mention how to flash the SPIFFS. Can this be done in one command when flashing the firmware also? I am very unclear how this works.

The emontx has been working well when tested nearby to my emonPi. However I will check which firmware is currently on the emonTx now.

Your advice is greatly appreciated, I realise this equipment is a number of years old. I am trying to use it eventually to control an OpenEVSE unit of a similar age to divert only exported solar energy.

Paul

I’m guessing your flashing of the unit wasn’t successful… and its still running whatever firmware it came with (a relay board?)

Can you post your esptool output ?

Hello @alandpearson,

Well, it did flash firmware.bin successfully, but after connecting to the wifi device I can see the following message in a browser:

“/home.html not found, have you flashed the SPIFFS?”

Here is the esptool output:

pi@raspberrypi:~/EmonESP/EmonESP-master/compiled/wifirelay $ esptool --baud 115200 write_flash 0x0 ./firmware.bin
esptool.py v2.8
Found 3 serial ports
Serial port /dev/ttyUSB0
Connecting…
Detecting chip type… ESP8266
Chip is ESP8266EX
Features: WiFi
Crystal is 26MHz
MAC: ac:0b:fb:ee:86:c1
Enabling default SPI flash mode…
Configuring flash size…
Auto-detected Flash size: 4MB
Erasing flash…
Flash params set to 0x0340
Took 2.11s to erase flash block
Wrote 440320 bytes at 0x00000000 in 48.2 seconds (73.1 kbit/s)…

Leaving…
Hard resetting via RTS pin…
pi@raspberrypi:~/EmonESP/EmonESP-master/compiled/wifirelay $ ls
firmware.bin spiffs.bin

Ok. Not sure you have correct firmware
This page lists three versions. One for sonoff one for wifi relay and one for huzza … did you use the one for the huzza?

[edit]
I see this nugget in the release notes :

  • HTML/JS embedded into the firmware, no more uploading the SPIFFS separately

I don’t know much about this - I’ve never tried to flash EmonESP to an ESP8266 Huzzah, so the comments below may be completely wrong. I’ve only had a brief look at EmonESP before, and I was rather confused!

I have a feeling that there are three versions of firmware in the EmonESP github repository:

  1. for EmonESP
  2. for using an ESP8266 to control a relay via wifi
  3. for putting into a sonoff smartplug

Numbers 2) and 3) are in the EmonESP/compiled directories with their associated spiffs.bin files (not sure what these are?) But Number 1) isn’t in the EmonESP/compiled directory

The docs for EmonESP are at
https://docs.openenergymonitor.org/emontx3/esp8266.html
and

The latter says:

Using Esptool

Find and Install esptool, python required. Navigate to the Releases section of the github page and get the firmware.bin and spiffs.bin files. Use the command below to flash the ESP.

esptool.py write_flash 0x0 ./firmware.bin

So it looks like you go to ‘Releases’ (on the right hand side of the EmonESP github page), click on ‘V3.1.4 Latest’ and under ‘Assets’, download ‘firmware.bin’

Then use
esptool.py write_flash 0x0 firmware.bin
to write it to the Huzzah. It seems that ‘spiffs.bin’ is not needed here?

Not sure if this is correct or just adds some confusion!

Why make it easy and call the three files

Huzzah.bin
Sonoff_S20.bin
MQTT_WiFi_relay.bin

when instead you can make it confusing and call them

firmware.bin = FW for Huzzah
smartplug.bin = FW for Sonoff S20
wifirelay.bin = FW for MQTT WiFi relay

Calling a compiled file firmware.ino is just about on a par with, and just as helpful as, calling every C / C++ source file src.ino, which was the craze a few years ago.

@glyn.hudson , @TrystanLea ? It’s OK for you two because you KNOW which is which. For everyone else, you don’t seem to be able to understand that most other people are totally dependent upon the information you publish being comprehensible, complete and accurate. Remember, you can assume your target audience is sensible and intelligent, but you cannot assume they have prior specialist knowledge.

1 Like

Neither do I. I did it a while ago, and was totally confused - hence my post above. I succeeded, I can’t remember how, I think it was more by luck than anything else. What @glyn.hudson & @TrystanLea need to answer is what is the relationship between

and

The files (at least one pair ostensibly doing the same job) are totally different, so where is the information saying which is to be used for what and when? And if one set is obsolete/superseded or for obsolete/superseded hardware, why isn’t it labelled as such?

1 Like

Hello all and thank you for the quick replies, they were all relevant and very helpful.

@alandpearson 's edit regarding SPIFFs flash no longer needed was super helpful, I had not spotted that.

@rupert 's completely correct and that under ‘releases’ there is indeed the correct firmware for the Huzzah. I should have visited there first rather than just downloading the code .zip.

@Robert Appologies if I touched a nerve there, but I feel the frustration also and thank you for fighting our corner, the filenames and src reference is confusing and I was unable to work out what actually applied to my situation. Many thanks.

I have flashed the correct Huzzah firmware and it is behaving as it should be.

Many thanks to you all for your help!

Glad to hear it is working

I can confirm that emonEVSE / openEVSE solar divert works really well, but do get the latest firmware for it. It’s also very easy to setup once you have your monitoring device publishing data to emoncms or to mqtt. Very reliable indeed.