Pages: [1]   Go Down
Author Topic: Communicating with a serial device over XBee  (Read 180 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 2
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Any advice would be greatly appreciated.

Logged

Offline Offline
Faraday Member
**
Karma: 87
Posts: 4966
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

What have read so far in the way of documentation on how to use the xbee -S2B ?
What documents do you have ?
Logged

Arduino UNOs, Pro-Minis, ATMega328, ATtiny85, LCDs, MCP4162, keypads,
DS18B20s,74c922,nRF24L01, RS232, SD card, RC fixed wing, quadcopter

Offline Offline
Newbie
*
Karma: 0
Posts: 2
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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)
Logged

Offline Offline
Faraday Member
**
Karma: 87
Posts: 4966
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Take a look at this video and see if there is anything helpful here.
http://www.jeremyblum.com/2011/02/27/arduino-tutorial-9-wireless-communication/   
Logged

Arduino UNOs, Pro-Minis, ATMega328, ATtiny85, LCDs, MCP4162, keypads,
DS18B20s,74c922,nRF24L01, RS232, SD card, RC fixed wing, quadcopter

Offline Offline
Faraday Member
**
Karma: 87
Posts: 4966
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

This may help
http://arduino.cc/en/Tutorial/SoftwareSerialExample   
Quote
  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 ?
Code:
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.
Logged

Arduino UNOs, Pro-Minis, ATMega328, ATtiny85, LCDs, MCP4162, keypads,
DS18B20s,74c922,nRF24L01, RS232, SD card, RC fixed wing, quadcopter

Pages: [1]   Go Up
Jump to: