Character modified in Bluetooth

Hi Juan Antonio,

thanks for these informations.

I do not know if I understood well.

I don't think I can use your way of doing it, because I have to (it seems to me) attach a "$" to the start and a "*" to the end, so Arduino knows when to start and when to end the value I want ( I send it quite a few other values).

In your Arduino code, "Bluetooth.setTimeout(100);" is very interesting! I didn't know that. I tried in my code, but the problem is still there. Thanks anyway, maybe I'll use it a day !

Yes I had also thought of using a button to send the text, that might have solved the problem. But the addition of this button did not suit me.

On the other hand, I would have liked very much that when I type the value, AI2 does not send anything, and when I click on the button of the Android keyboard "validated" it sends the value.

Because for example when I type 6584, there are 4 values sent (6-65-658-6584), and the same when I delete and when I retype a value.

Can AI2 detect hitting the "send/submit" button on Android keyboard?

Thanks to you !:slight_smile:

Hi there,

Here is some information that I was able to gather.

There may be unnecessary or missing information.

As a reminder, my problem is that when I enter a value in an AI2 Text Zone, the information transmitted by Bluetooth sometimes arrives with unwanted characters (errors occur at random intervals, see video above).

Materials:

Arduino KEYESTUDIO Mega R3 Plus 2560 board

CNC Shield V3

A4988 controller (modified see HERE)

HC-05 Bluetooth module (I believe)

4-channel relay module (control of 4 LED spotlights)

Sw-18010p vibration sensor module

Circuit board salvaged from a wireless remote → PROfezzion 165ft Nikon

PRIOR joystick control box + optical encoder + two buttons

Footswitch dictaphone Phillips (modified) 3 buttons

UNIROI 0-32V (11.9/12v) stabilized power supply

4 stepper motors (X-Y-Z-R axes)

CHUWI HiPad LTE touch tablet

/
/
/

Information:

HC-05 Bluetooth module → 115000 baud

Arduino program → 115000 bauds for Bluetooth and Serial monitor

Android tablet:

  • Android version 8.0.0

  • Bluetooth version 8.0.0 (application information)

  • Android Bluetooth baud rate → ? Where to find this information ?

  • Baseband version: MOLY.LR11.W1630.MD.MP.V67.2, 2018/06/15 17:37

  • CDMA baseband version: SIXTH.CBP.MD.MP5.V72.2, 2018/04/02 17:53

/
/
/

Communication :

HC-05 → Bluetooth → Android

Android tablet → Wifi (via repeater) → Internet Box

Pc → Wired → Internet Box

/
/
/
Program :

The Arduino program: Nikon-Stacking_V2.ino (50.4 KB)

  • I used three libraries: RotaryEncoder.h | AccelStepper.h | SoftwareSerial.h

The AI2 file: WeTransfer link because file too large HERE

I ask for your indulgence, I am a beginner, this is my first real project.

I started from scratch with AI2 and had some basics in Arduino.

The Arduino program is not finished (example limit switch, AI2 pause button, stop, emergency stop), it can be difficult to follow, and not optimized.

I still have a few issues that I haven't taken much time to research yet:

  • I have some latency between joystick action and position display on AI2 Android (but I won't deal with this problem here, maybe it will be in a new topic :slight_smile: )

  • When I activate the Z rotary encoder, I have the X Y motors moving slightly a few steps. Maybe a ground issue, or the optical encoder causing the problem, I don't know yet.

When you open the AI2 file, maybe all the labels, images, buttons will be shifted, because I positioned them (at pixels!) for my tablet (1920x1200 resolution).

You will see that there is a lot of image overlay following the actions, it is to make small animations when you press the buttons.

I was wondering, if we set the HC-05 module to 115000 baud, how does it work with Android? Does Android automatically set itself to 115,000 baud? Or did I misunderstand the principle?

I thank you in advance!

[I use Google Translet French → English]










It's AI2 Jon :grin:

There isn't an officially released Bluetooth version 8, the latest is v5.3 BLE, released in 2021.

The HC-05 modules are Classic BT v2.0

Classic BT typically uses a Serial Baud Rate of 9600
BLE typically uses a Serial Baud Rate of 9600 or 115200

Ideally your devices should all sing the same Bluetooth song.

Whoops ! :roll_eyes:

I made the change :grinning_face_with_smiling_eyes:

...and:

I tried to find the Bluetooth version of my tablet by following the indications found on Google.

They say to go to:

Setting > Application > Bluetooth > Version

I have :

Setting > App & notifications > App info > Show system processes > Bluetooth > version 8.0.0 (which is apparently not the BT version)

I will try to download an application that will give me all the technical details of the tablet

HC-05 module:

Yes, I had made a baud change with AT commands.

I had set to 115200 baud.

I double-checked it yesterday to be sure.

(he also tells me he's a "slave", I don't know if that's important)t)

I have just downloaded an application (AIDA64) which indicates all the technical data of my device.

Bluetooth version, it says "4+".

I will read the post, it looks interesting, thank you!

ChrisWard,

I read what you suggested.

There is something interesting. I may have misunderstood, but he writes that the baud rates of the BluetoothClient and the Arduino BT module must be the same.

When it says " BluetoothClient" is it talking about AI2's BluetoothClient?

Because I don't see where to set this value?

Capture d’écran 2022-12-10 150233

Ouch - that's an early BLE version - could be glitchy unfortunately so needs as perfect an environment as possible. I suggest using a Serial Baud Rate of 9600.

The HC05 modules support BT Classic version 2. So you need a BLE module such as an HM-10 (BLE 4.0) or maybe an HM-16 (BLE 4.1 to 5.0)

I ironed the HC-05 module at 9600 baud, as well as in the Arduino program.
I still have garbage characters...

I will take a closer look at the modules you offer.

The App Inventor BT Client is normally used with a Baud Rate of 9600, so the BT Module (HC-05) would need to be the same, as would the Serial comms via the Arduino Sketch Serial(9600).

A similar harmony is required for BLE but the MIT BLE extension can work with a selection of Baud Rates.

Oh okay!
I switched everything back to 9600 baud (HC-05 + Ardunio module), but the problem is still there...

This selection is done by itself? Or is it up to us to choose the right one? (I may not have understood :upside_down_face:)

I was wondering what is the use of "polling rate" in BT client properties? Do you think this might have something to do with my problem?

123

It means it can work with a range of different devices that may have different baud rates.

I have never noticed it! The default value is actually 10, so start with that. I think it is to do with scanning Bluetooth devices that could be connected to, i.e. how many attempts to collect each device address. Or perhaps how many times it will test for incoming bytes per system defined time interval. I have asked the powers that be.

Very well thank you! Let me know when you get a response. :slight_smile:

Next week I will try this value (currently it is 100 I believe)

Do you think it could come from there? which one do you recommend me to take? On Amazon.fr (delivery in 2 days) there is the [HM-10 BLE4.0] and the [HM-11 BLE4.0] (what's the difference?) or you advise me to take the HM- 16 (Aliexpress 3 weeks)?
How do I know which one would be better, since the only information I could get from my Android tablet was BLE version 4+ (->4+? What does that mean? 4.0 -4.1-4.2-.. .-?)

Thank you for your help ! :+1:

What I can tell you is that BT Classic and BLE, whilst both Bluetooth, are as different as chalk and cheese. It's therefore important to ensure that the Project's devices all use the same Bluetooth Version.

https://www.professorcad.co.uk/appinventortips#TipsBluetooth

The PC manufactures do this because their Bluetooth modules are supplied by more than one source. BLE v4+ = v4.1, v4.2 (2010) but not v5. See the tables on my website.

Dear @Jon1,
please rememeber that the baudrate that you set to the HC05 (or any BT Arduino shield), is between the CPU and the shield, it isn't the BT trasmission speed toward the AI2 app (i.e. the phone, ot pad, or PC).
The BT trasmission speed is resumed here below:

.
Having said that, anyway, all the hints that @ChrisWard said you, are pretty "gold".
I've given again a look to your first post, and I've seen that the data that your Arduino is receiving seem not following a "rationale". In other words: there isn't one bit which is stuck at 0 or stuck at 1 in the same position, but sometimes the wrong bit is in the low nibble, sometimes in the high nibble, sometimes it is just one bit which is faulty, sometimes there are two bits which are at 1 instead of being at 0. It seems that the comparator inside the BT UART is not working properly, so sometimes it catches a 1 instead of a 0, like if it was foolished by an EM glitch or a too high baudrate; not in absolute terms, but too high with respect to the environment, and yours seems to be very harsh (I see power components, with heat sinks, relays drivers, etc.). To be sure that your AI2 app is not sending garbage, you can use a SW like TeraTerm on your PC and use it as a monitor of what the app is truly sending. Once you are sure that the app is sending correctly the data, than you can focus your attention to your HW (have you some capacitors that can delay the edges of the communication between the HC05 shield and the CPU ? Sometimes the "fast prototype boards" have very high parasitic capacitances. Then, I see many "flying wires" in your photographs:have you already tried to rearrange the wires, so to make it a bit "cleaner" ? (Please apologise me, I don't say that your HW is messy, but sometimes a clean layout helps :slight_smile: ).
Another question: from where you get the HC05 power supply ? The Arduino board ? @5vd or @3VDC ? Have you put the voltage divider to the HC05 input from the CPU or have you tied directly the wire from the CPU to the shield ?
like below:
image
In this drawing, dont'care about the NANO and HC06 boards: the same principle applies to the HC05 or another type of Arduino CPU.
Hoping this helps a bit.
Ciao, Ugo.

PS Joyeux Noël !!!