**************************************** Upgrade an ESP8266 Gateway with an ESP32 **************************************** In early 2021 we moved on from EMS-ESP for the ESP8266 to EMS-ESP32 for the ESP32 platform. To make use of all the great features of EMS-ESP32 you need to have a Gateway with the ESP32 (or newer S3) chip inside. The older Gateways have the ESP8266 chip inside, however it's possible to update your ESP8266 Gateway to the powerful ESP32. .. note:: If you don't want to upgrade your Gateway with EMS-ESP32, the 'old' firmware will still work as it is of course. But at some point it will lose compatibility with Home Assistant and Domoticz. If you want to upgrade to an ESP32 yourself you can do so with the simple instructions below. If you already have a Gateway Premium II and would like to get one of the new Gateway models instead of replacing just the chip, send me an email via the contact form on the website and I'll give you a 15% discount on a new Gateway of your choice. There are several drop-in replacements available now for the Wemos D1 Mini: the MH-ET Live ESP32 D1 Mini and the new LilyGO T7-S3. .. image:: ../images/hardware/esp32-upgrade-1.JPG :width: 500 :alt: EMS Gateways with ESP8266 and ESP32 LilyGO T7-S3: .. image:: ../images/hardware/S3-upgrade-on-old-gateway.jpg :width: 500 :alt: EMS Gateway with ESP32-S3 Compatible Gateways: All 'old' ESP8266 Gateway models: First edition, Regular, Standard, Premium, Premium II. --You cannot upgrade a S3, S32 or E32 Gateway this way.-- This upgrade also comes with it's downsides: - It's no longer possible to power the Gateway from the bus itself. You need to use the jack or an external USB adapter. - The ESP32 replacement is bigger than the Wemos D1 Mini, so the side piece won't fit anymore (or you have to cut it in two). - You have to modify the enclosure otherwise the top cover won't fit anymore. - The LED is on a different position so it does not align anymore with the hole in the lid (but you can still see it though). Steps to upgrade to the drop-in replacement =========================================== Get the right board ------------------- The best module to get now is the new LilyGO T7-S3. This is the latest ESP32-S3 architecture with 8MB RAM and 16MB Flash. This chip will probably outlast EMS-ESP itself. Check availability of this module on the `LilyGO website `_ or in the `BBQKees webshop `_. Alternatively, many users have upgraded with a MH-ET live ESP32 D1 Mini based on the ESP32. You can buy one yourself online like for instance on `AliExpress `_ (choose the correct ESP32 version) or in `Germany `_. I really recommend using the LiliGO mentioned above. The MH-ET only has 4MB of flash and no PSRAM. This will likely give issues with future firmware updates. Solder on the headers --------------------- Solder on the 8-pin male headers on **only** the inner position like below. this is the same for the MH-ET and the T7-S3. The S3 has longer headers included, you need to cut off 2 pins so only 8 pins remain. .. image:: ../images/hardware/esp32-upgrade-4.JPG :width: 400 :alt: MH-ET board headers 1 .. image:: ../images/hardware/esp32-upgrade-5.JPG :width: 400 :alt: MH-ET board headers 2 (If you buy one from the BBQKees webshop the headers are already soldered on) Load the EMS-ESP firmware ------------------------- Now you need to upload the correct EMS-ESP firmware to the chip. Use an ESP32 firmware version. You need to use the ESP Flasher tool for both the MH-ET or the T7-S3. See :ref:`HERE `. When you load the ESP32 firmware it's preconfigured for the MH-ET version. If you have problems set the board profile in Settings to MH-ET. If you use a build for the S3, you might need to set the board profile to the LilyGO S3 in the settings. .. note:: Only use our dedicated EMS-ESP flash tool as the latest firmware needs modified partitions. Other flash tools do not create the right sizes and your chip will flash, but it will never boot. Modify the enclosure -------------------- The ESP32 board is too wide for the lid of the enclosure of the Gateway. You need to cut off a part or the whole of the screw bushings on the side of the JST/USB connector. Also trim off the edge of the enclosure. See below. **The lid only fits in one orientation on the bottom so make sure you are cutting the right side!** You need to cut the side where the LED hole is. .. image:: ../images/hardware/esp32-upgrade-2.JPG :width: 400 :alt: Enclosure lid trim You also have to leave out the plastic side because the board will stick out. You can trim the side piece as well and then it will fit too. If you did it properly the lid will fit again and it looks like below; .. image:: ../images/hardware/esp32-upgrade-3.JPG :width: 400 :alt: MH-ET board in Gateway Putting it all together ----------------------- - If you can use the service jack you can continue to reconnecting to the bus. You do not need to use a USB adapter. - Otherwise remove the jumper from the Gateway board. By removing the jumper you are disabling the green voltage converter. If you have a board without a jumper, you need to remove the green voltage converter. - Connect a USB cable and adapter to the ESP board. - Reconnect the bus. - Log in to the web interface of the Gateway and reconfigure it to your situation. If jack power does not work anymore ----------------------------------- If powering via the jack does not work properly anymore, you need to reduce the voltage of the green voltage regulator. You can do this by slighty turning the screw pot meter on the back about 5 degrees to the LEFT. DO NOT turn it to the right as it increase the voltage and may damage the ESP32 board. Use a multimeter to verify the voltage. Pinout compatible boards ======================== .. list-table:: :header-rows: 1 * - Function - Wemos D1 Mini - MH-ET D1 - LilyGO T7-S3 * - LED - GPIO02 - GPIO02 - GPIO17 * - RX - GPIO13 (D7) - GPIO23 - GPIO08 * - TX - GPIO15 (D8) - GPIO05 - GPIO05 * - Dallas (DS18B20) - GPIO14 (D5) - GPIO18 - GPIO18 * - Reset - NA - NA - NA Other replacements ================== In general you can use all ESP32/S3/S2/C3 development boards. But none will fit inside the Gateway enclosure. But almost all will work with the Gateway circuit board! Remove the Wemos and use Dupont wires to connect your ESP32 board of choice to the pins on the header of the Wemos on the Gateway board. You cannot use bus power anymore. Use either the jack if it's available or use an USB adapter to power your ESP32 board. If you can use jack power then you can still use the green voltage regulator to power your ESP32 board. Do not draw more than 200mA of current! If you cannot use the jack remove the jumper from the Gateway board. If you have a board without a jumper, you need to remove the green voltage converter. Position your Gateway like below: .. image:: ../images/hardware/gateway-1-7-internals.jpg :width: 450 :alt: Gateway Premium II internals The pins are numbered from left to right. .. list-table:: :header-rows: 1 * - Pin number - Top Wemos header - Bottom Wemos header * - 1 - Not in use - Reset (via the on-board switch) * - 2 - Not in use - A0 (Not in use) * - 3 - Not in use - D0 (Not in use) * - 4 - Not in use - D5 -> Dallas sensor input * - 5 - Not in use - D6 (Not in use) * - 6 - Not in use - D7 -> EMS RX IN * - 7 - Ground - D8 -> EMS TX OUT * - 8 - 5V INPUT to ESP32 from Gateway board - 3,3V OUTPUT from ESP32 to Gateway board