I admit it! I had help from ChatGPT ..

Being really alien to BLE Characteristic, Service UUIDs and all the other BT alphabet soup. I wanted to quickly wrap up a BLE “Hello World” to read some temperature data from my Silicon Labs X24G dev board below ..

SIlicon Labs xG24 BLE development board

… with a C++ temperature monitoring program running in the development board. As usual, I started sussing around Stack Overflow, Hackster.io, Medium and ended up using bluetoothctl to scan and connect to the remote BLE device from our Debian IMX8PLUS gateway.

[bluetooth] scan on # to locate BT/BLE devices (WIFI adaptor dependant)

bluetoothctl


Bingo!


[bluetooth] pair MAC of our chosen device i.e. the BLE dev board

bluetooth device pairing


[bluetooth] info MAC to list/check some of the properties of the BLE device

bluetooth device info


Now, time to “code”. Tried all kinds methods, testing with sockets etc and settled with Bleak Python library which I liked the available methods and well supported from Python 3.7 to 3.11! By total rock-stars!

As said, I have zero prior experience working with Bluetooth or worse, BLE. Therefore, I ‘kick-started’ my development with our “friendly assistant” ..

chatgpt programming assistant


I was happily “advising” ChatGPT of errors that popped out, what methods I wanted to use and format of variables etc .. it learned quick along the way …

chatgpt python programming bot


I could get use to this!!! OK … it was an interesting experience, the bot pumps out pretty efficient codes, well commented but it does “hallucinate” and uses non-existing methods, e.g. BleakClient.get_service which does not exist. It’s even well versed in asyncio chops which today still trips me up once a while.

Are we all going to lose out job? Nah .. the bot still needs someone to plug in the USB console cable, press the hardware reset button and of course power up and down my laptop. My job is safe for now …

Related posts

Latest posts

Unknown's avatar

Author: stangeek71

51 year old Electrical/Electronics Engineer, background in industrial servo controls but been developing and pushing industrial gateways for past 15 years. Nowadays, working hard to catch up on machine learning knowledge to develop, test and deploy useful new features for customers of our next gen industrial gateways.

One thought on “I admit it! I had help from ChatGPT ..”

Leave a comment