Android Bluetooth joystick

Perfect
extremely safe

I'll try the chair
I soon post a video demonstrating your code running in my wheelchair
thank you

ola Kas
now it's crashing the app
if I stay connected for a long time the bt comander gets slow and hangs
What can it be?
if restart the bluetooth connection bt comander back to normal, but a few minutes later it will lock again

  • Is it specific to RevC, is RevB OK ??
  • Please disconnect all attached devices from Arduino and try again
  • What is BT commander App version number ?

joystick bt comander v5.5
strange, just connect bluetooth bt comander starts to lock
Could it be because of this last part of code security?

Could it be because of this last part of code security?

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

Kas

see the prints I made
with code without deadMan, bt comander works fine, does not crash, and uses little cpu and mobile ram

already with the code deadMan, the cpu of the cell phone increases a lot, the ram also
j2 prime android 6.0


(upload://6I6PuuEmauXO02up6hgyYXrei26.jpeg)]
(upload://6I6PuuEmauXO02up6hgyYXrei26.jpeg)]

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)