How to collect SHT85 Sensor Data using STM32 & Bluetooth Low Energy

This is a basic Bluetooth Low Energy project that shows how to use javascript to receive data from the SHT85 Humidity Temperature Sensor attached to the STM32 Nucleo-144. We’ll connect an SHT85 humidity and temperature sensor to an STM32 microcontroller and use BLE to collect sensor data.

Sensations’ SHT85 series is a newly designed temperature and humidity sensor. A band-gap temperature sensor measures temperature, a capacitive humidity sensor measures humidity in the environment, an analog-to-digital converter, data memory, measurement data processing, and a digital communication interface are all included in the sensor. The SHT85 works between 2.15V to 5.5V and uses an I2C interface to connect with a microcontroller.

Components Required

  • A BleuIO dongle (
  • An SHT85 sensor (
  • A board with an STM32 Microcontroller with a USB port. (A Nucleo-144 development board: NUCLEO-H743ZI2, was used to develop this example. (
  • To connect the dongle to the Nucleo board we used a “USB A to Micro USB B”-cable with a USB A female-to-female adapter.)
  • STM32CubeIDE (

When the BleuIO Dongle is connected to the Nucleo board’s USB port, the STM32 will recognize it and start advertising the sensor values that it reads from the SHT85 along with the sensor serial number. It will update these values every 10 seconds.

Setup the project

Get project here:

In your STM32CubeIDE workspace, either clone the project or download it as a zip file and unpack it.

Importing as an Existing Project

  • From STM32CubeIDE choose File>Import…
  • Then choose General > Existing Projects into Workspace then click ‘Next >’
  • ‘Select root directory:’ should have your workspace selected. You should see “stm32_bleuio_SHT85_example”, check it, and then click “Finish.”
  • You must rename the project folder from’ ‘stm32_bleuio_SHT85_example-master’  to ‘stm32_bleuio_SHT85_example’ if you downloaded the project as a zip file.
STM32 SHT85 Sensor
  • Connect the SHT85 Sensor SDA to PF0 on the STM32 Nucleo board and SCL to PF1. Then setup I2C2 in the STM32Cube ioc file like this:

Running the Example

  • To build the project in STMCubeIDE, click the hammer symbol.
  • Use a serial terminal emulator program like TeraTerm, Putty, or CoolTerm to access the ‘STMicroelectronics STLink Virtual COM Port.’
  • Baudrate: 115200
  • Data Bits: 8
  • Parity: None
  • Stop Bits: 1
  • Flow Control: None
  • To flash and run it on your board, press the green play button in STMCubeIDE. The ‘Run Configuration’ window will appear the first time you click it. Simply leave it alone and click Run.
  • The BleuIO Dongle must be connected.

Access SHT85 sensor data from a web browser

We created a simple script to connect to the BleuIO dongle and read data from the STM32.

For this script to work, we need


Create a basic Html file called index.html to act as the script’s frontend. This Html file has certain buttons for connecting to and reading data from the remote dongle attached to stm32.

<!DOCTYPE html>
<html lang=”en”>
<!– Required meta tags –>
<meta charset=”utf-8″ />
<meta name=”viewport” content=”width=device-width, initial-scale=1″ />

<!– Bootstrap CSS –>

<title>STM32 Read sensor value</title>

<div class=”container mt-5″>
<h1>Sensor data collection from stm32 using Bluetooth Low Energy</h1>
<button id=”connect” class=”btn btn-primary”>Connect</button>
<button id=”getdata” class=”btn btn-success”>Get device data</button>
<div id=”loader”></div>
<br />
<div id=”response” class=”fw-bold”></div>

<script src=”./index.js”></script>
  • Create a script.js file and add it at the bottom of the Html file. The BleuIO js library is used to write AT commands and connect with the other dongle in this js program.
import * as my_dongle from ‘bleuio’

//connect to BleuIO
document.getElementById(‘connect’).addEventListener(‘click’, function(){
//get sensor data
document.getElementById(‘getdata’).addEventListener(‘click’, function(){
document.getElementById(‘loader’).innerHTML = ‘Loading’
//set the BleuIO dongle into dual role
// sensor id of the device that we are trying to get data from
let sensorID=’05084FA3′

//look for advertised data of with the sensor id

//split the advertised data from the respnse
let advdata= x[x.length-1].split(” “).pop()

//trim the advertised string to only get sensor response
const result = advdata.split(sensorID).slice(1).join(sensorID)

//get temperature and humidity value
let temp = result.substring(0, 4);
let hum = result.substring(4, 8);

//convert from hex to decimal and device by 100
temp = parseInt(temp, 16)/100
hum = (parseInt(hum, 16)/100).toFixed(1)

document.getElementById(‘loader’).innerHTML = ”
document.getElementById(‘response’).innerHTML = `Sensor ID : 05084FA3 <br/>
Temperature : ${temp} °C<br/>
Humidity : ${hum} %rH<br/>`


The connect and read advertised data buttons are located in the script js file.

  • We also need to update the Sensor ID on line 13 of script js.  This sample project’s Sensor ID is 05084FA3, which we obtained from SHT85.
  • As a result, this script looks for sensor ID 05084FA3 in advertised data. We separate the temperature and humidity information after receiving the advertised data and display it on our index.html page.
  • Now we need a web bundler. We can use parcel.js
  • Let’s go to the root directory and type “parcel index.html” once parcel js is installed. Our development environment will now begin.
  • Let’s launch the script in a browser and choose the correct port for the dongle.
STM32 SHT85 Humidity Temperature Sensor


This is how you can use STM32 and Bluetooth Low Energy to collect data from the SHT85 Humidity Temperature Sensor. The web script can be found in the GitHub repository’s web script subdirectory. We MATHA ELECTRONICS will be back soon with more informative blogs soon.

Leave a Reply

Your email address will not be published.