Android Bluetooth joystick

woodygb:
The voltage.... as measured by your DVM .... that is being supplied to the Amp sensor is ?

Measuring from ground and "OUT" on the amp sensor I get 1600mv , this is with no current flowing through the sensor.

That is not what I asked.

The voltage.... as measured by your DVM .... that is being supplied to the Amp sensor is ?

So ..is the INPUT voltage actually 5v or is it perchance 3.3v ?

woodygb:
That is not what I asked.
So ..is the INPUT voltage actually 5v or is it perchance 3.3v ?

I am sorry, I misunderstood you. I was using a 5v power supply and it wasn't powerful enough so it was reading 3.6v input to amp sensor. I changed power supply and now I am getting 2590 mv from OUT to GND so everything is good. :slight_smile:

Hello Kas,
I'm glad I found your software because of its user friendliness. However I have a small issue. I tried connecting a servo motor to it and added the following code:

HorizontalServoPosition = map(joyX, -99, 99, ServoH_Min , ServoH_Max);
HorizontalServo.write(HorizontalServoPosition);

The servo does what it is supposed to do but it flickers continuously. Meaning it moves a little and comes back. Can you please suggest me a remedy?

The servo does what it is supposed to do but it flickers continuously. Meaning it moves a little and comes back. Can you please suggest me a remedy?

Hi rxget

Possibly a power supply problem
Please describe how you power both Arduino and servo

kas:
Hi rxget

Possibly a power supply problem
Please describe how you power both Arduino and servo

Well I tried different types of power supply methods. Mostly arduino and the servo have separate 5V power with common Ground trough a breadboard. I don't think its a power supply problem since I tried with a micro servo too and it does the same thing. I want to say that the flicker it's repetitive and constant as such the loop part of the code.

Please attach your Arduino sketch to your next post

Hello Kas,

I'm trying to replicate this project for an assignment in school. The goal it to make a remote controlled, two motor car. The original plan was to control the car with the gyroscope in my phone. I'm using an Arduino 101, Moto G 2, and an HC-06 bluetooth chip. I've wired the bluetooth chip to the arduino, downloaded your code onto the board and your app onto the phone, but cannot get the chip and phone to "connect." The phone has been able to pair with the chip, but whenever I try to connect from your app, the "connection fails." I have a limited understanding of how your code and bluetooth in general works. Do you have any ideas on what my problem could be?

is your Bluetooth card already configured @57600 bps (most are 9600bps by default)

BT INO

is your Bluetooth card already configured @57600 bps (most are 9600bps by default)

Woody, as far as I know, the Serial speed setting is not relevant for the radio link between Android device and BT card
It only applies to the serial link with the microcontroller
Actually, you can connect the card using any bps setting

@Lila
Create a clean test environment:

  • disconnect RX & TX from BT board, just keep 3.3V and Ground
  • reset the App (Preferences > reset Opt.)
  • restart App

Press Connect and make sure to choose the right BT board
The led should stop blinking
If unsure, try all devices in the list

EDIT: make sure it is not a Low Energy BT board
They look pretty much the same

❝Hi,
I really really like your work.

I have three vehicles using your RC Commander and now want to convert some of them to the TOTAL RC Commander.
I will be happy to send you $9.00 (USD) for one copy of the TOTAL RC Commander (assuming that it could be used eventually on all three vehicles.
I have installed IP cameras to a PC and to an automobile. I am a bit familiar with Android phones. I am somewhat comfortable with the RC Commander and bluetooth.

My eMail (and PayPal) address is NCxxx@HotMail.com

Thanks.

Hi Bob,
check your mail :wink:

Hello! Even I am electronics hobbyist for decades, but only recently I did "catch RC virus" :slight_smile: Well, probably partially because now I have a son 4 yrs old, so we can already share interests :slight_smile:
So, I am collecting projects, Android applications, to see what would be good for me to experiment. This joystick looks good! After a quick look-around, I have a question. In apk options I am not finding PWM range settings (to limit max speed of motors when joystick is in some max position). I am yet to be looking into INO files of available projects (i am bad at programming from scratch, only can modify), but should max PWM be hard-coded at Arduino side (not very comfy)? OR am I missing something here :slight_smile: ?
Thanks in advance!
Thanks for this project in any case!

Juris3D:
Hello! Even I am electronics hobbyist for decades, but only recently I did "catch RC virus" :slight_smile: Well, probably partially because now I have a son 4 yrs old, so we can already share interests :slight_smile:
So, I am collecting projects, Android applications, to see what would be good for me to experiment. This joystick looks good! After a quick look-around, I have a question. In apk options I am not finding PWM range settings (to limit max speed of motors when joystick is in some max position). I am yet to be looking into INO files of available projects (i am bad at programming from scratch, only can modify), but should max PWM be hard-coded at Arduino side (not very comfy)? OR am I missing something here :slight_smile: ?
Thanks in advance!
Thanks for this project in any case!

Hi Juris3D,

Thanks for the kind words
You may be missing something :wink: please google for PWM arduino

analogWrite() function send a modulated signal with a defined duty cycle
analogWrite(pin, 0) 0% duty cycle 0 Volt output
analogWrite(pin, 191) 75% duty cycle
analogWrite(pin, 255) 100% duty cycle 5 Volts output

So, no PWM settings in Joystick BT Commander
Within your Arduino sketch, you may adjust max motor speed by clamping analogWrite value using constrain() or scale it using map()

Driving servo motors is another story

Thank You for answer!
Well, one reason why I was asking about setting PWM limits from Android side, is because there are several projects that have that feature. I can quickly name two (maybe there are more): "Szabo RC Car" (not in Google store, found in Instructables) and "Arduino Joystick Controller" by Andi.Co.
It is nice feature to be able set maximum speed lower than value 255, maybe it can be implemented here too. I could even imagine presets like "gears" buttons, that can be configured each to particular maximum speed.

This feature was once built in, and deprecated with V4.0 release
I like the K.I.S.S approach and hate bloated software :wink:

Joystick BT Commander currently outputs a solid [-100 +100] signal for each axis
These values reflect JOYSTICK position
Values customisation is definitly a user responsibility and should be implemented within Arduino sketch

It is dead easy to create "gear buttons" for LOW/HIGH max speed
Should you need sample code, just let me know

Sorry I am trying to test your app AndroTest V2.0 with Arduino UNO and Android Nexus 4 (joystick commander)

I am not receiving any STX in cmd[0] , ony 0 and 224.

Could you help :frowning:

I solved the issue just changing Serial1.begin(9600); I have a bluethooth HC-06

With that everything works like a charm :=)

pedrobrio:
I solved the issue just changing Serial1.begin(9600); I have a bluethooth HC-06
With that everything works like a charm :=)

Hi pedrobrio

Glad it works :wink:

To avoid any potential communication errors, I strongly suggest to revert to Serial1.begin(57600)
and set your HC-06 BT card to 57600 bps
Should you need any help, let us know

Hello to developer and all hobbyists here. I bought tank chassis and also I am getting that "Total RC" APK with camera support. I would be very thankful for some basic INO file that goes with current APK version, for driving 2-motor vehicle (tank). As for hardware, I have Arduinos (nano, uno, pro micro), bluetooth module HC-05, and several kinds of typical motor drivers (L298, L293).
Oh, and especially awesome would be, if there are some framework for "gears" buttons, discussed a little before. By that I mean couple buttons that can set maximum speed of wehicle.
Big Thanks in advance!

Hi Juris,

First make sure you read the Android controlled RC tank with on-board Video thread


See it in action: >> video <<

and fullspool experience

Let's check that your hardware is up and running
This basic code will move your tank forward/backward, without RC control:

// ***********************************************************************
// *   TankControl   V0.1                                    @kas 2016   *
// *   Code for driving a generic tank with two motors and L298 driver   *
// ***********************************************************************

// Rev history
// V0.1  Basic moves, no RC control


#define   DIR_L     5        // direction control for left motor
#define   PWM_L     6        // PWM control for left motor
#define   DIR_R     8        // direction control for right motor
#define   PWM_R     9        // PWM control for right motor

void setup()  {
  pinMode(PWM_L, OUTPUT);
  pinMode(PWM_R, OUTPUT);
  pinMode(DIR_L, OUTPUT);
  pinMode(DIR_R, OUTPUT);
}

void loop() { 
  forward(100);             // forward low speed
  delay(1000);    
  forward(255);             // forward full speed
  delay(1000);    
  stopped();                // stop
  delay(1000);
  backward(100);            // backward low speed
  delay(1000);    
  backward(255);            // backward full speed
  delay(1000);    
  stopped();                // stop
  delay(2000);    
}

void forward(int pwmValue)    { 
  digitalWrite(DIR_L, HIGH);
  digitalWrite(DIR_R, HIGH); 
  analogWrite(PWM_L, pwmValue);
  analogWrite(PWM_R, pwmValue);
}

void backward(int pwmValue)   {
  digitalWrite(DIR_L, LOW);
  digitalWrite(DIR_R, LOW);
  analogWrite(PWM_L, pwmValue);
  analogWrite(PWM_R, pwmValue);
}

void stopped()   { 
  analogWrite(PWM_L, 0);
  analogWrite(PWM_R, 0); 
}

For next sketches, the roadmap is

  • basic RC control
  • differential drive
  • normal/turbo speed ("gear" buttons)
  • battery voltage display
  • battery current monitoring
  • who knows... :wink:

EDIT: depending on your motors setup, you may have to invert DIR_R pin level in forward() and backward() functions.

Thank You for help! I will tell my progress here, it may be not very fast from my side - have several things going on, commonly called "Real Life (TM)"... ;-D
But I am not totally blank, already made some "proof of concept", got tank chassis working from very simple Android apk "Robo RC" (just two speed sliders there, nothing else), so I know that all parts are working together.