ESP32 replaces iChip

262 views
Skip to first unread message

Michael Neuweiler

unread,
May 8, 2020, 4:08:52 PM5/8/20
to GEVCU-Development

Hey Amigos,

As mentioned about a year or more ago, I finally replaced the crappy WiFi iChip with an ESP32 (with on-board SD card reader)

The code can be found on https://github.com/neuweiler/GEVCU/tree/develop for GEVCU 4.x and https://github.com/neuweiler/GEVCU-ESP32Web for the ESP32. The ESP32 will work with the web-site files on SPIFFS or an SD card.

The live data communication between GEVCU and ESP32 is no longer done via json as the 115200 baud of the serial interface are too limmiting. I switched to binary data which requires only 3, 4 or 6 bytes per value instead of 16-30 bytes. The ESP32 converts the data to json before sending it via websocket to the browser.

Advantages:
* The dashboard is much more responsive and updates values 10x per second (instead of 1-2x)
* The ESP32 doesn't freeze up while driving (like the ichip did)
* 2MB (SPIFFS) or 64GB (SD card) space for website. Don't know what to do with that much space yet
* Much better reception/discovery of AccessPoint (my iPhone sometimes could not see the ichip AP).
* Full power over connection, server behaviour, etc.
* Lots of spare CPU power for other fancy stuff.
* No electronics parts needed.. it's only wiring. (refer to https://raw.githubusercontent.com/neuweiler/GEVCU-ESP32Web/master/docs/Adapter%20Breadboard.png)

Prototye with GEVCU2:

Adapter board:

In GEVCU 4:

I placed it a bit the wrong way.. could not solder a plug to the antenna on the left for an external antenna. But it works fine like that (with a plastic cover for GEVCU, not metal).

Cheers,
 Michael


Charles Galpin

unread,
Jul 7, 2020, 9:39:52 PM7/7/20
to GEVCU-Development
Hi Michael

This way cool! I'll have to try this sometime. I can't even recall exactly where I left off with my GEVCU years ago, but i think I had attempted to switch from my v2 board to my v4.2 board and found the wifi module stopped working and stopped there. So I'll give this a shot since wifi is a must have for me too.

Can you point me to an ESP32 dev board that comes with a SD card reader? I can't find one. Ideally one with an antenna connector too :)

charles

Matt Arabie

unread,
Aug 31, 2020, 6:17:23 PM8/31/20
to GEVCU-Development
Glad this group isn't dead yet.
Michael, I was looking around after dusting off my EV project and noticed you fork and this thread. If it helps you and others, I have seen a module (ESP32 CAM) that has the ESP32-S has a SD card built on to the board and comes with an external antenna pigtail and antenna. Not sure if the pig tail is long enough to reach the stock GEVCU location.
This plus a little circuit board could make this "plug and play" mod.
esp32cam.jpg

Charles Galpin

unread,
Aug 31, 2020, 7:13:49 PM8/31/20
to gevcu-de...@googlegroups.com
I thought the exact same thing too, so got one, but had trouble trying to map Michael's wiring diagram to my board. I emailed Michael at the time but did not hear back, then got distracted :)

Some of the pins are not exposed on my board and I am confused by the diagram and the code - i must have a fundamental misunderstanding somewhere. 
 
Michael's diagram shows 

J1 pin 4 RX --- ESP GPIO17
J1 pin 3 TX — ESP GPIO16

But the code uses constants 12 and 13

PIN_SERIAL1_RX = 12;
PIN_SERIAL1_TX = 13;

What am I missing? The constant is the GPIO number right?

The pinout for mine is this btw,


Basically all I have to work with are the pins on the right hand side. The left side are for the SD card. I am hoping that this isnt the case of the board not exposing enough pins!

charles

On Aug 31, 2020, at 6:17 PM, Matt Arabie <mar...@gmail.com> wrote:

Glad this group isn't dead yet.
Michael, I was looking around after dusting off my EV project and noticed you fork and this thread. If it helps you and others, I have seen a module (ESP32 CAM) that has the ESP32-S has a SD card built on to the board and comes with an external antenna pigtail and antenna. Not sure if the pig tail is long enough to reach the stock GEVCU location.
This plus a little circuit board could make this "plug and play" mod.
<esp32cam.jpg>
On Tuesday, July 7, 2020 at 9:39:52 PM UTC-4 Charles Galpin wrote:
Hi Michael

This way cool! I'll have to try this sometime. I can't even recall exactly where I left off with my GEVCU years ago, but i think I had attempted to switch from my v2 board to my v4.2 board and found the wifi module stopped working and stopped there. So I'll give this a shot since wifi is a must have for me too.

Can you point me to an ESP32 dev board that comes with a SD card reader? I can't find one. Ideally one with an antenna connector too :)

charles


On Friday, May 8, 2020 at 4:08:52 PM UTC-4, Michael Neuweiler wrote:

Hey Amigos,

As mentioned about a year or more ago, I finally replaced the crappy WiFi iChip with an ESP32 (with on-board SD card reader)

The code can be found on https://github.com/neuweiler/GEVCU/tree/develop for GEVCU 4.x andhttps://github.com/neuweiler/GEVCU-ESP32Web for the ESP32. The ESP32 will work with the web-site files on SPIFFS or an SD card. 

The live data communication between GEVCU and ESP32 is no longer done via json as the 115200 baud of the serial interface are too limmiting. I switched to binary data which requires only 3, 4 or 6 bytes per value instead of 16-30 bytes. The ESP32 converts the data to json before sending it via websocket to the browser.

Advantages:
* The dashboard is much more responsive and updates values 10x per second (instead of 1-2x)
* The ESP32 doesn't freeze up while driving (like the ichip did)
* 2MB (SPIFFS) or 64GB (SD card) space for website. Don't know what to do with that much space yet
* Much better reception/discovery of AccessPoint (my iPhone sometimes could not see the ichip AP).
* Full power over connection, server behaviour, etc.
* Lots of spare CPU power for other fancy stuff.

Prototye with GEVCU2:

Adapter board:
 

In GEVCU 4:

I placed it a bit the wrong way.. could not solder a plug to the antenna on the left for an external antenna. But it works fine like that (with a plastic cover for GEVCU, not metal).

Cheers,
 Michael



-- 
You received this message because you are subscribed to the Google Groups "GEVCU-Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gevcu-developm...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/gevcu-development/dcf4d6a2-5c94-4a7b-b915-3961da5da1f3n%40googlegroups.com.
<esp32cam.jpg>

Matt Arabie

unread,
Sep 1, 2020, 8:17:56 AM9/1/20
to GEVCU-Development
Looking at the original threads picture again and opened up my GEVCU. The WiFi daughter board and the antenna are right next to each other. The pig tail should be more than enough.

Michael Neuweiler

unread,
Sep 1, 2020, 9:08:32 AM9/1/20
to gevcu-de...@googlegroups.com

Cool stuff!! Where can you buy this board?

When designing an interface PCB, consider the final location of the antenna connector. I made a small error there and the antenna's right at the wall of the box. But it also works approx 10-15m around the car and also inside the car. So an external antenna is not absolutely necessary but certainly helpful.

I had to add some minor changes to get it working reliably but now I'm really happy with it. Software and web site can be updated over the air - no wire connection required.

Cheers,
 Michael

--
You received this message because you are subscribed to the Google Groups "GEVCU-Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gevcu-developm...@googlegroups.com.

Michael Neuweiler

unread,
Sep 1, 2020, 9:42:51 AM9/1/20
to gevcu-de...@googlegroups.com

Ooops, sorry charles! ;)

An SD card reader is not an absolute must at this moment. The web site can be stored in 2MB SPIFS for now. But when we add some fancy animations, sounds etc. it might be wise to foresee one.

The GPIOs 16 and 17 are correct - these are used by Serial2 in an ESP32 (see HardwareSerial.cpp lines 18, 22 and 50-53). The pins of Serial1 clash with the ones used for the SD card on my board and caused crashes.

Oh I just realized that GPIO is not exposed on your board. Darn.. different setups complicate things. But it's possible to assign different pins via software or use Serial. But another problem is that the EN(able) pin is not exposed. We need that one so GEVCU can reset the ESP32 in case of a crash. I need it in my setup because at start-up the ESP32 sometimes got stuck and I implemented a heart-beat with automatic reset.

The connections to D18 and LED are not mandatory for operation and could be left out.

Cheers,
 Michael

Michael Neuweiler

unread,
Sep 2, 2020, 2:02:20 AM9/2/20
to gevcu-de...@googlegroups.com

Maybe the 16MB variant of this would be a good alternative when creating an adapter PCB anyway: https://www.aliexpress.com/item/33000362589.html

Or this one (although it ha no SD card) : https://www.aliexpress.com/item/32807887667.html

Matt Arabie

unread,
Sep 2, 2020, 2:28:41 PM9/2/20
to GEVCU-Development
I ordered a ESP32 CAM and dev board that looks like the one Michael is using.

I am curious to see if the CAM board comes with the onboard or the external antenna configured (there is a resistor that has to physically moved depending on the desired antenna).
If soldering is required then not so plug and play, but opens the door for a bodge wire from the esp32cam board to an interface pcb. Bringing the EN pin down.

Charles Galpin

unread,
Sep 2, 2020, 7:00:08 PM9/2/20
to gevcu-de...@googlegroups.com
The CAM board I got has the resistor set to the onboard. 


Thanks Michael- I suspect the CAM board is not a good fit then. Will try the dev board or another, but I like Matt’s longer term idea of a small adapter board. I wonder what the number of boards out there is that could use this. 

-- charles

On Sep 2, 2020, at 2:28 PM, Matt Arabie <mar...@gmail.com> wrote:

I ordered a ESP32 CAM and dev board that looks like the one Michael is using.

Charles Galpin

unread,
Oct 29, 2020, 2:29:25 PM10/29/20
to GEVCU-Development
Ok, finally got around to trying this again - this time with a HiLetGo ESP32 board. I am still having problems.

I am not sure it's wired up correctly, mainly because I see no LED activity and assume I should. Should I see the wifi led on the GEVCU light up when there is communication? Or one on the esp32?

But otherwise I have the WifiEsp32 enabled in the GEVCU and with debug logging see it's getting heartbeats. On the GEVCU-ESP32 side it appears to be getting the config (when miswired i'd see it keep retrying), but on the web ui I do not see the settings. I can also not set any settings (save is never enabled). I can get the logs though, so the websocket is working.

But not sure how to troubleshoot this further. This is a naked GEVCU-4.2 on my desk, with the latest version from your repo. Any ideas?

BTW, I don't have this  HardwareSerial.cpp file - which project are you referring to?

Anyway, tia
charles

ESP32 console log:

ets J
⸮⸮ ⸮⸮⸮ ⸮⸮0,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff0018,len:4
load:0x3fff001c,len:1044
load:0x40078000,len:8896
load:0x40080400,len:5816
entry 0x400806ac
45 - INFO: setup
46 - INFO: Configuring access point: GEVCU
232 - INFO: Access point started
236 - INFO: OTA initialized
E (435) sdmmc_common: sdmmc_init_ocr: send_op_cond (1) returned 0x107
E (517) wifi: addba response cb: ap bss deleted
366 - INFO: SPIFFS Mount successful
368 - INFO: HTTP server started, use http://gevcu.local
368 - INFO: WebSocket configured
369 - INFO: GevcuAdapter configured
10069 - WARNING: GEVCU config not loaded, requesting
31491 - INFO: ws[/ws][1] connect
101272 - INFO: ws[/ws][1] disconnect
115972 - INFO: ws[/ws][2] connect
293485 - INFO: ws[/ws][2] disconnect


GEVCU log:

1311559 - DEBUG: WIFI (ESP32) - incoming: 'hb:973'
1312659 - DEBUG: WIFI (ESP32) - incoming: 'hb:974'
1313759 - DEBUG: WIFI (ESP32) - incoming: 'hb:975'
1314859 - DEBUG: WIFI (ESP32) - incoming: 'hb:976'
1315959 - DEBUG: WIFI (ESP32) - incoming: 'hb:977'
1317059 - DEBUG: WIFI (ESP32) - incoming: 'hb:978'
1318159 - DEBUG: WIFI (ESP32) - incoming: 'hb:979'
1319259 - DEBUG: WIFI (ESP32) - incoming: 'hb:980'

GEVCU 2020-04-11 (build: 1070)
System State: ready
System Menu:

Enable line endings of some sort (LF, CR, CRLF)

Short Commands:
h = help (displays this message)
K = set all outputs high
J = set all outputs low
z = detect throttle min/max, num throttles and subtype
Z = save throttle values
b = detect brake min/max
B = save brake values
p = enable wifi passthrough (reboot required to resume normal operation)
S = show list of devices
w = reset wifi to factory defaults, setup GEVCU ad-hoc network
W = activate wifi WPS mode for pairing
s = Scan WiFi for nearby access points
P = perform pre-charge measurement

Config Commands (enter command=newvalue)

LOGLEVEL=[deviceId,]1 - set log level (0=debug, 1=info, 2=warn, 3=error, 4=off)
SYSTYPE=4 - Set board revision (Dued=2, GEVCU3=3, GEVCU4=4)
WLAN - send a AT+i command to the wlan device
NUKE=1 - Resets all device settings in EEPROM. You have been warned.
KILL=... - kill a device temporarily (until reboot)

Currently enabled devices: (DISABLE= to disable)
     0x1041     WIFI (ESP32)
Currently disabled devices: (ENABLE= to enable)
....
1320359 - DEBUG: WIFI (ESP32) - incoming: 'hb:981'
1321459 - DEBUG: WIFI (ESP32) - incoming: 'hb:982'
1322559 - DEBUG: WIFI (ESP32) - incoming: 'hb:983'
1323659 - DEBUG: WIFI (ESP32) - incoming: 'hb:984'
1324759 - DEBUG: WIFI (ESP32) - incoming: 'hb:985'
1325859 - DEBUG: WIFI (ESP32) - incoming: 'hb:986'
1326959 - DEBUG: WIFI (ESP32) - incoming: 'hb:987'
1328059 - DEBUG: WIFI (ESP32) - incoming: 'hb:988'
1329159 - DEBUG: WIFI (ESP32) - incoming: 'hb:989'
1330259 - DEBUG: WIFI (ESP32) - incoming: 'hb:990'
1331359 - DEBUG: WIFI (ESP32) - incoming: 'hb:991'
1332458 - DEBUG: WIFI (ESP32) - incoming: 'hb:992'
1333558 - DEBUG: WIFI (ESP32) - incoming: 'hb:993'
1334658 - DEBUG: WIFI (ESP32) - incoming: 'hb:994'
1335758 - DEBUG: WIFI (ESP32) - incoming: 'hb:995'
1336858 - DEBUG: WIFI (ESP32) - incoming: 'hb:996'
1337958 - DEBUG: WIFI (ESP32) - incoming: 'hb:997'
1339058 - DEBUG: WIFI (ESP32) - incoming: 'hb:998'
1340158 - DEBUG: WIFI (ESP32) - incoming: 'hb:999'
1341258 - DEBUG: WIFI (ESP32) - incoming: 'hb:1000'
...

Michael Neuweiler

unread,
Nov 8, 2020, 2:59:13 PM11/8/20
to gevcu-de...@googlegroups.com

Hey Charles,

Great you got this far! I'm running it without any problem at all for over 2 months now. I really like the new set-up: 100% reliable, faster, more space, support for SVG graphics (just changed all icons).

Ok, from the log it looks like GEVCU gets data from the ESP. I'm not sure about the other way though... when you open the settings pages, are the values partially pre-filled or all empty/zero (check the loglevel on the system tab) ? To me it looks like the serial buffer of the ESP32 overflows. This might explain why the loglevel is set and the config is not requested (line 121, GevcuAdapter.cpp). To see what's sent to ESP32 also arrives there, remove the comment from line 88 in GevcuAdapter.cpp and check the log of the ESP32. This should work for the settings as they are sent in clear-text, not binary.
But line 50 in GevcuAdapter.cpp should fix that: Serial2.setRxBufferSize(4096);

Check again that you've correctly connected ground between the two boards and maybe also twist the TX/RX lines to reduce interference.

Disabled save button: I tried to change the config once while standing at a red light and the parameters were not properly pre-loaded (with ichip) - yet I changed only one parameter and saved. Let me say, I became an traffic obstacle for ~15min until I had all params set again via serial console. I was lucky I had my laptop with me because Wifi was also gone (all devices disabled). So I added this as a safe-guard. If the button is disabled, something went wrong and it's better it stays disabled.

The LED should blick every 1 sec when no client is connected. When connected it is always on. It doesn't matter if the wiring is not set-up correctly for the LED, it'll still work. It's just a status-indicator.

HardwareSerial: I refer to .../packages/esp32/hardware/esp32/1.0.4/cores/esp32/HardwareSerial.cpp , lines 18, 22, 51/52:

...
#ifndef RX2
#define RX2 16
#endif

#ifndef TX2
#define TX2 17
#endif

#if !defined(NO_GLOBAL_INSTANCES) && !defined(NO_GLOBAL_SERIAL)
HardwareSerial Serial(0);
HardwareSerial Serial1(1);
HardwareSerial Serial2(2);
#endif

HardwareSerial::HardwareSerial(int uart_nr) : _uart_nr(uart_nr), _uart(NULL) {}

void HardwareSerial::begin(unsigned long baud, uint32_t config, int8_t rxPin, int8_t txPin, bool invert, unsigned long timeout_ms)
{
    if(0 > _uart_nr || _uart_nr > 2) {
        log_e("Serial number is invalid, please use 0, 1 or 2");
        return;
    }
    if(_uart) {
        end();
    }
    if(_uart_nr == 0 && rxPin < 0 && txPin < 0) {
        rxPin = 3;
        txPin = 1;
    }
    if(_uart_nr == 1 && rxPin < 0 && txPin < 0) {
        rxPin = RX1;
        txPin = TX1;
    }
    if(_uart_nr == 2 && rxPin < 0 && txPin < 0) {
        rxPin = RX2;
        txPin = TX2;
    }

    _uart = uartBegin(_uart_nr, baud ? baud : 9600, config, rxPin, txPin, 256, invert);
...

I'd love to help somehow and find the problem. We could do a zoom/skype/slack/whatsapp session together to troubleshoot. I'll send you my phone number via PM.

BTW: the ESP32 code also contains OTA capabilities: you can upload code changes over the air with the latest arduino tool.

Cheers,
 Michael

Arbies

unread,
May 9, 2021, 2:58:57 PM5/9/21
to GEVCU-Development
Wow, lost track of this thread. Anyway,
I did get the ESP32CAM board:
    The 0ohm resistor was in the onboard antenna position. (I have seen other, more expensive, version with the external antenna setup) so looks like a little soldering is needed.
     As noticed by others the GPIO is limited. The good thing is there are enough.
        Hardware Serial 0 (GPIO1 and 3) are exposed so could be used for comms to the GEVCU
        GPIO 0 and 16 could be used for the GEVCU LED and GEVCU D18.
        Finally there would need to be a bodge wire to connect the GEVCU to the EN pin on the ESP32
    I put together a little PCB, I have not ordered any yet, as I want to get it working on the bench first. The random solder pad is for the bodge wire.

Spent the weekend dumping the Original GEVCU firmware (4.03.3), updating to the latest official release (5.220).
I have successfully compiled the collin80 and the neuweiler GEVCU versions, in VisualCode/PlatformIO. I am still working through the GEVCUWeb. I'll be the first to admit I am not a software guru, but I do know how to google stuff.

I have seen the other threads with talks about a possible new hardware version (exciting). I think at this point the best idea would be to keep the hardware as aligned as possible. Get it into the hands of the GEVCU users. If I can get it all up and running, I'll post back and if there is enough interest, go into hardware mode.
GEVCU2ESPCAM.png

Charles Galpin

unread,
May 11, 2021, 6:24:33 PM5/11/21
to gevcu-de...@googlegroups.com
Great news, and I’m glad you stuck to it. I am looking forward to see how this works, and am interested in a board or two if it does!

charles

Jason Arnold

unread,
Sep 11, 2021, 7:50:24 PM9/11/21
to GEVCU-Development
Hi all, nearly a year of having all the parts, I finally decided to give this a go last night... and again today lol

DAY 1:
Firstly, I have a NodeMCU ESP32S dev module (https://www.amazon.ca/gp/product/B07QCP2451) and was able to load GEVCUWeb and associated data without much issue. The only programming bump was figuring out the 10uF cap mod that's so popular on these devices (tip: on a 38-pin dev board, don't use the GND next to the 5V pin, seems it's mislabeled).

Following the upload, I then wired the ESP32 to the GEVCU with some 200mm Dupont jumpers for testing... a bit long for my liking, but I did twist the TX/RX as was suggested :) The ESP32 powered up, but didn't present an SSID. However, when I remove the EN pin, and reboot, the GEVCU SSID shows and I can connect. When I navigate to gevcu.local, the "GEVCU loading..." screen appears, but after a time I get an "websocket connection failure, trying to reconnect" error. Also, I've double-checked that pin 12 on the GEVCU's WiFi header is running to GPIO32, but  I never see any activity on the "WIFI" LED?

On the hardware serial side, if I connect to the ESP32 via USB I see some traffic in a serial terminal (see attached for some captures). "GEVCU log.txt" is my fist capture, "GEVCU log (vebose).txt" is after I uncommented line 81 in GevcuAdapter.cpp. Sadly, I'm not having as much luck as Charles. There seems to be a lot of garbage characters, but the heartbeat (hb) ticks along consistently, and after a while I see "ERROR: Too many messages queued" appearing in the mix.

Out of curiosity, should I be able to be connected to both the USB and WiFi serial connections at once?

DAY 2:
Some of these foibles seem due to my test setup (i.e. using a USB 2.0 port to power both the GEVCU and another to power the ESP32), so today I went from USB power to proper 12V. Connecting the ESP32's EN pin to pin 12 of the GEVCU's WiFi header still holds the board in some sort of reset :(

Looking over Charles' logs, I see he has one for the ESP32 that looks rather like mine, but he also has a GEVCU log. For some reason when I connect to my GEVCU over serial I see nothing in the Serial Monitor... perhaps this is causing some of my issues? Reflashing didn't change anything.

While I was at it, I reflashed the ESP32 and the output is very different today; very, very chatty and will actually crash my terminal if left running too long. See attached "GEVCU log (day 2).txt" for the latest.

That's about all the blind thrashing and stumbling I have time for today, but look forward to any replies! Thanks also for all the info above that got me to this point - it's strange to be excited about GEVCU again after so many years!


GEVCU log (verbose).txt
GEVCU log (day 2).txt
GEVCU log.txt
Reply all
Reply to author
Forward
0 new messages