[conn-dev wk 4] Bluetooth LE

New week new topic! I gained basic understanding of BLE (Bluetooth Low Energy) devices, their differences with Bluetooth Classic, and the interaction model known as publish-and-subscribe. Overall, I really enjoyed reading the Introduction to Bluetooth LE, though I still have a couple of questions so I’ll post them first:

1. I still don’t really understand “float16”, “float32” and “float64” when reading BLE inputs — are they necessary? Why do they make my normal numbers appear humongous?

2. Can Arduino BLE be read without plugged into the computer, which means no Serial Monitor? If not, how can I ever make wireless applications?

3. Multiple characteristics?

On to exploring Bluetooth devices!

I never liked the interface of Light Blue, so I installed BlueSee. There are seriously hundreds of different devices on the floor! I know for a fact those ALM:000X are the lights that ought not to be played with 😅 most of the rest seem to be Apple products.

After playing with the example code in the BLE Lab (which enabled me to write to an LED via bluetooth software!!), I started to try and build my own application. I actually attempted BLE for IMU readings last semester when I tried to make my pcomp project 2 wireless, unfortunately my documentation skipped over this part… Luckily I still had my code and p5 sketch (thanks to Tom’s help, even though I gave up half way).

Digging out the old file, the eventual issue I ran into was the reading appearing weird. I tried changing “float” type, mapping readings or doing math in Arduino, none helped. Damn you IMU readings!!

I finally gave in and went for a simple button instead.

Then it was transferring p5 code into html/css/JavaScript, a process with a lot of referencing to Jingwen’s p5.ble.js library Repo, and Tom’s examples. I found it to be much easier this time comparing to writing one for Serial connection three weeks ago — I don’t think I gained more knowledge in JavaScript (well, a little), more so I’ve gotten more familiar with appropriating / migrating p5 code and example code for my own use. I hope this is good.

The only new design this time was changing fonts upon receiving button press input. I also made the button display “connected” when it starts receiving characteristics, but I’m not sure I wrote it right — this would be when the OLED screen comes into play, if I had more time! For now, alas, this is what I got:

Code available here!

Leave a Reply

Your email address will not be published. Required fields are marked *