Skip to main content

IoT Hackathon Part II : Overview of Grove Pi sensors

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 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

Popular posts from this blog

ADF 12.1.3 : Implementing Default Table Filter Values

In one of my projects I ran into a requirement where the end user needs to be presented with default values in the table filters. This sounds like it is a common requirement, which is easy to implement. However it proved to be not so common, as it is not in the documentation nor are there any Blogpost to be found that talk about this feature. In this blogpost I describe how to implement this. The Use Case Explained Users of the application would typically enter today's date in a table filter in order to get all data that is valid for today. They do this each and every time. In order to facilitate them I want to have the table filter pre-filled with today's date (at the moment of writing July 31st 2015). So whenever the page is displayed, it should display 'today' in the table filter and execute the query accordingly. The problem is to get the value in the filter without the user typing it. Lets first take a look at how the ADF Search and Filters are implemented by...

ADF 11g Quicky 3 : Adding Error, Info and Warning messages

How can we add a message programatically ? Last week I got this question for the second time in a months time. I decided to write a short blogpost on how this works. Adding messages is very easy, you just need to know how it works. You can add a message to your faces context by creating a new FacesMessage. Set the severity (ERROR, WARNING, INFO or FATAL ), set the message text, and if nessecary a message detail. The fragment below shows the code for an ERROR message. 1: public void setMessagesErr(ActionEvent actionEvent) { 2: String msg = "This is a message"; 3: AdfFacesContext adfFacesContext = null; 4: adfFacesContext = AdfFacesContext.getCurrentInstance(); 5: FacesContext ctx = FacesContext.getCurrentInstance(); 6: FacesMessage fm = 7: new FacesMessage(FacesMessage.SEVERITY_ERROR, msg, ""); 8: ctx.addMessage(null, fm); 9: } I created a simple page with a couple of buttons to show the result of setting the message. When the but...

ADF 12c : Using Jasper Reports en JasperSoft Studio 6.1; What Libraries do you need?

Over the last couple of years, or better in the last decade I have implemented several reporting solutions with Jasper Reports in ADF. I did that in ADF 10g, ADF 11.1.1.x, ADF 11.1.2.x and ADF 12.1.x I also used several version of Jasper Reports. There is a whole lot of documentation, blogposts and presentations available. So when today I got a request from one of my customers to make a setup for the implementation of Jasper Reports 6.1 in ADF 12.1.3 I did not expect any problems. Boy was I wrong. Here is the Story With all the knowledge from the past, I decided to follow the known steps. 1) Download iReport Designer, 2) Build a report in iReport 3) Create an ADF application 4) Add the necessary libraries to use the report 5) Call the report from a button via a Managed Bean Step 1 In the past I used iReport designer to build the reports. When you go to the download site of iReport designer you now see an interesting message. So I took this serious and decided not to u...