homespun-grovepi
v0.2.0
Published
This is a Node.js module that reads sensors residing on a [Raspberry Pi](https://www.raspberrypi.org) and a [GrovePi+ Shield](http://www.dexterindustries.com/shop/grovepi-board/) and transcodes them to [TSRP](http://thethingsystem.com/dev/Thing-Sensor-Rep
Downloads
4
Maintainers
Readme
homespun-grovepi
This is a Node.js module that reads sensors residing on a Raspberry Pi and a GrovePi+ Shield and transcodes them to TSRP. You should review the homespun root in order to understand home this repository fits into the homespun family.
In brief, you need to be running a process on your home network that listens for TSRP traffic, and then feeds it to a server that listens for TSRP and uploads the sensor readings to the management cloud of your choice -- here's my choice.
Note that this repository does not have the "Wiki" section -- if you want to discuss the homespun framework or homespun-grovepi, please send an email to the maintainer requesting to be added to the homespun team.
Installation
The first step is to get a Raspberry Pi and a GrovePi+ Shield. (Note that there is an earlier version called the GrovePi shield -- no longer for sale; however, without loss of generality, the same instructions apply to both!)
Once you have the RPi configured, you'll need to install software on your RPi that will talk to the GrovePi+ shield. You can find the QuickStart here, but here's the gist:
First, gently mount on the GrovePi+ on the RPi, the pins should align exactly.
Next, install the software:
pi@raspberrypi ~ $ git clone https://github.com/DexterInd/GrovePi.git
...
pi@raspberrypi ~ $ cd GrovePi/Script
pi@raspberrypi ~/GrovePi/Script $ chmod +x install.sh
pi@raspberrypi ~/GrovePi/Script $ sudo ./install.sh
...
These commands may take a while, and (as of this writing) you'll be asked twice:
Do you want to continue [Y/n]?
Please be patient. When complete, your RPi will reboot.
You can verify that everything installed OK, by running this command:
pi@raspberrypi ~ $ sudo i2cdetect -y 1
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- 04 -- -- -- -- -- -- -- -- -- -- --
...
At this point you might as well upgrade the firmware on the GrovePi+ to the latest:
pi@raspberrypi ~/GrovePi/Firmware $ sudo ./firmware_update.sh
...
The script may ask you to connect a jumper to the reset pin -- this is no longer necessary. You can check the firmware version by running:
pi@raspberrypi ~/GrovePi/Software/Python $ python grove_firmware_version_check.py
('GrovePi has firmware version:', '1.2.2')
Finally, here is the list of supported sensors.
Programming
The "preferred" language for programming the GrovePi+ is Python.
However in the GrovePi/Software
directory,
you will find examples in C, C#, Go, Node.js, and Python.
If you want to use the homespun.js
script:
pi@raspberrypi ~ $ cd homespun-master
pi@raspberrypi ~/homespun-master $ npm -l install
...
In the file config.json
,
there are several configurations:
the first configuration is an example of using a Grove Water Sensor connected to pin D7; and,
the second configuration,
the-kitchen-sink
, is purposefully incomplete -- it contains definitions for all the Grove sensors known to work with thehomespun.js
script.
A configuration file is used to tell the homespun.js
program which sensors are active, e.g.,
pi@raspberrypi ~/homespun-master $ node homespun.js --config name whatever.json
Running
pi@raspberrypi ~/homespun-master $ npm -l install
...
pi@raspberrypi ~/homespun-master $ node homespun-grovepi.js
Without any arguments, homespun.js will use the first entry in the file config.json
.