Programming instructions

These instructions explain how to load the espmeter firmware on a fresh Wemos D1 mini. This normally only needs to be done once. Any subsequent updates can be done "over the air" (OTA).

Initial programming

There are two options to load the firmware and file system into the Wemos D1. The easiest method is to let the browser do it. Unfortunately this method only works with Google Chrome and Microsoft Edge. As an alternative a tool can be downloaded to flash the device from the command line.

ESP Web Tools

Using either Google Chrome or Microsoft Edge, go to the on-line firmware installation page and follow the instructions there.

ESPtool program

  1. Download the appropriate esptool binary for the platform that is going to be used to flash the Wemos D1 mini, and unpack the archive.
  2. Download the espmeter firmware and unzip it in the same directory as the esptool.
  3. Connect the Wemos D1 mini to the computer using a microUSB cable. On linux, the serial device appears immediately. On Windows, an appropriate driver may first need to be installed.
  4. Open a terminal and navigate to the directory where the files from step 1 and 2 have been unpacked.
  5. Run the following command (adjust the -cp option if your Wemos D1 mini appears as a different serial device).
    Linux:
      ./esptool -cp /dev/ttyUSB0 -cd nodemcu -cb 921600 -cf espmeter-fw.bin -ca 0x300000 -cf espmeter-fs.bin
    
    Windows:
      esptool -cp COM4 -cd nodemcu -cb 921600 -cf espmeter-fw.bin -ca 0x300000 -cf espmeter-fs.bin
    

In-circuit programming

As indicated, it should not normally be necessary to reflash the Wemos D1 mini once the firmware has been loaded initially. Should the need somehow arise anyway, special action needs to be taken. When the Wemos D1 mini board has been soldered onto the circuit board, the serial receive line is connected to circuitry that will interfere with the communication via the micro USB interface. This circuitry can be disabled by placing a jumper on the JP2 header. The jumper must be removed again before connecting the ESPmeter to the smart electricity meter.