Home > Blog > Posts Tagged "XBee Broadcast"

XBee Tech Tip: Connecting to the IoT with XBee ZigBee Cloud Kit

Posted on: No Comments

This Tech Tip is brought to you by Digi Applications Engineer Mark Grierson, who will take you through the steps to connect an XBee Smart Plug to the XBee ZigBee Cloud Kit and manage it from the XBeegateway.herokuapp.com web application. Be sure to answer the XBee Puzzler at the end of this entry to win an XBee ZigBee Cloud Kit!

The XBee ZigBee Cloud Kit is the easiest way to connect to the Internet of Things (IoT). It features a sample web application that lets users remotely activate various outputs on the development board including LEDs, a vibration motor, a bar graph gauge and an audio buzzer.

In addition, users can build their own circuits on the development board to sense temperature or light, switch on and off other devices via a relay, turn on and off additional LEDs and more. The web application code is open-source, available for anyone to download and use as a learning tool.

The purpose of this article is not to teach you how to set up and use the kit. There is an excellent online user’s guide that will step you through that process found here. http://ftp1.digi.com/support/documentation/html/90001399/90001399_A/Files/kit-getting-started.html

This article assumes that you have set up the XBee ZigBee Cloud Kit and have followed the instructions in the getting started guide.

Using the XBee Smart Plug with the New XBee ZigBee Cloud Kit

Now that you have seen how easy it is to web enable just about any device, you may be wondering about Digi’s boxed ZigBee devices such as the XBee Smart Plug, XBee Sensors, AIO and DIO adapters, etc. Can you use these devices with the XBee ZigBee Cloud Kit? Absolutely!

1)     Introduction

Using the XBee Smart Plug is an easy way to intelligently monitor and control connected electrical devices. This example uses the XBee Smart Plug and allows you to control the AC relay as well as read and monitor the AC current sensor, the Temperature Sensor and the Light Sensor.

The three sensors generate voltage outputs that are passed to the XBee’s analog-to-digital converter (ADC). These readings are then sent via Device Cloud to the XBee ZigBee Cloud Kit’s online dashboard application where you can control and monitor the XBee Smart Plug right in your web browser.

2)     Assemble the Parts

To complete this exercise you’ll need:

1 – XBee Gateway

1 – XBee Smart Plug

1 – Device Cloud Account


xbeegateway1xbeegateway2

3)     Connect the XBee Smart Plug to the Gateway and Configure

You’ll need to ensure the XBee Smart Plug is connected to your XBee Gateway. If your XBee Smart Plug is new and has not connected to a ZigBee network, this should be as simple as plugging it in while the XBee Gateway is powered up.

The Green Association (ASSC) light will flash once the XBee Smart Plug has joined a network.xbeegate3

You can then go to the XBee Network tab in the configuration section of the Gateway’s web UI to ensure the smart plug has joined.

deviceconfic1

If the XBee Smart Plug does not show up, click on the “Discover XBee Devices” button to have the XBee Gateway perform a network discovery. If the XBee Smart Plug still does not show up and the ASSC light is flashing on the XBee Smart Plug, this means that the XBee Smart Plug has joined another ZigBee network and must be reset using a 4-button press of the Reset button. Consecutive button presses must occur within 800 milliseconds of each other for the reset to occur.

xbeegateway4

When the reset is successful, the ASSC light will go steady as the XBee Smart Plug looks for a new network to join and will flash again once it joins. Return to the Gateway web UI and click discover to see the XBee Smart Plug is now joined to the XBee Gateway.

Once the XBee Smart Plug has joined the XBee Gateway, configure it by clicking on the extended address of the Smart plug.

deviceconfig2

After a few seconds, the settings of the XBee Smart Plug will be displayed. Click on the Input/Output settings tab and:

  1. Check the Detect box for D4 (D4 is used to toggle the AC outlet)
  2. Ensure that the IR parameter is set to 5000ms
  3. Click the Apply button to save changes 

deviceconfig3

4) View It!

You will use the XBee Wi-Fi Cloud Kit’s web application to configure three widgets for viewing the temperature current and light readings from your sensor. You will also configure a widget to control the AC relay.

Log in to the XBee ZigBee Cloud Kit web application: https://xbeegateway.herokuapp.com/#/login

dcscreen342

The Outlet Widget

First we will create the outlet control widget.

Use the Add Widget button to create a new display widget.

dcwidget

Choose On/Off Switch Widget for the widget type.

Add a label such as “XBee Smart Plug Outlet.”

Choose your XBee Gateway and module by selecting their ID.

Select DIO4 as the output stream and check the device configuration to make sure it is configured properly. Your screen should look like the following.

createnewwidget

Save the changes to see your new Widget on the home screen.

You should now be able to turn the XBee Smart Plug AC outlet on and off using the widget.

The Current Draw Meter Widget

Next we will createa widget to measure the current draw on the XBee Smart Plug. The concepts used to build this widget are the same for the light meter and temp sensor built into the XBee Smart Plug. Only the Input stream and transform will be different.

Use the Add Widget button to create a new display widget.

dcwidget

Choose Gauge Widget for the widget type.

Add a label such as “Current Draw.”

Choose your XBee Gateway and module by selecting their ID.

Select AD3 as the Input Stream and check the device configuration to make sure it is configured properly.

Enter the following formula into the Input Transform:

Enter “((((value/1024)*1200)*(156/47)-520)/180*0.7071)*1000″ into the Input Transform to transform the input from millivolts to milliamps. The formula in brackets converts the millivolt reading into AMPS. The herokuapp application is constrained to whole numbers and will convert a decimal result to the nearest whole number. To make this data more meaningful, we then multiply this value by 1000 to convert to milliamps. The following knowledgebase article is the source for this info: http://www.digi.com/support/kbase/kbaseresultdetl?id=3522#Adapters

Enter mA into the Units field.

Enter 0 for the Low value and 8000 into the High value (the XBee Smart Plug is only rated for loads up to 8 amps).

You screen should look like the following:

widgetsettings

Save the changes to see your new Widget on the home screen.

The Temperature and Light widgets are made using the same procedure as the Current widget with a few small changes.

For the Light Widget use the following:

Label=Light Meter

Input Stream=AD1

Input Transform=(value/1024) * 1200

Units=Lux

Low Value=0

High Value=1000

lightmeter

For the Temperature Widget use the following:

Label=Temperature

Input Stream=AD2

Input Transform= (((((value/1024)*1200)-500)/10)*1.8)+32 for Fahrenheit

= (((value/1024)*1200)-500)/10 for Celcius

Units=Fahrenheit or Celcius

Low Value=0

High Value=150

5) Use It!

Now you can use the XBee Smart Plug to control any AC appliance up to 8 Amps! Additionally, you can monitor the amperage being used along with the Ambient light and temperature around the XBee Smart Plug.

In my screenshot below, I have a 60 watt lamp connected to the XBee Smart Plug.

widget dashboard

Using a variation of Ohms law “P=VxI” we can see that this 60 watt bulb should draw about 500 milliamps at 120 volts. 60W/120V=.5Amps or 500 mA. My meter is showing 494 mA, which is just about right on! Feel free to try other widget types. Use a Bar Graph or Line Graph instead of a Gauge widget.

Now that you have completed this exercise, use what you have learned to add the XBee LTH Sensor, Wall Router or Analog Adapter.The formulas you will need for the transform can be found in this article: http://www.digi.com/support/kbase/kbaseresultdetl?id=3522#Adapters

XBee Puzzler

In the “Connect the XBee Smart Plug to the Gateway and Configure” section of this month’s Tech Tip, you are instructed to check the Detect box in the IO settings (See arrow 1 below).

zigbeekitconfig

What advantage is gained by having D4 monitored for a change of state?

Submit your answer below. The deadline for entries is October 15, 2014. Three winners will be randomly selected from the correct submissions. Winners will be notified by email. Employees of Digi and its subsidiaries are not eligible for the prize drawing. Good luck!

XBee Tech Tip: Sending Serial Data From One XBee Wi-Fi to Another

Posted on: No Comments

This Tech Tip is brought to you by Digi Applications Engineer Mark Grierson. It is Part 1 in a 3-part series focusing on the XBee Wi-Fi module.

Be sure to answer the XBee Puzzler at the end of this entry for a chance to win an XBee Wi-Fi Development Kit!

In this tech tip, we are going to see just how easy it is to send serial data through from one XBee Wi-Fi radio module to another.

Setup

In order to complete this exercise, you’ll need:

  • 2  XBee  Wi-Fi(S6B) radio modules
  • 2 USB interface boards. These can be the development boards contained in the XBee Wi-Fi Cloud Kit, any XBIB-U or XBIB-U-DEV interface board, or any third party USB XBee interface board such as the Parallax XBee USB adapter board
  • PC (or Mac) running Next Generation XCTU

Procedure

Sending transparent serial data between 2 XBee Wi-Fi modules.

First we will need to connect 2 Wi-Fi Modules to a Wi-Fi access point that has access to the internet. For brevity, if you need assistance connecting you modules to an access point, please refer to the Quick Start Guide: XBee Wi-Fi Cloud Kit for assistance.

Note: For the purposes of this article, a basic understanding of XCTU is assumed. For specific help in working with XCTU please see the help section of the XCTU program.

techtip1-may14

  • Connect the radio modules to the PC using the interface boards and launch 2 instances of XCTU.
  • In each instance of XCTU connect to one of the XBee Wi-Fi modules:
    1. Click on the Add Radio icon
    2. Select the correct com port
    3. Ensure data settings are correct (Radio default is 9600, 8, N,1)
    4. Click Finish

techtip2-may14-sm

  • Now click on the radio module in each instance of XCTU to read its settings.

techtip3-may14-sm

  • Once you have the 2 instances of XCTU running, verify that the radios have received IP addresses from your DHCP server and then address each radio’s Destination IP address (DL) to match the Module IP Address (MY) of the other radio as shown below.

techtip4-may14-sm

  • You will also want to ensure that the Device Options (DO) setting is set to 0. This will ensure that the serial data is not sent to the cloud.
  • Go to the “Consoles” mode of each XCTU by clicking the terminal icon at the top of XCTU.
  • Open the serial connection to the modules by clicking the “Open Serial Connection” icon on each XCTU instance.   The Icon will change to a connected status  and the background changes to green.
  • You can now type text directly into one of the console log screens and see it appear in red of the other consoles screen.

techtip8-may14-sm

  • If you would rather send an entire string at once, this can be accomplished by creating a packet by clicking on the “Add New Packet” icon.   This packet builder also lets you select ASCII or Hex data to be sent.

Using the packet builder, you can create a series of serial strings to transmit from the radio.

Summary

As you complete this exercise, it will become apparent just how easy it can be to connect your XBee Wi-Fi module to any serial sensor or device and have that data sent to any other device connected to another XBee Wi-Fi module. Of course this is just a simple example of how transparent serial data can be transmitted around an XBee Wi-Fi network. XBee modules have many more advanced features including a full API mode to allow your applications to efficiently move data to any IP addressable device worldwide.

In our next issue we will demonstrate sending data back and forth between a host connected to an XBee Wi-Fi module such as XCTU and a non-XBee network client application on a local area network. Until then, have fun experimenting with all of the varied capabilities of these remarkable radio modules.

XBee Puzzler

Which statement best describes how a passive high gain antenna works?

  1. A high gain antenna adds energy to a radio to enhance its range.
  2. A high gain antenna does not add or subtract overall energy to a radio transmission, but rather focuses or re-shapes the radiation pattern in a certain direction.
  3. A high gain antenna removes energy from a radio’s radiation pattern.
  4. A high gain antenna has no effect on the range of a radio link

Submit your answer below. The deadline for entries is June 12, 2014. Three winners will be randomly selected from the correct submissions. Winners will be notified by email. Employees of Digi and its subsidiaries are not eligible for the prize drawing. Good luck!

This XBee Puzzler contest is now closed. The correct answer is: 2. A high gain antenna does not add or subtract overall energy to a radio transmission, but rather focuses or re-shapes the radiation pattern in a certain direction.

 

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 0×17) 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 “0×17 – 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 0×05 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 0×00 (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 Wi-Fi Cloud Kit

Posted on: No Comments

The new XBee® Wi-Fi Cloud Kit brings the Internet of Things to the popular XBee platform.

xbee-cloud-kitBuilt around Digi’s new XBee Wi-Fi module, which fully integrates into Device Cloud by Etherios™, the kit is a simple way for anyone with an interest in M2M and the Internet of Things to build a hardware prototype and integrate it into an internet-based application. This kit is suitable for electronics engineers, software designers, educators, makers and innovators of all kinds.

  • The fastest and easiest way to explore and develop Internet-connected devices and circuits
  • Free, open-source application enables two-way communication and control with the development board over the internet
  • Fully customizable widgets for simple monitoring and control of connected devices
  • Free limited subscription to Device Cloud

You can order an XBee Wi-Fi Cloud Kit today. Click here>

Want to win a free XBee Wi-Fi Cloud Kit? Answer the XBee Puzzler at the end of our latest XBee Broadcast Tech Tip for your chance to win a kit!

Contact a Digi expert and get started today! CONTACT US

Desktop Site