Hi all
I'm about to start designing a 'Body Control Module' for my 80's campervan, and would like any guidance anyone has on existing projects that may help, and/or hardware support.
My background is, I studied computer architecture, embedded computing, and electronics at university, and am now employed full time as a software developer. I have been an electronics hobbyist for 20+ years, and have been tinkering with AVR uC's since before Arduino, so my skill level should be up to the task
My camper currently has a grand total of 3 computers in it, counting the aftermarket stereo, alarm, and solar controller. It was originally a commercial vehicle, and at the moment has had the interior completely stripped out pending a refit, so is a bare metal shell. (No dashboard even!!)
The plan is to install a system that accepts inputs from across the vehicle (eg. door open switches, panel switches, light sensors, pots) and controls outputs across the vehicle (eg. interior lighting via PWM, status indicators behind input switches, sink water pump, extractor fan etc etc).
This would normally be a straightforward system to design with one uC and lots of I/O, however I would like to avoid having massive amounts of wiring traversing the vehicle. It seems that the CAN bus was designed for just this use case, so am currently considering using this to allow a centralised uC to control all the outputs based on all the inputs.
Awesome ASCII art plan:
PWM IO PWM ADC IO PWM ADC IO PWM IO PWM IO
\ / \ | / \ | / \ / \ /
Main uC Ceiling I/O Cargo wall I/O Kitchen I/O Rear door I/O
|| || || || ||
CAN rxtx CAN rxtx CAN rxtx CAN rxtx CAN rxtx
|| || || || ||
*=++================++======== CAN BUS ====++=====================++====================++=*
Logic for controlling things would be contained on the Main uC, which also has loads of I/O on it, as it will be situated by where the bulk of the vehicle's existing wiring congregates.
The other units will send CAN bus signals to notify the Main uC when a signal state changes, and accept messages from the Main uC to change output states.
Some decisions to make - your input appreciated
-
Use an Arduino for each I/O node, or just use a dedicated I/O expander like MCP25050 (PDIP package available for ~$6) - expander would involve more learning, but would probably simplify everything, and maybe result in a new open source library if there isn't one already =]
-
Use another bus instead? SPI would involve more slave-select lines than I'm comfortable with, and I2C is probably too susceptible to in-car EM noise. LIN seems to be short-distance only. Maybe something like Ethernet might be suitable.
-
Run a separate 5V line around the vehicle, or run a 12V->5V regulator for each node? Leaning towards a common ground and running a 5V regulator for each node, for no real reason other than it seems cleaner than having multiple voltages floating around the camper.
-
Is there anything else I should consider?
Thanks for reading and contributing to my project!
Darren