Why isn't my Arduino Nano 33 BLE Sense transmitting pulse and SpO2 data via BLE?
Hello, I am working on a health monitoring system using an
Arduino Nano 33 BLE
Sense and a Pulse Oximeter (MAX30102
) sensor. The objective is to measure and transmit pulse and oxygen saturation data using Bluetooth Low Energy (BLE
). The system is running on MicroPython. I have checked that the I2C
connection and initialization for the MAX30102
sensor is okay, confirmed the BLE
initialization and advertising settings, tested BLE
connection with a mobile app to ensure proper pairing.
But am getting the error
This is my MicroPython Code for Arduino Nano 33 BLE Sense9 Replies
@Middleware & OS
Why are you sending the pulse and SpO2 data as strings (str(pulse)) in the ble.gatts_notify calls , BLE expect raw byte data
Use bytes([pulse]) and bytes([spo2]) instead of
str(pulse) and str(spo2)
. Cus you should convert the integer values to a single byte format
Would that result in an error @Marvee Amasi, I just wanted to send print it as strings on screen
No no you won't get an error by sending the data as strings to the serial monitor for display purposes. My suggestion focused on sending the data correctly over BLE for the mobile app
Okay, now I understand it fails because it expects bytes value and am supplying it a string right
Is it okay if I do it this way
str(pulse).encode('utf-8')
Only one way to find out , check let's see if you will get the error message again
Okay, testing it now