Thunkable’s friends,
I am programming with thunkable and I need to connect via bluetooth AT-09 BLE I can communicate from the IDE’s serial monitor of the arduino with the BlExAR App and with the DSDTECH Bluetooth App perfectly in both directions, but when I try to do this through the thunkable, I can only do it transmitting a word, a few letters come out at the reception, only the first letter of the word I sent is returned to me and if I send it from the IDE monitor, nothing arrives in the thunkable. I am operating with the thunkable for IOS on the Iphone.
the link of my thunkable Thunkable
If anyone can take a look and see what could be wrong I am grateful for the help!
Most of the BLE devices will use different characteristic UUID for send than that one for receive. Check to have one of them start with FFE0 instead of FFE1.
[Edit]
I read more about BLE and iOS and read a comment that not all iOS version accept the full UUID but only FFE1
Also read that FFE0 is used as a service not as a characteristic.
I want to thank your attention I mean that both the reception and the transmission use the same UUID characteristic and always start with 0xFFE1 and the service 0xFFE0 the thunkable only asks for the UUID of the ID and UUID Characteristic
It would be nice if they could be different from each other maybe it was already resolved.
I saw in some examples that the UUID are declared in the arduino’s sketch and I didn’t understand and I don’t know if it is necessary because the transmission works the reception that I can’t send from the serial monitor
what i don’t understand is that when i send a sequence of letters FGHJKH and call the reception it returns the letter F as if he was bringing back what i sent.
I can’t evolve anymore !! the interesting thing is that when I use a ready-made application as I said above, the communication is perfect for both sides.
Can you try putting the receive block in a loop to see if it will bring you all letters?
When you send, do you see the full letters you send in the device display?
I did the loop, but I was not successful, I did a simple Sketch only with Bluetooth.write (“felipe”);
and only the “f” continues to appear.
I did the experiment with numbers and continues with the letter “f”
another word and “f” again
on the second question, yes I send it to both the Serial monitor and an OLED display and it appears complete.
https://x.thunkable.com/copy/7c05441c3ab8ca0dcc2d4dc5c4e779de
#include <SoftwareSerial.h>
SoftwareSerial Bluetooth(3 , 2);
void setup() {
Serial.begin(9600);
Bluetooth.begin(9600);
}
void loop() {
Bluetooth.write(“FELIPE”);
}
Your C code says that you are dealing with a serial port and in bauds this means you need to change the text in Thunkable to a list of single characters not simple text.
So make a list of the word “FELIPE” by creating a list and having each letter in a position in the list and then assign the list as the string to send.
I will try to do what it says.
I come back to tell you what happened.
thanks
Would the list be for reception? because I’m already managing to get the word out on both the monitor and the display.
This sketch I posted before was an idea to make a very simple one to see if I could solve the reception on the thunkable App.
I saw an example in which to send a signal from a sensor to a label in the app would be something simple >>>> bluetooth.write (“the signal”); <<<<<< and it would arrive in the App but nothing arrives.
the code I’m using from sketch is more complex. I’ll send it to you to take a look.
thanks
#include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#include <SoftwareSerial.h>
SoftwareSerial bluetooth(3 , 2);
const byte SCREEN_WIDTH = 128; // OLED display width, in pixels
const byte SCREEN_HEIGHT = 64; // OLED display height, in pixels
// Declaration for an SSD1306 display connected to I2C (SDA, SCL pins)
const int OLED_RESET = -1; // Reset pin # (or -1 if sharing Arduino reset pin)
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);
#include “HX711.h”
HX711 scale;
uint8_t dataPin = 6;
uint8_t clockPin = 5;
uint32_t start, stop;
volatile float f;
unsigned long prevMillis;
const int READ_TIME = 500; //ms
void setup() {
bluetooth.begin(9600);
Serial.begin(9600);
display.begin(SSD1306_SWITCHCAPVCC, 0x3C);
display.clearDisplay();
display.setTextSize(2);
display.setTextColor(WHITE);
scale.begin(dataPin, clockPin);
scale.set_scale(420.0983);
// reset the scale to zero = 0
scale.tare();
delay(1);
}
int filtered;
int val1,
val2,
val3,
val4;
void loop() {
f = scale.get_units(5);
int value = f;
val4 = val3;
val3 = val2;
val2 = val1;
val1 = value;
filtered = (((val1 + val2 + val3 + val4)*-1) / 4)*3.44;
Serial.println(filtered);
display.setCursor(10, 28);
display.println(filtered);
display.setCursor(60, 28);
display.println(“grams”);
display.display();
bluetooth.println(filtered);
if (Serial.available()) {
String str = "";
Serial.print("Input: ");
prevMillis = millis();
while (millis() - prevMillis < READ_TIME) {
if (Serial.available()) {
char c = Serial.read();
if (c != 10 && c != 13) {
str += c;
bluetooth.write(c);
}
}
}
bluetooth.println(str);
Serial.println(str);
}
if (bluetooth.available()) {
String str = “”;
Serial.print("Item: ");
prevMillis = millis();
while (millis() - prevMillis < READ_TIME) {
if (bluetooth.available()) {
str += (char) bluetooth.read();
}
}
Serial.println(str);
display.clearDisplay();
display.setCursor(28, 10);
display.print(str);
display.display();
}
}
Very good,
The C language code you presented actually reads the output one character at a time and then display it. This is typical for bauds devices.
It only shows that you need to create a similar loop in the receiving side.
Mr Muneer,
Thanks for your direction, now I am studying how to do it, I am learning a little bit day by day, but it is still not easy for my level of knowledge and I can’t find an example that I can compare the differences. When you talk about doing the LOOP are you talking about the block “recive string” from BLE in thunkable?
if it is possible to send me any example, it would facilitate my execution.
But if there is no way, soon I will give you some news !!
Ok, I will make an example in Thunkable and send to you later today.
Please see the screenshot below. I made use of a “Timer” component in the project to use it to establish a functional loop. This way, the receive block will be executed every 100ms to see if any information is coming to the port.
If the BLE device is sending one character at a time then the blocks will be rearranged a bit differently like this.
Notice in this block you need to reset the contents of the label every time you start receiving.
Mr.Muneer,
First modification continued in the same way, but the second modification with the join block, see what happened
the communication works from thunkable to the IDE monitor and I can return the first letter of any word or number in the thunkable lable.
In the opposite direction, I write in the IDE’s upload bar and what I sent appears on the IDE’s monitor.
What I find interesting is that there isn’t even a character in the thunkable, so I don’t think it’s a matter of list, we needed to do something that at least the thankable gets one character, but nothing is difficult to understand.
What do you think about writing a code as simple as possible to send a character from arduino to thunkable only with receiver blocks and one lable.
this would have to work, what do you think?
The question is why the first letter is echoed back?
Is that meant to be? In normal circumstances it should not.
maybe because the UUID characteristic is the same
I at first thought it was a question of string or hex or DEC
I think that if we had UUID Characteristic one for TX and one for RX it would be resolved but it is my thought I don’t know if I am right.
unfortunately the AT-09 BLE only has service UUID and UUID characteristic
-
Can you send anything from your BLE device and receive it in Thunkable?
-
Can you try to send the text as a list not as a normal string?
-
Can you send AT commands to you BLE device? More particularly ATZ or ATT0 note: the last character is ZERO not “O”.
-
Can you send anything from your BLE device and receive it in Thunkable?
No I never got it.
only with BLExAR App and DSDTech from apple store -
Can you send AT commands to you BLE device? More particularly ATZ or ATT0 note: the last character is ZERO not “O”.
yes, but i never tried to send these two commands