Creating my “Box of Tricks”

auto počítač Slovensko svetla systém varovania Installing a Raspberry Pi into the car with space for headlight warning system and USB power adapter and GPS

This is the box I will use.

As I mentioned in an earlier post, I’m in the process of creating a box to store my Raspberry Pi computer, which I will install in the car. Along with this little Linux powered computer, I want to install a headlight warning system.

In Slovakia it’s the law to always have your headlights turned on, day or night. Unfortunately I sometimes forget to turn on my headlights, and this is something Slovak police take very seriously.

As I’ve mentioned before, the police in Slovakia are generally uninterested if you speed or if you overtake dangerously close into oncoming traffic, however if you dare to drive without headlights – even in bright sunshine – you’ll be stopped immediately and given an on-the-spot fine.

To make sure this doesn’t happen to me, I am developing a headlight warning system on my Suzuki Swift, so that if I drive without my headlights turned on for around 15 seconds, the car will say “Turn on your headlights”.

Everything fits. So far so good.

With the perfect sized box and all the components I need, I got to work making sure everything fits in ok. The Raspberry Pi is the circuit on the top left of the above photo, and when I finally have a TV screen installed into my dashboard, this tiny computer will allow me to surf the internet, check email, and play YouTube videos while I’m in the car (not while actually driving of course).

I even got the idea of having the Raspberry Pi powered up and running all the time, providing it doesn’t use too much power and drain the battery. The benefit of having the computer running all the time is that when I’m waiting for the engine to warm up, I can access the Internet immediately, instead of having to wait 40 seconds for the Raspberry Pi to power up.

The Raspberry Pi consumes only 2.1 Watts when running - 12 volts, 0.18 amps

The Raspberry Pi uses only 2.1 Watts when running.

The main question is then how much power does a Raspberry Pi use when it’s running? I found out by running the little computer through my ammeter.

As you can see in the picture above, the Raspberry Pi uses 0.18 amps on a 11.5 volt power supply. That equals 2.1 Watts which is barely noticeable. For example a car’s interior light uses around 9 watts. This means that if I decide to have it running all the time I don’t have to worry about my car’s battery going flat.

Auto rele počítač Slovensko svetla systém varovania Installing a Raspberry Pi into the car with space for headlight warning system and USB power adapter and GPS

I used silicone sealant on some connections to protect against accidental shorting.

Everything fits so far. In this photo above you can see the Raspberry Pi, the 12v-to-5v power supply (for the Raspberry Pi and headlight warning system), the white “chocolate block” connector, the main power plug, and the automotive relay (which will turn on and supply power to the headlight warning system if the car is operating without the headlights).

The headlight warning system itself is very simple. It’s basically a simple MP3 playing circuit with an SD card slot. I simply need to make an MP3 audio track with the words “Turn on your headlights” onto the SD card with 15 seconds of silence beforehand. This way, when the key is turned and yet no headlights have been activated, after 15 seconds a spoken warning will sound. The simplest ideas are always the best!

Auto rele počítač Slovensko svetla systém varovania

I tapped a simple DB-9 connector into the car’s existing speaker wires.

The headlight warning system has quite a decent output volume for its size, so I can connect it straight to the car’s speaker cables. Hopefully there won’t be any problem with the car’s stereo and the warning system both connected to the same speakers, but time will tell.

In the meantime, I used the multi-pin DB-9 connector (which was just a €3 serial cable cut in half) to tap into the car’s speaker wires, and I also ran a connection into it from the dashboard lights (which illuminate when the headlights are turned on).

While I was behind the stereo, I also set aside a couple of wires in the DB-9 connector to supply power for a GPS tracking system which I will install in the future.

6 - Connecting the headlight warning system system into the car's stereo system behind the dash - Using a DB-9 connector in the footwell

I made everything “plug & play” so that the box can be effortlessly installed or removed.

I installed always-on power, accessories power, and earth to come via a large 3-pin plug, and the speaker wires, GPS power, and headlight power will feed through the DB-9 connector (with a few pins spare for future uses).

This way, I can remove the box easily and effortlessly if I need to fix something or if I wish to add something new in the future. Why crouch down and unscrew wires when you can unplug the whole thing cleanly in 2 seconds. I used the exact same method with my subwoofer and amplifier in the back.

Interestingly, the pins on a typical DB-9 connector are rated at an impressive 7 amps.

On the box end, I connected all the pins on the DB-9 connector and super-glued it in place. Then I insulated it all with a good blob of silicone. It’s not going anywhere!

I coiled up the unused wires inside the box (such as the GPS power) for future use.

DB9 DB-9 konector auto rele počítač Slovensko svetla systém varovania Headlight warning system testing - everything works so far. The car is speaking to me.

I triple-checked all the connections then fired it up. Everything works nicely.

In the end I asked my Slovak wife to record the headlight warning message in her voice as female voices always sound better for nagging, uh, I mean reminders. :)

I got out my microphone, and recorded her saying “Zapnúť svetla” (which means turn on the headlights) as clearly as possible. Having the warning in the Slovak language should give the car a more native Slovak feel. Although considering this car was built across the border in Hungary, maybe it should say it in Hungarian?

The headlight warning system and Raspberry Pi are ready to go into the car.

The image above shows the box’s current appearance, with the DB-9 multi-pin connector and the C13 power connector (commonly called a “kettle plug”) at the front. On the top-right that black thing sticking out is the USB receiver for my wireless keyboard, connected into one of the Raspberry Pi’s two USB outlets.

On the back of the unit are holes for the audio & video output from the Raspberry Pi. Those will go into the car’s TV system when I buy it.

Annoyingly, I had a problem occur when I plugged the system into the car. Everything seemed to power up just fine, however the power output from the Suzuki Swift’s car stereo overloaded (and fried) my MP3 headlight warning circuit. I have a spare circuit which I will wire in, however to save blowing it up, I will not use the car’s existing speakers and instead I’ll install a dedicated speaker for the headlight warning system somewhere under the dash. I have brought a couple of new 10cm / 4 inch speakers for this purpose.

Raspberry Pi external speaker for Slovak headlight law lights must be always on

My new speaker ready to go under the dash.

I bought a set of two speakers, but I will only install one for space-saving reasons. The problem is, this generation of Suzuki Swifts have very little room under the dashboard – every space is used up for something. This means I’ll have to be creative in finding a place to install the speaker while making sure it’s hidden from sight.

Raspberry Pi external speaker for Slovak headlight law lights must be always on

To avoid screw holes, I held it in place with silicone windscreen sealant.

As you can see above, the hidden speaker is well and truly out of sight – although it’s not a pretty looking installation. The location was ideal, but I didn’t want screw holes coming through the plastic (on the other side is a storage box).

I raised the speaker slightly, so the sound shouldn’t be muffled, and if need be the silicone can be cut with a knife, and the speaker removed. Unfortunately I couldn’t do a very pretty job because I only had one hand in that very tight location.

Varovanie! Svetlometov varovný systém. Slovenská polícia zastavovať motoristov.

Everything’s hidden well out of sight!

Once I’d replaced the MP3 circuit and wired up the new speaker into the DB-9 plug, it was just a matter of plugging it in and hiding the box under the carpet, in front of the storage box. To see it in action, check out the video below.

Now the next step is to set up a mobile GPS system so I can track where my car is at any moment. I had some bad luck with the mini GPS tracker I bought, so instead I’m going to try and use the Raspberry Pi as a tracker with a USB GPS aerial and a 3G USB modem. Stay tuned!

You can use all images from this site, but please keep “suzukiswift.info” in the corner.

3 thoughts on “Creating my “Box of Tricks”

  1. The headlight warning system is cool-ish. However, I have to ask the obvious question here. If it’s law to have your headlights on, why not just create a circuit/relay to turn the lights on with the ignition?

    • A very good question, and yes I could have the lights just come on automatically (and almost did) but decided there was no fun in that! 😉

Leave a Reply

Your email address will not be published.