I used to get a lot of speeding tickets when I was in college. In one instance, I was driving a rental Dodge Neon, allegedly, 103 MPH on I-45. That ticket cost me more than $500 to keep it off my record, and back in 2003, it was a lot of money.
When I invent a time machine, I would like to go back and give my younger self a device and an advice. The device will remind me to stay below the speed limit and the advice is to be a better driver for the streets of Texas.Game plan
Spresense can be used as an audible alarm device. It needs to get the current speed to determine if I'm exceeding the limit. I was going to connect to my truck's ODB-II, but that requires buying more hardware. I only needed one thing and using ODB-II seemed like overkill.
In this project, I will tap into my truck's speed sensor to get the current speed. I will also make sure that I can hear the alarm by disconnecting the radio momentarily until I comply with the speed limit.Preparing my truck
The truck uses a three wire speed sensor. Since Spresense will be powered through the cigarette lighter receptacle (i.e. has the same common ground as my truck), I only needed to get one wire out of the speed sensor (the Blue wire in the picture).
That wire carries pulses corresponding to the speed of the truck. At this point, I can get the frequency in Spresense, but that disables my truck's speedometer. I even tried to use an optocoupler I made, but no luck. After a while, the check engine light came on for obvious reasons.
I will solve this problem later on.
I found the fuse that affects the radio sound without disconnecting the radio. I pulled that fuse out and got another fuse I modified by breaking the linkage between the terminals.
I pulled two wires (Orange and White/Orange in the picture) from the fuse box using the modified fuse.
My goal here is to increase the distance not bypass the fuse.
I will use the same colors for the wires coming out of the enclosure that houses Spresense.Ancillary hardware
I went to Micro Center and got myself 2 Channel 5V Relay Module. I only needed one relay with Normally Closed terminals, but for some reason, two relays were cheaper than one. Remember that check engine light issue from before? I used the second channel to solve that problem. Didn't really need the whole thing so I remove the relay and the terminals.
Another reason I removed the relay is the annoying clicking noise which increased as the speed increased and that can't be good for the contacts.Optional hardware
I had a double digit seven segment display laying around collecting dust so I decided to include it in this project.
Not really critical, but I needed to see some numbers while testing and troubleshooting.
That took a little bit of planning and a lot of soldering. In the top right corner you'll see how I figured which pins to connect in parallel to reduce the amount of GPIOs used.
Digit | 1 | 2
Common | 14 | 13
A | 16 | 11
B | 15 | 10
C | 3 | 8
D | 2 | 6
E | 1 | 5
F | 18 | 12
G | 17 | 7
DP X X
One pin to enable each digit and one pin for each letter A to G. That is nine pins for display. The idea here is to enable one digit at the time and use the letters to show the number.Spresense
Started by mounting Main board on the Extension board and setting the operating voltage of the board to 3.3V. Next, I inserted a formatted Micro SD card and powered the board. I used Arduino IDE for DSP Installer (details are here)
Found a professional looking enclosure for Spresense, Relay Module, and Seven Segment Display.
...and damaged it.
Before we go out for a ride, KITT (that's his name now) wanted to wear a headband and grab his boombox.
Remember that fuse that disabled the sound of the radio? It turns out it also disables cigarette lighter receptacle which is what I'm using to power KITT. The project will start correctly and continues to do so up until the threshold speed. The NC contacts became open as it supposed to, KITT loses power, NC contacts return to close, KITT gets power again and realizes I'm over the speed limit so it opens NC relay contacts. One of the wires coming from the fuse box carries power so I used that to bypass the relay only (not the fuse).
I thought testing with 30 MPH would be safer than 60 MPH. Apparently, going 5 MPH below the speed limit is an act of aggression; at least to my fellow Houston drivers. Alarm may sound a little theatrical, but it gets the point across. It sounds very similar to what you would hear if you were a pilot of a Boeing and you are getting very close to making the evening news.