Three cooling circuits with pumps, valves, electrical high voltage heater with blower, airconditioning with blowers, dual CAN-BUS and much more. In the end the car will be packed with electronics. One of the first blogposts on this topic was controlling the Pierburg CWA pump with Arduino in February 2017. After that in May 2018 controlling the heater ventilation, in August 2018 the OLED screens in the speedometer and in February 2019 controlling the cooling system valve. I have not written much about this topic, but overall a lot of things have happend with special thanks to Erik Ciesluk for his help and support!
My wiring diagram emerged step by step.
As I went along new components and functions were added. Initially I had chosen an Arduino Mega as microcontroller because of the large number of inputs and outputs. I was advised to also look at the Teensy 3.6 since not only does it have a lot of I/O’s, it also has CAN-BUS onboard.
It’s not a 100% Arduino board, but an Arduino compatible boord. The functionality I had developed so far could also be implemented in the Teensy so I switched.
That does have some implications since the Teensy has 3.3V logic whereas the Arduino Mega was 5V. So now I need gate drivers for all mosfets.
And so I started from scratch with a new diagram.
At a certain point in time I decided to count the number of connections: 97!
That did trigger the question, how am I going to organise and connect all that. So I reviewed and compared various connectors.
- TE Ampseal
- TE Superseal
- Molex CMC/CMX
- TE Econoseal 070
- Deutsch DT
- Deutsch DTM
- Molex MX150 34830 Series
To come to a decision I used the following criteria:
- Number of pin count variations
- Allowed amps
- Usable wire size
- Costs of the official crimp tools
In the end I have chosen the TE Ampseal connector.
It’s available with 8, 14, 23 and 35 pins with both horizontal and vertical mating chassis connectors for the PCB. Max current is 8 amps when using tin contacts and even 17 with gold. The crimp pins are available for wire size 0,5 to 1,25 mm2. For the CAN-BUS and wiring of the OLED screens the lower value of 0,5 mm2 is quite thick but not really a problem.
So then I started thinking about what connector combination to use and which function to output where.
I ended up having a 35 pin twice, a 23 pin and a 14 pin connector.
Testing functionalities and currents
Next it was time for some more testing. For example to answer the question ‘What is the real current draw of the fans?’
Switching those fans, 12V leds and some more stuff is being handled via the microcontroller. Together with my son we made a “12V switch” on a breadboard.
Unfortunately that did not work yet, the 12V battery symbol led did not switch off.
Later on I discovered I had forgotten to add the resistor in the pullup and used a piece of wire instead.
After rebuilding the circuit it worked!
The 12V blowers are slightly more difficult to control. I want independent variable speed control for the heater and airconditioning blowers. I am using a PWM control with modified frequency to prevent an audible noise. It already worked on the Arduino Mega and now also on the Teensy.
As I went along, the wiring diagram became more and more complex.
Unfortunately not everything was running as smooth as it should in particular the blower control so I went to Erik who helped me out.
Using his scope he found out that despite the flyback diode the circuit was still facing voltage peaks caused by PWM switching the blower. A Schottky diode instead of a regular diode probably would help.
While everything started to come together in terms of electronics I started working on a schetch of the PCB size and rough layout in Onshape. I’m going to outsource the layouting of the PCB and since the available space is limited a detailed briefing is required.
For most of the components datasheets and dimensions are available but not for all. One of them is the watchdog I am using. It monitors whether the microcontroller is still running and if not resets it. I’ll stack that upside down onto the PCB.
The first couple of components have been positioned.
Next step was checking whether the size and connector positioning would indeed fit in the car so I made a mockup out of cardboard.
Further testing and developing functionalities
Earlier I got a small OLED screen to integrate into the speedometer up and running on the Arduino Mega. I had to redo this for the Teensy.
In the end I got that working too. I’m using the U8G2 or U8x8 library by Oliver Kraus.
That library included some functionality to adjust the brightness of the screen. Although the controller should support that I could not get it to work.
Instead I’ll be using some window tinting foil to reduce brightness.
PWM control pump and valve
Similar to variable speed control of the blowers I also want to dynamically control the motor and batteries cooling pumps. The Pierburg CWA50 pumps I’m using have a PWM signal input. Furthermore I want to control the valve using a microcontroller. So I wrote some code and started testing.
Unfortunately that did not work out as planned. The pump ran full flow and the valve position did not change.
So I started from scratch again with all components on a breadboard.
In the meantime I did buy a LabNation PC scope so I was able to analyse the signals like I did together with Erik.
Now I could also check the voltage spikes of the blower and confirm that using a Schottky diode indeed did help.
Ultimately I managed to get it to work. In the below video you can see the flow increasing and decreasing automatically and the valve position changes by pressing a button.
This was one of the last pieces of the puzzle and now the input and detailed briefing for the PCB designer was ready:
Then it was a matter of awaiting the result.