Thursday, August 06, 2015

Physical Controls for the Digital Dash



I know, of course, that it's somewhat dangerous (not to mention illegal in many places) to operate a touch screen device while driving.  That's why I've wanted to add physical controls to my system for quite a while.  In fact, the latest version of the system was built with that in mind, with a structure that was prepped for it.

I had initially become pretty excited about the Flic Bluetooth button when I heard about it last year on the Tasker Google Group.  I backed their project on Indiegogo and ended up ordering five of them.  I've become a bit disillusioned, though.  They were supposed to deliver in March, and it's now August and I still don't have them.

I had intended, originally, to mount four in the car: two on the center console for the passenger, and two on the back of the steering wheel (that mirrored the console buttons) for the driver.  I figured that with two buttons, I could control just about everything in my system.  I may still mount one on the console for passenger music control, but I've found something better for complete driver control.


This is a "Compact Bluetooth Gamepad" that I bought from GearBest.  It only costs about $7, has a rechargeable  battery, and incorporates nine buttons (including a four-way joystick) that send standard Android keycodes to your device.  And with Tasker and the AutoInput plugin, I can intercept those codes and make them do anything I want.  And what I want is to control the digital dash system...completely.

Here are the keycodes it sends in it's default mode.  There are at least two other modes that change the mapping, but I haven't messed with those.


I've remapped all the buttons except for the Play/Pause control; that one I use as is.  In addition, each of the joystick buttons uses two linked Tasker profiles to allow it to recognize two different types of activation: a short click, or a longer, held one. (I could do that with the buttons as well, but haven't needed to...yet.)



This picture shows how I've got it mounted in the car.  An inverted "U-shaped" piece of plastic with a couple of self-adhesive rubber feet to hold it in place and a couple of Velcro dots to hold the controller to it.  It gives me a very nice little sidearm controller that's easy to reach and use.  In the descriptions that follow, "up" is toward the front of the car.

Here's a list of functions that each button can perform, broken down by screen:

On the Main Screen

Joystick Up Click - Launch Google Maps
Joystick Up Held - Show the list of pre-programmed destinations
Joystick Down Click - Launch the MyRadar weather app
Joystick Down Held - Launch the Weather Channel app
Joystick Left Click - Replay previous song
Joystick Left Held - Show the list of favorite songs
Joystick Right Click - Skip to the next (random) song
Joystick Right Held - Launch PowerAmp if the music source variable is currently set to "Local".  If it's set to "Net", launch Pandora, instead
Volume Down Click - Launch Pandora and start playing my pre-existing 60's music station
Volume Up Click - Launch Pandora and start playing a mix of my pre-existing stations.
Back Key Click - Launch Pandora and start playing my pre-existing 70's Rock station
Enter Key Click - Launch GasBuddy

On Google Maps

Joystick Up Click - Return to Main Screen
Joystick Up Held - Toggle Voice Navigation on and off (uses AutoInput to press on-screen controls)
Joystick Down Click - Download A-GPS data using the GPSStatus app. (uses AutoInput to press on-screen controls.  Automatically returns to the main screen.)

On Radar or Weather Apps

Joystick Click Down - Return to Main Screen

On GasBuddy

Enter Key Click - Return to Main Screen

When the Destinations List is Showing

Joystick Down Click - Step the cursor down to highlight the next destination in the list.  If you try to step below the last one, it wraps around back to the top of the list.

Joystick Up Click - Step the cursor up to highlight the previous destination in the list.  If you try to step above the first one, it wraps around back to the bottom of the list.

Joystick Left Click - Cancel destination selection and remove the on-screen list

Joystick Right Click - Select a destination and send it to Google Maps.  Navigation starts automatically.

When the Favorite Songs List is Showing

Joystick Down Click - Step the cursor down to highlight the next song in the list.  If you try to step below the last one, it wraps around back to the top of the list.

Joystick Up Click - Step the cursor up to highlight the previous song in the list.  If you try to step above the first one, it wraps around back to the bottom of the list.

Joystick Left Click - Cancel song selection and remove the on-screen list

Joystick Right Click - Select a song and send it as a search to PowerAmp.  The song will start playing and then the system returns automatically to the main screen.

The Play/Pause key executes the Play/Pause function regardless of what screen is showing.

It seems a bit complicated when you're just reading through the list, but the operation is really pretty intuitive (at least to me.)  That's the beauty of designing your own system; you can have something that makes perfect sense to you, even if others don't see it the same way.

If you've read some of my previous entries, you might notice that there are a few functions that aren't accounted for.  They're used so rarely that I didn't feel it was necessary to add those in, but if I get bored, or ambitious I might do it anyway.  The missing functions are: launch ScannerRadio, set the PowerAmp EQ, toggle Auto-Brightness, and launch the fireplace app.

 I just got back from a long weekend mini-vacation where we put about 700 miles on the car and the system worked very well.  So far, I'm very pleased with how this part of the project has turned out.

19 comments:

Unknown said...

Can you please share the tasks? I am trying to make the same with another remote I own but cannot make it work right. Would love to get a chance to look at what you have done. Thanks

Mike said...

All the tasks are built on the basic template described here:
http://mikesgeneralblog.blogspot.com/2015/08/controlling-bluetooth-buttonsof-course.html

I'd be happy to try to help you with any specific issues you might be having.

kevin yuliawan said...

Do you know of any equivalent programs to Tasker and AutoInputProgram for iOS? Jailbroken works too. Thanks!

Mike said...

There isn't anything that I know of that has Tasker's range of functions, particularly the ability to do screen overlays, but IFTT (If This Than That) is available for IOS and allows you to create "recipes" that can do certain things. For example, it can silence your phone at certain times or automatically send an SMS saying when you'll be home. The main IFTT website is here: https://ifttt.com/

Daniel said...

Mike, did you ever investigate or maybe even achieve the possibility to have both the hardware keyboard and the software one available at the same time?

Mike said...

Hi, Daniel. I had run into the keyboard problem when I was using the Bluetooth gamepad as a controller, but I never tried to work around it. Instead, I moved all the physical controls to a pair of Flic buttons. Since the Flics use their own service, they don't use the keyboard profile and the soft keyboard will still pop up even with the Flics active.

Daniel said...

Thanks Mike! I found the solution on my own. I just asked you here too soon. It is Hardware keyboard action found in Secure settings (enable when connecting, disable when disconnecting).
On another note, personally I find Flic's price a little prohibitive.

Mike said...

Hi, Daniel. Glad you found a solution. I'll keep that in mind for the future. I agree that the Flics are a bit pricey, but I was an early Indiegogo backer and was able to get them for a significant discount.

Petersons said...

Fantastic blog and all that your stuff are really amazing specially your remote joystick.
Atex PVEH

Mike said...

Thanks. Glad you liked it.

rice said...

Hi, Mike. Is it possible emulate touch event to specific coordinates and set to gamepad buttons?

For example if i type A on game pad. Touch will appear on 100x 200y coordinates on screen.

Mike said...

It can be done if you are rooted, or on Nougat. If you just need to touch an on-screen control (rather than a specific spot on the screen), you might be able to do it with the AutoInput plugin.

Tom said...

Can you share your Tasker Profiles and Tasks?

I've tried the items listed in this thread on the AutoInput forum and I do get the feedback showing which buttons were pressed. I am also able to get a button intercepted and turned into a simulated button press on the screen. The simulated button press on the screen works while in the Tasker screen, but not on any other screen.

I'm specifically trying to get a button press to click on the Mic icon in the lastest version of the Android Auto app.

Any ideas?
thanks

Mike said...

The profiles and tasks I use are shown in this blog entry: http://mikesgeneralblog.blogspot.com/2015/08/controlling-bluetooth-buttonsof-course.html

You might be having issues because not all on-screen buttons can be pressed by AutoInput. I don't know about the Mic button in Android Auto, but that could possibly be the problem.

Tom said...
This comment has been removed by the author.
Simon said...

Hey Mike, is this still working for you?

I'm currently trying to get the media keys on my car stereo mapped to functions such as launching Google Assistant, and Autoinput doesn't seem to be able to capture the at all.

Seems like the new Android 8.0+ handling of media keys is incompatible with current iterations of Tasker and Autoinput - can you confirm?

If so... What alternatives to this remote can you recommend for in car use? They would need to send key codes that are NOT media keys.

Mike said...

Sorry, I can't confirm that information. I'm no longer using this device for this project and have not updated my devices to 8.0+, yet.

About the only thing I can offer is to suggest that you might play around with the different modes that this controller can support. It can be configured for use as a gamepad that puts out different commands than the media ones.

Outside of that, perhaps you can check in with AutoInput's developer. I've always found him to be helpful and responsive; perhaps he has some sugeestions.

Simon said...

Hi Mike, thanks for the quick reply!

Using the gamepad mode is a good idea, of course - I was a little surprised that you used the MediaKeys configuration and assumed that this setup was hardcoded even though that makes no sense whatsoever :D. I haven't actually bought one of these yet since I was hoping to get the media keys on my car steering wheel working instead, but I will definitely keep that in mind. I think I'm leaning towards a selfie-stick-remote type two-button device now anyway - or maybe even the Flic button you're using, although that seems incredibly overpriced.

Like you, I don't really need that many functions - I mainly just want a physical button to trigger Google Assistant. Voice commands and IFTTT can take care of the rest. I've been using the proximity sensor to do the triggering lately, and the accidental activations are getting a little annoying :p

I've actually been trying to post on the AutoApps forums to get some help from the dev, but I have yet to receive my confirmation e-mail... I assume something's broken, because my spam folder is empty too :p. Will keep trying :)

Thanks and kind regards,
Simon

Mike said...

At this point, I couldn't tell you exactly why I used the media configuration; it might be that that was what came up when I first powered the thing up, so I didn't bother changing it.

Agreed, that the flics are expensive, but have some nice features, like not needing to be charged (I change the batteries about once a year.), automatic connection to the tablet, and a more elegant sleep mode than the media controller.

I used to have an earlier version of this project that ran on my phone and used gesture recognition to trigger things. I found, with Tasker anyway,) that I needed to put in some debounce code to make it more reliable.

Strange about the AI forum. If it doesn't get taken care of soon, let me know and I can post there and let the developer know you aren't getting approved.