ESP-M1 Model Train Control System – Part 1

ESP8285 is a smaller version of ESP8266 and comes in three different beakout modules – ESP-M1, ESP-M2 and ESP-M3. The attractive part of this is the size of only 12.3 x 15mm. This being a Wifi module with several IO options it is ideal for my old Model Train Control System.

This picture is of a ESP-M1 which is the smallest module measuring only 12.3 x 15 mm. I selected the M1 because of it’s IPEX antenna and total cost with antenna is ca 3.- USD.

In the earlier prototypes I struggled with size as well as lack of positioning system. The four things I want are Wifi, H-Bridge, a positioning system and an expansion port. With some help of some friends that are big on modelling trains I actually got an idea on a positioning system that is low cost, small and most likely will work – I will return to that later.

ESP-M1 needs an external adapter to be programmed, but luckily those can be purchased in two versions – one that I can use for testing modules and another one I can use for programming the module while mounted on the final system. So, how to program this is already solved by the community. lets have a look at M1:

The content on a ESP-M1 is basically the same as the largest ESP8266 modules – ESP12 have more pins, but those extra pins are already used. The picture above do not show all the capabilities, but it gives an idea:

  • 1Mb Flash, 80Kb RAM
  • Tensilica L106, 80Mhz & 160Mhz, 32 bit MCU
  • Ultra small 12.3 x 15 mm
  • Wifi
  • Build in TCP/IP protocol stack
  • Uses ca 85mA with radio on.
  • Large range of IO – GPIO, ADC, HSPI, UART, I2C, I2S, IR, PWM
  • Support for 802.11 b / g / n / e / i
  • Support Station, SoftAP, SoftAP + STA mode
  • Support Wi-Fi Direct (P2P)
  • Support CCMP (CBC-MAC, counter mode), TKIP (MIC, RC4), WAPI (SMS4), WEP (RC4), CRC hardware acceleration
  • P2PDiscovery, P2P GO mode / GC P2P mode and Power Management
  • WPA / PA2 PSKAnd WPS
  • 802.11 iSafety features: pre-certification and TSN
  • 802.1h / RFC1042Frame encapsulation
  • Seamless roaming support
  • AT Support remote upgrade and cloud OTA upgrade
  • Support Smart Config function (including Android and iOS devices)

I have only used the Arduino toolchain yet, but I will set up the proper toolchain later and dig deeper into the modules capabilities.

The block diagram above illustrates the new system.

PSU My earlier design was limited to 16V and 500mA. I have this time changed a few components and can manage 36V @ 2A. Most modern H0 trains use around 300mA, but some older ones can be above that. The PSU is classic Рa rectifier so we can take any polarity and even AC. a supercap to keep MCU alive and a Current Sensor to measure motor current/torque. Increasing the capacity means I also can use this as a small Wifi power switch or PWM driver.

MCU/Radio is the ESP-M1 module itself. This is Wifi, but it also have some extra features I want to dig into. I have only started playing with this.

Supercap I managed to find a smaller SuperCap that is 4.8 mm in diameter and with a current usage of ca 85mA that should be sufficient to keep the MCU alive 1-2 seconds, but I need to test this one.


Leave a Reply