First test of passing data from XBee to Arduino to Node.js to client

Today I successfully mapped data from three different XBee modules onto a web page hosted on a local server. This is a very big accomplishment for me since it is truly a proof of concept for the entire Sonome project.

Just a few days ago I finally hooked up the receiver XBee to the Arduino so that I could see the packets coming in through the serial monitor. Today I took that one step further, by incorporating that Arduino code into the du.ino code used to connect the Arduino to the Node.js server.

I don't have an XBee shield so I had to wire the pins myself. It's very easy though; as indicated in the code, Arduino digital pins 8 and 9 connect to the XBee DOUT and DIN pins, respectively.

AltSoftSerial allows you an additional serial port simulated through software, and is necessary since both the XBee and Arduino use serial communication. In my testing I found that the hardware serial baud rate must be significantly higher than the XBee rate in order to minimize mixed-up packets. I found this using only 3 XBees, but it will become even more critical when all 16 are blasting away simultaneously.

I then had to incorporate the code above into the du.ino stock code. There was some sort of conflict with the Servo library used by du.ino, so I removed all servo-related code; I don't need to control servos for this project.

As you can probably see from the code, I am printing an array of 16 bytes to the serial port - one byte for each sensor. This is what gets passed through to Node.js, and is how a client knows which value is which. The indices correspond to the transmitter XBee addresses so I can correctly map their locations.

I'm in very good shape now to finish the project on time. I need to connect the microphones to the XBees, and start testing ranges and levels in the real space.

Heatmap color schemes and XBee update

I have been spending a lot of time trying out different color schemes for the Sonome heatmap. Even if all of the sensors are working and successfully transmitting to the server, the visualization could easily be ruined by using the wrong palette.

I decided to focus on a single color because I think it will stand out beautifully on a minimal, sparse background. The final floor plan image will use even thinner lines than the one shown here so there will be plenty of negative space for everything to breathe.

Below are some possible options, the last being the stock heatmap colors for comparison (gradient from blue to green to red). I am favoring #1 but am curious about the grayscale versions because I think they are visually compelling as well.

In addition to the graphic design, I have pressed onward with creating an XBee network. Right now I'm borrowing 4 XBee modules and can successfully send packets from each transmitter to the master receiver. However, I am still hard at work figuring out the best way to send the data from the receiver XBee to the Arduino, and through to the web server.

The program XCTU makes programming the modules so much easier. As shown above, it even can visually display the network topography. This has proven helpful in testing multiple modules at once. I have researched further techniques for managing the barrage of data received by the single receiver. One technique is to stagger the transmit rate of each module by a few milliseconds in order to reduce overlap.

I configured the XBees using custom parameters, including the use of API mode, which allows them to send packets instead of simply serial data. This makes it possible to identify the source transmitter from the data alone. Also I am much more confident that I won't run into RF interference problems from other XBees because of the steps I've taken to isolate them in one part of the XBee wireless spectrum.