Connecting to BLE Server

All ESP32 boards running MicroPython.
Target audience: MicroPython users with an ESP32 board.
Post Reply
RS485
Posts: 2
Joined: Tue Sep 10, 2019 1:39 am

Connecting to BLE Server

Post by RS485 » Tue Sep 10, 2019 2:00 am

Hi,

I have a project I am doing for fun, to connect a ESP32 to a BLE water actuator to check the water moisture content and then send a signal to my BLE water timer.

I have been looking around at varioius forums and they all have heaps of info about connecting the ESP32 to Phones etc that are clients.

I have already found the MAC address for the water actuator, the UUID for the service as well as the 10 bit registers that control the water actuator going on and off. Its essentially 1 byte that is a 00 or 01 that does this.

I used wireshark and RFConnect from Nordic to find this worked really great! Now onto the hard bits as I am a beginner in programming uPython.

Here is a good post on it for anyone that is interested: https://www.instructables.com/id/Revers ... nergy-Dev/

I was wondering if someone can help point me in the right direction as to how I can:

1. put the ESP32 into server mode
2. connect to a known MAC address
3. Select the right Service UUID - there are 2 levels here a main UUID and then a service UUID(could be a register)
4. Just send a 10 bit mask to that correct register

If someone can help me with this I would be really grateful and it might help someone else as well wanting to do the same thing.

Thank you.

User avatar
jimmo
Posts: 553
Joined: Tue Aug 08, 2017 1:57 am
Location: Sydney, Australia

Re: Connecting to BLE Server

Post by jimmo » Tue Sep 10, 2019 2:34 am

I am working on this exact feature for MicroPython at the moment. See https://github.com/micropython/micropython/pull/5051 for discussion.

What you're describing is central role (confusingly, "gatt client" -- a peripheral like your water sensor is actually the "server" in BLE terminology).

I'm prioritising the STM32 HCI implementation first while we sort out the API, but I have WIP support for this functionality on ESP32, which I'm working on today. But it might still be a couple of weeks away because I only do this part time.

RS485
Posts: 2
Joined: Tue Sep 10, 2019 1:39 am

Re: Connecting to BLE Server

Post by RS485 » Tue Sep 10, 2019 10:46 pm

Thanks Jimmo looks pretty promising! It's funny how not many people are connecting to devices mainly just phones etc

Post Reply