Home > Blog > Posts Tagged "XBee Puzzler"

XBee Tech Tip: Using the XBee Wi-Fi Cloud Kit to Toggle Power to an A/C Circuit via WebApps

Posted on: No Comments

This Tech Tip is brought to you by Digi Applications Engineer Brenton Mock from the Lindon, UT team.

Be sure to answer the XBee Puzzler at the end of this entry for a chance to win an XBee t-shirt hot off the presses!

There have been an increasing number of requests for Tech Tips and How-to articles regarding the XBee Wi-Fi and the XBee Wi-Fi Cloud Kit.

Due to the protocol-bridging nature of the XBee Wi-Fi, many communication project infrastructures are simplified. One such project is controlling an AC circuit remotely using web applications. This makes control from any web-connected device possible.

This Tech Tip relies heavily on the Getting Started Guide for the XBee Wi-Fi Cloud Kit. Please ensure that you are familiar with the procedures contained within that guide.

Overview

In this tutorial we will be using the XBee Wi-Fi Cloud Kit to toggle a digital output line on the XBee which will control an AC relay. We will be using the Heroku website service to accomplish this in conjunction with Device Cloud by Etherios.

Since dealing with high voltage electricity can be dangerous, we’re going to stick to using the PowerSwitch Tail, a product that packages the relay circuitry in a nice little box that we can plug into the wall. Any device that we plug into the other end will be at our command. This guide will get you started using the PowerSwitch Tail with the XBee Wi-Fi Cloud Kit.

Setup

1 – XBee Wi-Fi Cloud Kit (XBee Wi-Fi, Cloud Kit Development Board, micro-USB cable for power)

1 – XBee Wi-Fi Cloud Kit account (To create an account, please follow these setup instructions)

1 – PowerSwitch Tail II (This product can be found here)

2 – Solid Core, 22 AWG or 24 AWG, insulated wires

1 – AC-powered device (in this case, a fan)

Procedure

During the XBee Wi-Fi Cloud Kit setup, you will be asked if you would like to configure the XBee Wi-Fi for the Cloud Kit. Please do so. This will configure all the DIO lines for use with the HerokuApps that are used by the kit.

Once your XBee Wi-Fi is added and configured to your account, you will see a screen as shown below:

We will be using DIO 9 (pin 13) for our example. This will correlate with the User LED toggle:

Wiring

The DIO line (pin 13 on the XBee) connects to pin 1 of the PowerSwitch Tail.

Ground (pin 10 on the XBee) connects to pin 2 of the PowerSwitch Tail.

Final Connections

Connect the PowerSwitch Tail to an AC power source.

Connect an AC device to the PowerSwitch Tail.  In this case we are using a fan.

Test

Now you should be able to click on the User LED toggle. This will then send a web services instruction to the radio via Device Cloud by Etherios (which interfaces with the HerokuApp on the backend) that will toggle the DIO9 (pin 13) to a high state. This in turn toggles the PowerSwitch Tail to complete the AC circuit.

The fan is now on:

But seeing as this isn’t a User LED that we are toggling, we must re-label the widget to accurately reflect the device that will be used. This can be done by clicking on the Widget Settings icon that will appear when you hover over the widget:

This will take you to the following screen:

You can change the label from “User LED” to something more appropriate such as “Most Awesome Fan of the Heavens.” (I love this fan.)

Conclusion

The XBee Wi-Fi Cloud Kit demonstrates an easy way to web-enable your devices. Device Cloud by Etherios and the Heroku web apps service together simplify the process of remotely controlling AC devices anywhere in the world.

Ready to get started with an XBee Wi-Fi Cloud Kit? Head over here.

XBee Puzzler

You are working on a project with an XBee ZigBee Coordinator radio installed high up in a tower. You have an XBee ZigBee Router radio connected to your PC and want to test the link between the coordinator and router.

Digi ZigBee radios support a loopback cluster to enable link testing to a remote radio without the need for a physical loopback adapter. You decide to use the loopback cluster in API mode to test the link success rate of many transmissions.

You have the following information:

Coordinator 64 bit address: 0013A200 40506070
Router 64 Address: 0013A200 12345678

You want to send “Hello World” without the quotation marks as your test payload.

What is the correct API frame to accomplish this?

Submit your answer below. The deadline for entries is March 7, 2014. Winners will be notified by email. Employees of Digi and its subsidiaries are not eligible for the prize drawing. Good luck!

We are no longer taking submissions for this XBee Puzzler. The correct answer is:

7E 00 1F 11 01 00 13 A2 00 40 50 60 70 00 00 E8 E8 00 12 C1 05 00 00 48 65 6C 6C 6F 20 77 6F 72 6C 64 F4

XBee Tech Tip: Using Remote AT Commands to Toggle an IO on a Remote XBee 802.15.4 Radio

Posted on: No Comments

 

This Tech Tip is brought to you by Digi Applications Engineer Mark Grierson.

See the XBee Puzzler at the end of this entry to put what you learned to use.

Using API mode it is possible to send commands from a transmitting radio to a receiving radio. This allows for module parameter registers on a remote device to be queried or set.

One useful application of this feature is to toggle an IO on a remote radio from a high to a low state. In this manner the radios can be used as a wireless relay to control a wide variety of remote devices.

Overview

In this tutorial we will be using XCTU to create and send 2 distinct API frames. One frame will toggle the remote radio’s IO high, and the other will toggle the remote radio’s IO low. You could easily program a micro or other piece of hardware to issue these commands.

Setup

To perform this tutorial you will require the following materials:

  • 2 – XBee 802.15.4 RF modules.
  • 2 – Interface boards (USB or RS232) *the use of DEV boards (XBIB-U-DEV or XBIB-R-DEV) will allow the use of onboard LEDs to observe output
  • 1 – PC with XCTU software installed
  • Serial or USB cables to connect interface boards to the PC

In this tech tip I have chosen to use our new Beta version of XCTU to demonstrate its API packet generation capabilities. You can download the Beta version of XCTU here.

If you do not have access to the new Beta software or choose not to use it, these procedures can also be completed using our current version of XCTU.

Procedure

Select one radio to operate as your Base and one to operate as your Remote.

Both radios are programmed with the default settings with the following exceptions. API is enabled on the Base radio (AP=1), D4=4 on the remote radio

In this example my radios have the following factory set 64 bit addresses:

Base:

SH=0013A200

SL=403199EB

AP=1

Remote:

SH=0013A200

SL=4055F498

D4=4

Connect the base radio to the PC and launch XCTU. Connect the radio to XCTU by clicking on the Add Devices icon and selecting the appropriate com port and settings and clicking finish.

The Radio will now be listed on the left side of XCTU as in the following screenshot.

Open the Console mode of XCTU by clicking on the Console icon.

Open the serial connection with the base radio by selecting the Connect icon.   The image will change to the connected status.

The Console should indicate that it is opn as an API Console.   If it is showing that it is an AT console, return to the module settings tab and ensure API is enabled (AP=1)

In the Send a single frame section open the “Add a frame” dialog box by clicking on the  .  Rename your frame name to Low, then click on the Packet generator icon  to open the packet generator.

We will now use the built in API frames generator to create two remote AT command (type 0x17) frames paying close attention to the structure of this frame as outlined in the API section of the Product manual. One frame will set the remote radios Digital output High and the other will set it Low.

Select “0x17 – Remote AT Command” as the frame type and then set the 64 bit address to the SH and SL of the remote module.  Set the AT command to ASCII D4 and the Parameter value to HEX 04 as in the following screenshot.

*Please note that the command D4 (bytes 17 and 18) is issued as 44 and 34. 34 is the hex equivalent of the ASCII character 4. The parameter value setting for D4 (byte 19) is issued as 04 and 05. This is the hex equivalent of decimal 4 and 5 respectively.

Click OK and the frame contents will appear in the Add API frame to the list dialog box as follows:

Click on Add frame.

Repeat the procedure for your set high frame changing the parameter value to 0x05 and create a second frame with a frame name of High

Click on Add frame.

Your API console should now look something like this:

Here are the frames configured for the address of my radios. Your packets will contain the address of your remote radio and the checksum will be different.

Note: I have chosen to toggle DIO4 as it is connected to LED 3 on the XBIB-DEV board and allows easy viewing of the toggle process without the use of a voltmeter or scope.

Command to set DIO4 high:

7E 00 10 17 01 00 13 A2 00 40 55 F4 98 FF FE 02 44 34 05 95

Command to set DIO4 Low:

7E 00 10 17 01 00 13 A2 00 40 55 F4 98 FF FE 02 44 34 04 96

You can now send the commands to the base radio which will in turn send remote commands to the remote radio to set its digital output D4 (Pin 11). Do this by highlighting the appropriate frame (high or Low) and clicking on “Send selected frame.”

The LED associated with the D4 pin should go off and on as you send these two frames. You may also verify the state by connecting a multi-meter to Pin 11 of the module to check its voltage state as it is toggled from High to low. The pin should read about 3.3v when high and about 0 volts when low.

You can also view and parse the frames and their corresponding response packets in the Frame log section of the display. A status of 0x00 (OK) indicates that the frame was sent successfully and acknowledged by the remote module.

If you do not receive a response frame please check your API packet for accuracy.

Note: This article is written using the XBee 802.15.4 radios but the concepts are applicable to all of the XBee radio lineup that offer API mode.

XBee Puzzler

Below are screenshots of the configuration of 2 XBee ZB radios. One is an API coordinator and one is an AT router. The router’s Association Indication(AI) parameter indicates that it is associated.

There are no other ZigBee networks within range of these two radios.

These two radios will not communicate with each other. What is the reason?

This XBee Puzzler contest is closed. Congratulations to our winners: “JZ” Gray, Adam Muegge & Diego Hoyos Robles

Answer:

The two modules will not communicate because they are operating on different 16 bit PAN IDs. ZigBee radios must be operating on the same 16 bit PAN ID (OI)
to communicate.

XBee Tech Tip: The IO AT Command

Posted on: No Comments

This Tech Tip is brought to you by Digi Applications Engineer Mark Grierson.

Be sure to answer the XBee Puzzler at the end of this entry for a chance to win a free XBee-PRO 900HP S3B Development Kit!

Recently a customer asked me if they could send a single command to a remote module to set the states of multiple Digital outputs. Well if you are using the XBee/XBee-PRO 802.15.4 modules the answer is, “Yes!”

Let us introduce you to the IO AT command.

The IO command is only available on the XBee/XBee-PRO 802.15.4 modules but provides some powerful IO features not available on other modules. With the IO command it is possible to change the states of multiple Digital output pins with a single AT command, either on a local module, using API Mode or Command Mode, or on a remote module, using API Mode.

To change the States of your local modules digital outputs, first set 1 or more IOs as digital outputs, either high or low. In this example I have set them to a low state (Dx=4).

You can then change those states by issuing an IO command. The command is followed by a bitmask where a 1 will set the state of a pin high and 0 will set the state low. Sending an
ATIO with no bitmask will set all outputs low and is the equivalent of sending an ATIO0.

A local module’s IO pins can be set using the IO feature in AT command mode.

In the X-CTU terminal screen
Use +++ to enter Command Mode
Enter ATIO7 to set D0, D1, and D2 to a high state
Enter ATIO to set all Digital outputs low. Your screen should look like the following.

+++OK
ATIO7
OK
ATIO
OK

The local modules Digital outputs can also be set using API Mode.

The following are some sample API frames using the IO command to set the local module’s DO 1,2, and 3 high and low.

7E 00 05 08 01 49 4F 07 57 Set D0, D1, and D2 on
7E 00 05 08 01 49 4F 00 5E Set all Do’s off

To change the States of a remote module’s Digital outputs API Mode must be used on the base module. The remote module can be in either API Mode or Transparent Mode. First set one or more of the remote module’s IOs as Digital outputs, either high or low. You can then change those states by issuing a remote AT (IO) command from another module on the network that is running in API Mode. The remote module can be in either AT Mode or API Mode.

Using Remote AT Command examples:
7E 00 10 17 01 00 13 A2 00 40 08 4E 3C FF FE 02 49 4F 07 C2 – TURN D0,D1,D2 ON
7E 00 10 17 01 00 13 A2 00 40 08 4E 3C FF FE 02 49 4F 00 C9 – TURN OFF ALL DO

Your frames will be slightly different due to differences in the remote modules 64 bit address. For more information on API mode and transparent mode please use the following links.

http://www.digi.com/learningcenter/video/player?id=zigbee-at-vs-api-commands

http://www.digi.com/support/kbase/kbaseresultdetl?id=3215


XBee Puzzler

The first 3 responses with the correct answer will receive a free XBee-PRO 900HP S3B Development Kit. Good luck!

Using the IO command, what would be the correct API frame, including checksum, to set a locally connected XBee 802.15.4 module to the following digital output settings?

D0=High
D1=High
D2=Low
D3=Low
D4=High
D5=Low

————————————————————

This Puzzler contest is now closed. Correct answer:

For API mode 1:  7E 00 05 08 01 49 4F 13 4B
For API mode 2:  7E 00 05 08 01 49 4F 7D 33 4B

Congratulations to our XBee-PRO 900HP S3B Development Kit winners: Sergio Alonso, Evan Farthing and Thomas Tracy Allen Ph.D.

Check back in November for our next Puzzler!