Hacking a BT Audio Reciever With an Attiny - (How to Simulate a Button Press)
June 10th, 2020
Bluetooth... obey
As far as car audio goes, I like the convenience of Bluetooth. I can hop in my car and my music will start playing on its own, or so I thought…
The Case of the Crappy Bluetooth
My car, my Prius, has an aux port. It's served me well, but the future is wireless and therefore I joined the future and bought myself a cheap Bluetooth to Aux receiver.
The thing about buying cheap BT products is they don't usually work well. This one was no exception. In order to connect my phone I had to hold the receiver button down for 5 seconds (aka. a petite eternity). And not only that; if I wanted to turn off the car, the receiver would have no clue and continue playing my music into the void.
My Problems (TLDR):
I bought a cheap BT reciever
I don't want to return it
It doesn't turn on when the car turns on
It doesn't turn off when the car turns off
Goals:
Automate the power-on of Bluetooth receiver
Program ATTiny to hold button for "x" seconds
Keep battery operation
Add switch to disable/enable battery
Adding a Toggle Switch
First, I need to separate the "normal" battery operated function, and the new and "improved" car functions. To do this I'll add a toggle switch between the LiPo power and the charging port allowing me to disconnect the battery.
Simulating Pressing a Button
Now, to use an ATTiny to sabotage its functions. In order to turn on the BT device automatically I had to simulate a button press. This meant the ATTiny would be soldered onto the input side of the button programmed with a simple delay.
As I found out in my research: some buttons are "pull up" and some are "pull down". These terms just describe whether the button is connected to a positive or negative wire. If you ever need to simulate a button press, make sure you know what kind you need to simulate. Most, however, are pull down, and indeed this one turned out to be pull down.
Optional Additions
I decided to make a small and simple board to hold my ATTiny and keep it removable for future tweaks and wired this little guy together:
Since I had him opened up anyway I soldered a small male auxiliary cord to avoid the need for the two-sided aux adapter that it came with.
Programming
After figuring out the wiring, we need to figure out how to program the ATTiny. In case you haven't done this before, there's a great guide be the HiLo Tech Group. There's two options: modify you're current Arduino Uno to work as ISP, or if you're doing this often I'd recommend buying a simple USBasp programmer.
Here's a model of the working hack in TinkerCAD Circuits. You can play around with the simulation in TinkerCAD.
What about turning it off automatically? Well, as you can tell on the diagram the LiPo is only powering the board when the toggle switch is off. When you turn it on the LiPo is cut off and the ATTiny is connected. This means that when the car turns off there will be no power to allow my music to play into the void.
Finishing Up
Finally, but optionally, in order to make it look like a real home made project I designed a clunky case on fusion 360 and 3D printed it in clear PET plastic. I chose PET because its easy to work with and probably won’t melt on me in the car like PLA would.
And … voalah!
Written by:
I'm a web developer, maker, and constantly learning amateur.