Android Bluetooth joystick

kas:
Please try again Andro_four_PWM_B.ino and let me know

Also confirm that no devices (motor driver, ...) are attached to Arduino
Did it work before ?, did you change something in your Arduino setup ?
did you change something in your smartphonr setup ?
Give me more info, I need to reproduce this situation

EDIT: please confirm your phone brand, model and android version

não fiz nenhuma alteraçao,

testei o codigo com o driver
testei tambem somente com arduino sem o driver

o problema é realmente o aumento de cpu e ram ,com o codigo deadMan
j2 prime android 6.0, 1,5G de ram

não fiz nenhuma alteraçao,

testei o codigo com o driver
testei tambem somente com arduino sem o driver

o problema é realmente o aumento de cpu e ram ,com o codigo deadMan
j2 prime android 6.0, 1,5G de ram

Il faut trouver un langage commun, je propose l'anglais :wink:

I am confused ...
This Arduino sketch has no sendBlueToothData() function and should not send anything back to the smartphone
The App has no idea whether the deadman function is implemented or not in the Arduino sketch

Let me think about it :roll_eyes: :roll_eyes:

OK :smiling_imp: :smiling_imp:

You had to connect Arduino pin #0 to TX BlueTooth module to get commands from the App
I suspect you also connected Arduino pin #1 to RX BT module

Arduino pin #1 is used to send debug information to the Serial Monitor when DEBUG = true
In that case all this debug info is also transmitted via BlueTooth to the phone (hard to swallow)

Please make sure that nothing is connected to Arduino pin #1
Alternatively you can set DEBUG to false to stop debugging info transmission

I CHANGE the baud, I lowered it to 9600, see the photo the cpu lowered to 25%

soon after I changed the baud to 4800 and the cpu dropped to 15%

will it be a congestion there?

with 9600 or 4800 baud, bt comander worked fine, did not crash

what do you think?

(upload://6I6PuuEmauXO02up6hgyYXrei26.jpeg)]

(upload://6I6PuuEmauXO02up6hgyYXrei26.jpeg)]

kas:
OK :smiling_imp: :smiling_imp:

You had to connect Arduino pin #0 to TX BlueTooth module to get commands from the App
I suspect you also connected Arduino pin #1 to RX BT module

Arduino pin #1 is used to send debug information to the Serial Monitor when DEBUG = true
In that case all this debug info is also transmitted via BlueTooth to the phone (hard to swallow)

Please make sure that nothing is connected to Arduino pin #1
Alternatively you can set DEBUG to false to stop debugging info transmission

Okay, I'll disconnect pin 1
lol

: D
it worked out
Perfect
everything is OK
Soon I will post a video of the operation of the wheelchair

God bless you
you are awesome

RULDI:
: D
it worked out
Perfect
everything is OK
Soon I will post a video of the operation of the wheelchair

Make sure to be back @ 57600 baud and post the video when ready

HI ,KAS

I did a little video test
It worked very well the chair
just a problem, the speed was too fast to make maneuvers in the house
Is it possible to use the bt comander buttons to adjust the speed?
1 button with 30% speed
another with 60%
and another with 100% speed

THANKS

Hi Ruldi, thanks for this nice video 8)

Is it possible to use the bt comander buttons to adjust the speed?

This is Andro_four_PWM_D.ino (rev D)

  • Button management implemented
  • High/Low speed using Button #1
  • default mode is Low speed

Make sure to connect Arduino D1 to RX BT module,
DEBUG should now be set to 'false' at all time

Button #1 management code:

void getButtonState(int bStatus)  {
  switch (bStatus) {
// -----------------  BUTTON #1  -----------------------
    case 'A':
      buttonStatus |= B000001;        // ON
      fullSpeed = true;
      displayStatus = "Turbo";
      break;
    case 'B':
      buttonStatus &= B111110;        // OFF
      fullSpeed = false;
      displayStatus = "Low speed";
      break;

Within setMotorSpeed() function:

  if(fullSpeed == true) {
    pwm_1_a = map(joyX, 100, 200, 255, 0);                            //mapeamento para 0-100 pino A - 100-200 pino B
    pwm_1_b = map(joyX, 200, 300, 0, 255);
  
    pwm_2_a = map(joyY, 100, 200, 255, 0);                            //mapeamento da ponte 2
    pwm_2_b = map(joyY, 200, 300, 0, 255);
  } 
  else {
    pwm_1_a = map(joyX, 100, 200, 127, 0);                            // Low speed
    pwm_1_b = map(joyX, 200, 300, 0, 127);
  
    pwm_2_a = map(joyY, 100, 200, 127, 0);                            // Low speed
    pwm_2_b = map(joyY, 200, 300, 0, 127);
  }

I suggest you access the App config menu and

  • display two buttons only
  • rename Button #1 to "Turbo"

Happy driving :wink:

HI KAS

when I press the turbo button it turns green and goes out quickly

speed does not increase
the communication seems perfect to me

I do not know why speed does not increase.

:-* :-* Sorry for that

Andro_four_PWM_D1.ino (8.41 KB)

Hi, Kas
I am very happy with bt comander and the code that you have developed
I will finish the electric installation in the wheelchair, soon I will post another video with the operation
thank you so much

Hi Ruldi
Thanks for the feedback 8)
Let us have the video when ready

Good new, classic Bluetooth feature is now available for ESP32
Get the Arduino IDE library here

I have ported the basic Arduino demo sketch (AndroTest_V20_POSTED.ino) to this super platform
No wiring, no software setup, nothing !!
just upload to ESP32 and enjoy

All in one small board for 5 bucks shipped that's insane :smiling_imp: :smiling_imp:

EDIT
Sketch updated to V1.1

AndroTest_ESP32_V1.1.ino (7.23 KB)

Hi Kas,

I am working with your app and sample code and ran into a snag last night. I am using the adafruit ez-link, nothing seemed to show up over the serial link. I believe the issue is the baud rate for ez-link is not selectable in the rc commander app so I am unsure of what baud it is actually connecting at. I will try with an hc-06 where the baud is set by the module. Bluefruit EZ-Link - Bluetooth Serial Link & Arduino Programmer [v1.3] : ID 1588 : $22.50 : Adafruit Industries, Unique & fun DIY electronics and kits

Is there a version of the app floating around that may have selectable baud?

Thanks!!

Is there a version of the app floating around that may have selectable baud?

Hi cshunt

No ::slight_smile: ::slight_smile:

There is no such thing as "baud rate" for Bluetooth radio transmission between two devices
Baud rate only apply to the wired serial connection between BT card and Arduino

Try to adjust baud rate in AndroTest.ino demo sketch

BTW Bluefruit EZ-Link had major flaws and is now discontinued, just use a plain HC-05/HC-06 board

Hi, Kas

I made this video so you can see the chair working perfectly

Kas
is it possible to turn the bluetooth comander design a bit?
When I put the 2 motors forward, I have to by the bluetooth comander diagonally

I would like to go up and go forward.
and back the same thing

the diagonal control is confusing me a little lol

but if you can not do this well

Hi Ruldi,

Thanks for the video, you are now a super driver :wink:

is it possible to turn the bluetooth commander design a bit?
When I put the 2 motors forward, I have to by the bluetooth commander diagonally
I would like to go up and go forward.
but if you can not do this well

Let me see what I can do

Hi Rudi,
This is version E, with differential steering

** Cuidado **
I still can't test the code, some joystick positions may produce unexpected moves
Test carefully and let me have your comments

Hi, Kas

It really did look strange.
the engines with this code behaved differently
did not work nor the speed control
and so connect the bluetooth comander the motors go out spinning and do not stop
and when I put it forward they slow down

the image I posted shows the position of the joystick diagonally with the 2 front motors

the other image with the joystick up, the chair turns sideways

I do not know if I could explain it well, but that's it.
Thank you for always being considerate.

(upload://6I6PuuEmauXO02up6hgyYXrei26.jpeg)]

(upload://6I6PuuEmauXO02up6hgyYXrei26.jpeg)]