Thursday, December 6, 2012

Graphic Display Connected to the Programmable XBee


In this post we will show how to control a Graphics LCD display using a Programmable Xbee module from Digi international.

Digi international delivers a SDK for the Programmable Xbee in a free way, you can downdload from here (http://ftp1.digi.com/support/developmentsoftware/40003003_B.exe). 

One of the samples Digi deliver in the SDK is the Graphic display. This example draws different shapes in a graphic display based on the ST7565R chip. Depending on the button pressed from the XBee Interface Board, the display will show a circle or a rectangle.

To run this sample you need a S2B or S2C module with 128 KBytes of flash memory. The sample is not supported in standard 32 Kbytes flash memory modules.

You should connect the graphic display to the SPI interface of the XBee module.
Take a look to the “config.xml” file of the sample application to see how is configured each pin of Programmable Xbee. 




In following schematic you have the connections.

Here a photo of the sample running:

Digi Programmable XBee SDK offers following API to control the graphics LCD display: 


voidlcd_graphic_cmd_write (uint8_t cmd)
Sends the given command to the LCD.
voidlcd_graphic_data_write (uint8_t data)
Sends a byte of data to be written in the LCD.
voidlcd_graphic_goto_xy (uint8_t x, uint8_t y)
Sets the pointer of the LCD at the specified coordinates.
voidlcd_graphic_init (void)
Initializes graphic display with default params.
voidlcd_graphic_set_clear_screen (uint8_t data)
Fills all the display with the specified byte mask.
voidlcd_graphic_write_box (uint8_t x0, uint8_t y0, uint8_t x1, uint8_t y1, bool_t color)
Draws a filled rectangle in the LCD defined by two points.
voidlcd_graphic_write_circle (uint8_t x0, uint8_t y0, uint8_t r, bool_t color)
Draws a circle in the LCD defined by its center point and the radius.
voidlcd_graphic_write_line (uint8_t x0, uint8_t y0, uint8_t x1, uint8_t y1, bool_t color)
Draws a line in the LCD defined by two points.
voidlcd_graphic_write_pixel (uint8_t x, uint8_t y, bool_t color)
Draws a pixel in the LCD given position (point).
voidlcd_graphic_write_rectangle (uint8_t x0, uint8_t y0, uint8_t x1, uint8_t y1, bool_t color)
Draws a rectangle in the LCD defined by two points.
voidlcd_graphic_write_text (uint8_t x0, uint8_t y0, uint8_t *textplot, bool_t color)
Writes the given text in the graphic display.
voidlcd_graphic_write_tile (uint8_t x, uint8_t y, uint8_t *buf)
Writes a tile (square of 8x8 pixels/bits) at the given point.

Enjoy!


Tuesday, November 27, 2012

XBee playing "The Imperial March" using a buzzer


In this sample we show how to play a tune using a buzzer and the PWM interface of the Digi Programmable XBee module.

Here a video with the result:
Direct Link to the Video:  LINK


If you can try the sample, here is the source code: LINK

For this sample we are using the PWM API that provides the SDK delivered with the Digi Programmable XBee:
Pulse-Width Modulation (PWM)
Functions
int
pwm_config (xpin_t pin, bool_t enable, uint32_t ton, uint32_t period)
Function that configures the settings of the Pulse-Width-Modulation module.
int
pwm_enable (xpin_t pin, bool_t enable)
Function that enables/disables the Pulse-Width-Modulation.
Function that returns the current period for the Pulse-Width-Modulation component.
Function that returns the current positive semiperiod for the Pulse-Width-Modulation component.
Function that changes the positive pulse-width of the Pulse-Width-Modulation component.



Thanks to Sebas for the video and the source code!


Sunday, October 14, 2012

Connect a Character LCD to a Programmable XBee

Programmable XBee SDK delivered by Digi International is plenty of samples to show the power of the API developed for the Programmable XBee S2B and S2C modules from Digi International.

One of the sample delivered shows how to use Programmable XBee module to control a character LCD.
The CharLCD example delivered with the Programmable XBee SDK performs different actions in a character LCD based on the HD44780, KS0066U or equivalent display controller.
The purpose of this example is to show how to use the char_lcd driver/API.

To create the Character LCD sample you need to install Codewarrior 10.2 (You can download from Digi site Link.) and Programmable XBee SDK from Digi (you can download from Digi site: Link ).
Once installed, open Codewarrior 10.2, go to File -> New -> Programmable XBee Sample Project, in the new window that will pop up, select the sample "Char LCD Demo", you will find it under "Displays" item.

Now, you should build and flash into the Programmable XBee the character LCD demo application.
After flashing the demo, check that in serial console you have the application header, that means that the demo is running.

In next section we will show you how to connect the Programmable XBee and the character LCD.

Hardware connection:

In the config.xml you have the lines of Programmable XBee module that should be used for this example and should be connected to the character display.
Here you have a screenshot of the config.xml file for the character LCD sample.



Here you have the schematic to connect the Programmable XBee and the character LCD.
Note that the XBee module used is a Programmable XBee module, not the standard XBee module.

When you have set up all the hardware, connect the power supply and demo application will perform a sequence of actions in the character LCD

Character LCD connected to the Programmable XBee S2B.

Character LCD API:

Programmable XBee SDK offers following API for related with a character LCD:

  • Character LCD configuration functions: 
    • char_lcd_init() 
    • char_lcd_cmd_write() 
    • char_lcd_on_off() 
    • char_lcd_cursor_on_off() 
    • char_lcd_cursor_blink_on_off() 
    • char_lcd_clear() 
    • char_lcd_goto_xy() 
  • Functions to read/write the LCD: 
    • char_lcd_putchar() 
    • char_lcd_write() 
    • char_lcd_read_data_xy() 


For more information about the API you should have a look into the help delived with the Programmable XBee SDK.

Best regards,

Sunday, July 22, 2012

S2B XBee Adaptor Board

In a previous post we talked about an S2C XBee intermediate board to isolate any pin from the S2C module using jumpers for doing your prototypes in an easy way.


We mentioned that the XBee modules also have a through-hole mounting variant, the S2B XBee module. Here we show you an adaptor board for that module:









More photos about these adaptors at Flickr Gallery.


Monday, July 16, 2012

S2C XBee Adaptor Board


The Xbee modules from Digi international offers two variants depending on mounting technology: S2B module (Through Hole Technology) and S2C (Surface Mount Technology).

If you buy the XBee Programmable S2C kit you will receive a Programmable XBee S2C module (SMD module) and a XBee S2C development board (apart from other accessories like a USB X-Stick).


If you want to build a prototype with these modules you need to connect wires from the module to a breadboard. However, most of breadboards’ pitches are 2.54 mm and the XBee modules 2 mm. This complicates things apart from the fact that S2C are SMT devices. 


Furthermore,  some pins of the S2C module are connected to the development board, so if you want to use those lines for other purpose you need to disconnect those pins from the development board, but in the default kit you are not able to do that. You would have to unplug the S2C module and solder it in your proto board, but that is not a good solution unless you have plenty of modules.


The best solution for building a prototype with the Programmble XBee S2C is to use an intermediate board between the development board and the S2C module like the one shown below:


With that board you can isolate any S2C pin from the development board by removing the jumper associated to the proper line.

Xbee S2C adator board




More photos about the S2C adaptor board in our flickr gallery.