Ult
Featured
Urt
Ll Lr

Ult
Log in
Urt
Ll Lr


Using The Arduino IDE With The TouchShield

The Arduino hardware is a base for modular electronics. It sports a 16 Mhz 8-bit processor with 16k of program memory and 1024 bytes of RAM. That’s just a little more powerful than an original Gameboy. The Arduino is supported by a community of hardware and software developers at www.arduino.cc. One of the results of this support effort is the Arduino IDE, a platform for compiling C programs into Arudino hardware compatible assembly and uploading it over USB.

The Arduino hardware alone is simply a processor and pins. To build complex devices shields are used to extend the hardware capabilities. There are shields for adding a protoboard, extending the pin out, and a whole bunch of other more advanced abilities. This guide is going to use the Liquidware TouchShield as an example for learning the hardware and software needed to create a complex device.

The Liquidware TouchShield is a 1.5 inch OLED screen with a resistive touch film layered over it. It has it’s own 16 Mhz 8-bit processor with 64k of program memory and 4096 bytes of RAM. The pins line up with the male Arduino pins, so it’s called a shield. To physically connect the TouchShield to the Arduino line up the TouchShield with the screen side up and long part that juts out on the bottom right. Lay it next to the Arduino with the pin side up and the USB port on the top.

The TouchShield should snap on top of the Aruino with the hole on the leg corresponding to the Digital I/O pins at the bottom right of the Arduino. All the pins from the Arduino should be accepted into the TouchShield’s sockets?.

With the shield physically connected the Arduino and TouchShield can communicate over a serial interface on Arduino digital pins 2 & 3.

Installing the Arduino IDE & TouchShield core

The Arduino IDE is a cross platform application for writing & uploading code over USB. It’s written by the community at www.arduino.cc. When working with a complex shield like the TouchShield the IDE uses a “core” to properly compile the source code. Liquidware’s core for the TouchShield can be downloaded as a zipfile:

Or the Arduino IDE can be downloaded with the TouchShield core already included:

To install the TouchShield core on an existing Arduino IDE installation, download the core as a zipfile. Extract the zipfile into the “cores” directory already part of the IDE installation. Usually the path is something like Arduino-0011/hardware/cores/. The following configuration will need to be added to the boards.txt file, usually found at a path like Arduino-0011/hardware/boards.txt.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
##############################################################

diecimila.name=Liquidware TouchShield

diecimila.upload.protocol=butterfly
diecimila.upload.maximum_size=57342
diecimila.upload.speed=57600

diecimila.bootloader.low_fuses=0xFF
diecimila.bootloader.high_fuses=0x98
diecimila.bootloader.extended_fuses=0xFB
diecimila.bootloader.path=TouchShield
diecimila.bootloader.file=TouchShield_boot.hex
diecimila.bootloader.unlock_bits=0xFF
diecimila.bootloader.lock_bits=0xFF

diecimila.build.mcu=atmega645
diecimila.build.f_cpu=16000000L
diecimila.build.core=touch

Copy the above code block and append it to the end of boards.txt. To confirm the TouchShield core is properly installed start the Arduino IDE and access the “Tools” menu, then the “Board” option. “Liquidware TouchShield” should be listed as one of the boards.

Uploading Code with the Arduino IDE

To write and test code for the Arduino Diecimila (the most common model of the Arduino hardware) write code into the source editor, then select “Arduino NG or older w/ Atmega168” from the Boards menu under Tools. Verify the code compiles properly by clicking the play button in the IDE window’s top left. If the code compiles properly a “Binary sketch size” report will appear in the console below the source.

Uploading code to the Arduino follows the same steps, but instead requires clicking the “Upload to I/O Board” button, an arrow pointing right into a vertical row of pins.

The Liquidware TouchShield is programmed with two additional steps. Select “Liquidware TouchShield” from the boards menu before compilation or upload: Before uploading code press the reset button on the TouchShield hardware. The button is near the Arudino hardware’s USB port when the TouchShield is installed. After pressing reset and selecting the proper board click the IDE’s upload button. The TouchShield will load the program into memory and begin execution.

What’s Next?

If you’re new to working with the TouchShield start by looking at some code in the Liquidware projects part of the site. If you’re already comfortable with development on the Arduino, you could read about the TouchShield API or learn how to collaborate on the TouchShield core & projects.

Get in touch if you have any questions, or ideas for something you want me to build.