# 05-02 Noble and Nodejs
Today I researched about ways to program the raspberry pi to scan for BLE Devices. Surprisingly enough there doesnt seem to be as much community interest in the RPi BLE with the ESP32. I think this must be because the RPi has many models without BLE and the RPi company only creates Raspbian but not any library APIs.
Nonetheless I found two interesting libraries that can both be used for this project. Both tools that are wrappers for Bluez. That means that they are basically just programmable interfaces for the the default Bluetooth stack manager. The first tool is called Noble and uses nodejs. Being nodejs it is portable across many OS's (Win10, OSX, Linux, Raspbian) and seems quite simple to use. The latest Noble release was last month. The other one is called Bluepy and uses Python. The latest release of Bluepy was in late 2018. Since Noble seems to be a lot more active and is used quite often (2400 weekly downloads on npm), I decided to give it a shot.
I flashed a clean copy of raspbian, set up ssh and vnc and created the Gitlab folder ble-ips-rpi-client.
# Problems
I installed nvm on the RPi and Windows, but I am not quite sure what the best node version is yet. In typical Windows 10 fashion, I had to install some stupid custom drivers that bricked my PC. I quickly gave up on that.
# Wrong Raspbian and Node config.
On the RPi I havent got it to work yet using nodejs v12.x LTS and nodejs v10.x LTS. Tomorrow I will try nodejs v8.x LTS and see if it works. I think another reason might be that my npm script does not run as sudo, which is necessary for vanilla hcitools. Perhaps I am using a too new version of Raspbian (Buster) and Stretch has all the bugfixes I need.
# Maybe wrong RPi version?
My raspberry pi possibly doesnt have the right hardware for BLE support. I have the model 3b, which only has Bluetooth 4.1. This is the first Bt version that supports BLE, and this article also uses a model 3b. I think it might make sense to invest in a model 3b+ or model 4b which have Bluetooth 4.2 (same as ESP32) or Bluetooth 5.0 respectively.
# Further actions
I will install nodejs version 8 and buy a model 3b+ because there do not seem to be many websites about Noble and the 4b. I do not want to spend 60 CHF to find out that the model 4b does not work with noble. On the RPi Stackexchange they used the 3b+ version, this japanese dude also tested connections using the 3b+.
# Bonus video
This print took 11 hours on the highest quality settings of the 3d printer. The cases look really nice.