I'm working on a project which consists in a bluetooth pulseoximeter using Arduino Nano, HC-05 BT module and GY-MAX30100 pulseoximeter sensor.
When I want to receive the infos through BT connection on serial monitor, the screening is very laggy. So laggy that it is merging the strings into one as you can see in the following photo. The info that I should get is " BPM: x.xx SpO2: x%". Does anybody know what should I do? Reporting period is set to 1000 ms, baud rate of serial monitor is set to 1152000 and baud rate of bluetooth pins is 9600. I tried tons of combinations of baud rate and reporting periods but nothing helped.
I have to mention that on USB connection it works perfect!
Hello!
I am sorry, this is my first time on this forum and also my first time using Arduino. Now I uploaded the code and the hardware info you can find in the beggining of the post.
Please post the code which gives the output you posted. There is no serial printing in the code shown.
I think that you should only call the two .get reading functions once at the start of loop, and use the values you get for both bluetooth and lcd printing.
I bet you are blaming the wrong thing. Bluetooth is printing virtually nothing, and half of what it is printing is redundant anyway. Much the same can be said for the LCD, but the real problem may be in the way you actually get the data. The fact that you are calling the same data twice, AND printing redundant data, AND clearing the LCD each trip round the loop ALL put you at a disadvantage - particularly the last, and that quite apart from any sluggishness in the sensor, which I know nothing about. You say it works with USB, so if you just cut out all the LCD stuff, you may find it will go like a rocket with Bluetooth, and thus prove the point. The code looks incomplete. You might check to see if it what you posted actually compiles, I would be surprised if it does. Also, you might spare us of some of the unnecessary whitespace.
All I see is a total absence of data, which is probably more to the point.
That’s kinda my point. Seems the sensor - assuming it works and is connected in the right way - does not return anything and may be it’s just a timeout thingy that creates the delay.
That is the code that I am actually running. I took it from the internet because this is my first code ever. The device should run on bluetooth at the end of the day so I can not give up on it.
I get infos from the sensor, it works very well, in the printscreen i have shown you i did just an example of how i get the transmition on the serial monitor. I get good results if I put my finger on the pulseoximeter sensor. My problem are those united strings "BSpO2". I will make a demo video in the next post.
Sorry if I'm not explaining very well, this is my first contact ever with Arduino.
Thanks. Now you are giving us someplace to start from.
This code also had the same behaviour on bluetooth.
Correct. The HC05 can be connected to the hardware serial pins 0 and 1 after the code is loaded to the board, and output will be seen on both the phone and the serial monitor. Input can come from the phone only.
This is an acceptable way to run bluetooth output from a program.
It appears that you want to have output on a lcd as well as the phone and the serial monitor. Is that correct?
How do you want to modify the working program you posted?
I want the bluetooth to run on a computer so serial monitor is just fine. I don't use a phone app. I want the info to be shown both on serial monitor via bluetooth and on lcd.
But the USB working program has the same problem on bluetooth, the same laggy screening
Thank you! And I'm sorry again for my poor knowledge.
If the USB Serial program works correctly, but when the output is from the HC05 to some bluetooth adaptor/dongle or internal pc bluetooth module the issue maybe on the pc side.
If we can show that the HC05 output to a phone is fast and not laggy, (similar to the usb output to the monitor), but different from the HC05 output to the pc bluetooth you will know that the issue is on the pc side.
I have only a Huawei available but it is not supporting google services. I will search for one tomorrow and I will come back with a reply. I will also check this code on another PC.