In September (15th and 16th) we will be organising an IoT Hackathon together with Oracle. I preparation of that I will write several post here concerning IoT. This post gives you an Overview of Grove Pi sensors and some of the fun things that you can do with it. See also this two minute tech tip that is an intro to this post.
The GrovePi+ Starterkit
Connecting sensors to the Internet of Things (IOT) is really easy! No need for soldering or breadboards: plug in your Grove sensors and start programming directly. GrovePi+ is an easy-to-use and modular system for hardware hacking with the Raspberry Pi and the Internet of Things.
Here is what the kit contains:
The following sensors and lights are in the kit:
It also contains a GrovePi+ Guidebook what all the stuff you need to setup your Sensorkit. Make sure to go trough this guidebook before you start. It can really save you some time.
Preparing your Raspi
The first step with your new GrovePi is to get it working with the Raspberry Pi. There are several ways to getting the Grove Pi communicating with the Raspberry Pi. You can configure your own image, download and use the modified Raspian image, or get an SD card from Dexter industries. All methods are described here.
I choose to use the modified Raspian image that is optimized for use with the GrovePi kit. A complete and precise description of all the steps involved in setting up the SD card can be found here. It worked for me, but be careful not to get fooled. Do not ignore this line SD card setup manual : Installation could take many minutes, and up to an hour depending on the speed of your SD card device and quality of the SD Card. Unfortunately, there is no indication of progress.
It really took me a long time. Because I was oblivious, I aborted the process several times, only to find that the SD card setup really was not finished.... It honestly took 1 hour and 20 minutes to finish the SD card creation. But once it was done, it worked great.
Don't forget to continue with the final step in the manual, expanding the filesystem on the SD card.
Creating your first thing
With the new and optimized SD card up and running, you can now go and create you first thing
Again, I found that there are many samples available. I decided to work with the Temperature and Humidity sensor. A very nice and simple setup which is described here.
I prefer to work with python because it is a very simple language which is easy to learn. I could simply copy and paste the code. The only change I had to make was to change the parameter module_type from 1 to 0 because I am using the DHT sensor and not the DHT pro. This is also part of the description. I also changed the filename to wheatherstation.py
Now you are ready to start your program and the see the reading on your LCD
Some notes to help you when you run into errors:
1) If you get import errors you probably run into one of the weird and slightly confusing things about the awesome library of GrovePi scripts. A lot of these scripts import other scripts that are in the same directory. We need grovepi and grove_rgb_lcd as imports, but in order to do this without errors I had to copy grove_rgb_lcd.py into the same directory as my weatherstation script.
2) If you see some weird reading (like I did, humidity = 1800%), you probably did not change the module type parameter to indicate what DHT sensor you are using, which is explained here.
Autostart ?
Now the weatherstation works like a charm, but if the Raspi is rebooted, you need to manually restart the python script. That is not the way I want this to work. In a next post I will describe how to make the weatherstation start on reboot.
The GrovePi+ Starterkit
Connecting sensors to the Internet of Things (IOT) is really easy! No need for soldering or breadboards: plug in your Grove sensors and start programming directly. GrovePi+ is an easy-to-use and modular system for hardware hacking with the Raspberry Pi and the Internet of Things.
Here is what the kit contains:
- The GrovePi+ Board
- 12 Grove sensors
- Grove cables for connecting the sensors to the GrovePi+ board.
The following sensors and lights are in the kit:
- Grove – Sound Sensor
- Grove – Temperature and Humidity
- Grove – Light Sensors
- Grove – Relay
- Grove – Button
- Grove – Ultrasonic Ranger
- Grove – Rotary Angle Sensor
- Grove – LCD RGB Backlight
- Grove – Red LED
- Grove – Buzzer
- Grove – Blue LED
- Grove – Green LED
It also contains a GrovePi+ Guidebook what all the stuff you need to setup your Sensorkit. Make sure to go trough this guidebook before you start. It can really save you some time.
Preparing your Raspi
The first step with your new GrovePi is to get it working with the Raspberry Pi. There are several ways to getting the Grove Pi communicating with the Raspberry Pi. You can configure your own image, download and use the modified Raspian image, or get an SD card from Dexter industries. All methods are described here.
I choose to use the modified Raspian image that is optimized for use with the GrovePi kit. A complete and precise description of all the steps involved in setting up the SD card can be found here. It worked for me, but be careful not to get fooled. Do not ignore this line SD card setup manual : Installation could take many minutes, and up to an hour depending on the speed of your SD card device and quality of the SD Card. Unfortunately, there is no indication of progress.
It really took me a long time. Because I was oblivious, I aborted the process several times, only to find that the SD card setup really was not finished.... It honestly took 1 hour and 20 minutes to finish the SD card creation. But once it was done, it worked great.
Don't forget to continue with the final step in the manual, expanding the filesystem on the SD card.
Creating your first thing
With the new and optimized SD card up and running, you can now go and create you first thing
Again, I found that there are many samples available. I decided to work with the Temperature and Humidity sensor. A very nice and simple setup which is described here.
I prefer to work with python because it is a very simple language which is easy to learn. I could simply copy and paste the code. The only change I had to make was to change the parameter module_type from 1 to 0 because I am using the DHT sensor and not the DHT pro. This is also part of the description. I also changed the filename to wheatherstation.py
# grovepi_lcd_dht.py
# dht(pin,module_type), change module_type number to use other kind of dht
# module_type:
# DHT11 0
# DHT22 1
# DHT21 2
# DHT2301 3
from grovepi import *
from grove_rgb_lcd import *
dht_sensor_port = 7 # Connect the DHt sensor to port 7
while True:
try:
[ temp,hum ] = dht(dht_sensor_port,0) #Get the temperature and Humidity from the DHT sensor
print "temp =", temp, "C\thumadity =", hum,"%"
t = str(temp)
h = str(hum)
setRGB(0,128,64)
setRGB(0,255,0)
setText("Temp:" + t + "C " + "Humidity :" + h + "%")
except (IOError,TypeError) as e:
print "Error"
Now you are ready to start your program and the see the reading on your LCD
sudo python weatherstation.py
Some notes to help you when you run into errors:
1) If you get import errors you probably run into one of the weird and slightly confusing things about the awesome library of GrovePi scripts. A lot of these scripts import other scripts that are in the same directory. We need grovepi and grove_rgb_lcd as imports, but in order to do this without errors I had to copy grove_rgb_lcd.py into the same directory as my weatherstation script.
2) If you see some weird reading (like I did, humidity = 1800%), you probably did not change the module type parameter to indicate what DHT sensor you are using, which is explained here.
Autostart ?
Now the weatherstation works like a charm, but if the Raspi is rebooted, you need to manually restart the python script. That is not the way I want this to work. In a next post I will describe how to make the weatherstation start on reboot.
Comments