Blueduino Rev2: problem with central device receiving data

Hi,

I have got 2 Blueduino rev2 set up. One is a peripheral device connected to an accelerometer and the other is a central device that receives the accelerometer data.

The peripheral device with the accelerometer sends out acceleration data at 50Hz. When it is connected to an iPhone, the data streams normally. But when it is connected to the other Blueduino central device, the central device doesn’t receive the acceleration data properly. It receives the data in chunks.

The arduino code that I use for the central device is simply the one from the hardwareserialmonitor example shown below.


" void loop() {

while (Serial1.available() > 0)
{
tmp += char(Serial1.read());
delay(2);
}

if(tmp.length() > 0)
{
Serial.println(tmp);
tmp = “”;
} "


I am using a baud rate of 115200.

Could this be a software issue (arduino sketch) or a hardware limitation or something else?

Thanks!

Please try this sketch instead. It has better UART performance.

Hi aprilpea,
Thanks for that. But I have 2 issues with this sketch:

  1. It does receive the data from the peripheral, but the data received is not an entire string of data as sent from the peripheral.

  2. It stops or hangs after receiving data for a short while (less than a min).

Do you think this is still a sketch issue?

Thanks again!

Hi,

How can I repeat the two issues? Do you have any other app to simulate the sensor data?

Hi aprilpea,

For my other blueduino which is the peripheral device, it is basically trying to send a string at 50Hz. My sketch is something similar to this:

void loop()
{
//sensorData

    delt_t = millis() - count;
    
    if (delt_t > 20) //sending data at 50Hz
    {
       Serial1.println(sensorData); //where sensorData is a string equivalent to "0.00, 0.00, 0.00, 0.00, 0.00, 0.00"

        count = millis();
     }
}

Please try to reduce the frequency. I think 50Hz is too fast for BlueDuino.

Hi aprilpea, have you tested or verified what is a suitable frequency for Blueduino? Thanks