BLE Scanner to the AutoPi cloud

Hi, still very new so please go gentle on me.

My objective is to write a function that scans for a Bluetooth low energy device, extracts data from it, display it on my AutoPi dashboard and upload it to the cloud (from where I can extract it to my own db).

I tried to search documentation (and probably missed it) but not sure where this is documented

I just want to make sure

  1. it is doable
  2. I have the right overall component structure

So the steps

  1. Install ble python modules for the PI (some like Adafruit BLE

  2. Create a AutoPi custom code module that

Runs every x minutes while the dongle is operational
Scans fro BLE device and retrieves data

3). Create a trigger ?

  1. From here I know I could report to my own cloud however I would like to make it available on the daashboard and upload to autopi.io and then retrieve from atopi.io

Am I on the right path or totally misunderstood the architecture

Thanks

2 Likes

Hi @Chris_Neave,

Sounds like an interesting project you have ventured into. And it’s doable :blush:

You will be able to find a lot of examples on how to make a Bluetooth scanner for the RPi, on the web.

The approach would be:

  1. Implement the module in custom code
  2. Verify the code works
  3. Setup a “job” to run the custom code with your desired interval.
  4. Expand the custom code piece to return the found values to your own cloud.

Looking forward to following your progress. Just reach out to support@autopi.io, if there is something that bugs you.

Best
Peter

Peter,

Many thanks for the quick response

so no way to get the data into the autopi world (dashboard, cloud). It will only b3 6 bytes (3 if i am pushed :slight_smile: ) and I would much rather use your existing cloud process (to save log on retry etc) but can absolutely do my own.

Will try it tomorrow - thanks again

Well if anyone is watching and for future google searches.

I had tremendous problems getting python ble libraries running using https://github.com/IanHarvey/bluepy however I am happy to put that down to my lack of python knowledge.

So went to back to node.js and after some fun (40 degree day in Sydney, a very hot garage with very dodgy wifi, no 4 g coverage and a cat who would not take no as an answer )

I got node.js installed

I used the arm 6 version wget https://nodejs.org/dist/v10.16.1/node-v10.16.1-linux-armv6l.tar.xz

The Noble (BLE for Node) package, a great fork by abandonware (you must use this one or you will get VERY VEY frustrated) https://github.com/abandonware/noble

And then got a simple script running that can scan for and connect to ble peripherals.

My thinking given I have a very short amount of time to get this running is that I will have a node.js script (initiated from a python job every 5 minutes) that runs and uploads to cloud,

A question - has anyone run a node script on the pi while running autopi. Is there an impact ?

Time for a beer after a very hot and frustrating (but successful) say

1 Like

I am going to try scanning for ble too.

I’m about to also embark on iBeacon scanning project with BLE. Are there any sample projects out there yet with this capability?

Rhett,

The way I have got BLE installed has been through

https://elinux.org/RPi_Bluetooth_LE

I have the BLE installed, just hsvent gone the next step to integrate it into the autopi services

Let me know how you go

Thanks Chris! I’ll give it a go

Hello Peter,
thank you for suggestion 'Implement the module in custom code'.
Can you please clarify, Does the standard AutoPi image includes pre-installed libraries like bluepy or beacontools for work with BLE scan ? or if not then does command line autopi module offers BLE scan functions?

thanks in advance.

@Dima I do not believe the AutoPi has any BLE tooling. bluepy is pretty easy to use

1 Like

Ah, got it.

I have only worked with devices that I have registered so not able to help here, I had it running on a device that was registered ( I remember an extremely hot pre Covid day in the car in the garage ; so it was running on the AutoPI)

Is there a reason why you are not registering ?

sure. there is a reason.