Hardening ESP32 for automotive use

First off I’m no programmer or electronics design engineer and very self taught so assume the worst.

I have built a couple of data gathering modules that transmit different engine parameters to the cabin guages wirelessly via espNow.

They are built on stripboard. The ESPs are based on these boards…

Needless to say they work perfectly on the bench. However in real use they keep locking up.

I have tied all unused pins using the pull-up function. Tied pins that do not support that function with resistors. Electrolytic and 0.1u decoupling caps all over the place. Added transorbs to inputs and power lines.

I tried using the esp watchdog function to reboot the chip but because the chip as a whole locks up it does not get triggered. So I have implemented it in hardware which works if it crashes.

One transmitter is dealing with engine rpms from the points so you can imagine how harsh that is. The input is opto isolated.

The other unit is dealing with temps.

The biggest improvement so far has been to drop the clock speed of the esp.

Any other suggestions, thanks in advance

Gary

The automotive electrical environment is extremely harsh, with circuit-destroying voltage spikes of hundreds of volts on the power line, both positive and negative, along with radiated electrical interference.

For reliable operation, excellent power supply filtering is required, along with complete shielding for the circuit board and filtering of any input leads. Transient suppressor diodes and properly designed LCR filters are used.

Lots of design info can be found on the web using a search phrase like "managing automotive electrical interference".

Thanks for the reply, so there is the first obvious thing I have not tried, case shielding. Got carried away with my 3D printer for the enclosures so being PETG they don’t offer any protection. Might try covering them with copper tape

Power supply on one of the units is fully isolated but it behaves the same.

I bet the ground/negative is not isolated and is used with the signals being monitored. One sure thing to do is to use battery supply instead of anything connected to the auto power and see if the problem still occurs.

Good shout.

I would use opto isolators for digitals , input and output ( and pwm outs ) .

For analog inputs , you will be using voltage dividers which offer a degree of protection , but some filtering also helps . You could even consider op amp buffer .

google “ how to destroy your Arduino “ and “ “ industrial Arduino “ for some tips .

I’ve had success using two stage power supplies 12>9v , then 9>5v ( or 3.3v) with electrolytics and small value poly/ceramic caps in front of and after regulators ( 78 series ok for most cases ) . Add an inductor in series with the 12v supply .

As you said watch dog is useful and possibly bod.

Cross fingers and hope for the best !

Rugged IO

Sorry bod?

I had thought of multiple psu drops, isolated smps for stage 1 and linear for 5v and 3.3v. Running from an isolated battery should confirm if that has legs

There is a logic ip and the points ip both are opto isolated. There is a battery voltage which is via a simple voltage divider, capped and transorbed. I have 4 off board e wire pt100 sensors these come back to adafriut boards that are then spi’d to the esp. This is where I think the biggest pickup could be.

Brown Out Detector.

What do the pt100 measure ? Are they run through shielded cable ?

For temperatures below 150, ds18b20’s might be better??

You can also try removing all I/O and adding in turn to see which causes the issue.

Wiring layout is important , the points signal for example has a high voltage spike on it when the points open.

Your battery input divider should be scaled for something like 20v full scales using the lowest possible esp voltage reference. Use something around 1k for resistor between input and ground in the divider

But if you are using Wifi for communication, you will also shield that. Wireless communication within a vehicle is problematic and wired connections are preferred.

Power Supply can be fairly safe but you will need to prevent reverse voltage and have capacitors that are rated for high voltage (100v) in between diodes to cover the high voltage spikes and inversions.

Thanks Hammy

The PT100s measure cylinder head temps (4 off) around 200C (air cooled engine) & Oil temp around 100c. They are 3-wire but not screened. They terminate into MAX31865 Adafruit boards (each has its own 5V - 3.3V regulators). The boards connect via SPI.

Incomming supply is reverse voltage protected and has a transorb to clamp spikes >16v. This feds a SMPS board to drop to 5V where linear regulators on the ESP and Adafruit boards drop to 3.3v. Both those voltage drops are decoupled and transorbed.

A DIY-EFI board provides a 5v RS232 stream given AFR values, this is resistor level shifted to 3.3V but thinking of opto isolating as it has a 12V driving the probe heater

Yep had thought of that but willing to give it a go. The engine bay is a big metal box as is the cab. I'm amazed at how well its worked out so far. Wireless makes installation simple espeically while playing around, saves long cable runs (even more RFI pickup potential) and ground loops

I have 2 different data servers in the engine bay. Version 1 works 99% of the time. It captures Oil Temp, via PT100 dipstick, Oil pressure via a 5V analogue sender, Engine RPM via schmitt triggered opto isolator. Via ESPNow it wirelessly spews its data to the cab gauges.



The server lives to the side of the engine bay the battery.

The server I'm currently working on is attached to the rear of the big metal fan housing...

and currently sends its data to a CYD

while I work on the server

Nice wheels! We bought one in 1972. Engine a real POS! Valve failures.

Hence merging my various hobbies together. Learnt a lot about the engine and possible gremlins with the instruments. Hence I’d like to get this better.

A PCB should do a lot to better things but I don’t have that skill set

Hi, @garym999
Welcome to the forum.

At this point it might be worth giving us a basic schematic.

Thanks.. Tom.... :smiley: :+1: :coffee: :australia:

Have been planning to learn KiCAD but just took a look to do a schematic and instead I decieded to etch-a-sketch...

The way you power the ESP32 on the sensor board with a 1N4007 to the Vin pin (??) in questionable. The devboard has a linear 3.3v regulator on it, and the 1N4007 may have more voltage drop than 5v minus that, for what is the spec for the regulator, which may cause the working voltage of the ESP32 to drop below 3.3v (i think it still runs on a lot less though), particularly during higher current demands when using WiFi

The diode is a very recent addition and not tested yet off the bench. I added it to stop backfeed in to the rest of the circuit (sensor board) when plugged in to the USB programming port.

The ESP board uses a AMS1117-3.3 regulator and if I have read the datasheet correctly the drop out is 1.1-1.3v so yes that says to me I need 4.6V in so although it works on the bench I think I should take it back out. Or I can change the strap on the switching regulator to 9V and use that as the feed which is well within spec of the regulator.

Of course I'd then need another 5V regulator for the other devices