LightBlue Bean reporting temperature to ThingSpeak via NodeRed on a RaspberryPi.. Whew!
I recently bought a LightBlue Bean to play around with and I have to say it is pretty cool! For fun I thought I would get NodeRed running on my Raspberry Pi and send the temperature reading to ThingSpeak.. Good times! It takes a bit of patience to get things setup but its with it in the end. There are a few write-ups on how to get NodeRed running on a Pi and I thought I would share my notes in hopes that it helps someone else on their maker journey.
Start with a SDCard formated FAT32 Download Rasbian Wheezy On OSX - Click on the "Apple" icon and then "About this Mac". Click "System Report" and note the BSD Name of the Card Reader - in my case, disk3. Use disk utility to unmount the partition on your SDCard. Open Terminal and execute the following command: (Note: make double and triple sure you pick the proper disk! You could loose data on your system or worse!) sudo dd bs=1m if="path to your downloaded image” of=/dev/disk3 This will take a while... Once done put the card back in to your Pi and power it up.
I install Occidentals using Adafruit Pi Finder but this is an optional step.
If connecitng via ssh you may need to generate a key. ssh-keygen -R "you pi IP" or ssh-keygen -R raspberrypi.local once logged in and run sudo raspi-config Expand the file system, set the local and change the password
Install Required Libraries sudo apt-get install libusb-dev libdbus-1-dev libglib2.0-dev libudev-dev libical-dev libreadline-dev
Install Bluez sudo mkdir bluez cd bluez sudo wget www.kernel.org/pub/linux/bluetooth/bluez-5.30.tar.xz
Unzip and Compile Bluez sudo unxz bluez-5.30.tar.xz sudo tar xvf bluez-5.30.tar cd bluez-5.30 sudo ./configure --disable-systemd sudo make sudo make install
This will take about hour.. Yes about an hour. Once done shutdown and insert your USB BLE adapter
Verify your BLE adapter is working cd bluez/bluez-5.30 tools/hciconfig
If adapter is down:
Enable the adapter sudo tools/hciconfig hci0 up sudo tools/hciconfig hci0 leadv 3 sudo tools/hciconfig hci0 noscan
Do a quick scan for your Bean sudo tools/hcitool lescan
Other required files sudo apt-get install bluetooth bluez-utils libbluetooth-dev
Install Node.js wget http://node-arm.herokuapp.com/node_0.10.36_armhf.deb sudo dpkg -i node_0.10.36_armhf.deb sudo apt-get install build-essential python-dev python-rpi.gpio
Install Node-Red sudo npm install -g --unsafe-perm node-red This takes a few minutes Then run update sudo apt-get update
Install Bean-Nodes mkdir -p ~/.node-red/node_modules npm install --prefix ~/.node-red node-red-contrib-bean Takes a bit as well
Allow Noble hci-ble to run without sudo sudo apt-get install libcap2-bin find -path '*noble*Release/hci-ble' -exec sudo setcap cap_net_raw+eip '{}' \;
Start NodeRed node-red-pi --max-old-space-size=128
Install PM2 sudo npm install -g pm2
pm2 start /usr/local/bin/node-red --node-args="--max-old-space-size=128" -- -v
Open a browser on your PC and type in the ip address of your Pi along with port 1880, in my case if looked like this: http://10.0.1.20:1880
You should be all set!
My ThingSpeak feed
https://thingspeak.com/channels/39237
LBB Code:









