IoT without the Breadboard Part 2

      No Comments on IoT without the Breadboard Part 2

In 2012 Seeed Studios of China introduced the Grove System of modules for the burgeoning IoT sector. Seeed used the classic model of simplification, Lego. In the world of Lego you just push bricks together. Seed developed the Grove System to be that easy to use. Of course nothing is quite that simple, not even Lego. None the less, the Grove system was made for breadboard impaired developers like me.

When initially introduced it was and still remains agnostic towards whatever processor you are working with. As long as your processor system, such as either an Intel Edison or a Raspberry Pi, has GPIO pins you can use the Grove. The individual devices are mounted on a circuit board with all the necessary support components. A 4-pin connector allows you to plug the module into the processor’s board.

The Grove modules fall into specific categories. These are:

  • Environmental Monitoring modules
  • Motion Sensing modules
  • User Interface modules
  • Physical Monitoring modules
  • Logic Gate modules
  • Power modules

Here are some of the modules.

IoT-Sensors-Market

Figure 1 For a complete list of what is available go to http://www.seeedstudio.com/wiki/Grove_System

The second part of the Grove system is the shield. A shield is what is properly called a daughter board. When the Arduino system was introduced they repurposed the word shield to mean daughter board. There are some unhappy engineers as a result of this because the term shield is supposed to mean “a conductive layer that prevents capacitive coupling to whatever you are trying to protect with the shield”. I also read that the Arduino folks also decided to rename programming as sketching. Here is what a basic Grove system looks like as sold by Seeed Industries.

Grove Starter Kit V3

Figure 2 From https://www.seeedstudio.com/Grove-Starter-Kit-for-Arduino-p-1855.html

You can see the shield between the LCD Display and the cables. The shield in this kit is designed for the Arduino system board. This particular kit sells for $49 USD.

In a collaborative project between Seeed Studios and the US firm Dexter Industries a shield for the Raspberry Pi was developed. The most recent version of this shield is called the GrovePi+ and it will connect to all models of the Raspberry Pi. The shield makes use of the same processor as found on an Arduino board.

grovepi2

Figure 3 GrovePi+ mounted on a Raspberry Pi

The GrovePi+ has a female pin connector that lines up with the GPIO pins on the Pi. The board even includes a slit to allow using the dedicated camera connector on the Pi that the shield is covering.

With the shield in place you can easily connect a wide range of moduleseffortlessly to your platform of choice such as the Raspberry Pi. The shield can be purchased separately or as part of a kit. Dexter and Seeed sell a kit with the shield and 12 modules.

GrovePi-Base-Kit-800x800

Figure 4 The Basic GrovePi+ Kit

Dexter began as a maker of Lego Mindstorms add-ons before they added the Raspberry Pi to their lineup. They market their products to the education field and they have a 3-month loaner program for educators. A kit containing the basic kit and a Raspberry Pi 2 is what Dexter was kind enough to loan to me under this program.

GrovePi-Starter-Kit-800x800

Figure 5 GrovePi+ Starter Kit for the Raspberry Pi.

With the hardware in place the next thing I needed was a Java library that I could use to interact with the Grove modules. The Dexter web site lists only Scratch, Python, NodeJS, Go, C and C# as supported languages. The next article will look at a mashup between Payara Micro and the GrovePi+ in Java.

Bibliography:

Importing Maven Projects from Git into Eclipse That Were Created By NetBeans

Eclipse projects managed by Maven and stored in a git repository can be opened in NetBeans without taking any special measures. The same cannot be said for trying to open a NetBeans project managed by Maven in Eclipse. This article will show you how to accomplish this task.

Step 1:

Verify that the project you are importing from a git repository is a Maven managed project. This is important because Maven defines the directory structure of the project and only if this structure is respected can the project be succesfully imported.

Maven projects created by Eclipse store all the files in a folder at the root level of the Git repository.

Figure 1 What an Eclipse project will look like on gitlab.com

To determine if this is a Maven managed project you will need to open the folder.

Figure 2 Maven managed Eclipse project

The existence of the ‘.project’ and ‘.classpath’ files plus the ‘.settings’ folder identify this project as created by Eclipse. NetBeans will load Eclipse based Maven projects without any issues. The same cannot be said when going in the other direction. Up until now I have been creating my sample code with Eclipse so that it can be used with either Eclipse or NetBeans. Not anymore as I prefer NetBeans to Eclipse.

A basic Maven managed project will have a file named pom.xml and a folder named ‘src’. There may be sub-folders to ‘src’ as well as other folders and files but it is safe to assume that if there is a pom.xml then the directory structure below ‘src’ is correct.

Image title

Figure 3 Maven managed project created with NetBeans

Eclipse cannot recognize this project created with NetBeans as a valid project without some effort.

Step 2:

In Eclipse select the File menu and then select Import… You will see:

Figure 4 Eclipse Import dialog

Step 3:

Select Projects from Git, click on Next, and you will now see:

Figure 5 Is the project in a local or remote repository

Step 4:

Select Clone URI and you will see:

Figure 6 Defining the location of the repository and project

All you need to enter on this form is the https address of your project from the repository. Once you do, most of the remaining fields are filled in. You only need a user name and password if you plan to commit back to the repository, assuming you have the necessary privileges.

Figure 7 After entering the URI

Step 5:

The next dialog allows you to select either the master or a branch of the project.

Figure 8 Choose the master or, if present, one of the branches of the project

Step 6:

The next dialog deals with an unusual feature of Eclipse and Git. Eclipse stores projects in folders called Workspaces. In the workspace folder are all the configuration information for every project in the workspace. Non git projects are created as sub folders of the workspace.

In a non-Eclipse environment the folder that a project is stored in will have a sub-folder named ‘.git’. This is where git stores your code whenever you perform a commit. However, the best practice for Eclipse is for git projects to be stored outside the workspace folder. The workspace is then configured to use your project as if it were a sub-folder of the workspace.

Figure 9 Selecting the folder for a Git project

By default, Eclipse will want to store your projects in a folder named git in your home folder. Feel free to change the location of the folder.

Step 7:

The next action is to chose a wizard for importing the repository.

Figure 10 Choosing the import wizard

If the project was originally created by Eclipse then you would select Import existing Eclipse projects. A NetBeans project is not recognized. Therefore, we must set it up as a General Project.

Step 8:

Now we need to give the project a name. Eclipse chooses the git name and that is usually sufficient.

Figure 11 Entering a name for the project

Click on Finish and you should see your project in Eclipse.

Figure 12 Imported project in Eclipse

Step 9:

As it stands the project is not ready to work with. You must convert the project from a General to a Maven project. Eclipse makes this easy. Right mouse click on the project and select Configure -> Convert to Maven project.

Figure 13 Converting a general Project to a Maven Project

The project will now look like a proper Maven project.

Figure 14 Maven project prsentation in Eclipse

You can delete the ‘bin’ folder. It is not a Maven folder and Eclipse is storing a copy of the project with its compiled code in it. It can be safely removed.

Step 10:

As a final step you should build your project. In Eclipse you build a Maven project by right mouse clicking on the project and selecting Run As -> 4 Maven Build.

Figure 15 Running your project as a Maven Build

Step 11:

The Edit Configuration dialog now appears. All you need to do here is click on Run.

Figure 16 Edit configuration dialog

Your project should compile and execute. There is one problem that could crop up here.

Error when building

You may or may not know that Eclipse, unlike NetBeans and other IDEs, does not use the Java JDK installed on your computer when compiling code. Instead it has a built-in compiler. Maven cannot work with the Eclipse compiler and so must have access to the Java JDK. Unfortunately, Eclipse only sees the JRE installation of Java which is all it needs to run the code it has compiled. If your Eclipse setup does not use the JDK then you will see this error when you run the Maven project:

[ERROR] No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?

To resolve this, go to the menu Window and select Preferences. In the Preferences dialog select Java -> Installed JREs. If you see the JRE in the list, remove it and replace it with the JDK.

Figure 17 Change from JRE to JDK

If you needed to update from JRE to JDK then you should be able to successfully execute a Maven Build.

You should now be able to manage the Maven project that was created from NetBeans in Eclipse.