This object is in archive! 

Bluetooth button integration

Claus Köster shared this idea 7 years ago
Completed

Hi


here is an idea for integration of a Bluetooth button into locus!


So far I used locus with 100% display brightness of my smartphone, but this costs a lot of battery power!


But to switch to 100 % brightness is only necessary if you look at the locus map for navigation.


So I linked my smartphone to a 5 button Bluetooth device, which can toggle the display brightness between e.g. 10 to 100 % via a small tasker program.


I attached the button close to my handlebar, so I can handle the button just with my thumb.


The center button toggles the brightness. The buttons above and below the center button can be used for zooming in and out. The remaining two buttons could be programed for some other tasks.


Even with the additional Bluetooth connection is the energy consumption of the battery by far reduced.


So if you could integrate a waterproof Bluetooth button (may be you can sell it!) into your software would help a lot!


Thanks for considering my I idea.


Best regards,


Claus


P.S.: I attached a jpg, which shows my handlebar bag together and the GPS-shell from Ortlieb together with my Samsung smartphone. Next to the right bar you can see the round (1 inch diameter) Bluetooth button from Satechi (Media button).

Best Answer
photo

I have so much other tasks to do and I have to deal here with custom mapping for BT keyboard, damn :).


Oki, so in next version will be new setup in config.cfg


e466e977de0b1f09f5f955159c89c8cb


Values are "keyCodes", usually defined here ( 'KEYCODE_x' values ), or I'm sure there will be application that display pressed keyCode value. In case you needs to use "shift", it is possible to prefix "s70" like for zoom-in action. Enjoy it.

Replies (13)

photo
1

Good day Claus,

nice tools on your handlebar.


Locus already support control over hardware buttons. You have to enable it in settings : http://docs.locusmap.eu/doku.php?id=manual:user_guide:maps_settings:screen ( Use hardware buttons ).


Thank if you are able to program buttons on your BT device to certain keys, like +/- for zoom, it should already work.

photo
1

What about hardware key to add new point?

photo
1

Menion you are right, HW buttons already work with Locus. I purchased a cheap mini BT gamepad recently and tested it for use as a "remote" for Locus. After remapping the Keys with "External Keyboard Helper Pro" app, I was able to enable/disable the display, center on gps position and pan and zoom the map.


Although this is working fine, it has the disadvantage that I have to use "External keyboard Helper Pro" app to remap the keys of the remote. This app works as a virtual keyboard, which means the "normal" virtual keyboard is not easily available any more, when text input is required (for example in Address Search or Quck POIs).

So maybe you could think about making the keycodes freely configurable through an (advanced) settings screen or maybe config.cfg? This would make the additional remapping step through the virtual keyboard unnecessary on an unrooted device.


Also, would it be possible to add "Toggle Screen Rotation" to the HW key bindings?

photo
1

Locus Map supports several "Android intents" which allows an external app (like Tasker) to control Locus. The available intents are described here:

http://docs.locusmap.eu/doku.php?id=manual:advanced:locus_api:public_intents

Currently, there are four Locus intents:


  1. Create a waypoint
  2. Start track-recording.
  3. Pause track-recording.
  4. Stop track-recording.

Perhaps the most flexible solution is to have more Locus intents, such as intents for zooming in and out (and other functions). This solution doesn't operate through the keyboard so you don't need "External Keyboard Helper Pro" and the virtual keyboard would not be affected.

You could use Tasker to make the Bluetooth buttons zoom the map using the new Locus intents. If you added the AutoVoice app, you could probably use voice commands to control Locus via intents.

photo
1

Ok, this could also work, but I don't know if intents are meant to be used for purposes like zoom/pan in an appliction (which might not even be in the foreground at the time the intent is initiated).

Menion, what's your opinion on this?

photo
2

Intents can provide whatever functionality the app developer chooses to expose. If an app is not in the foreground, or if the app is not in the correct "operating mode", the developer ensures the requested action fails gracefully.

For example, I tested the existing Waypoint intent. It only works if you are in track-recording mode. If you are not recording a track, the Waypoint intent fails and a message appears in Locus Map (indicating it is not in track-recording mode).

photo
1

Well idea with "intents" is really interesting and I think it should work. Not too complicated for me to create, but it sounds for me really complicated to setup on side of user/device. At least I personally was so confused from "tasker" application, that I've rather un-install it :).


For me, main though against some deeper support of bluetooth hardware buttons is "where the hell should I purchase some usable bluetooth buttons that I may attach to bike/motorcycle"? I remember I search for some last summer and after few hours I really gave up this ...


So for me biggest negative on this is problem with obtain some usable hardware keys ... any tips?

photo
1

What about this ?

photo
1

Instead of Tasker, I have used MacroDroid and Automate. Both are available in free versions (with certain restrictions) and are able to send intents.


For example, in MacroDroid, I created a Floating Action Button (FAB) that sends an intent to Locus to create a Waypoint. Creating this macro was fast and easy. I repeated the test with the other Locus intents. I did this for testing purposes only because I don't plan to use a FAB to make waypoints.

The one thing that neither MacroDroid or Automate can do (as far as I know) is work with AutoVoice. My ultimate goal is to speak commands like "Create Waypoint" and "Pause Recording" and control Locus Map. I think I will need to use Tasker, with AutoVoice, for that.

photo
1

Hmm oki, let's move back to start of this idea.

My main question here is ... "how you expect to use this feature"? Bernhard gave me example of one bluetooth tool that do not have any working construction to attach to bike. How you expect to use this feature when I see no working toys here??

photo
1

Oki Bernhard, thanks (it show me just some power-bank, but never mind).


I miss commend from author of this idea Claus, because form my point of view, main idea is already completed, isn't it?


I'm anyway not sure/convinced, that adding additional support for some keyboard/intent commands make a big sense, because there seems to be no easily available hardware buttons with direct mount to bike. So idea completed.

photo
1

Oki, mistake from my side when using the forum form a mobile phone, sorry.

Here is what I intended to post

Menion, you seem sometimes a bid to fast with closing ideas and a bit to lazy to look for Bluetooth Button at Amazaon!

At the end it's your software and your business, I'm only a customer....

photo
1

I experimented with this cheap BT remotes so far:

https://www.amazon.de/Musik-Fernbedienung-Kamera-Ausl%C3%B6ser-Selbstausl%C3%B6ser-Windows-iPhone-Smartphone/dp/B013BJCMSO

https://www.amazon.de/gp/product/B01CWMT7BQ/


I used External Keyboard Helper Pro to remap the keys to supported Locus HW buttons and they both work as intended.

But the first one is still unusable, because it only has multimedia keys. Android seems so treat them special when the phone is locked. These keys work as multimedia keys when locked (Play/Pause, FastForward and so on), but don't wake the phone. So I am able to disable the Screen (Locus 'D') with this, but have no chance to wake it up again (the buttons are back to multimedia functionality when the phone is locked).


The second one works without any problems. The only disadvantage: I have to switch "virtual keyboard" for this to work (as mentioned before).


Of course, none of this cheap devices has mounting equipment for handlebars, but I will build a mount for myself if this should work without virtual keyboard in the future...?

Only remaining problem for me would be water proofability...

photo
1

The model that Claus described is from Satechi and it comes with a plastic clip to mount it to a steering wheel (or handlebars).

https://www.amazon.com/gp/product/B00RM75NL0

I searched for "Bluetooth button android" on Amazon.com and found two more models that can clip to a steering wheel or handlebars. The first model is sold by at least three different brands.

1) Favolcano/Auzeuner/UEB

https://www.amazon.com/gp/product/B01K9A0LYA

2) Lionsoul (same as the one Bernhard showed)

https://www.amazon.com/Lionsoul-Bluetooth-Controller-Handlebar-Compatible/dp/B01HTNXA0C

Another model is shaped like a key-fob (there is no clip for attaching to handlebars) and has buttons for media and camera control.

https://www.amazon.com/Fintie-Bluetooth-Wireless-Multimedia-Smartphones/dp/B00WFXWKY4

photo
1

I have so much other tasks to do and I have to deal here with custom mapping for BT keyboard, damn :).


Oki, so in next version will be new setup in config.cfg


e466e977de0b1f09f5f955159c89c8cb


Values are "keyCodes", usually defined here ( 'KEYCODE_x' values ), or I'm sure there will be application that display pressed keyCode value. In case you needs to use "shift", it is possible to prefix "s70" like for zoom-in action. Enjoy it.

photo
1

Please add also intent and/or key mapping for Create new waypoint (quick waypoint)


(whithout need to start a record a new track, that intent already exist)

Thanks! :-)

photo
1

Thank you so much for implementing this although for you this topic was completed and despite all the other tasks on your list!

I'm looking forward on testing this...will we have to wait for next full version or will it be available in BETA?

photo
1

You are welcome :).


Definitely in Beta. Hope tomorrow I'll publish one ...

photo
1

Thanks! It's working as intended. My second testing device works perfectly with the new BETA, while the standard vitual keyboard is still available!

Now I will look into building a mount for my handlebar and test it in the field...

photo
1

I just wanted to thank you again for enhancing this feature despite it was already considered "completed". I have now built myself a handlebar- mount for a cheap BT remote and it is amazing how more secure you feel on the mtb when you don't have to let go one hand to activate the map display for orientation!

Tested it intensively for two days in the "Trailpark Rabenberg" and on a MTB - daytrip to the Czech Republic (all unknown terrain for me) and it worked great!


That's my setup for now:


811514fc7fd40f42d86a7c86d1416fd8

photo
1

Looks nice, thanks for sharing.

I'm glad you found it useful. Hope this will be inspiration for other users ;).

photo
1

zossebart, could you describe how you built a handlebar mount for this device?

photo
1

Short version: I attached two small m3 screews to the back side of the device (had to open it up for this).

For the handlebar-side, I made a mount out of ABS plastic which is fixed by the break lever screw (had to get a longer screw to compensate for the thickness of the mount and a washer).

See the 9051d0b4553b8bd6c2d3f28b83bee070pictures of the back side of the device and the handlebar mount:

1f6b22f4a2c849da7a9bbd518a98e051

photo
1

Dear Menion, can you add some more commands to this great feature? :)

photo
1

Good day Evgeny,

Taras in older post mentioned option over intent, how to control Locus Map app ( currently only track recording system ). In case, I add additional commands over this "intent" system, is it usable solution also for you?

Also, what "commands" are you interested in, which are missing from your point of view?

photo
2

Simple (map existing command to keycode):

- (!) Route recalculation

- (!) Open "Quick new point" dialog

- Dashboard on/off

- Speed auto-zoom on/off

- Zoom lock on/off


New function (but great for bicycle remote control): change maps. I see two simple solutions:

- (simple) change to previous map (== swap two last maps). I can select scheme, then sattelite image. An on bicycle, swap it with one button.

- (complex) two keys for going up and down through "Quick map switch" list.


Current solution with keycodes in config.cfg is very easy to use with cheap gamepad. Now, I don't know how to do this using intents.


Best gamepad, I found: in work / making. I use it really every bicycle ride.

photo
1

Omg!!! I purchased same bluetooth gamepad maybe an year ago and was really sad, it has stupid finger-only usage and cannot be mounted on my bike. And you have here complete solution also with video-manual how to do it yourself with video with funny old school music. You made my evening :D.

Thanks Evgeny.

I currently have some needs to make extra features available over intent as well, so when this will be done ( control over intent ), it won't be a big problem to some of requested commands as well.I've currently a lot of other work to finish first and also I'm not sure how big interest is here in this feature (for other users), so cannot promise a progress here, but check news in app and this topic.

photo
1

I understand, that it's very geeky feature (8 votes here, 6 there), but I will hope :)

Thanks!

photo
1

Ah, this second topic is what I wanted to see. Thanks, I'll add this to my "short" list of tasks to watch "people's interest".

photo
1

@Evgerry: Make this +1 vote here. I guess it is a chicken-egg problem - once remote control is well supported by locusmap, there will also be more demand for it. The feature also adds to the safety of using locusmap on a bike. What held me back so far was that the devices suggested a year ago where not Bluetooth 4.0 and needed a lot of energy (battery life <20h - really?). Also, with the device suggested by zossebart (https://www.amazon.de/gp/product/B01CWMT7BQ/), I had problems with the buttons triggering the actions reliably, so I didn't use it.

Now I ordered the device you suggested, which appears to be Bluetooth 4.0, possibly using even BLE, so it should last pretty long with one charge. As for attaching it to the bike, I am sure something can be 3D-printed, but your solution seems also fine. Thanks for posting.

photo
1

+1 for more public intends to make Locus functions available.

I guess I have to play around with Tasker once more to get it working with BT remote then...

photo
1

Look for my solution: http://help.locusmap.eu/topic/external-bluetooth-controller-more-commands

It works without any problem.

photo
1

Nice!

Together with a lap function (open feature wish) when recording tracks, a simple BT button could do the trick of marking a lap while running!

photo
1

I just tried this out, in principle all fine, but I can't get "Display On" to work. No matter what button of my remote (it's one of those round ones with Vol+/-, Skip </> and Play/Pause) I use: Turning display off works, but when the display is off and I press the button, my music player is started in the background.

I did set hardware_buttons_enabled_during_screen_lock=1 - is there anything else, perhaps within the Android system, I have to do?

photo
1

Hi Ingo,


I had the same problem (see http://help.locusmap.eu/topic/bluettoth-button-integration#comment-37965). I found no solution!

The problem with this cheap "multimedia" remotes seems to be that they are handled in a special way (as media controller) by Android when the phone is locked.

I had more luck with other devices. Some of them allow to switch the role from "multimedia controller" to "gemapad"-mode or similar. In this other mode, they don't work as multimedia buttons and thus can be used to wake the display.


Here are some devices that are known to work:

https://www.amazon.de/gp/product/B01CWMT7BQ/ (thats the one I use)


https://www.aliexpress.com/wholesale?SearchText=r1+gamepad (at least Evgeny and freischneider use it with success, see Evgenys video)

photo
1

Thx! I found the second one also on Amazon, for not much more:

https://www.amazon.de/Controller-Bluetooth-Wireless-Fernbedienung-Smartphones-R1-VR/dp/B01NBDM4AJ/


Anyway, how do you attach those to your bike? Doesn't seem like there's an obvious sturdy solution (those BT buttons come with a 3/4-ring that works fine).

photo
1

Evgeny modified his device to be attached like this: https://www.youtube.com/watch?v=LayVNIDUbmM


My solution you can see further up this thread (it involves opening the device and building a custom mounting bracket, though):

http://help.locusmap.eu/topic/bluettoth-button-integration#comment-41150

http://help.locusmap.eu/topic/bluettoth-button-integration#comment-41186


photo
1

Nice work there from both of you! A bit above my handyman-paygrade, I fear (and time I don't have...). I'll see if the BT button is already of enough help for me. Thx anyway!

Replies have been locked on this page!