You are viewing thefattony

Previous Entry

Car Radio


So about 3 months ago, i left my car door window down a little too much and a wouldbe passer-by helped themselves to the contents of my car, taking with them my car stereo. now the stereo was not that great, in fact all we used was the aux to play music off our cell phones. seeing I had an old (edit) car stereo amp (12v) laying around with an aux input, I spent a weekend wiring it in to the car speakers. now this worked wonderful, with one pitfall -  the only volume controls were on the cell phone and the amp which got mounted under the dash.
so my wife asked if i could build something so she could adjust the volume form the normal driving position. i had just got an order in for some cheap Bluethooth dropin TTL Transceiver Module and had been playing around with some android apps and knew that with a good weekend of coding i could have a new working "stereo".

I have mainly been working with the Avr ATtiny85 chips but this was something I wanted to get work quickly so I pulled out my trusty Cypress PSoC® 5 FirstTouch™ Starter Kit. after finding my self an old RC control knob and fashioning pause/play button from an old clicky pen,a  2 liter cap and a momentary switch, I programmed the Psoc with and ADC for reading the RC controller position, a digital input pin for the pause/play and a counter for determining where the control knob is at after a set length of time, control register for led output, and lastly a Uart TX for sending commands via the ttl to the phone. 



The coding was short and sweet.  I posted the project on Github Psoc-Car-Stereo, (**lots of cleanup need**) buts it works.
the features that were implemented are.
  • Play / Pause
  • Volume up / down
  • Next track /  Prev  track.

I framed the consoles with old plastic coat hangers and hot glue.
added a 3.7v old cell phone battery for power.
You can see the "Button", the old RC control knob, and battery.


Here is a shot of the back to show the psoc and the prot-o-board connections. the Black rectangle in the top left
is the Bluetooth chip covered in heat shrink.


This is a shot of the back top showing the click pen and the momentary switch.

The top of the pen was removed so we have the pen and the spring without the clicking part.
the bottle cap had a hole drilled and the inside pin part was inserted and glued. a thread was attached to keep the pen from falling out the back side. the momentary switch was positioned where the pen would make contact when the "Button" was pushed.

Now I had some way of sending basic commands over Bluetooth.

next I moved to the android cell phone app. taking the post from XCaffeinated [android-beginners] Re: Serial over Bluetooth  as a starting point, added background threading and receiving and the thread to listen for the commands from the "Car Radio" .
the controls are designed to change the current aps volume. meaning you can contol media volume and cell volume whether or not you are in a call or listening to music.
the controls are mapped to 
  • AudioManager.ADJUST_RAISE
  • AudioManager.ADJUST_LOWER
  • KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE
  • KeyEvent.KEYCODE_MEDIA_PREVIOUS
  • KeyEvent.KEYCODE_MEDIA_NEXT
there are 2 current problems with the app. if the "car radio" is powered off during use the app has to be killed and restarted. on closing the bluethooth connection I get a force close message. the code is very "brute force" but i was just playing with the proof of concept. my plans are to clean up and get a more friendly version i can release for the market. along with the following additional features:
  1. Device pairing and learning.*(allows any ttyl device to control your phone)*
  2. code cleanup and optimization.
  3. Some sort of link check to keep connection alive and to restart on power interuption.

after the code is cleaned up a little and if I get the force close message to stop i will be posting it to github.

here is a demo video showing the debug leds.












Comments

Profile

thefattony
Anthony Pray The 3rd
TheFatTony

Latest Month

October 2011
S M T W T F S
      1
2345678
9101112131415
16171819202122
23242526272829
3031     
Powered by LiveJournal.com