Trying to get Robert Faludi’s Simple Sensor Network to run


Following on from USB-TTL interface devices on OS X, basically I am trying to run Robert Faludi’s processing code, Simple_Sensor_Network, from Building Wireless Sensor Networks. However, I have run into an incredible number of issues:

Issue #1

I have been unable to get the MacBook to play ball with my cheapo Chinese eBay sourced XBee explorer (the USB-TTL chip is non-standard (i.e. not FTDI FT232RL), see USB-TTL interface devices on OS X. So, I have plugged it back into the PC laptop, where it works fine with X-CTU. However, when running simple_sensor_network.pde I only get a blank grey window:

Blank grey output window
Blank grey output window
Issue #2

Don’t forget that you have to use Processing 1.5.1 as later versions have a problem with the XBee library, Source: XBee API Library for Processing « Rob Faludi. If you use a later version then the following lines throw the error “NoClassDefFoundError:gnu/io/serialportevent listener”:

// create and initialize a new xbee object
XBee xbee = new XBee();
Issue #3

There is a line, in the Simple_Sensor_Network.pde file, (line 20) that requires changing in the code, to specify the SerialPort:

String mySerialPort = "/dev/tty.usbserial-A1000iMG";

On the PC, it is listed as COM16. However, changing /dev/tty.usbserial-A1000iMG”; to “COM16” does not seem to help (See Note #1), and I still get the blank grey window.

If this is not set correctly then the following error will be displayed:

** Error opening XBee port: com.rapplogic.xbee.api.XBee.Exception **
Is your XBee plugged in to your computer?
Did you set your COM port in the code near line 30?

This is totally expected, as it is caught by the code, and is, essentially, the same as Issue #7.

Issue #4

Now, there is a warning about RXTX mismatch, when running on Windows 7 x32:

WARNING:  RXTX Version mismatch
Jar version = RXTX-2.2pre1
native lib Version = RXTX-2.2pre2

The solution appears to be to change a binary in the Processing library. It is described in How do I install RXTX-2.2pre1.jar on Windows 7?


   and download from “Binary” column.
goto C:\Users\Downloads\\rxtx-2.1-7-bins-r2
   and copy RXTXcomm to
   C:\Program Files\processing-1.5.1\java\lib\ext
goto C:\Users\Downloads\\rxtx-2.1-7-bins-r2\Windows\i368-mingw32
   and copy both rxtxParallel.dll and rxtxSerial.dll to
   C:\Program Files\processing-1.5.1\java\bin


This actually does fix the issue, with the resulting output:
Stable Library
Native lib Version = RXTX-2.1-7
Java lib Version   = RXTX-2.1-7
[0] "COM4"

However, I still have the blank grey window.

Issue #5

Starting Processing 1.5.1 with the explorer plugged in, but no XBee in the explorer, seems to cause Processing application itself, not the .pde code (the code has not even been loaded at this point) to barf with an error along the lines of “The was a problem starting up”.  When the dialogs were dismissed the processing application opened up (in fact two instances opened). This was quite unexpected, and happened twice in succession (hence the two instances opening), and then it was no longer reproducible. This may have been due to a background Windows Update check for updates, that was maxing out the CPU and which was subsequently cancelled.

Issue #6

Ignoring Issue #5 as a one-off Windows Update race condition… Starting Processing 1.5.1 with the explorer plugged in, but no XBee in the explorer, results in a grey window.

Blank grey output window
Blank grey output window
Issue #7

Starting Processing 1.5.1 without the explorer plugged in, causes the code to result in the error:

** Error opening XBee port: com.rapplogic.xbee.api.XBee.Exception **
Is your XBee plugged in to your computer?
Did you set your COM port in the code near line 30?

This is totally expected, as it is caught by the code, and is, essentially, the same as Issue #3.

Issue #8

I only get a grey window, even with a router sensor (see Issue #9 below) plugged in. I had thought that the grey window was due to the fact that there were no sensor nodes were detected by the coordinator (as there were none – I was merely starting the processing application up, and running the simple_sensor_network.pde file, with only the Coordinator XBee plugged into the PC, via the explorer.


Nicholas and NickG (they could be one and the same), in the comments on the page TMP36 Instructions: Simple Sensor Network, have this issue

Then nothing appears.

Now, whether “Then nothing appears.” means that they get a grey window, is not clear. They appear to have remedied this issue by buying a new explorer.

OK – the Xbee’s are now communicating (purchased a new xbee explorer) however all i receive is the “Got error in data frame”. How could i remedy this? Thank you

Maybe this is my issue? I will purchase another explorer to check this.

Issue #9
 The router’s association LED flashes twice a second, even if the Coordinator is not plugged in… so what on earth is it associating with??? Why is there not a steadily lit association LED?
Issue #10
Ripping out the XBee explorer from the USB whilst the simple_sensor_network.pde is running results in a NullPointerException and a loop of errors:
Error 0x5 at /home/bob/foo/rxtx-devel/build/../src/termios.c(482): Access is denied.

Error 0x5 at /home/bob/foo/rxtx-devel/build/../src/termios.c(2714): Access is denied.

[2015-12-15 10:44:09,599] [Thread-3] [ERROR] [com.rapplogic.xbee.RxTxSerialComm] RXTX error in serialEvent method No error in nativeavailable
 at Method)
 at com.rapplogic.xbee.RxTxSerialComm.serialEvent(
 at Method)
Putting the explorer back in to the USB does not serve to quell the errors and the Processing sketch needs to be stopped.
Issue #11

It is not possible to close the Output window of the Processing sketch. The sketch has to stopped on the Processing “console”, by hitting the stop button.


In an act of desperation, I switched the CP2102 to using a CH340G USB-TTL interface, but then even the X-CTU failed to see the XBee! That could be due to an incorrect driver, although it seems unlikely as the COM port was detected. So it seems like an issue bettween USB-TTL and XBee explorer.


OK, so I had erroneously set the router’s DH and DL to the coordinator’s SH and SL respectively (as this had been done for the Doorbell, I had assumed that it was required for this project), instead of 0 for both. I don’t know why there is a difference, maybe to do with the fact that the coordinator is using API, in lieu of AT, firmware?

I had also set the DH and DL of the coordinator to the router’s SH and SL, however, this seems to work for just one router. For more than one, as yet, I don’t know what would happen – I assume that it would fail.

The AP (=2) and (PAN) ID are set correctly however, on the coordinator, as is the  (PAN) ID on the router.

In addition, I had both lazily and stupidly, failed to set the router’s rejoin (JV) to 1, Pin 0 to analogue mode (D0) to 2 and the sampling rate (IR) to 3E8.

The lack of a JV may explain Issue#9, why the router was apparently self associating.

The lack of IR (in conjunction with a lack of D0) may explain why the blank window, as no samples where being sent, or again, along with the lack of JV and the incorrect DH and DL, as the remote sensor (i.e. the router) was not discovered, no thermometer was displayed.


The moral of the story is to read the instructions and complete the configuration fully, instead of half-arsed attempts.

Useful Links

  • BWSN Remote Temperature Sensors raises a good point about simple_sensor_network.pde not working with the later Processing versions (after 1.5.1) and provides a code patch:
// opens your serial port defined above, at 9600 baud
// ## (2013-Aug-27) Updated Processing, now have to
// ## select the serial port from the "serial.list" array.
// ## IE "serial.list()[X]" where X is the COM port
// ## in the array.[2], 9600);

However, this does not address Issue#2


2 thoughts on “Trying to get Robert Faludi’s Simple Sensor Network to run”

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s