About Sony Spresense's Bluetooth LE Add-on Board

Asked 2 years ago, Updated 2 years ago, 82 views

I would like to know what I can do with the Bluetooth LE Add-on board.

Is it possible for RaspberryPi to receive sensor data measured from commercially available sensors instead of sensors corresponding to the sensor Add-on board using BLE communication?

spresense

2022-09-30 19:22

2 Answers

Bluetooth LE Add-on - The Arduino sample source and library for sending and receiving boards are
It is posted on Rohm's GitHub website below.
https://github.com/RohmSemiconductor/Arduino/tree/master/MK71251-02

Please refer to this and add a process to read the data of your commercial sensor.
You can create a program that sends that data to the host (such as RaspberryPi) by BLE. I think it's possible.


2022-09-30 19:22

Regarding not knowing the UUID of the BLE add-on board of SPRESENSE, I was able to obtain it using the following method, so I will share it with you as a memorandum.The environment is Windows 10.

STESTEP1 AnInstall the BLE library Bleak in Anaconda etc.

 pip install break

PSTEP2 MDescribe Python code to get MAC address

import asyncio
from break import discover

async def run():
  devices = wait discover()
  Ford in devices:
    print(d)

loop=asyncio.get_event_loop()
loop.run_until_complete(run())

[STEP3] Reset SPRESENSE+BLE and execute Python code (MAC address will be displayed)

 (Reset SPRESENSE)
>python scan.py  
XX:XX:XX:XX:XX:LapisDev< -- MAC Address

PSTEP4 DeDescribe and save Python code for obtaining service for Device (this is called getservice.py)

import asyncio
from break import BreakClient

address="XX:XX:XX:XX:XX:XX" #MACAddress

async def run (address, loop):
  async with BleakClient (address, loop=loop) as client:
    x = wait client.is_connected()
    print("Connected: {0}".format(x))
    svcs = wait client.get_services()
    print("Services:")
    for service in svcs:
      print(service)

loop=asyncio.get_event_loop()
loop.run_until_complete(run(address,loop))

[STEP5] Reset SPRESENSE+BLE and execute Python code

 (Reset SPRESENSE)
>python getservice.py  
Connected—True
Services:
00001800-0000-1000-8000-00805f9b34fb (Handle:1)—General Access Profile
00001801-0000-1000-8000-00805f9b34fb (Handle: 257)—General Attribute Profile
0000180a-0000-1000-8000-00805f9b34fb (Handle:513): Device Information
0000180f-0000-1000-8000-00805f9b34fb (Handle: 769)—Battery Service
0179bbd0-5351-48b5-bf6d-2167639bc867 (Handle: 1025): Unknown

Please forgive me for the occasional timeout error at the end, but I can get the UUID.


2022-09-30 19:22

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.