Eavesdropping on the Single Wire CAN Bus – Part 6: Job Done.

“Do, or do not. There is no try.” – Yoda.

Well, I’m very pleased to say that the entire unit is now fully operational and deployed to the car. If you recall, this is the system that enables me to connect my phone to the car with Bluetooth, in order to play music from the phone to the car’s stereo, whilst leveraging the car’s steering wheel controls to play/pause and change tracks on the phone (continuing from part 5). Whilst my car already had Bluetooth, it was strictly for hands-free phone control, not for music.

The reason for the delay between the previous post and this one was due to a significant amount of trouble in deploying the unit. It actually went quite smoothly in that the functionality worked perfectly the first time it was installed inside the car stereo, however there was a significant amount of noise coming through the speakers whenever I used the device. This is what has taken the time – removing the noise.

To cut to the chase – the noise was caused by the power system in the car – most likely the alternator – as presented on the 12V Accessory line. I originally chose to power my device from the 12V Accessory line as the 12V Accessory line, as the name suggests, is used to power accessories like mine – and only when the car’s ignition is on. This is in contrast to the stereo itself. It turns out that the car stereo always has power, and uses a message from the single wire can bus telling it to wake up when the ignition is turned on. I didn’t want the Arduino (plus Bluetooth module and amplifier) to receiving power at all times, and as such I chose the 12V Accessory line instead. Little did I know though that the 12V Accessory line is extremely noisy.

To make matters worse, I actually had multiple problems at the same time that were all compounding the same symptoms – noise. This made troubleshooting extremely difficult, as I would rarely see an improvement after a change, despite the change correcting an underlying issue.

In summary, the final set of issues that I believe attributed to the noise I was receiving were:

  1. The use of the 12V Accessory line. Even with an LC filter (Inductor + Capacitor), coupled with a DC-DC Converter, shielded cables, and ferrite shields and chokes, I could not remove the noise. This was finally resolved by picking up 12V from the stereo itself – on the clean side of the stereo’s filtering system. I rely on the stereo to filter the noise from the car power system, and present me a clean 12V. However, as the stereo’s 12V is always on, I needed to couple it with a 12V relay which is described further down.
  2. An incorrect understanding of differential balanced audio connections. The car wanted L/R/C (Left/Right/Common) as audio input, and my Bluetooth device output L-/L+/R-/R+. I had incorrectly assumed that L-/R- were essentially ground. This was resolved through an amplifier circuit based on the TPA112 integrated circuit. This converted my L-/L+/R-/R+ to L/R/C.
  3. Using transistors to control the flow of power to the Bluetooth and amplifier circuits. Originally I had the Arduino power off the Bluetooth module and amplifier circuits under certain conditions, but that was contributing to the noise. It could be that this problem would have been resolved by the cleaner 12V signal, but I ended up working around the need for the transistors through code instead, and as such removed them from the circuit.

There was of course a much larger list of other issues that I spent far too much time trying to resolve, but many of those were simply symptomatic of the three problems above. For example, whilst the Arduino was being powered by the 12V Accessory line it was causing further interference to all channels of the car stereo – basically inducing noise into the CD and radio. This for a while caused me to physically relocate the Arduino to a dedicated box sitting under the driver’s seat with too much cabling running back to the stereo. Very unwieldy. Sad. However, once the 12V issue was resolved I was able to move the complete circuit back inside the stereo without issue. When I say ‘inside the stereo,’ I mean the stereo unit itself is contained in a rather large metal box, which is mostly free space. I was able to mount my device inside.

I also tried using a ground loop isolator as well – that was in the circuit for most of the time until I fixed the other problems.

Speaking of mounting my device inside the stereo – I was able to save quite a bit of time with some help from the gentleman who owns this page. He was able to point out various solder points on the stereo’s motherboard.

In order to supply the Arduino with the clean 12V from the stereo and still have my device powered off when the car ignition is turned off, I used a 12V relay powered by the 12V Accessory line (as you can see in the schematic below).

Here is the final schematic for the unit. The components included are:

  1. Freetronics Evelen (Arduino R3 equivalent).
  2. Freetronics Watch Dog module to reboot the Arduino in the case of failure.
  3. SparkFun Logic Level Converter to connect the 5V Arduino’s serial lines to the RN-52 Bluetooth module’s 3.3V serial lines.
  4. SparkFun RN-52 Bluetooth Breakout Board.
  5. Real Time Clock (RTC) used to generate a timer.
  6. DC-DC Voltage Converter converting the 12V-15V DC power from the car to 8V which is supplied to the Arduino.
  7. TPA6112 differential balanced amplifier.
  8. A 5V relay with diode for disconnecting the Arduino from the single wire CAN bus network in the car.
  9. A 12V relay with diode for connecting the Arduino to the clean 12V from the stereo.

This photo shows the final device. The alligator clips were for connecting to a set of headphones to test the audio.

Lastly, here is the device installed in the stereo. Unfortunately there’s still quite a few cables, but at least they are all self contained inside the stereo – with the exception of a cable to connect to 12V Accessory – which isn’t available inside the stereo itself. Luckily though there is an accessory plug just underneath where the stereo sits in the car. I also left a USB cable plugged into the Arduino which is coiled up under the dash – in case I want to change the code on the Arduino without physically dismantling the car (again).

In this photo, the small little circuit board has the 12V relay. Not that you can see from this angle, but it is well shielded from the stereo chassis to which it is is mounted. The ribbon cable in the middle connects the stereo motherboard to the CD player. My device is mounted to the front side (bottom in the photo) of the stereo chassis. It then has one plug connected to it with the L/R/C that connects to the Rear Auxiliary solder points on the stereo motherboard (the red, black and white cables at the bottom right of the photo). It has one other plug coming in with 12V (from the relay), ground, and SWCAN (orange). The red cable leaving the device (on the right side of the photo) is the 12V Accessory cable.

All of the solder points are actually on the underside of the stereo motherboard. You can see the 5 cables going to the underside of the motherboard, at the bottom left and bottom right of the photo.

This photo shows where the L/R/C are connected on the underside of the stereo motherboard. I’m also picking up 12V and ground, but you can’t see them in that photo.

Unfortunately, the device I built is quite physically big – particularly when using an Arduino and a CAN Bus shield. If I was making one of these professionally, all of the necessary components could be placed on a single board. However, with the facilities to which I have access, this was the best solution. The size isn’t really an issue – it fits perfectly inside the stereo and doesn’t touch any other components.

For information, this is what it looked like when the device had its own box.

It feels like a very long journey, with countless assembly and reassembly of the front dash, but I’m pleased to say its finally working. There was quite a lot of ‘clutching at straws’ moments trying to work out what was going on with the noise, but we got there in the end. The ‘we’ in this case refers to the countless hours I was on the phone with my father while I was soldering and re-soldering trying new ideas until we eventually got to the outcome.

The device is now working perfectly, and providing the value for which we hoped. I also learned a huge amount along the way which makes me happy.

~ Mike

5 thoughts on “Eavesdropping on the Single Wire CAN Bus – Part 6: Job Done.

  1. Did you ever sniff the CANBUS codes for HVAC? I’m interested in creating a custom HVAC controller for the VE.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s