Sensor data collection from STM32 and SHT85 using Bluetooth Low Energy

Requirments :

Setup the project

Part 1 : Download the project

Part 2 : Importing as an Existing Project

Running the example

Access sensor data from a web browser

<!DOCTYPE html>
<html lang="en">
<head>
<!-- Required meta tags -->
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<!-- Bootstrap CSS -->
<link
href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css"
rel="stylesheet"
integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3"
crossorigin="anonymous"
/>
<title>STM32 Read sensor value</title>
</head>
<body>
<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>
</div>
</body>
</html>
import * as my_dongle from 'bleuio'//connect to BleuIO
document.getElementById('connect').addEventListener('click', function(){
my_dongle.at_connect()
})
//get sensor data
document.getElementById('getdata').addEventListener('click', function(){
document.getElementById('loader').innerHTML = 'Loading'
//set the BleuIO dongle into dual role
my_dongle.at_dual().then(()=>{
// 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
my_dongle.at_findscandata(sensorID,4).then(x=>{
//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 BleuIO is Bluetooth low energy solution that can be used to create new BLE 5.0 applications in the fastest and easiest way.

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Test Universal Links Locally iOS

SQL DATABASE CH-1 || BY YP

Digital image processing using Matlab on Altera FPGA

DAREY.IO LINKEDIN CAMPAIGN EMAIL

Codeless Architecture, Speed, and the Art of the Possible

Graphic showing speeding lines towards a cityscape horizon

Enabling Let’s Encrypt on Old Devices by Qt (2021)

Flutter Design Patterns: 12 — Command

HARMAN Hiring Java developer | Product Development

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
bleuio

bleuio

The BleuIO is Bluetooth low energy solution that can be used to create new BLE 5.0 applications in the fastest and easiest way.

More from Medium

Enforcing FIDO security key ‘make and model’ with AAGUIDs in Azure

Deploy your KIE Sandbox to OpenShift

The Sixth Sense | a not so technical guide to sensors

INTEGRATION OF LVM PARTITION WITH HADOOP CLUSTER