Jump to content

Universal electrics for old cars


Recommended Posts

2 hours ago, elbekko said:

One of the main upsides of the ESP32 that I've found is that all the GPIO pins can do anything. PWM, I2C, CAN,

Yep, pretty much, some are restricted, but not many. Certainly waaaaay more flexible than Arduino. 

Link to comment
Share on other sites

thanks a lot. Thats a better place.

I found, there are nice breakout boards with screw terminals for the ESP32 as well.

It is getting more and more likeable ☺️

  • Like 1
Link to comment
Share on other sites

How did I miss this thread! 😅

I've done quite a lot of this kind of thing, including a Land Rover which used DIY PDM's (based on PIC Microcontrollers + CAN Transceivers).  I ran one big 35mm power ringmain around the whole vehicle and had most things switched by local PDMs with local fuses.  If a light stops working - the fuse will be next to the light.  Seemed a good plan to me.  All the original controls & dash just connected to microcontrollers.   This was in 2001 - so was a bit ahead of it's time!  It worked pretty well.

I'm surprised by your dislike of CAN.  The physical layer is very similar to RS485 - and since you're defining your own protocol for the data, I can't see much difference.

The advantage CAN has, is that many vehicles use it already - making it easy to integrate if you need.  If I were building something from scratch, I'd probably adopt the J1939 Standard

This is very simple compared to a lot of CAN implementations.  It's generally used on Trucks, plant & agricultural equipment (and Polaris vehicles).  It's really easy to implement and because all the PID's are defined universally, you can re-use them.  Then, you can plug in a standard diagnostic tool to your network and get meaningful diagnostic data out of it.

I would exercise a little caution with both Atmega and ESP32 boards.  Atmega doesn't cope at all well with electrical noise.  The build quality of some ESP's leaves a lot to be desired.  I've had the best luck with Adafruit Huzzah ESP32 in automotive applications.  They are relatively expensive - but they also survive long term.

The best of the lot are Teensy.  It's an ARM Cortex processor which seems remarkably resilient.  It also has 3 CAN ports built in.  I've used several of these boards and several others from this range, including a 3 port CAN Bridge in my EV conversion.  It translates between the vehicles J1939, the BMS's OBD2 and the motor controllers proprietary CAN protocol.  It's been bullet proof!

With any of the boards, add a (preferably isolated) DCDC Converter on the power lines, plenty of decoupling capacitors, flyback diodes on any switched outputs and where possible, opto, capacitive or inductive isolation on GPIO pins.  If you do, you can turn a crappy hobby grade microcontroller into one as good as is used in an ECU.

Whichever way you go, I wish you the best with it.  At the very least, it will be educational.

 

  • Like 3
Link to comment
Share on other sites

33 minutes ago, simonr said:

How did I miss this thread! 😅

I've done quite a lot of this kind of thing, including a Land Rover which used DIY PDM's (based on PIC Microcontrollers + CAN Transceivers).  I ran one big 35mm power ringmain around the whole vehicle and had most things switched by local PDMs with local fuses.  If a light stops working - the fuse will be next to the light.  Seemed a good plan to me.  All the original controls & dash just connected to microcontrollers.   This was in 2001 - so was a bit ahead of it's time!  It worked pretty well.

I'm surprised by your dislike of CAN.  The physical layer is very similar to RS485 - and since you're defining your own protocol for the data, I can't see much difference.

The advantage CAN has, is that many vehicles use it already - making it easy to integrate if you need.  If I were building something from scratch, I'd probably adopt the J1939 Standard

This is very simple compared to a lot of CAN implementations.  It's generally used on Trucks, plant & agricultural equipment (and Polaris vehicles).  It's really easy to implement and because all the PID's are defined universally, you can re-use them.  Then, you can plug in a standard diagnostic tool to your network and get meaningful diagnostic data out of it.

I would exercise a little caution with both Atmega and ESP32 boards.  Atmega doesn't cope at all well with electrical noise.  The build quality of some ESP's leaves a lot to be desired.  I've had the best luck with Adafruit Huzzah ESP32 in automotive applications.  They are relatively expensive - but they also survive long term.

The best of the lot are Teensy.  It's an ARM Cortex processor which seems remarkably resilient.  It also has 3 CAN ports built in.  I've used several of these boards and several others from this range, including a 3 port CAN Bridge in my EV conversion.  It translates between the vehicles J1939, the BMS's OBD2 and the motor controllers proprietary CAN protocol.  It's been bullet proof!

With any of the boards, add a (preferably isolated) DCDC Converter on the power lines, plenty of decoupling capacitors, flyback diodes on any switched outputs and where possible, opto, capacitive or inductive isolation on GPIO pins.  If you do, you can turn a crappy hobby grade microcontroller into one as good as is used in an ECU.

Whichever way you go, I wish you the best with it.  At the very least, it will be educational.

 

There you go again......

I so wish you guys would talk in a language a 5yr old can understand....lol Although i would probably still be struggling...

Regards Stephen

  • Haha 1
Link to comment
Share on other sites

14 hours ago, Sigi_H said:

Are there enough I/O? Do not forget all (future) interior switches.

Very few micros have enough IO, but GPIO expander chips are cheap & can be added on I2C or SPI easily for basic ON/OFF IO.

With regard to Simon's excellent comments, the automotive electrical environment is harsh, often very noisy especially on older vehicles, Littelfuse have a great appnote on it:

https://m.littelfuse.com/~/media/electronics_technical/application_notes/varistors/littelfuse_suppression_of_transients_in_an_automotive_environment_application_note.pdf

"Suppression of Transients in an Automotive Environment"

Some key points are the sorts of spikes and drops you can get from things like engine cranking or jump starting:

automotive_transients.png.1e36aa30334db14230fda2705cd1674e.png

It's easy to design something that works on your bench from a nice 12v wall-wart power supply or USB adapter but it's very different making it survive (and work reliably) in an old Land Rover.

  • Like 1
Link to comment
Share on other sites

On 12/3/2023 at 3:11 PM, Arjan said:

Not to mention us mere mortals living out in the deep dark Auvergne where 3 phase is getting rare and solar panels can't be integrated into the grid..

Aside from the ability to get some return from backfeeding the grid, what other need is there to integrate your solar?

Personally, when I can afford solar, I'm most certainly NOT interested in backfeeding for peanuts money from a system that has cost me a few months salary to fit.

 

Link to comment
Share on other sites

1 hour ago, Bowie69 said:

Doesn't quite work like that in the UK, you get paid for every unit you make even if you use it, plus any you don't use, you get paid for again. 

Not any more!

Until a few years ago, that was the case - but now, the feed-in tariff is now quite low (£0.05 per kWh) and only on the power you feed in to the grid!  However, it all adds up! 

There are some better feed-in rates available, but I'm tied in to this one until March.

I would install Solar again in a heartbeat though.  Our total bill for the year has been reduced from £2,618 for 2022 to £567 for 2023. 

  • Like 2
Link to comment
Share on other sites

9 hours ago, FridgeFreezer said:

It's easy to design something that works on your bench from a nice 12v wall-wart power supply or USB adapter but it's very different making it survive (and work reliably) in an old Land Rover.

you're absolutely right, but it's not that difficult again. Since supply of the micro is 5V or 3.3V it is easy to keep most away from the micro with a good stabilisation of the supply voltage. Most really bad spikes come from I/O lines.

Take optocoupler, wherever possible. Use a lot of L/C combinations and feed through capacitors. Put the micro in a sheet metal box to keep away magnetic influences.

Very important is to avoid spikes where they are created. Put diodes to every relay or inductive load. If you have a diesel without high voltage ignition it is half of it. The Diesel eliminates worst problems with spikes. But use the methods anyway, because there will be gasoline engines standing beside you at the trafic light.

 

Link to comment
Share on other sites

9 hours ago, FridgeFreezer said:

That's a good article!

For home built automotive electronics, I've found, using a DCDC converter is the easiest option.  They usually include good transient surpression & voltage clamping on the output.  Then you only have to deal with transients generated inside your circuit.  I have used Varesistor clamps in the past - but they are often not fast enough to deal with <20uS pulses.  It's easy to solve but once you add regulation, you're into a similar cost to the DCDC converter, just with added complexity.

My go-to is the B1505LS - 13-16V in, 5V out, They seem to cope with typical automotive voltage ranges.  As a one-off, they only cost £2.

Link to comment
Share on other sites

A very informative article, but you shouldn't let it scare you. Many things (such as soldering, size of soldering surfaces) only concern series production and are completely uninteresting for diy. The article provides a good theoretical basis, but has little to do with diy practice. So: don't let it scare you.

11 minutes ago, simonr said:

Then you only have to deal with transients generated inside your circuit.

In my experience not. Inside the circuit almost no transients are created. We will not have any time critical procedures. Most problems are from I/O lines in my experience. They can be avoided reliably using optocouplers and L/C combinations generously

Link to comment
Share on other sites

10 minutes ago, Sigi_H said:

In my experience not. Inside the circuit almost no transients are created

Perhaps, I should have phrased it 'noise' as people often interpret 'transient' as high voltage spikes - where it just means brief.

Stick a scope on pretty much any pin on a typical microcontroller & you'll see plenty, particularly if WiFi or BT are active.

All of these things are layers - add as many as you think you need for the level of reliability you want.  If you're just switching the interior light on & off, you can get away with none.  If you're controlling more critical systems, more.

Link to comment
Share on other sites

1 hour ago, simonr said:

 

Stick a scope on pretty much any pin on a typical microcontroller & you'll see plenty, particularly if WiFi or BT are active.

Yes, but 99% of it are no problem. I repeat, this is not time critical. A simple watchdog can solve all problems.

Link to comment
Share on other sites

The board I grabbed has a 7-15V input with regulator, I hope that'll be good enough. It can also take power off USB-C, so that's another easy way to get cleanish power in there.

https://cdn.sparkfun.com/assets/4/5/f/c/2/SparkFun_IoT_RedBoard-ESP32_Schematic_v10.pdf

Screenshot_20240107_171625_Firefox.jpg.a8452a05e3cd222e0406e60af18a8ac0.jpg

As for the GPIO part... CAN seems fairly resilient, and the ESP32/nanoFramework has filtering and debounce built in. We'll see if it's good enough with 8 sparky things.

Link to comment
Share on other sites

First hand experience is that an LM1117 or similar will struggle with automotive voltage as normal charging voltage (14.4v ish) is VERY close to its operating limit (so any spikes or other wobbles will exceed it) and it's dissipating a lot of heat do drop 9-11v across itself (classic linear regulator problem), you don't have to be using it very hard to hit the thermal limit pretty quickly.

There's nice little switch-mode modules all over eBay for peanuts that will be more efficient, you can always chain one into the linear regulator so the switcher does the heavy lifting and the LDO just does the last little bit to make it properly smooth but without having to dissipate all the power.

  • Like 2
Link to comment
Share on other sites

4 minutes ago, FridgeFreezer said:

First hand experience is that an LM1117 or similar will struggle with automotive voltage as normal charging voltage (14.4v ish) is VERY close to its operating limit (so any spikes or other wobbles will exceed it) and it's dissipating a lot of heat do drop 9-11v across itself (classic linear regulator problem), you don't have to be using it very hard to hit the thermal limit pretty quickly.

There's nice little switch-mode modules all over eBay for peanuts that will be more efficient, you can always chain one into the linear regulator so the switcher does the heavy lifting and the LDO just does the last little bit to make it properly smooth but without having to dissipate all the power.

That's probably wise for a final install, indeed, good advice that I've read before (stacking a switch-mode and linear regulator).

Link to comment
Share on other sites

In my eyes there should be no need to solder anything. And I think it will be possible. Coils in the supply line and capacitors to ground can be enough and should hopefully be. Voltage regulaters are already on the boards

 

 

 

 

Link to comment
Share on other sites

  • 2 months later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We use cookies to ensure you get the best experience. By using our website you agree to our Cookie Policy