IoT Zone is brought to you in partnership with:

Dr. Industrial Engineer in structures, working in the School of Engineers in the University of Valladolid in Spain for more than 16 years. His passion is related to applying programming to solve real problems. Being on Java since 1999, now spares his time between JavaFX and the Embedded world, developing commercial applications and open source projects (JFXtras, https://github.com/jperedadnr), blogging (http://jperedadnr.blogspot.com.es/), tweeting (@JPeredaDnr) or speaking at conferences (JavaOne, W-JAX, JFokus). José lives with his wife and kids in Valladolid, Spain. Jose has posted 1 posts at DZone. You can read more from them at their website. View Full User Profile

End-to-End Raspberry Pi with NetBeans IDE 8

01.22.2014
| 10092 views |
  • submit to reddit

In preparation for the talk G-Force! Self-Powering Global Sensor Nets for IoT that Mark Heckler (@MkHeck) and I will give in a few days in the IoT track of JFokus 2014, we’ve been using the brand new beta version of NetBeans IDE 8 to deploy, debug, and run two of the three different projects required. We use three different Raspberry Pis for three different tasks:

  • Pi “Remote”, in the backend, with a Java SE project

  • Pi “Master”, the server, with GlassFish 4.0 (Web Profile).

  • Pi “Client”, the client, with a JavaFX (SE) project

The communications between the three of them is done via WebSocket. In the backend, the Pi gathers readings from several sensors installed via serial port and also controls a few connected devices. In the client, the user can see values in real time, charts with data for a selected period of time, or command the devices.

Here are two pics of our systems. The first one is the backend in Mark’s shed, where all the sensors are powered with renewable energy coming from a small wind turbine and three small solar panels.


The second is my own setup, with the three Raspberry Pis on my table, just when I’m deploying a JavaFX client from my laptop to the Pi on the left, which is connected to the monitor. The server is embedded in a Lego case to hold a Pi camera, and the third one has an XBee antenna to wirelessly connect to the Arduino on the right.


Except for the server, for the other two SE projects, the new capability of NetBeans IDE 8.0 beta that allows you to select a Remote Java Standard Edition platform comes in really handy, as it greatly simplifies the process of deployment and debugging on the Pis.


You just need to provide the IP address, username, password and the JRE/JDK path of the Pi (on the LAN, with SSH enabled).


After that, simply go to Properties->Run, select the Remote platform, and add a configuration file (providing a name for it), and you’ll be able to run your project on the Pi. If you want, you can run it locally too, just by selecting the default configuration file (Run, Set Project Configuration).


NetBeans will take care of sending the dist folder with the jar and its dependencies to a folder on the Pi (by default /home/pi/NetBeansProjects/<project’s name>), running and even debugging it remotely as if you were running the project on your own computer, with all the console messages in your output windows. You just have to keep in mind that you’re on the tiny Pi.


Once again, kudos to the NetBeans Team!

Published at DZone with permission of its author, Jose Pereda.

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)