BLE Peripheral Simulation

Hi everyone,
I'm new to Node-RED and interested in sports sensors e.g heart rate, cadence, power etc. I have tried various tools to try and create a BLE device based on inputs from other sensors. I have got an example heart rate sensor flow working using the noble-red-contrib-noble-bluetooth library:

and managed to write the live value to a global variable:
..which I initialised in a separate flow:
( image removed as there's a 2-image limit for new users ! )

What I'd like to do is create a BLE Peripheral node which simply emits the global variable. I can't find an example flow anywhere that does only that. I've saved my Polar OH1 sensor here:

but what would be cool is to be able to use that as a template ( with a new MAC address ? ) so you've got all the placeholders for each service and characteristic.

If someone can show my just a simple how to advertise the primary characteristics ( heart rate measurement + battery level ) then that would be awesome.

Once I've done this I have a slightly bigger project in mind - it's just getting off the ground that's always the tricky bit :slight_smile:

Thanks in advance for helping,


I am not sure if I understand your question completely. Do you want to make a BLE peripheral that advertises the heart rate, cadence information? If you want to do it from scratch, then you are going to face a big challenge. You need to get a BLE development kit such as nrf52840 DK, then download its SDK and write your C codes. Fortunately, there are quite some examples on the heart rate sensor already.

A faster and easier way is to get a heart rate BLE sensor off the market. You should be able to decipher the advertisement message from the BLE sensor.

Hi David,
That board seems to do everything :slight_smile: I've been playing with ANT+ too and it does that so have bookmarked this one.

I tried to create an Android app to simulate a heart rate monitor in MIT App Inventor and I could see it advertising the service however I couldn't quite figure out the right event triggers to be able to handle an incoming connection etc.

Tried several examples on the internet but they're either too old or just too complicated.

I've just come across this article tonight which I'll take a look at:

However there must be someone somewhere who's written a node-red package to add a BLE Peripheral object. I've noticed there's a iBeacon library but that's not quite what I'm after. I don't think Bluetooth Classic would even work with a BLE central device.

I've got a Raspberry Pi 3+ btw which seems to connect just fine to my BLE heart rate monitor, well it didn't work until I installed bluetooth-hci-socket! It was a lot easier to get working on my Mac, so maybe get everything working on the Mac first? :wink:

We did this for industrial applications. We have BLE temperature sensors and accelerometers (for vibration monitoring) set up and pumping data into a RPI 3 based gateway for data visualization, analysis and storage. The gateway uses Node Red, InfluxdB and MQTT, which turns out to be very reliable. With MQTT, data are routed to a remote server with Grafana and InfluxDB.

To achieve this, you need another BLE chip such as nrf52840 to interact with the RPI 3 gateway and the BLE peripherals. The interface between nrf52840 and RPI 3 can be UART, where the Node Red Serial node becomes very useful. The BLE chip accepts command from the RPI 3 gateway and then sends the command to the BLE peripherals. The BLE chip also receives data from BLE peripherals and then send them to RPI 3.

It would be great to have a general BLE peripheral node, which I think it is extremely difficult. Different BLE vendors have different requirements and BLE is in constantly development. a two-year old node w/o maintenance can become obsolete :joy:

Hi David, That sounds very impressive and slick. The only experience out of that lot is Grafana & Influx DB so for a non-electronics/pro-IT person maybe I should learn MQTT next then get my Dad to teach me the electronics - he has 60 yrs more experience than me! I definitely get how incompatible each BLE device is with another, my Polar running watch is very fussy about what will work with it which is BLE 4.2. ANT+ seems to play a lot nicer but all the drivers and example code I can find are dated 2012 and not much later. So I managed to get something working but would only work with an old version of python. I might downgrade to windows 2000 then everything will work fine then :wink:

Right now BLE is at version 5+ (5.2 I believe) and BLE 5+ can transmit data really fast (up to 2M bps) with little energy consumption. Our BLE temperature sensor can send temperature data every 10s and easily last 4 years with a small battery (It is a conservative estimate).

BLE 4.2 is way slower and consumes more energy compared to BLE 5+. BLE 5+ also has a much longer range now. So I will recommend to go with BLE 5+ to enjoy the new technology.

Upgrading the program later on can be a pain since BLE is complicated with lots of C programming (because of C's speed and efficiency :joy:) and SDK updates.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.