CuVoodoo

the sorcery of copper

User Tools

Site Tools


spark_abacus

This is an old revision of the document!


Table of Contents

The spark abacus is a custom electricity meter with wireless data logging capability. It's a follow-up to the spark counter for a 3 phases 4 wires electricity installation.

EPS8266

To send the values I used a WiFi module based on the ESP8266 SoC.

Several modules based on this chip exist. Since I only use it's WiFi functionality, and no other micro-controller capability, I used the simplest, smallest, and cheapest one, the ESP-01.

ESP-01

ESP-01 moduleESP-01 pinout

To use the device, simply connect the GND, VCC (3.3V), RX (module input), TX (module output), RST (using a pull-up resistor), and CH_PD (using a pull-up resistor) pins.

AT firmware

My module showed the following firmware information when powered up (with 9600 8N1 serial configuration): Vendor:www.ai-thinker.com Version:0.9.2.4. When using the AT+GMR command to get the version it returned 0018000902-AI03. This custom firmware wasn't particularly stable, so I decided to use a more recent standard one.

To flash a firmware you have to enter the bootloader mode by connecting GPIO0 to ground. Then you can use one of the numerous ESP flashing tools. I used esptool.

Espressif offer SDKs for the ESP chip. Since I only want to use this module for its WiFi connectivity I only care about the AT firmware. The AT firmware allows to use the ESP over serial using AT commands. This firmware is provided in the NONOS SDKs (V2.0.0 since 2016-08-10).

The module I had uses a 25Q40 flash chip with only 4Mbits/512KBytes. You can also identity using esptool:

esptool --port /dev/ttyUSB0 flash_id

esptool.py v1.1
Connecting...
Manufacturer: c8
Device: 4013

As mentioned in the SDK notes: “Since the release of ESP8266_NONOS_SDK_V1.5.0, AT firmware is too large to use 4Mbit flash. Please choose flash with at least 8Mbit capacity.”
This is mainly because it is now possible to update the firmware over the air, thus there needs to be a second firmware image the main firmware can write and boot.

I was still able to flash the AT firmware provided in SDK 1.5.0 from 2015-11-27 (archive) using the “non-boot” version as described in the readme.txt:

cd esp_iot_sdk_v1.5.0/bin/at/
esptool --port /dev/ttyUSB0 write_flash 0x00000 noboot/eagle.flash.bin 0x40000 noboot/eagle.irom0text.bin 0x7e000 ../blank.bin 0x3e000 ../blank.bin
esptool.py v1.1
Connecting...
Running Cesanta flasher stub...
Flash params set to 0x0000
Writing 28672 @ 0x0... 28672 (100 %)
Wrote 28672 bytes at 0x0 in 2.5 seconds (92.0 kbit/s)...
Writing 249856 @ 0x40000... 249856 (100 %)
Wrote 249856 bytes at 0x40000 in 21.7 seconds (92.3 kbit/s)...
Writing 4096 @ 0x7e000... 4096 (100 %)
Wrote 4096 bytes at 0x7e000 in 0.4 seconds (90.5 kbit/s)...
Writing 4096 @ 0x3e000... 4096 (100 %)
Wrote 4096 bytes at 0x3e000 in 0.4 seconds (90.5 kbit/s)...
Leaving...

Now when I ask for the firmware version using the AT+GMR command (with 115200 8N1 serial configuration) I get the following:

AT version:0.51.0.0(Nov 27 2015 13:37:21)
SDK version:1.5.0
compile time:Nov 27 2015 13:57:56
OK

Here is also the AT v0.51 Instruction Set for SDK v1.5 (archive).

I wasn't able to get AT firmware for later SDKs (>1.5.0) to flash though. But again, this is just if you have only 4 Mbits (512KBytes) of flash. It is now also possible to get ESP-01 modules with 8 Mbits / 1 MByte of flash, which supports more recent AT firmwares.

spark_abacus.1475312471.txt.gz · Last modified: 2024/01/07 17:49 (external edit)