5,606,297 Members 31,909 Now Online
XDA Developers Android and Mobile Development Forum

Remote steering wheel control ( v1.2 ) based on Arduino + (BT)?

Tip us?
 
bryce007
Old
#111  
Junior Member
Thanks Meter 1
Posts: 13
Join Date: Dec 2005
Hi,

I'm having an issue when using my arduino via USB with this tool. It works fine when I initially set it up, but when i put the tablet to sleep (and power down the hub the arduino is conected to) the serial connection to arduino is not found again until I reselect it in the app settings? It seems the USB path changes each time the tablet sleeps..

Is it possible to change the app so it auto connects to any USB serial device?
 
_crue_
Old
#112  
Senior Member - OP
Thanks Meter 122
Posts: 205
Join Date: Nov 2013
Quote:
Originally Posted by bryce007 View Post
Hi,

I'm having an issue when using my arduino via USB with this tool. It works fine when I initially set it up, but when i put the tablet to sleep (and power down the hub the arduino is conected to) the serial connection to arduino is not found again until I reselect it in the app settings? It seems the USB path changes each time the tablet sleeps..

Is it possible to change the app so it auto connects to any USB serial device?
what arduino used, what kernel and rom?
 
bryce007
Old
#113  
Junior Member
Thanks Meter 1
Posts: 13
Join Date: Dec 2005
Quote:
Originally Posted by _crue_ View Post
what arduino used, what kernel and rom?
This is using an Arduino Pro Micro (Similar to the Leonardo just smaller). This is running on Stock 4.4 with Timur's FI Kernel (This is 2013 Nexus 7)
 
_crue_
Old
#114  
Senior Member - OP
Thanks Meter 122
Posts: 205
Join Date: Nov 2013
Quote:
Originally Posted by bryce007 View Post
This is using an Arduino Pro Micro (Similar to the Leonardo just smaller). This is running on Stock 4.4 with Timur's FI Kernel (This is 2013 Nexus 7)
this is Arduino Pro Micro (Leonardo) issues, each time it resets it changes device path.
Try to use something else.
Somewhere I've read about how to fix this on the board, but I don't remember where.
You have to prevent resetting the board on power on.
try to add
Code:
while(!Serial.available());
to setup function in sketch.
 
bryce007
Old
#115  
Junior Member
Thanks Meter 1
Posts: 13
Join Date: Dec 2005
Quote:
Originally Posted by _crue_ View Post
this is Arduino Pro Micro (Leonardo) issues, each time it resets it changes device path.
Try to use something else.
Somewhere I've read about how to fix this on the board, but I don't remember where.
You have to prevent resetting the board on power on.
try to add
Code:
while(!Serial.available());
to setup function in sketch.
:"(
Wah that is crappy. Oh well. Looks like ill have to use the HC-05 bluetooth adaptor to do it.. its a shame cause the arduino will be connected via usb anyway.

Its amazing that your app can do app launching and tasker so easily.. I have yet to find a easy solution sending keyboard hotkeys off the Leonardo's built in HID driver, which was the reason i bought that variant in the first place
 
_crue_
Old
#116  
Senior Member - OP
Thanks Meter 122
Posts: 205
Join Date: Nov 2013
Quote:
Originally Posted by bryce007 View Post
:"(
Wah that is crappy. Oh well. Looks like ill have to use the HC-05 bluetooth adaptor to do it.. its a shame cause the arduino will be connected via usb anyway.

Its amazing that your app can do app launching and tasker so easily.. I have yet to find a easy solution sending keyboard hotkeys off the Leonardo's built in HID driver, which was the reason i bought that variant in the first place
Just try to play around, I guess there is solution
I don't have such board, and it's hard to fild solution for me
but previos issue with micro we fixed.
 
la.ouiche
Old
(Last edited by la.ouiche; 18th April 2014 at 01:17 PM.)
#117  
Senior Member
Thanks Meter 13
Posts: 196
Join Date: Dec 2009
Hi _crue_,
Finally I had received my Arduino Uno, and learned from scratched, it is very accessible.
In my peugeot (406 coupé) car I have a 3 wires command : 1 for ground, 1 for seek&vol and 1 for 2 buttons (labelled 'mode' and 'change').
I have plugged the ground on the ground on the Arduino and the 2 other cables on A0 and A5.
In your testing sketch, when you declare the Button, it is associated to DPIN (is it a mistake?), I had to change it to APin to make it work :
Button buttonMode = Button(APin, LOW);
Also as you see I had to make it to LOW and to declare this line :
pinMode(A0, INPUT_PULLUP);
I think it is because I didn't used any resistor in the circuit. (Otherwise if I don't do that I have a constant and repeating <click:1000> with the test sketch).

Anyway it works great, and it has been well interfacing with your RemoteInputManager.apk
I have created a modified sketch to handle the 2 wires and remap the values (because data received from the command for seek and mode are sending the same values)

If someone is interrested in the sketch it's basic but works for me :
Quote:
#include <Button.h>

const unsigned int DPin = 13;
const unsigned int APinRed = A0;
const unsigned int APinWhite = A5;

Button buttonMode = Button(APinRed, LOW);
Button buttonSeek = Button(APinWhite, LOW);
unsigned int valueMode = 0;
unsigned int valueSeek = 0;
boolean holdingMode = false;
boolean holdingSeek = false;

void setup()
{
pinMode(A0, INPUT_PULLUP); // sets analog pin for input
pinMode(A5, INPUT_PULLUP); // sets analog pin for input
Serial.begin(9600);
buttonMode.setDebounceDelay(10);
buttonSeek.setDebounceDelay(10);
buttonMode.setHoldDelay(800);
buttonSeek.setHoldDelay(800);
}

void loop()
{
buttonMode.listen();
buttonSeek.listen();

// BOUTON MODE
if (buttonMode.onPress()) {
valueMode = analogRead(APinRed);
if (valueMode < 16 ) Serial.print("<click:50>"); // Value for MODE command
else if (valueMode < 20 ) Serial.print("<click:100>"); // Value for CHANGE command
}
if(!holdingMode && buttonMode.isHold()) {
if (valueMode < 16 ) Serial.print("<hold:50>"); // Value for MODE command
else if (valueMode < 20 ) Serial.print("<hold:100>"); // Value for CHANGE command
holdingMode = true;
}
if(holdingMode && buttonMode.onRelease()) {
if (valueMode < 16 ) Serial.print("<release:50>"); // Value for MODE command
else if (valueMode < 20 ) Serial.print("<release:100>"); // Value for CHANGE command
holdingMode = false;
}

// BOUTON SEEK
if (buttonSeek.onPress()) {
valueSeek = analogRead(APinWhite);
if (valueSeek < 15 ) Serial.print("<click:150>"); // Value for VOLDOWN command
else if (valueSeek < 17 ) Serial.print("<click:200>"); // Value for VOLDOWN command
else if (valueSeek < 20 ) Serial.print("<click:250>"); // Value for SEEKUP command
else if (valueSeek < 24 ) Serial.print("<click:300>"); // Value for SEEKDOWN command
}
if(!holdingSeek && buttonSeek.isHold()) {
if (valueSeek < 15 ) Serial.print("<hold:150>"); // Value for VOLDOWN command
else if (valueSeek < 17 ) Serial.print("<hold:200>"); // Value for VOLDOWN command
else if (valueSeek < 20 ) Serial.print("<hold:250>"); // Value for SEEKUP command
else if (valueSeek < 24 ) Serial.print("<hold:300>"); // Value for SEEKDOWN command
holdingSeek = true;
}
if(holdingSeek && buttonSeek.onRelease()) {
if (valueSeek < 15 ) Serial.print("<release:150>"); // Value for VOLDOWN command
else if (valueSeek < 17 ) Serial.print("<release:200>"); // Value for VOLDOWN command
else if (valueSeek < 20 ) Serial.print("<release:250>"); // Value for SEEKUP command
else if (valueSeek < 24 ) Serial.print("<release:300>"); // Value for SEEKDOWN command
holdingSeek = false;
}
}
The only issue I'm facing now is in your app, I can't make the 'hold' parameter works for any command. May be this is due to my sketch that sends a <click> as soon as it is detected? It should send a click only when 'released' I guess, or how did you solve that?
Sorry for the verbose post but I'm so happy, because of you ^^
 
_crue_
Old
#118  
Senior Member - OP
Thanks Meter 122
Posts: 205
Join Date: Nov 2013
Quote:
Originally Posted by la.ouiche View Post
The only issue I'm facing now is in your app, I can't make the 'hold' parameter works for any command. May be this is due to my sketch that sends a <click> as soon as it is detected? It should send a click only when 'released' I guess, or how did you solve that?
Sorry for the verbose post but I'm so happy, because of you ^^
hi
Analog PINs can not have LOW HI state only Digital
try to re-wire your scheme to get pairs (13, A0) and (12, A1) for example
DPIN responsible for events, APINs for resistance values.
So when DPIN come in HI state, you able to read voltage value from APIN

resistor used to set DPINs in LOW state (wired to ground) until you press the button.

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes