Overview

Having feedback from a program running on the mote is nice, and usually rather helpful. While the 8 LEDs included on a JCreate can provide some level of feedback, having an LCD display available opens up a whole new world of debugging options. So, let's look at how we can adapt a character-based LCD display for use with a Sentilla Jcreate and the Sentilla Work development environment. We will show rather specific instructions for the LCD module that we used, but these instructions are also meant to provide guidelines and considerations for using and LCD module of your choosing.

Project Components

Hardware

A main component of this project is finding a suitable display peripheral and deciding how to adapt it to the JCreate.

Choosing a Device

Because you'll want the processing power of the Jcreate to do useful things for you and your application, the LCD module should have basic logic for accepting a simple input and managing the display and refreshing of the screen. Since the Jcreate has an external serial UART, we suggest finding a module that accepts serial input. We use the BPK-216 module available from www.seetron.com.

Adapting the Device

Physical connection

To connect the LCD panel to the mote, you need to connect the power, ground, and serial out pins. These pins can all be accessed through the 16-pin header on the JCreate. Pins 1 and 3 provide ground and power, respectively. Pin 15 provides the serial output that you will use to send data to the LCD display.

Voltage conversion

Since this is a 5V module, we need a solution for powering it, as well. The Jcreate provides only 3V in its nominal configuration. Rather than provide an external power supply, we use a MAX1044 voltage boost chip to boost the 3V from the Jcreate to 5V for powering the LCD. A simple 2N2222 transistor powered from the 5V boost source provides the inverter necessary to convert 3V TTL serial to 5V inverted TTL serial that the LCD module requires. Since the part to convert a 3V source voltage into a 5V source and signal voltage is generally useful, it's a separate project on this site. You can find more information about it here.

Testing the Attachment

Debugging hardware can be tricky, usually due to the limited scope of feedback options, and the number of places that things can fail. As a result, it helps to have a progressive system for developing circuits. During this project, I used the following checkpoints to smooth the process:

  1. Ensure that a 3V power supply input the to voltage booster results in a 5V source that can power the device. You can use the test mode of the device (holding the serial pin of the device high while powering it on) to verify this.
  2. Connect the 3V serial output pin on the JCreate programming board to the serial input of the LCD display. Use a simple computer program to send serial output to the device, and ensure that it works.
  3. Write a simple serial test program for the JCreate. Connect the JCreate serial output to the LCD display, and verify that you see something.
  4. Install the LCD Driver and test program, and verify that it works.

Software

The BPK-216 LCD serial display backpack has a fairly straightforward interface and command set, and so it would be simple enough to use it directly in your programs. However, for convenience, I've included a Java interface to the device, which allows you to use the device in a more intuitive fashion, without having to worry about Serial port issues.

The display works in two different modes. Normally, it is in character mode. In this mode, any byte received over the serial input pin will be displayed at the current screen location, and the cursor will be moved to the next screen location.

If a special control character is sent, the next byte will be interpreted as a command. The commands allow you to do things like positioning the cursor, clearing the screen, or uploading custom characters.

The BPK216 driver for java is stateful. The way the driver works is that it allows you to queue up a series of strings and commands, and then send them to the display. So for example, you can use the following sequence to clear the screen and send a basic string:

1
2
3
4
5
LCD.clearCommand();
LCD.clear();
LCD.home();
LCD.writeString("Hello World!");       
LCD.submitCommand();

Note that submitting the command does NOT clear the command state. This is useful for scrolling effects, for example. You can queue up a common animation command, and then just repeatedly call LCD.submitCommand(); to repeat the command.

The commands are as follows:

  • clearCommand() - clear the command string.

  • clear() - clear the screen (but leave the cursor where it is)

  • home() - send the cursor to the home position (0,0)

  • hideCursor() - Hide the cursor block

  • setPos(x,y) - position the cursor at x,y on the screen

  • writeString(str) - Display a string of bytes on the screen.

  • scrollLeft() - Shift everything on the screen 1 position to the left

  • scrollRight() - Shift everything on the screen 1 position to the right

  • makeChar(n, data) - Send data for custom character. The first argument specifies which of the 8 characters to change. Data is a byte array containing the bitmapped character data.

  • makeSplat() - Make a cool Sentilla Splat using characters 0-5.

You can download the driver here

Related Projects

ThreeToFive.Home



#Overview
<<<<b
!{200,}[Image Alt Text][[myLCD]]
<><><><>

Having feedback from a program running on the mote is nice, and usually rather helpful. While the 8 LEDs included on a JCreate can provide some level of feedback, having an LCD display available opens up a whole new world of debugging options. So, let's look at how we can adapt a character-based LCD display for use with a Sentilla Jcreate and the Sentilla Work development environment. We will show rather specific instructions for the LCD module that we used, but these instructions are also meant to provide guidelines and considerations for using and LCD module of your choosing.
<br clear="all"/>

#Project Components

##Hardware

A main component of this project is finding a suitable display peripheral and deciding how to adapt it to the JCreate.

###Choosing a Device
Because you'll want the processing power of the Jcreate to do useful things for you and your application, the LCD module should have basic logic for accepting a simple input and managing the display and refreshing of the screen. Since the Jcreate has an external serial UART, we suggest finding a module that accepts serial input. We use the BPK-216 module available from www.seetron.com.

###Adapting the Device

####Physical connection
<<<<b
![Image Alt Text][[JcreateHeader]]
<><><><>
To connect the LCD panel to the mote, you need to connect the power, ground, and serial out pins. These pins can all be accessed through the 16-pin header on the JCreate. Pins 1 and 3 provide ground and power, respectively. Pin 15 provides the serial output that you will use to send data to the LCD display.
||||

####Voltage conversion
Since this is a 5V module, we need a solution for powering it, as well. The Jcreate provides only 3V in its nominal configuration. Rather than provide an external power supply, we use a MAX1044 voltage boost chip to boost the 3V from the Jcreate to 5V for powering the LCD. A simple 2N2222 transistor powered from the 5V boost source provides the inverter necessary to convert 3V TTL serial to 5V inverted TTL serial that the LCD module requires. Since the part to convert a 3V source voltage into a 5V source and signal voltage is generally useful, it's a separate project on this site. You can find more information about it [here][[ThreeToFive.Home]].

###Testing the Attachment
Debugging hardware can be tricky, usually due to the limited scope of feedback options, and the number of places that things can fail. As a result, it helps to have a progressive system for developing circuits. During this project, I used the following checkpoints to smooth the process:

1. Ensure that a 3V power supply input the to voltage booster results in a 5V source that can power the device. You can use the test mode of the device (holding the serial pin of the device high while powering it on) to verify this.
1. Connect the 3V serial output pin on the JCreate programming board to the serial input of the LCD display. Use a [simple computer program][[LCDProject.SerialTest]] to send serial output to the device, and ensure that it works.
1. Write a simple [serial test program][[LCDProject.JCreateSerialTest]] for the JCreate. Connect the JCreate serial output to the LCD display, and verify that you see something.
1. Install the LCD Driver and test program, and verify that it works.

##Software

The BPK-216 LCD serial display backpack has a fairly straightforward interface and command set, and so it would be simple enough to use it directly in your programs. However, for convenience, I've included a Java interface to the device, which allows you to use the device in a more intuitive fashion, without having to worry about Serial port issues.

The display works in two different modes. Normally, it is in character mode. In this mode, any byte received over the serial input pin will be displayed at the current screen location, and the cursor will be moved to the next screen location.

If a special control character is sent, the next byte will be interpreted as a command. The commands allow you to do things like positioning the cursor, clearing the screen, or uploading custom characters.

The BPK216 driver for java is *stateful.* The way the driver works is that it allows you to queue up a series of strings and commands, and then send them to the display. So for example, you can use the following sequence to clear the screen and send a basic string:

<code>
#!java
LCD.clearCommand();
LCD.clear();
LCD.home();
LCD.writeString("Hello World!");
LCD.submitCommand();
</code>

Note that submitting the command does NOT clear the command state. This is useful for scrolling effects, for example. You can queue up a common animation command, and then just repeatedly call LCD.submitCommand(); to repeat the command.

The commands are as follows:

* clearCommand() - clear the command string.

* clear() - clear the screen (but leave the cursor where it is)
* home() - send the cursor to the home position (0,0)
* hideCursor() - Hide the cursor block
* setPos(x,y) - position the cursor at x,y on the screen
* writeString(str) - Display a string of bytes on the screen.
* scrollLeft() - Shift everything on the screen 1 position to the left
* scrollRight() - Shift everything on the screen 1 position to the right
* makeChar(n, data) - Send data for custom character. The first argument specifies which of the 8 characters to change. Data is a byte array containing the bitmapped character data.
* makeSplat() - Make a cool Sentilla Splat using characters 0-5.

You can download the driver @[here][[BPK216.java]]

#Related Projects

[[ThreeToFive.Home]]