March 16, 2025, 05:49:05 PM

Author Topic: Mustang Electronics Project - Arduino Controlled... well, electronics.  (Read 16046 times)

Offline digitalsolo

Okay all, I think most of you have seen (or can find) my Mustang project car on the forum.    I'm nearing the end of body work (thank God!) and need to stab the engine/tranny in and fab mounts/redo the floor/finish the engine bay, but that is about it as far as things I'm actually able to completely without spending more money.

So, while I recover the bank account (this is important to prevent my wife from killing me in my sleep, which would negatively impact project completion), I'm going to start on another project.

If any of you are familiar with MSD SmartWire or the Infinitybox (formerly "ISIS" before uh, the other ISIS), they're kinda neat systems.   Modular wiring.

Well I want to do something similar in my car, so I'm thinking of this:

Arduino based system that takes low power inputs from all of the controls for chassis electronics (read headlights/tail lights/turn signals/dome lights, window switches, wipers, etc.) and then runs relays to control them.   

Note:  I will NOT be putting brake lights through this.  If that box ever crashes, I don't want my brake lights on it!

This will let me do neato stuff like auto control for power windows (one touch up/down), triple blink turn signals (new cars will do a quick 3 blink turn signal when you touch the lever, for lane changes), pulsing brake lights, yada yada.   Plus I'm a nerd and it's neat.   I'll also be modularizing the electronics, with small relays/control boxes at the front/rear of the car to run their perspective functions instead of a big box in the middle of the car.   That way I can run low voltage, low power control wires everywhere and just actuate relays via that signal.  Then I just run one +12V into each relay center for power output.  Neato.

I plan to run an Arduino with an opto-isolated FET board to handle relay signal control and then just dump signal wires from all the controls into the Arduino so it knows what to do.   The neat thing here is I can actually PWM with solid state relays (or just beefy FETs) if I want do something like PWM fan or fuel pumps.    I may also be able to integrate my electronic power steering assist into this with a VSS reference, because, why not?

Anywho, I figured I'd start a thread on this to see if anyone was interested in the project.   :D

It's worth noting that I've never really done an Arduino and it's been about 15 years since my last EE class at Purdue, so this should be a good learning/remembering experience.   I do have some coding background and I'm pretty sure I still remember how the electrons work, so I think it'll work out okay.  :P
Blake MF'ing McBride
1988 Mazda RX7 - Turbo LS1/T56/ProEFI/8.8/Not Slow...   sold.
1965 Mustang Coupe - TT Coyote, TR6060, modern brakes/suspension...
2007 Aston Martin V8 Vantage - Gen V LT4/TR6060, upper/lower pullies, headers, tune.
2021 Tesla Model 3 Performance - Stock...ish.

Offline Donthitme

Hey Blake, this might help.  I was doing similar research months back.  I wanted smaller fuse boxes around the car but with room for growth.   This box uses 280 pins which is a huge plus and is modular.  The 2nd one is a smaller block but is not mdular.

You can buy them both at Waytek.

http://www.littelfuse.com/products/dc-power-distribution-modules/hard-wired-pdm/hwb60.aspx

http://www.littelfuse.com/products/dc-power-distribution-modules/hard-wired-pdm/hwb18.aspx

Offline digitalsolo

Very cool, thanks!
Blake MF'ing McBride
1988 Mazda RX7 - Turbo LS1/T56/ProEFI/8.8/Not Slow...   sold.
1965 Mustang Coupe - TT Coyote, TR6060, modern brakes/suspension...
2007 Aston Martin V8 Vantage - Gen V LT4/TR6060, upper/lower pullies, headers, tune.
2021 Tesla Model 3 Performance - Stock...ish.

Offline cholmes

Sounds like a neat project Blake, looking forward to updates.

Offline darthmayndawg

Re: Mustang Electronics Project - Arduino Controlled... well, electronics.
« Reply #4 on: August 08, 2016, 06:04:37 PM »
This is great and if it works everyone should be doing this I was wanting to do this myself hopefully you have a nice write up or diagram after the fact

Offline carlb

Re: Mustang Electronics Project - Arduino Controlled... well, electronics.
« Reply #5 on: September 02, 2016, 09:42:36 PM »
Looks like an awesome project. I've wanted to do an infinity box type thing for awhile.
'93 RX-7 Black ~500hp
Forged LS2, MMS 220 Heads, 227/230 114+3, Ported FAST 92
Magnum F, Mamo RPS BC2 Clutch, Ronin 8.8 / 3.55 LSD
Ohlins DFV, RaceLogic TC, RB Dual Tip Exhaust

Offline digitalsolo

Re: Mustang Electronics Project - Arduino Controlled... well, electronics.
« Reply #6 on: September 03, 2016, 09:25:48 AM »
Thanks!    I will probably be starting it in a couple months.    Still working on chassis/drivetrain right now, but I'm about out of of parts to put on the car, at which point his project gets its piece of my free time.  :)
Blake MF'ing McBride
1988 Mazda RX7 - Turbo LS1/T56/ProEFI/8.8/Not Slow...   sold.
1965 Mustang Coupe - TT Coyote, TR6060, modern brakes/suspension...
2007 Aston Martin V8 Vantage - Gen V LT4/TR6060, upper/lower pullies, headers, tune.
2021 Tesla Model 3 Performance - Stock...ish.

Offline MPbdy

Re: Mustang Electronics Project - Arduino Controlled... well, electronics.
« Reply #7 on: September 03, 2016, 10:23:22 AM »
In another life I'd be happy being a controls engineer.

Look into PID control for easy closed loop PWM control. You can do this fairly easily with available arduino resources.

https://youtu.be/r5VaAP09BPA

I think where you may run into complexity issues is multitasking and memory constraints. Especially if you have PID control functionality mixed with other code.

Let's say your windows are auto going down and you turn your headlights on and signal to change lanes and you have your cooling fan PWM controlled to manage a temperature setpoint which is being run by your PID (which you could also do for your AC/blower fan controls... Temp setpoint like a modern car... Could have automatically adjusting cabin lights for nighttime driving. Autoheadlights. Auto windshield wipers etc)

Any one of the functions you're talking about is super simple to wire and code but the complexity of the code grows into interrupts and function calls.

I don't think I ever got multiple PID's to run on one arduino but I'm not very good.

When I code I do it with a perpetual tension headache and pit in my stomach because all I'm doing is copy/pasting bits of code from smart people who know what they're doing and try to brute force it into working program. I don't like it lol. I did a fair amount of arduino control projects in college and it all came from code snippets on forums and websites like this

https://learn.adafruit.com/multi-tasking-the-arduino-part-1?view=all

Offline digitalsolo

Re: Mustang Electronics Project - Arduino Controlled... well, electronics.
« Reply #8 on: September 07, 2016, 11:16:42 AM »
So...  after reading Daniel's points, I decided to make a tweak:

The Arduino Mega is being replaced with a Teensy 3.6.

Teensy 3.6:

180 MHz ARM Cortex-M4 with Floating Point Unit
1M Flash, 256K RAM, 4K EEPROM
Microcontroller Chip MK66FX1M0VMD18 (PDF link)
USB High Speed (480 Mbit/sec) Port
2 CAN Bus Ports
32 General Purpose DMA Channels
22 PWM Outputs
4 I2C Ports
11 Touch Sensing Inputs
62 I/O Pins (42 breadboard friendly)
25 Analog Inputs to 2 ADCs with 13 bits resolution
2 Analog Outputs (DACs) with 12 bit resolution
20 PWM Outputs (Teensy 3.6 has 22 PWM)
USB Full Speed (12 Mbit/sec) Port
Ethernet mac, capable of full 100 Mbit/sec speed
Native (4 bit SDIO) micro SD card port
I2S Audio Port, 4 Channel Digital Audio Input & Output
14 Hardware Timers
Cryptographic Acceleration Unit
Random Number Generator
CRC Computation Unit
6 Serial Ports (2 with FIFO & Fast Baud Rates)
3 SPI Ports (1 with FIFO)
3 I2C Ports (Teensy 3.6 has a 4th I2C port)
Real Time Clock

That ought to be more than enough juice to do anything I want to with it.   It's (mostly) Arduino IDE compatible also.  Dual CAN bus ports means I can pull data to/from the ECU as well.   I figure since memory space is a valid concern, let's just hit that shit with a big hammer up front.  :P

I also have a Raspberry Pi Zero to play with at well (got it free at Cisco Live! in Vegas this year).
« Last Edit: September 07, 2016, 11:25:57 AM by digitalsolo »
Blake MF'ing McBride
1988 Mazda RX7 - Turbo LS1/T56/ProEFI/8.8/Not Slow...   sold.
1965 Mustang Coupe - TT Coyote, TR6060, modern brakes/suspension...
2007 Aston Martin V8 Vantage - Gen V LT4/TR6060, upper/lower pullies, headers, tune.
2021 Tesla Model 3 Performance - Stock...ish.

Offline kinger

Re: Mustang Electronics Project - Arduino Controlled... well, electronics.
« Reply #9 on: October 25, 2016, 02:44:40 PM »
This sounds so awesome because I have no idea what language it is but I see some exclamation marks like it must be badazz so HURRAY! 
93 Touring, 6.3L, T56 Magnum, Mamo RPS BC2 clutch, FAST 90, NW 90TB TB, 8.8, samberg everything, AC, PS, TC, Cruise, LED Tails, HID head lights

Offline digitalsolo

Re: Mustang Electronics Project - Arduino Controlled... well, electronics.
« Reply #10 on: January 22, 2017, 12:21:47 AM »
LOL, so I haven't forgotten this, just been busy on other projects.   It's worth noting that the last time I wrote actual code was 2001, at Purdue, and that was C.   Since then I've only ever done simple scripting.   I -understand- code, but to say I'm rusty is an understatement.

That said, I'm trying to design this in a forward thinking manner, so I'm building a bunch of different things that should make it somewhat flexible.   I started working on it last night, and so far, this is what I have

2 types of switch functions are in place, momentary (only on when you press/hold it) and latching (stays on after you release, until you press it again).   If you tell the program how many latching you want, it will automatically build/map inputs and configure those, then run loops against those to watch for button presses, with an array that tracks the state at all times.     Since it knows how many pins there are, and it knows how many were latching, the rest are then momentary, so it builds more arrays for those, and does the same basic functions.   

That's the start of it, and those will be "universal" functions.   I will build specific functions for:  Center Brake Light, Turn Signals, Hazards.  I want to add in "comfort" signals, where a quick tap does a 3 blink indication, and a "hey stupid, you left the turn signal on" buzzer.   Additionally, the center brake light will pulse on press, with a possible double tap to disable feature.

Beyond that, power window motors will have one touch functions, and I'll current monitor the motor draw to enable that.    The other functions in the design right now will be simple stuff, turning on/off dome lights, footwell lights, headlights, DRLs (maybe), stuff like that.  Those can all live on latching or momentary inputs (if you put a latching physical switch on a momentary input, it acts as a latch, like a door striker for example).    I plan to add some other stuff like a light sensor for turning on headlights/tail lights, etc. eventually as well, but for now, I'm just trying to get it all working.    As this is all simple, I'm building on my Arduino Mega 2560 for now and I'll port it over to my Teensy later (or if I hit my head on the Arduino for CPU power.    Oh, and my interior lights, etc., will probably end up with soft on/off (so they fade in/out).   That's pretty easy to do with a transistor.

Fun fact, I've been building electronics and doing wiring for 25+ years, and I went to college for EE/CE.   I had never used a breadboard before today.   LOLz.
Blake MF'ing McBride
1988 Mazda RX7 - Turbo LS1/T56/ProEFI/8.8/Not Slow...   sold.
1965 Mustang Coupe - TT Coyote, TR6060, modern brakes/suspension...
2007 Aston Martin V8 Vantage - Gen V LT4/TR6060, upper/lower pullies, headers, tune.
2021 Tesla Model 3 Performance - Stock...ish.

Offline digitalsolo

Re: Mustang Electronics Project - Arduino Controlled... well, electronics.
« Reply #11 on: January 22, 2017, 04:28:49 PM »
Spent a bit more time on it today.   I now have (basic) turn signal functionality with adjustable "blink" rate, and hazards with separately adjustable "blink" rate.   I need to look at the "comfort" method still, though I'm not entirely sure that's super relevant with the Mustang's steering column indicator setup, but I'd still like it to be an available option.   :)

Next up is making the brake light flash a few times when you touch the brake, then stay solid.   I'm going to use this for an added center brake light in the rear window.
Blake MF'ing McBride
1988 Mazda RX7 - Turbo LS1/T56/ProEFI/8.8/Not Slow...   sold.
1965 Mustang Coupe - TT Coyote, TR6060, modern brakes/suspension...
2007 Aston Martin V8 Vantage - Gen V LT4/TR6060, upper/lower pullies, headers, tune.
2021 Tesla Model 3 Performance - Stock...ish.

Offline Cobranut

Re: Mustang Electronics Project - Arduino Controlled... well, electronics.
« Reply #12 on: January 22, 2017, 05:52:20 PM »
Spent a bit more time on it today.   I now have (basic) turn signal functionality with adjustable "blink" rate, and hazards with separately adjustable "blink" rate.   I need to look at the "comfort" method still, though I'm not entirely sure that's super relevant with the Mustang's steering column indicator setup, but I'd still like it to be an available option.   :)

Next up is making the brake light flash a few times when you touch the brake, then stay solid.   I'm going to use this for an added center brake light in the rear window.

Just don't have it flash again EVERY TIME you hit the brake.
I got stuck in traffic behind some bozo who added an el-cheapo flasher to his CHMSL.  The damn thing flashed 3 times every time he inched up in traffic.  Thought I was going to have a damn siezure before I could get past the dude.   :o

Even better, have it work as a normal brake light unless you hit the brakes HARD from highway speeds and above.
1995 FD, 7.0 Liter stroked LS3, T56, 8.8, Samberg kit.

Offline digitalsolo

Re: Mustang Electronics Project - Arduino Controlled... well, electronics.
« Reply #13 on: January 22, 2017, 06:53:29 PM »
Pressure based would be more difficult, but I plan to set a timer that won't do the flash again for a period of time, say 30 seconds, that way if you are a nching around, it can only do it twice a minute.   I'm not going to rapid flash it though, probably just 3 times a second (think turn signal).
Blake MF'ing McBride
1988 Mazda RX7 - Turbo LS1/T56/ProEFI/8.8/Not Slow...   sold.
1965 Mustang Coupe - TT Coyote, TR6060, modern brakes/suspension...
2007 Aston Martin V8 Vantage - Gen V LT4/TR6060, upper/lower pullies, headers, tune.
2021 Tesla Model 3 Performance - Stock...ish.

Offline digitalsolo

Re: Mustang Electronics Project - Arduino Controlled... well, electronics.
« Reply #14 on: January 23, 2017, 02:20:06 PM »
I think I figured out a solution for the code to run the brake lights.

I'm curious of three things:

1.  Is anyone interested in this at all?  I'm an electronics nerd, so I think it's really neat, but I'm not sure if anyone else here cares.  ;)
2.  If you do care, does anyone want to see this code?  I can make a GIT repository or something for it if you're interested in it.  It's UGLY I'm sure, I'm not a developer, but I'm happy to share it.
3.  I'm going to put this all in an ECU style box when I'm done, to make it look professional.  Is this anything anyone would be interested in buying, assembled?   I may just 3D print a box for it all, but it would have an ECU type connector (not planning on IP67 water tight, but that is doable if needed).   It'd probably cost around ~150-200 bucks for a whole setup including connectors, etc.   That'd be pretty much cost of materials.   Just curious if anyone has any interest in a box like this.  It's kinda like MSD Smartwire in concept, but probably a lot less fancy (and a lot cheaper).  :)
Blake MF'ing McBride
1988 Mazda RX7 - Turbo LS1/T56/ProEFI/8.8/Not Slow...   sold.
1965 Mustang Coupe - TT Coyote, TR6060, modern brakes/suspension...
2007 Aston Martin V8 Vantage - Gen V LT4/TR6060, upper/lower pullies, headers, tune.
2021 Tesla Model 3 Performance - Stock...ish.