Here's the concept of this project. Using multiple physical buttons/switches, I want to be able to control the music on my phone (play/pause, next track, previous track, and volume) via bluetooth. So far what I've done is I bought this http://www.amazon.com/gp/product/B00824948U/ref=oh_aui_detailpage_o00_s00?ie=UTF8&psc=1 remote, removed the board, and attempted to solder on leads so I can wire momentary buttons to it. This has proven more than troublesome because the contact pads are very small.
I'm wondering if it would be possible to accomplish this using arduino boards. Is there any way to wire switches to an arduino board (with bluetooth module), that is paired with my phone, and have the switches control play/pause, next track, etc? Or is this not something I'm going to be able to accomplish this way.
Any help would be greatly appreciated, even if it's a nudge in the right direction.
Just for further clarification, my intent with this project is to be able to control the music on my phone while riding my motorcycle, using just my left hand (the switches/buttons would be mounted on my left handlebar).
Is there any way to wire switches to an arduino board
Of course it is.
(with bluetooth module), that is paired with my phone
You have not demonstrated that this is true.
and have the switches control play/pause, next track, etc?
Clearly, that device is sending some information that the phone understands. If you can determine what that information is, you can send the same information. If not, you need to write an application on your phone that takes your data and controls the existing music/video application.
Just for further clarification, my intent with this project is to be able to control the music on my phone while riding my motorcycle, using just my left hand (the switches/buttons would be mounted on my left handlebar).
What was it that the device you linked to was missing? It seems to have all the needed functionality.
If the problem is that the buttons are too small, I can see that being a problem. That's why the physical controls on my trike are big.
Yes, the buttons on the remote are far too small to operate while riding, and I cannot find anything on the market purpose built for something like this.
I don't quite understand what you mean by I "have not demonstrated that this is true" regarding having a bluetooth module that is paired to my phone. I am asking if this is possible, and basically trying to recreate what that remote can do (as far as pair with my phone, and control the music), but with my own switches.
The device does indeed work. How would I go about writing a sketch to capture what data a non-arduino device is sending to my phone though?
Edit: I did some research and figured out how to use my phone to record the bluetooth packets being sent back and forth. I have a log of the information that was sent from the remote, but it's all coming up as "Data - Input - Mouse" for every button press. I'm still looking into it to see if I can discern the difference between the different buttons.
Ok, I figured out what the signal that is being sent is, and it's a mouse input with varrying x/y displacements. For instance, play is x displacement 64, and pause is y displacement 4. Not sure how/why this is, but it seems to be the case.
So now that I know what data is being sent to accomplish the task, what do I need as far as hardware to make this work?
You implied that the device was already paired to your phone. I asked you to demonstrate that this was true. Now, you say that the device is not paired with your phone.
Some bluetooth devices can be paired with some phones. Finding one that is compatible with your phone may be easy. Or, it might not.
Ok, I figured out what the signal that is being sent is
How did you figure this out?
For instance, play is x displacement 64, and pause is y displacement 4.
@PaulS, unusually for you, I think you are a bit behind the ball on this one.
kharvey:
Ok, I figured out what the signal that is being sent is, and it's a mouse input with varrying x/y displacements. For instance, play is x displacement 64, and pause is y displacement 4. Not sure how/why this is, but it seems to be the case.
So now that I know what data is being sent to accomplish the task, what do I need as far as hardware to make this work?
You need to be more precise with your description.
Do you mean that a single number (e.g. 64 or 4) is being sent?
Or do you mean that a stream of numbers is being sent and you have just picked out some typical values?
Are the numbers being sent as readable ASCII values or as their byte equivalents?
Are there are any identifying or delimiting characters - for example x64,y4\r\n
If the device pretends to be a bluetooth mouse you may be out of luck because that could involve a lot of complicated code under the hood.
It may turn out to be easier to write your own program for the phone that can receive bluetooth from the Arduino and control the sound. I don't think you have said what sort of phone you have.
Paul, the portion of my post that you quoted was the hypothetical portion, the part that I am trying to achieve. When I said "paired with my phone", I was saying that I would have a bluetooth module, and it would be paired to my phone. I am new to all this, and am first trying to figure out if the general idea here is feasible before I start working out the details. I haven't looked in to what it's going to take to get a bluetooth module that will pair to my phone yet, but am assuming it's possible based on the little bit of research I have done.
As far as how I figured out what was being sent, I enabled developer mode on my galaxy s5, and set it to log all bluetooth packets being sent/received, opened it in wireshark program on my pc, and via multiple test trials I was able to figure out what each button was sending
Robin, I was picking out the portion that was different between the different buttons. The protocol is HID, and what is being sent is:
Towards the bottom you'll see the x/y displacement lines. There are other lines that could hold different values, but they never do, it's always X or Y displacement, because again, the remote is sending mouse inputs to the phone. The line of code at the bottom of the box changes too, but if I disconnect and reconnect the remote, some of the characters change, so the only constant I have been able to find is that X/Y displacement line.
And to reiterate what I mentioned above, I have a Samsung Galaxy S5
Also, as a side note, I did not have to install any app or anything on my phone in order to get the bluetooth remote to work, I paired it, and it worked.
kharvey:
Towards the bottom you'll see the x/y displacement lines.
My concern is that the app that is displaying the data is hiding a huge USB overhead that is required by the drivers on the phone and which would have to be produced by any emulator of your device.
It would probably be worthwhile trying to find information on the Web about how to write a bluetooth mouse interface for Android.
If you set up a Bluetooth device on an Arduino and pair it with your device you may be able to see (with appropriate code) what data is sent when a button is pressed. If you can, you can probably reproduce it. However the Arduino treats Bluetooth devices as virtual serial ports and I have no idea if that is how a bluetooth mouse works.
@Robin2, though I have little knowledge in this, that sounds like a valid enough concern. I'll do some research on that and see what I can come up with. I have done a bit of research on the Arduino boards and such, am I correct in assuming that I would need a Arduino Uno and a Arduino bluetooth module to be able to begin testing this?
@rogerClark, would the BlueSMiRF allow me to connect analog switches to it? Or would I need another board for that. I'll do some research on this as well when I get home, but I figure why not ask somebody who has knowledge in it already.
would the BlueSMiRF allow me to connect analog switches to it? Or would I need another board for that. I'll do some research on this as wel
AFIK, the BlueSMiRF is bascially just a rather Bluetooth transmitter / receiver module .
You will need an Arduino to control the BlueSMiRF and also to read the value of the physical buttons, and send appropriate X Y mouse positions to the BlueSMiRF for it to send those positions to the audio player
But you don't need to use an Arduino development board like a Uno etc for something like this where you want to embed the Arduino as part of a real world solution
Personally I use Arduino Pro Micro boards (from eBay) for these sorts of thing as they are about the cheapest way to do it and are about the smallest board you can get.
However Pro Mini don't have on-board USB to serial for uploading the program, so you'd need to buy a $5 USB to RS232 adaptor.
Or you could buy a Arduino Mico, which has USB, or a Nano which also has USB but is a bit bigger
I'd go for either the Pro Mini or the Micro in this instance
@rogerClark, The little bit of research i've done in using the bluesmirf board as a HID mouse looks like it may work, so I'm going to grab those components in the tutorial and tinker a bit. If nothing else, this will give me a better understanding. Thanks for the info!
I can't see how it won't work, if your current controller definitely emulates being a mouse
I've not used a BlueSMiRF but the spec seems to indicate it will do HID as mouse, but I guess the only complication may be mimicing something else like the Name of your current controller, but I'd have thought the BlueSMiRF should let you control that sort of thing as well, as it appears to be designed for this sort of use.
@roger, here's hoping. I'm going to blow through the tutorial stuff, get a better handle on it, then figure out how to get the switches wired up to it.
rogerClark:
Am I missing something here... Or doesn't the OP just need to buy the BlueSMIRF module from Sparkfun
From a quick look at the tutorial link (but not obvious from the product link) it seems like this device can deal with the stuff I was concerned about. I must remember its existence.
So i went ahead and attempted to just wire leads to the board from the remote, and surprisingly I did it without screwing any of them up hah. So if I can't get the sparkfun/arduino combo to work I can use the remote and wire on buttons.