External bluetooth controller

Nitin Ullal shared this idea 3 years ago
Completed

Hi,

I use Locus on my motorbike for off road trips. I want to adjust certain features while driving (zoom, center, display on/off) without having to touch the pad. So I was thinking why not use a bluetooth game controller to control the pad. Would that be possible and how could I map the controller to Locus functions?

Kind regards

Nitin

For example

http://www.miniinthebox.com/de/bluetooth-6-sixaxis-wireless-controller-fuer-ps3-verschiedene-farben_p1217566.html?currency=EUR&litb_from=paid_adwords_shopping&gclid=CLe73pDIyMQCFYIfwwodUSQAZg

http://www.amazon.de/drahtloser-Bluetooth-Controller-Joystick-IP117/dp/B00MUG3JPU/ref=sr_1_6?ie=UTF8&qid=1427460400&sr=8-6&keywords=bluetooth+controller

http://www.amazon.de/Samsung-EI-GP20HNBEGWW-Gamepad-kompatibel-optimiert-schwarz/dp/B00FP825JQ/ref=sr_1_8?ie=UTF8&qid=1427460400&sr=8-8&keywords=bluetooth+controller

Comments (37)

photo
1

Good day Nitin,


sorry to have to say this. I completely understand your request. Control device with Locus with motorcycle gloves is probably completely impossible, right? Anyway solution using game controller is quite funny :).


Unfortunately nothing like this is currently possible. What is possible, is enable in Locus settings > Map - control > Use hardware buttons. Which at least allows to zoom in/out thanks to volume buttons.


Do you have any ideas how other apps (like full featured navigation apps- TomTom, Navigon) works on motorcycle?

photo
1

Hi Menion,

thanks for you reply. I have Copilot and Navigon. Both have the same problem. Everything can only be controlled on screen. Which is only advisable while your standing.


Let's assume that I can connect a bluetooth keyboard to my android device (easier than having to configure a game controller). Wired keyboard does not work, since I need to charge the device. Are there hotkeys for zoom in, zoom, out, start track recording, stop track recording, next map, previous map, auto center map on/off, overlay dashboard, next dashboard, previous dashboard and create point. It that is the case I could use the electronics out of the keyboard and just wire the keys I need to a custom button bar, which I can build. For car use I can just label the buttons accordingly. Would be nice if the keyboard shortcuts are user define able.


That would work for me.

Kind regards

Nitin

photo
1

Hello Nitin,


hmm understand. Seems you are skilled enough to do some special BT keyboard. Anyway when I spend some time by this feature, I think you'll be only one, who will use it :).


I completely understand your problem. This is also something I'll want to solve soon too (control with motorcycle gloves), but your solution is really "hardcore". Maybe some easy control with voice over intercom should be better solution? Not sure if it is easier to do, maybe not. Just thinking ...

photo
1

Hi Menion,


did some looking around.


A 12 button bluetooth keyboard module is available for 19 USD. Works with every bluetooth device.

http://www.adafruit.com/products/1535


it sends a keypress to the computer. We pre-program the module to send

the 4 arrow keys, return, space, 'w', 'a', 's', 'd', '1' and '2' by

default. Advanced users can reprogram the module's keys using an FTDI or

other Serial console cable, for any HID key report they desire. Advanced user can programm different keys.


Button are dead cheap in China and come in all colors (less than 50 Cents a piece).


First approach would not look like this, but that is we it could go.

http://www.weissracing.at/wp/en/weissracing_5_button_switch_entwicklung_development_part_1/


So if you can somehow activate keyboard shortcuts in Locus, than we are set. 12 buttons is more than enough to control the main functions of Locus.


I can offer to help with the development costs or build you a box. Whichever suits you best.


I think if you add a link to this DIY project some people will adapt and create nice locus remotes.


Kind regards

Nitin

photo
1

This sounds and looks almost unbelievable :).


Quick search for possibilities on my side and +- OK. So seems (http://stackoverflow.com/questions/4263101/how-to-talk-to-a-bluetooth-keyboard) , it should be possible to communicate with BT device even without some extra hacking.


Ok, so if I understand correctly, you are able to construct BT sender based on BT keyboard module, right? So may you compute for me a price for this small device and post to Czech? Even it is not 100% sure it will work, I like your idea and I'm offering my time and skills to make it work on my (Locus) side. Ok? Unfortunately I need some device otherwise it is not possible for me to implement it (mainly because I still have really low skills with Bluetooth and such task will be based on trial and error method).


What you think?

photo
1

:=)


I suggest we start with a normal BT keyboard. (http://www.amazon.de/Wireless-Bluetooth-Tastatur-Keyboard-Notebook/dp/B00DN5WNTA/ref=sr_1_1?ie=UTF8&qid=1427789504&sr=8-1&keywords=bluetooth+keyboard). Do you want white or black?


The pairing itself should be easy enough from the bluetooth options.


Amazon can deliver by tomorrow and then I can forward the package to you. Just send me your delivery address to my email.


If that works than I can order the bluetooth keyboard module and do a test build with buttons, which I'll send you for testing.


If that works too, than we only need to come up with a nice design and button layout.


Sounds good? Anything else you need?

photo
1

Crazy, I have no time on other tasks and now I'll start work on this :).


Oki, I use BT keyboard for my notebook, so I'll try to work directly on notebook and pair BT keyboard to phone. At least something. If this will work, we should skip step 1 and go directly to "If that works than I can ...".


Unfortunately I have quite a lot of other tasks to do now, so if you won't get any feedback from me during next 14 days, push me by message here ...

photo
1

No worries., no need to hurry. It's raining today anyhow...


Ordered the BT keyboard mentioned above from Amazon, since it is dead cheap. Will test if pairing works on my android phone/pad and then forward it to you tomorrow. I'm not sure if you can pair any keyboard to a android device, so your BT keyboard might not work on your phone.


Skipped to the next step and ordered 2 BT keyboard modules. Delivery is from US, so it will take a bit longer. Will test pairing and attach buttons. Will forward one to you for testing.


I guess you have my email. Send me your delivery address and I will send package one tomorrow.


Good look with your work. Let's hope everything is as easy as it seems!

photo
1

I have to say that you are crazy (in good mean). Same enthusiast as me :).


Oki, I'll write you email directly.

photo
1

I would certainly love to control Locus with a little bluetooth remote control. Readily available are for example remote media buttons like this: http://amzn.com/B00RM75NL0


All that's required from Locus would be an option "handle media events" (volume/skip/play/pause/etc) and do something useful with it (zoom/pan/waypoint?).


Not sure if there are enough media events to make that really useful. Also you would lose the ability to control your media player while Locus is in front, which might not be desirable. But on the other hand, there are products to buy right now and there is choice. Sounds a lot simpler than building your own hardware :).

photo
1

Buttons on handlebar - that's great for bicycle! First of all for screen on/off and for zoom.

photo
1

Good day Nitin,


so let's move a little bit. Keyboard from You, received few days ago, thank you once more!


For my surprise, connection absolutely without problems. And what surprise me most (even it is a logical), this keyboard works like any other common keyboard - like a keyboard on some older devices that had keyboard as a part of body.


So you may check current 3.8.0 Locus version, where buttons C (center), D (display), R (rotate), G (gps), + (zoom in), - (zoom out) and arrows (move a map), should be already working. Just enable "Use hardware buttons" in settings > map - control. First step ;)

photo
1

Hi,


this is a very good idea! I also have the need for controlling Locus while riding the bike, so this is a very welcome idea!


May I ask which controller you are refering to? What controller is tested to work?


thanks,

olli

photo
1

Nitin, is here any progress? It's almost two months since I added improved support for events from keyboard to Locus and I still have no response from you!


And Oliver seems to be also interested.

photo
1

Hi,


I took a chance and ordered one myself, this one seems to fit my needs when it comes to size and mountability on a bike: http://www.amazon.de/gp/product/B00RJN6JU6?psc=1&redirect=true&ref_=oh_aui_detailpage_o02_s00


I tried it and suprizingly the 4-way-controller worked out of the box and scrolled the map. Unfortunately the other 4 buttons did not have any useful function.


Any chance that there will be a function to "learn" certain key presses for these controllers? that would be awesome!


thanks!

photo
1

ok, played around with it, with this little tool I was able to remap the buttons to the C/+/- key you mentioned. Except for the "+" key it works!


But right now I cannot zoom in. a "+" charcter is sent (verified that in text editor). Any idea?

photo
1

Hello Oliver, I'm glad to interest in this topic. Shame that Nitin do not communicate for some time as I already received BT keyboard over post from him for testing and also some crazy small something also for testing (I have no idea what to do with this "something" :) ).


Anyway I'm also glad you were able to remap your keys. It saves me a lot of time with some extra work in Locus. I'm checking code that handle these key events and there seems to be all ok. Are you sure, your map have some more zooms? Just for sure. You may anyway try to map there also a volume up/down keys, that should also perform zoom in/out.

photo
1

Hey Menion,


Thanks for your response! I don't think I can map it to the Volume keys, as I seem to be only able to enter Letters. I also connected a Bluetooth Keyboard I had laying around and it also did NOT work (the "+" key didn'T. the "-" and "C" did work. ) May this be due to language? My devices are all set to German, so is my keyboard. The Plus and minus keys are on different places.


Would be great if we cn get the Zoom to work!


thanks again for your great app and super support!


olli

photo
1

Hi Oliver, sure, you are welcome :).


Please try this application on your device https://play.google.com/store/apps/details?id=jp.bluetone.hardwarechecker - it seems to do exactly what I need. When you press button, you should get a keycode value, which is unique number I need to specify in Locus. So try you "+" button and let me know it's number you see in this app. Thanks

photo
1

I can do that, but not sure if this helps. I only used the bluetooth keyboard to validate if the mapper I already used is the issue. Because you said, it worked with your bluetooth keyboard.


I already used a mapper for the gamepad, as the gamepad does not transmit the right keys. and it works for "-" and "C", just like the keyboard. With BOTH (gampad/mapper AND keyboard). Only key not working is "+" for BOTH. That's why I don't think the issue is the mapper (used with the pad) or the keyboard (without mapper).

photo
photo
1

Maybe something like https://play.google.com/store/apps/details?id=com.tincore.and.keymapper&hl=en works to remap your key codes

photo
1

What a huge amount of possibilities. This should also work, thanks! On second side, I'm also curious why "+" button do not work, so if "keycode" will be know, I'll appreciate it.

photo
1

I used another app linked further up which does the same job. Adn it works for the "-" and the "C" key. It also seems to work with the "+" key as I get this key in the text editor on android. Just Locus seems to not get this key press. for whatever reason...

photo
1

enough talking, give me keycode ;)

photo
1

you mean the raw keycode of the controller without the mapping, right? or the one from the keyboard? Just to be clear: I am not planning to use the keyboard, this was just for testing.

I can give you that later, as I don't have the devices with me...

photo
1

Keycode without mapping is not useful, because by default it may be mapped to whatever key. But if you re-map it to "-" key, then Locus should really receive "-" key event (which should be equal to keycode number 69.

photo
1

Ok, will try. lets see if the mapper and the other tool work well together :-) what keycode are you expecting for "+"?


will send results later today

photo
1

This for +


KEYCODE_SHIFT_LEFT(59), UP(1)

KEYCODE_EQUALS(70), UP(1)

KEYCODE_EQUALS(70), DOWN(0)

KEYCODE_SHIFT_LEFT(59), DOWN(0)


This is for -

KEYCODE_MINUS(69), UP(1)

KEYCODE_MINUS(69), DOWN(0)


This for C

KEYCODE_SHIFT_LEFT(59), UP(1)

KEYCODE_C(31), UP(1)

KEYCODE_C(31), DOWN(0)

KEYCODE_SHIFT_LEFT(59), DOWN(0)


So because + key is on the = key with shift on us keyboard?

photo
1

Hi, hmm then I have no idea, how should I help here. What you need is to get


KEYCODE_PLUS(81), UP(1)

KEYCODE_PLUS(81), DOWN(0)


Otherwise it won't work.

photo
1

I feared that was you answer :-( Funny thing is, this seems to work for the "C".

Just this morning I found out that indeed I can map the Volume Key to the buttons, so I can get it working now! Not sure how stable, will test that. The extra mapping SW in between is a bit uncomfortable as I need to switch that on as a input manually. But it is working.

Any chance you will rethink your opinion about building this keymapping into Locus, so that you can assign individual keys directly?

photo
1

"C" has keycode 31 http://developer.android.com/reference/android/view/KeyEvent.html#KEYCODE_C , so press of SHIFT has no effect. Locus register just this value "31", that is all that matters.


And remapping in Locus ... it as always depend on interest. I'm sure it will be useful, but it is also a day of extra work.

photo
photo
1

Hello guys,

I believe we may mark this topic as implemented, because Locus Map currently support main features mapped over keyboard > which was point of this idea.


What is interesting for me ... is anyone using this feature in real life? If so, what keyboard/buttons were you able to purchase/create and mount on bike?

photo
1

Hi Menion,


yes, I use this feature in real live. I still have to go through the trouble of zooming using the Volume Keys, because I cannot get my Bluetooth equipment to send a "+" KeyCode, as discussed above. Probably a Problem with having a German System I assume. Would still be great if you can have the Buttons configurable..


thanks,

olli

photo
1

Thanks for a feedback.

Hmm how you define keys for your "buttons"? In Java/Android, all keys/characters has it's unique "key code". Are you able to define which key code will be send when you tap on any key?

EDIT: ah sorry, I now read few posts before and see we already discuss this problem. So probably zoom out mapped on "-" works for you, but zoom in cause troubles, right? Hmm ... complicated task.


EDIT2: little search and I think I've found something. Please give a try to next Locus Map version and let me know.

photo
photo
1

Please, add several new commands to this feature: http://help.locusmap.eu/topic/external-bluetooth-controller-more-commands

photo
1

Hi Menion,

I switched to new Hardware recently and I am sending BT-Keys programmatically. I still cant use the "+" key, but the workaround with Volume Up and Down works...


I just noticed another behaviour which started a few weeks (or months?) ago and I am not sure if this is due to Locus or due to the Andorid 8.0 Update: When I use the BT-hardware button to scroll (left, right, up down) while keeping the key pressed, Locus will not start scrolling for the first 2 seconds or so, but then when it does scroll, it JUMPS for a big step. It seems like it is updateing the position according to the keyproesses, but not updating the screen. It makes scrolling really difficult. This started without me modifiying anything at my hardware or software.

I tested in a text editor, and there I can see that the kepresses are sent as expected.


Does that make sense?


thanks,

olli


PS:

These are the BT AT commands I am using:

Left AT+BLEKEYBOARDCODE=00-00-50

Right AT+BLEKEYBOARDCODE=00-00-4F

Up AT+BLEKEYBOARDCODE=00-00-52

Down AT+BLEKEYBOARDCODE=00-00-51

Center AT+BLEKEYBOARDCODE=00-00-06

Display AT+BLEKEYBOARDCODE=00-00-07

ZIn AT+BLEHIDCONTROLKEY=VOLUME+

ZOut AT+BLEHIDCONTROLKEY=VOLUME-