Skip to content

Instantly share code, notes, and snippets.

@hornej
Last active September 13, 2021 08:29
Show Gist options
  • Save hornej/bf56d8103a1c2d685579f3628949a442 to your computer and use it in GitHub Desktop.
Save hornej/bf56d8103a1c2d685579f3628949a442 to your computer and use it in GitHub Desktop.
Raspberry Pi and Thunderboard help

Thunderboard Setup

I had a very difficult time following this tutorial so I am writing this to help me and other people. I would recommend following the directions in the tutorial using this page for reference if things go wrong.

I did this whole process on my Raspberry Pi 3 with Raspbian OS.

Following the GitHub doc

First things first: clone the repository.

git clone https://github.com/SiliconLabs/thundercloud.git

I believe this is what you need to install node.js and npm on the Raspberry Pi 3

sudo apt-get install nodejs npm

Once you have installed you will need to run gulp

When I tried to run gulp at first I had issues with missing modules. This is what I used

sudo npm install gulp-browserify gulp-plumber 

... including all the rest you will need. You may need to do

sudo npm install -g

to add things globally but I don't know what that means so I didn't worry about it.

Here is the reference: installing gulp modules

After you get gulp watch to work (not sure what it does), you will want to run gulp build.

Once this runs you will want to enter your thundercloud folder

cd thundercloud

I extracted the zip file from the tutorial to the the thundercloud folder.

Installing Bluepy

Following these instructions you will see

sudo apt-get install python-pip libglib2.0-dev
sudo pip install bluepy

Firebase

You will need the command line tools. The link on the GitHub is outdated. Use this one.

Following the directions there all you will have to do is

npm install -g firebase-tools
firebase login

You will then login with your Google account and should now be able to use Firebase commands.

You will then run

firebase deploy --project <your firebase project id>

Make sure you are in the thundercloud folder when you run this.

*When you create a Firebase account you will create a project. The project will have a project ID. This will be "yourprojectname-5555" or something similar. This is the project name you will be using throughout the tutorial. Don't just use "yourprojectname"

Scanning for Thunderboards

Make sure your Thunderboard is turned on and run

sudo python tbsense_scan.py

This script will scan for Thunderboards and every time it detects your Thunderboard it will return the sensing data.

Final notes

I still was unable to get the Silicon Labs app to work on the firebaseapp.com URL. I was able to see the real time database updating in Firebase but I was unable to see the visual Firebase app.

Here are the files from the original tutorial that you will need to download if you didnt already http://community.silabs.com/mgrfq63796/attachments/mgrfq63796/9/513/1/thunderpi.zip

@bennettChen
Copy link

bennettChen commented Jun 23, 2017

.... i cant do any thing about this board...
where is tbsense_scan.py? , i could not find this file.

PS: i even could not use app to get the information, just discover this board device id.(Thunder Sense #49078)
really trouble here.

every time, i ran the gulp command, it would be

gulp watch
[15:28:53] Using gulpfile D:\Project\Thunderboard\thundercloud-master\gulpfile.js
[15:28:53] Starting 'browserify'...
[15:28:53] Finished 'browserify' after 29 ms
[15:28:53] Starting 'less'...
[15:28:53] Finished 'less' after 3.11 ms
[15:28:53] Starting 'copy'...
[15:28:53] Finished 'copy' after 6.95 ms
[15:28:53] Starting 'connect'...
[15:28:54] Finished 'connect' after 616 ms
[15:28:54] Starting 'open'...
[15:28:54] Finished 'open' after 1.73 ms
[15:28:54] Starting 'default'...
[15:28:54] Finished 'default' after 2.56 μs
[15:28:54] Starting 'watch'...
[15:28:54] Finished 'watch' after 717 ms
[15:28:54] Server started http://localhost:8080
[15:28:54] LiveReload started on port 35729
[15:28:55] Plumber found unhandled error:
SyntaxError in plugin 'gulp-browserify'
D:/Project/Thunderboard/thundercloud-master/src/js/fake_2f082869.js: Assigning to rvalue (14:21)


and my browser got a blank page on localhost:8080

@hornej
Copy link
Author

hornej commented Jun 26, 2017

I just updated final notes section. it includes the link to the files you will need.
The link is in the original tutorial but kind of hard to find so I figured I would add it here as well

@bennettChen
Copy link

. thank for the help. and i can get the sensing data & upload it to firebase.

the guide missed one thing, that is firebase for python needed to be installed.
===> sudo pip install python-firebase
if u dont run this command, python will show u the ==> No module named 'firebase'

@MCRingo
Copy link

MCRingo commented Jan 22, 2018

Thanks for your help!
But I have a question. How can I ran gulp watch?
I have just installed the gulp modules. But when I type in "gulp watch" in thundercloud folder it says:

pi@raspberrypi:~/thundercloud $ gulp watch
module.js:540
throw err;
^

Error: Cannot find module 'gulp-concat'
at Function.Module._resolveFilename (module.js:538:15)
at Function.Module._load (module.js:468:25)
at Module.require (module.js:587:17)
at require (internal/module.js:11:18)
at Object. (/home/pi/thundercloud/gulpfile.js:2:14)
at Module._compile (module.js:643:30)
at Object.Module._extensions..js (module.js:654:10)
at Module.load (module.js:556:32)
at tryModuleLoad (module.js:499:12)
at Function.Module._load (module.js:491:3)

@dasberliner
Copy link

Thanks for your help!
But I have a question. How can I ran gulp watch?
I have just installed the gulp modules. But when I type in "gulp watch" in thundercloud folder it says:

pi@raspberrypi:~/thundercloud $ gulp watch
module.js:540
throw err;
^

Error: Cannot find module 'gulp-concat'
at Function.Module._resolveFilename (module.js:538:15)
at Function.Module._load (module.js:468:25)
at Module.require (module.js:587:17)
at require (internal/module.js:11:18)
at Object. (/home/pi/thundercloud/gulpfile.js:2:14)
at Module._compile (module.js:643:30)
at Object.Module._extensions..js (module.js:654:10)
at Module.load (module.js:556:32)
at tryModuleLoad (module.js:499:12)
at Function.Module._load (module.js:491:3)

MCRingo, if your issue is still unresolved, try
npm install gulp-concat

For installing all missing modules of gulp (I had to install a great deal of them manually), try this command https://www.npmjs.com/package/npm-install-all to install them all at once

@Xoib
Copy link

Xoib commented Sep 12, 2019

@hornej : Did you succeed with your sense2 ?

I keep getting this BTLE exception for whatever field I try to read.

Starting thread <Thread(Thread-1, initial)> for 54313
Exception in thread Thread-1:
Traceback (most recent call last):
  File "/usr/lib/python2.7/threading.py", line 801, in __bootstrap_inner
    self.run()
  File "/usr/lib/python2.7/threading.py", line 754, in run
    self.__target(*self.__args, **self.__kwargs)
  File "tbsense_scan.py", line 58, in sensorLoop
    data['co2'] = tb.readCo2()
  File "/home/pi/thundercloud/tbsense.py", line 79, in readCo2
    value = self.char['co2'].read()
  File "/usr/local/lib/python2.7/dist-packages/bluepy/btle.py", line 197, in read
    return self.peripheral.readCharacteristic(self.valHandle)
  File "/usr/local/lib/python2.7/dist-packages/bluepy/btle.py", line 530, in readCharacteristic
    resp = self._getResp('rd')
  File "/usr/local/lib/python2.7/dist-packages/bluepy/btle.py", line 407, in _getResp
    resp = self._waitResp(wantType + ['ntfy', 'ind'], timeout)
  File "/usr/local/lib/python2.7/dist-packages/bluepy/btle.py", line 370, in _waitResp
    raise BTLEException("Error from bluepy-helper (%s)" % errcode, resp)
BTLEException: Error from bluepy-helper (badstate)

@mrb0y
Copy link

mrb0y commented Dec 17, 2019

@Xoib $ @hornej I'm getting the same error when running tbsense_scan.py ? I tried three different Bluetooth adapters?

@manimathma
Copy link

@hornej I am not able to access the official thundercloud repo. Is it down? If it is taken down, you by any-chance know why that might be.
And one off-topic question. With Rpi3 how many Thunderboard can u track at a time?

@hornej
Copy link
Author

hornej commented Jun 7, 2021

@manimathma it looks like they took down the Firebase cloud functionality because of a security vulnerability, see here

I am not sure how many Thunderboards you can track at a time (I haven't used them in a few years) but I don't see why you shouldn't be able to track multiple.

@LYDIAHAMROUN
Copy link

Bonjour, quelqu'un peut m'aider SVP j'utilise thunderboard sense2 j'ai suivie toutes les étapes mais j'ai toujours des erreurs sous python
pour la comande scanner(), merci d'avance

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment