Hey! First, thanks for checking out my post In particular I'm looking for feedback on my on wether or not my use of Serial and I2C and layout of the components is the best strategy. Below is some background information on the cluster design, it's not particularly important to my real question so skip to the orange section if your not interested in all the details.
So I've been working on this project for about a year now, all by my lonesome. When I started I had very minimal programming experience and zero background with electronics. To date, I made a glowy halloween costume with neopixels and a LCD. And now this is my second project, obviously much bigger and a little unwieldy, so I'm looking for anyone with more experience to chime in.
WHAT I'M MAKING
An Arduino based instrument cluster, taking some off-the-shelf open source schematics (lots of adafruit stuff) and reworking them onto a few custom PCBs. Custom housing/face built with some 3D-printed pieces and CNC cut acrylic.
- 2 "hybrid" gauges - each with an OLED display, outer ring of neopixels, and a needle pointer.
- 3 additional OLED displays across the top-center area.
- 37 indicator lights, some of which have 2 different colored LEDs behind them. So that means a total of 47 individual LEDs. Of which 9 are "hard-wired" and the rest are controlled by software.
- Ambient light sensor, for backlighting adjustment / whatever future use
- Absolute Orientation sensor (magnetometer+accelerometer+gyro) for determining wether car is going uphill/downhill/etc. Which may help in adjusting the fuel level reading to be more accurate and again for whatever future uses. Also for a digital compass.
• Center LCD Information Center
The center display will have a GUI with on-screen gauges, notifications/alerts, and a menuing system for changing options accessing features. It will be comprised of an Arduino Due and Gameduino for graphics. It will use the steering-wheel controls for interaction.
I want the Information Center to be kind of on it's own (both physically and in functionality), but obviously it needs to communicate with the cluster in order to display on-screen gauges, alerts, and ability to change settings on other parts of the cluster (ie: switch speedometer between metric/imperial)
WHAT I WANT IT TO DO
• Everything the stock cluster does
• Look cool, obviously
• Car Diagnositcs & Analytics
A big goal would be monitoring the data from the car's sensors (via CAN) and looking to see if anything has moved out of it's normal range, read any trouble codes, and basically keep a lookout for abnormalities.
• Support future projects in the car / be extendable
You'll probably notice all the extra indicator lights that aren't on the stock cluster. For example that rain cloud icon is there for an automatic wipers system (which doesn't exist). It'd like to add a separate "auxiliary" CAN network that future extensions can plug into and communicate with the instrument cluster. Adjusting settings through the information center.
THE REQUIREMENTS
So this cluster is to replace the factory one in a 2007 Ford Focus. I have the wiring diagram and workshop manual that gives me a good amount of info on it. I actually feel like I have a pretty good grasp on it now. The basic connections of the factory cluster (to be replicated):
- Almost all the vehicle data comes over the CAN connection, with the exception of:
- 6 Ground-switched indicator lights: Speed Control, Brake Fluid, Park Brake, Antitheft (PATS), Door Ajar, and Oil Pressure.
- 3 powered indicator lights: Left/Right Turn Signals, and High Beams
- PWM feed for backlighting/illumination (comes from the car's dimmer switch)
** Then some more particular interfaces: **
- Fuel tank level sensor (signal and return line): The sensor is a variable resistor ranging from 15 ohms when low to 160 ohms when full. The instrument cluster needs to forward this information to the Powertrain Control Module over the CAN bus.
- Tone request: outgoing signal to the body control module (GEM) to request playing tones/chimes. I think this is PWM based? I don't have an oscilloscope so I haven't figured it out yet.
- Liftgate Inhibit signal: also haven't figured this out yet, but has to do with disabling the trunk opening button when vehicle speed is over a certain amount.
** I also have a chart that describes the CAN traffic the instrument cluster is involved in, pretty minimal, about 20 unique messages that I'll need to decode. **
THE CURRENT PLAN
Hopefully this makes sense, I call it a "functional diagram". It doesn't reflect the actual circuitry or location of things but kind of demonstrates the "Principals of Operation".
Microcontroller A (2x, one left, one right)
Reads in data from serial, controls the neopixel rings and OLEDs for each "hybrid" gauge.
Microcontroller B (2x, one left, one right)
Reads in data from serial, controls the motion of the gauge's pointer needle.
Microcontroller C (On center board with the 3 OLED-only gauges)
It does many things:
• reads in data from serial and controls the 3 OLEDs.
• Reads in data from serial on when to illuminate an indicator (ie: traction control icon).
• Reads in data from I2C on when to illuminate an indicator (ie: the auto-stop-start indicator).
• Detects when one of the hard-wired indicators is activated (passively) and then relay that information to the other microcontrollers via I2C.
Microcontroller D:
Interface with the vehicle's CAN network: retrieving data from the car and transmitting data and responses back to the car. Simultaneously analyzing the data and looking for any abnormal readings.
Microcontroller E:
Handles the special purpose interfaces (fuel tank sensor, tone request, liftgate inhibit). Interface with a "auxiliary" CAN network to connect with future peripherals.
MY QUESTIONS
So, looking at that functional diagram, and reading the microcontollers' roles, does it seem to make sense? Is one of the microcontrollers being asked to do too much?
Does the communication scheme between the microcontrollers make sense? The one-to-many serial setup is probably a little odd but It I think it makes sense in this situation. I also don't know which controller should be the Master on the I2C bus.
Any feedback is greatly appreciated! If anyone wants to join in on this with me, or would like some of my files I'm happy to collaborate