I currently have XBee S2 and I want to program the GPIO pins to switch ON/OFF LED. I saw a lot of tutorial by using external MCU(like Arduino) but in my case I want to use the XBee without any external MCU attached. It seems that XCTU software only allow the GPIO pins to be set HIGH, LOW, input, etc without any logic that can change their conditions.
So is there any IDE or software that allow XBee GPIO pins to be program?
Digi sells a "Programmable XBee" that includes a separate 8-bit processor you can compile C code to, but that probably isn't what you had in mind.
If you create a network with two XBee modules (A and B), you can have a computer wired to XBee A send a "Remote AT Request" (in API mode) to XBee B to change the I/O pin wirelessly. If you read through the documentation, you'll find everything you need to know about API mode and the Remote AT Request frame type.
Is that the sort of control you were looking for? If not, can you describe your use case in more detail?
Have you found your solution?
Using XCTU has settings for the DIO pins which include HIGH and LOW. What that means is when the XBee comes out of reset, that will be the default setting. So if set HIGH, coming out of reset, the DIO pin will default HIGH. That is my understanding anyway and that seems to be correct.
I am going through the exercise to have a non-programmable XBee sans micro controller to switch some circuits on and off remotely. The setup is as follows:
1) a control XBee which will be attached to a micro
2) a router XBee without a micro (standalone)
Fairly mundane. What I noticed in my setup was that the standalone XBee's associate pin would toggle for a bit then stop for a bit and repeat. This didn't seem right. When I sent a command from the controller XBee it was hit or miss as to whether the command was carried out by the standalone unit. A bit puzzling.
To check out what was going on with the standalone XBee, I hooked up a computer and fired up XCTU. The problem went away. To cut to the chase, I discovered that when I hooked the computer's serial TX to the XBee's RX pin solved the issue!
My XBees are setup with a level shifting IC so the outside world is 5 volt and the XBee is at 3.3v. My best guess is a floating RX pin which is connected to a level shifter is the culprit. Now holding the RX high at 3.3v seems to overcome the problem.
Then it is just a matter up using the API to set the DIO pin HIGH or LOW
In my case I am toggling DIO_1. Here is the API call from the controller XBee:
7E 00 10 17 01 00 7D 33 A2 00 41 50 EA D5 FF FE 02 44 31 05 69
The hex 44 31 is D1 in ASCII the 05 sets the pin HIGH
And for low:
7E 00 10 17 01 00 7D 33 A2 00 41 50 EA D5 FF FE 02 44 31 04 6A
Again the 44 31 but now set to 04 - LOW
And the standalone XBee responds properly to the command. No micro attached!
The floating RX pin may or may not be your issue, but the API string should work using your config params. And don't forget the PAN ID must be the same.
Hope this helps.
Related
I am trying to decode the signals going to shift registers in my washing machine. The registers are STP16CPC05 which also happen to be LED drivers. I am trying to get status from my washing machine like time left, which cycle, check if its done, etc. with an ESP12. If I can read the signals going to the LED drivers, I can determine which bits are for which LED and then determine status in my program.
My first thought was to use a custom shiftin but I had no luck with that (and supposedly digitalread() is too slow anyway) and I was reading everywhere that I should "just use SPI" since it's faster. I have been able to successfully read the signals using a logic analyzer and even made a script for an arduino pro mini that emulates the register signals so that I can more easily debug my ESP12 without running the washer all day. Writing an SPI master is relatively easy but the slave is the hard part. Here is the code for the Arduino Pro mini so it can emulate the washer signals:
// SPI master code for Arduino Pro Mini "washing machine clone"
#include <SPI.h>
void setup (void)
{
SPI.begin ();
SPI.setClockDivider(SPI_CLOCK_DIV8);
}
void loop (void)
{
delayMicroseconds(200);
SPI.transfer(0x00); //00 00 11 01 08 01 08 02 02 00 00 0C 67 66 80
SPI.transfer(0x00);
SPI.transfer(0x11);
SPI.transfer(0x01);
SPI.transfer(0x08);
delayMicroseconds(180);
SPI.transfer(0x01);
SPI.transfer(0x08);
SPI.transfer(0x02);
SPI.transfer(0x02);
SPI.transfer(0x00);
delayMicroseconds(180);
SPI.transfer(0x00);
SPI.transfer(0x0C);
SPI.transfer(0x67);
SPI.transfer(0x66);
SPI.transfer(0x80);
delayMicroseconds(200);
}
Does anyone have any idea on how to make a simple SPI slave on esp? Or is there a better way to sniff this shift register bus? The clock signal is 1 MHZ so it isn't terribly fast. I only need to read 15 bytes at a time.
This was promising but it's been alot of work stripping it down to what I want: https://github.com/JiriBilek/WiFiSpi. I can get it to print out the data once but then I think it is having issues resetting the receive interrupt because it is expecting an interactive master.
There is a SPISlave library in the esp8266 Arduino package. With examples. (Jiri Bilek's firmware has only a modified copy of it.)
I am usign one of Dorji's pruduct. The products name is DRF1276DM. The image of the product can seen in following images
In the application note the producers state that the module can communicate over serial port with TTL level UART. In their application note which can be found at http://www.dorji.com/docs/data/DRF1278DM.pdf. They state that if we send a command like AF AF 00 00 AF 80 03 02 00 00 92 0D 0A the device will response as AF AF 00 00 AF 00 03 02 00 00 12 0D 0A I try to check this command in order to test the device but I receive same command in my all trial. The device send me that 2400 O 8 1 DRF128X V2.7. In the application note they state that the device will send only one time this command when power is one but In my case the response is always same regardless to command code.
For checking the condition I try to use every command on http://www.dorji.com/docs/data/DRF1278DM.pdf but I recieved same respond. My first question is this. Are there any one who deal with same problem with me or could you give me any solution for this case. I am suspicious that the device get reset in every time when I try to send command over serial port. Is there any way to reset the device to default either using software or hardware.
In the application note they state that the first respond which I quoted above, will give the information for communcating device In our case I expected to communicate with device on odd parity 8 bit data size 2400 baud rate but the device only gives irrelevant or nonlogical bytes in 2400 baud rate. Only logical answer I received from device is on the 9600 baud rate. My second question is this. Is there a bug on this device setting or did I miss someting because as far as I know we cannot communicate with devices over multiple baud rate option.
PS:
I try to use their configuration tool which can be found in http://www.dorji.com/products-detail.php?ProId=61, but I got same "time out"
Error from device, I used 2400 boud rate and even parity but the result cannot changed.
Pin EN must be connected to logical 0
Firstly, the Error Time Out error appears because of a damaged UART-to-USB converter or this happens when you are using multiple jumper wires for a single pin of the module. Try using the a single female-to-female jumper wire to connect every pin of your module with the corresponding pin of the UART-to-USB converter.
Your UART is probably working fine, i have the same issues.
My DRF1278/76 modules dont seem to respon to me changing the baudrate in configuration parameters, it looks like its fixed to 9600 bauds, wich is a boomer
I had this problem too, my issue was the EN pin needs to be pulled low. Even with the USB to UART adapter I bought with the modules, that line is allowed to site high by default. Use a jumper to pull it to ground.
I've been trying to control Panasonic PT AE3000U through computer serial port for a last few days. Computer that I am using has serial port on its back, and I've confirmed that port functions at some level by connecting RXD and TXD with jump wire.
Technical information about projector (10Mb): http://www.projectorcentral.com/pdf/projector_manual_4506.pdf
Section that tells about serial communications starts from page 51.
According to manual and that what I've read from online, start-up command in hex should be 02 50 4f 4e 03, but I haven't been able to get it work with that.
Variations of that command I've tried to send with RealTerm and Termite:
02 50 4f 4e 03
02504f4e03
0x02 0x50 0x4f 0x4e 0x03
0x020x500x4f0x4e0x03
And other similar combinations and formats
I assume that command on third row should be the right one, because if I send that as numbers with Realterm, and connect RDX and TXD together similarly as I did before, I get this on screen (display settings are "display as ascii").
http://i.imgur.com/PjpRms7.png
But when I connect cable to the projector and repeat the process, nothing happens. Baudrate is set at 9600, which should be correct.
So, I guess it somehow solved itself. I decided to restart my computer and projector. "Just in case there would be something left from all of mine failed attempts"
And it started to work, I sent line 0x02 0x50 0x4f 0x4e 0x03 with Realterm as numbers only.
My settings were:
Baudrate 9600
Parity: None
Data bits: 8
Stop bits: 1
how can i build the serialforwarder or use it to forward the received data to another program to make some process?
how to parse the data and use it as input data to another program such as Matlab or c# or java application.
which protocol used to parse the recieved data ?
last question: it is just for motes which is base station mote ? can i build one for any mote ?
You have to read thoroughly the serial stack...its not very easy but its do able.
You can directly read from serial port. You don't need serial forwarder in this case. There are few things to take care of.
For example if you want to read a serial message that is being send to serial port of your PC (usb sensorboards just work like serial, since they are using usb to serial converters lik FTDI chip).
in C# (same for Java, etc...) you can read byte streams that are coming in the serial port. You can parse this byte streams to extract a standard serial message of tinyos.
This is somehow explained in TEP #113 although it has some problems, but you should be able to find those problems and make your program work.
As it stated in TEP 113, a standard serial packet is something like:
7e 40 09 00 be ef 05 7d 5d 06 01 02 03 04 05 7e
That means, a packet starts with hex 7E ( I believe its 126 or 127) and ends also with 7E. The last 2 bytes are CRC of the packet. So you can in your c# program start reading from serial port when you encounter 7E and stop reading when you reach the next 7E in the stream. Everything in between will be your packet.
You have to be careful of escaping that is if a 7E is part of your packet content, to be not be confused with start and end dilimeters, it will be escaped to something else...that's also is explained in that TEP 113.
I believe there were some C++ code fro calculating the CRC that you can easily convert it to C# or Java code.
Also check the source code of Serial.h which contains some details about how a serial packet is being formed in TinyOS.
I'm currently working on a project in which I use antennas such xbee XBee 2mW Wire Antenna - Series 2 (ZigBee Mesh).
how can I get my antenna64bit address so I can set it up using my software automatically?
Can I send zigbee message to antenna so that it returns a message that contains it`s antenna address, then I decode the message and know the address of my antenna.
thanks.
If you want an easy way of doing this, you can send one message from the Router/End-Device to the Coordinator in your ZigBee network. You can use the special 16-bit Network Address 0x0000 to address the Coordinator.
This message should contain the 16-bit Network Address (or the 64-bit Address), so later the Coordinator can use this address in order to communicate back with this node. That is how you can do if you work with AT Mode. If you work with API Mode, the "Receive Packet" already contains the address of the sender, so you do not need to explicitely add it to your message.
When you press one time the commission button: the module sends a node identification broadcast transmission.
Thus, I assume you are using the API mode, so from your Coordinator API (software side) you can send a Remote AT Command Request, in broadcast, which set the CB (commission button) to 1. This is the same of press the commission button virtually at one time. Here is the packet:
7E 00 10 17 00 00 00 00 00 00 00 FF FF FF FE 00 43 42 01 67
Then, when all your devices receive this packet, they should answer to the coordinator with a Node Identification Indicator, which contains their 16-bit and 64-bit address. This way, you can automatically set up your network on software.