Arduino to send Frames to Xbee 2 that will set the city water valve to either open or close (DPDT relay), then turn the supply voltage on or off to complete the process (SPDT relay). I currently have the circuit working between the Xbee coordinator and router perfectly (simulating the valve using leds). I have the Digital (DIO4, DIO5) pins of the Coordinator setup with the same pins of the Router. I now need to get the Arduino to send Frame packets to the Xbee Coordinator using serial communications. I copied the frames out of XCTU. I originally tried to use Arduino's pins 2 and 3, so I could keep pins 0 and 1 open for Arduino updates, but that did not seem to work. Well neither does using pins 0 and 1 for data. I am trying to get one of the processes working before adding the second one.
So here is the breakdown of the hardware indicators:
Arduino - TX LED is flashing at regular intervals (and verified that data is being sent through the serial monitor)
Xbee Coordinator (API) - Yellow LED on, Green LED is on, Red LED is flashing
XBEE Router (AT) - Yellow LED on, Green LED is on
XCTU sending-
Coordinator - BLUE LED
Router - Blue LED (LED's on/off as requested)
Arduino sending
Arduino - Flashing Tx LED
XTCU receiving?
Coordinator - No LED's responding
The TX and RX jumpers are correct
Changed baud rate to 9600, just to try, no luck
**** Tried using XTCU unable to activate Remote Xbee while Arduino is sending Frames
Thanks in advance for any assistance.
Code: Select all
// Write API Frame packet from Arduino to Xbee
// http://forum.arduino.cc/index.php?topic=119463.0
// include <Wire.h>
// #include <SoftwareSerial.h>
// #define rxPin 2
// #define txPin 3
// SoftwareSerial mySerial = SoftwareSerial(rxPin, txPin);
// byte pinState = 0;
// Frame for 'Valve' Open or Valve Close Position (Activates DPDT relay which reverses polarity (+ -) to pump)
byte Valve_CLOSE4[] = {0x7E,0x00,0x10,0x17,0x01,0x00,0x13,0xA2,0x00,0x40,0x8B,0x2D,0x60,0xFF,0xFE,0x02,0x44,0x34,0x04,0x5E};
byte Valve_OPEN4[] = {0x7E,0x00,0x10,0x17,0x01,0x00,0x13,0xA2,0x00,0x40,0x8B,0x2D,0x60,0xFF,0xFE,0x02,0x44,0x34,0x05,0x5D};
// Frame for 'Valve' Power "ON" or Power "OFF" (After Valve position is selected, power is then supplied)
byte Valve_Power_ON5[] = {0x7E,0x00,0x10,0x17,0x01,0x00,0x13,0xA2,0x00,0x40,0x8B,0x2D,0x60,0xFF,0xFE,0x02,0x44,0x34,0x05,0x5E};
byte Valve_Power_OFF5[] = {0x7E,0x00,0x10,0x17,0x01,0x00,0x13,0xA2,0x00,0x40,0x8B,0x2D,0x60,0xFF,0xFE,0x02,0x44,0x34,0x04,0x5F};
void setup()
{
// pinMode(rxPin, INPUT);
// pinMode(txPin, OUTPUT);
// mySerial.begin(19200);
Serial.begin(9600);
}
void loop()
{
Serial.write(Valve_OPEN4,20);
delay(3000);
Serial.write(Valve_CLOSE4,20);
delay(3000);
////////////////////////////////////////////////////////
/////// RESET VALVE POWER TO OFF /////////////////////
//////////////////////////////////////////////////////
}