I have a serial device (miniature particle counter) that I would like to communicate with using an Xbee radio shield connected to an arduino. Once the port is initialized, the device sends a serial stream that I would like to feed into the Arduino then the Xbee for wireless communication back to my host computer, where I will record the serial stream into labview. It would be ideal to also be able to transmit to the device. Having limited experience with Xbee and Arduinos, is there a recommended (straight forward) way to do this?
Hardware: Arduino Duemilanove ATMEGA328, XBee PRO S2B on a wireless proto shield
Most of what I know is by reading sample code (I have little formal documentation). I have successfully written/modified code to communicate to the arduino via the XBee to simply read in an analog voltage from A4/A5 of the Arduino. This works well for most of the sensors I have worked with. However, for this application the output from the sensor is already in serial format. I am a bit stuck on how to relay this through the arduino and Xbee.
Reading the buffer from the device directly into Labview (or another serial recorder is trivial). The buffer is simply a set of two numbers (e.g., 141, 121)
he Arduino Due is a microcontroller board based on the Atmel SAM3X8E ARM Cortex-M3 CPU (datasheet). It is the first Arduino board based on a 32-bit ARM core microcontroller. It has 54 digital input/output pins (of which 12 can be used as PWM outputs), 12 analog inputs, 4 UARTs (hardware serial ports), a 84 MHz clock, an USB OTG capable connection, 2 DAC (digital to analog), 2 TWI, a power jack, an SPI header, a JTAG header, a reset button and an erase button.
Have you tried using one of your extra serial ports to do something like this ?
void setup()
{
// Open serial communications and wait for port to open:
Serial1begin(57600);
Serial2begin(57600);
while (!Serial)
{
}
void loop() // run over and over
{
if (Serial1.available())
Serial2.write(Serial1.read());
}
I've never tried something like that so the syntax could be wrong but you get the idea. Read in from one port (the xbee) and write to another port (Serial Monitor). If that works then the next step is parsing the incoming code before sending the parsed data out. Persue that angle.