Category Archives: Embedded

New ESP32 WeMos Module

I ordered an ESP32 module from Ebay:

The pinout for the board is shown here:

WeMos ESP32 Pinout

This module is packaged as WeMos compatible board. I’ve used the Wemos ESP8266 modules previously and they provide a neat stackable package with a few pre-built modules for SD card readers, OLED displays, etc.

Plugging the module in and viewing the serial data on boot at 115200 baud shows that ‘Happy Buddha Trading’ appear to install some test software on the device. It doesn’t seem to create a Wifi hotspot, but it does activate the Bluetooth module, which I can view from a phone but not pair to.

ets Jun 8 2016 00:22:57

ets Jun 8 2016 00:22:57

configsip: 0, SPIWP:0x00
mode:DIO, clock div:1
entry 0x40080034
btip start
copy .data from 4000d890 to 3ffae6e0, len 00001830
set .bss 0x0 from 3ffb8000 to 3ffbff70, len 00007f70
BD_ADDR: 24:0A:C4:01:61:0E
RF Init OK with coex
Enable Classic BT
Enable Low Energy

Tested by Happy Buddha Trading

ESP32 Chip ID = 0C6101C40A24
ESP32 SDK: v2.0-rc1-803-g1e0710f1
Bluetooth LE Device 'ESP32_SimpleBLE started

Starting Wifi scan
Scan complete
2 networks found
1: TV License Surveillance (-69)

ESP8266 Arduino `.text’ will not fit in region `iram1_0_seg’ Error

I’ve been writing some software for a Wifi based CAN data logger for the ESP8266 in the Arduino platform, and have been getting a bit of a strange error. It appeared to be related to using the std::string functions in my code – and although I have used this in other sketches without issue, I suddenly received the following error as soon as I simply declared a std::string variable:

c:/users/scott/appdata/local/arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/1.20.0-26-gb404fb9-2/bin/../lib/gcc/xtensa-lx106-elf/4.8.2/../../../../xtensa-lx106-elf/bin/ld.exe: C:\Users\Scott\AppData\Local\Temp\build525647f6f8500d071cfab5cccf314276.tmp/ESPCANLogger.ino.elf section `.text' will not fit in region `iram1_0_seg'

collect2.exe: error: ld returned 1 exit status

A bit of googling appears to show that this is something to do with where those std libraries are stored in the code memory of the ESP8266 (I don’t fully understand the details of the chip). The issue is described in this issue in the Arduino ESP8266 github issues log:

There is a fix shown in this pull request

I had a bit of trouble locating the file referred to, because the Arduino boards manager doesn’t appear to store the added boards in the Program Files location anymore, but these are now located in the AppData folder in your user profile (on Windows 8)


The line which appears to fix it all should be added around line 163:

*libstdc++.a:(.literal .text .literal.* .text.*)

So my file then looked like this:

*libsmartconfig.a:(.literal .text .literal.* .text.*)
*libstdc++.a:(.literal .text .literal.* .text.*)
*(.irom0.literal .irom.literal .irom.text.literal .irom0.text .irom.text .irom.text.*)

There is some more detailed explanation about memory inside the ESP8266 here:

ESP8266 CAN Bus with MCP2515

I have just bought another ESP8266/NodeMCU development board cheapy from eBay (this one) with an ESP-12E chip on board. I’ve also bought an SPI-CAN bus interface with the common Microchip MCP2515 CAN controller to try and create a CAN-Wifi gateway.

The pinout for the ESP-12E NodeMCU board is apparently as below:
ESP-12E NodeMCU Pinout

Continue reading

Closed Loop Ignition Timing Control

I have been busy over the last few weeks with various things, but have now completed most of the practical work on my project and am now at the stage of writing up the report/dissertation. I have successfully managed to achieve closed loop ignition timing control by using the Stellaris Launchpad development board to directly interface with the optical encoder on the engine and the pressure sensor charge amplifier (this replaces the AVL IndiSet 620 in my system).

ECU in black on left, angle of peak pressure and optical encoder interface on right. Connected together via serial

Continue reading

Getting High Tech

Just a quick one on what I’ve been up to the last few days. I now have the engine set up inside so that I don’t have to keep pushing it outside or waiting for the rain to stop. I’ve also set up an optical encoder, in-cylinder pressure sensor, and AVL IndiSet high speed data acquisition unit to capture data on a 0.25 degree crank angle resolution.

Extended exhaust manifold for indoor running

Continue reading

Adding a load

More progress made today, I connected up the alternator to the engine to begin testing it under load. This was pretty successful, and the ECU all performed as expected, with only a few tweaks to the PID controller parameters to improve the AFR control. I restricted the range of fuelling down to as restricted as possible to prevent the system setting wildly large or small fuelling amounts under certain conditions. I finally managed to get the PID to maintain the AFR slightly rich within a few percent under steady state conditions.

Belt drive to alternator

Continue reading

Arduino Controlled Electronic Ignition

Success! I have started and run the engine on my own electronic ignition. The problem was in the end quite simple, it turns out that the missing tooth wheel on the crank was aligned differently to what I expected. I thought that the missing tooth occurred 240 degrees after TDC, but in fact it appears to be aligned almost exactly at TDC. This meant that my spark was happening around Bottom Dead Centre, which is no use at all!

Continue reading