Simple test sketch for UTouch library

Here is a simplest touch screen test sketch (display X,Y on serial) using UTouch library for common Arduino LCD shield.

#include <UTouch.h>

UTouch  myTouch( 6, 5, 4, 3, 2);

void setup()

void loop()
  while (myTouch.dataAvailable())
    long x = myTouch.getX();
    long y = myTouch.getY();
    if (x != -1 && y!=-1 && x != 319)
      Serial.print(" Y=");

Tested with XPT2046 / ADS7843 touchscreen driver on Arduino MEGA.

kit3-lcd35-2 kit3-lcd35-1
Newly released Telematics Shield with 3.5″ LCD (R61581 controller)

Posted in Playground | Comments Off on Simple test sketch for UTouch library

Arduino library for SIM800 for GPRS/HTTP communication

Recently I obtained a cheap (under $8) teeny-tiny SIM800 breakout board. The serial UART interfaced SIM800 makes it very easy for any embedded system to add cellular network access and connect to the cloud. The breakout board has a Mirco SIM seat the the back of the PCB.

 11054406_10206512499749880_7107441772337360198_n 11267482_10206512499909884_3327504921710956026_n

After some efforts, I managed to make it work with an Arduino Leonardo. Basically 5 wires are needed to connect the module to Arduino and they connect pins of VCC/GND/Rx/Tx/Reset. This is quite straight-forward. The module’s VCC can’t directly connected to that of Arduino as SIM800 requires a working voltage of 3.7V-4.2V. So a dixode is needed to step down the voltage a bit. The basic programming to make the module work was soon done by referring to the SIM800 AT command-set manual.

11264020_10206518105610023_3666326037796657461_n Continue reading

Switching among Arduino LCD shields or modules with ease

arduino_lcd_shieldsRecently I developed a library for ease the job of displaying texts and numbers on different LCD/OLED modules. This is mainly for my OBD-II data logger project which can be made up of different sets of Arduino hardware. I named the library as Arduino Text Display Library for Multiple LCD, or short as MultiLCD.

The library encapsulates several libraries for various Arduino LCD/LED display shields or modules into a set of unified APIs.

Currently it supports these hardware:

  • DFRobot LCD4884 shield
  • Nokia 3310/5100 LCD module
  • LCD1602 shield
  • SSD1306 OLED module
  • ZT I2C OLED module

Continue reading

Posted in Playground | Comments Off on Switching among Arduino LCD shields or modules with ease

Arduino SD card picture viewer with TFT LCD shield


I just started to play with TFT LCD screen with Arduino. I used Itead 2.8″ TFT shield which is said to work great with UTFT library. Taking into account that Arduino has too limited Flash to hold a full frame of picture, and that the shield has a SD card socket on the back, I decided to make a SD card picture viewer as my first approach.

The 8-bit AVR-based Arduino has not only limited storage but also limited computation power. It is impossible to decode JPEG or PNG on-the-fly with Arduino, nor is it possible to load a whole bitmap from SD card into SRAM. The image files have to be stored in raw data format and loaded and rendered portion by portion. The native data format of the TFT control chip is RGB565 (2 bytes for a pixel, 5 bits for red, 6 bits for green, 5 bis for blue). So I used MediaCoder, which is a universal media transcoder I developed, to generate the raw image data of RGB565. It can also convert video files to a sequence of image files.

Continue reading

Posted in Playground | Comments Off on Arduino SD card picture viewer with TFT LCD shield

A tutorial for Arduino Builder

Arduino Builder is a tool for viewing and compiling Arduino sketch (source code) and programming the Arduino board with the compiled code (HEX code).

From this link you can pick the latest version and download. Once downloaded, extract the 7z compressed package to a new folder and you can launch Arduino Builder by running ArduinoBuilder.exe in the folder.

Before launching, please plug your Arduino to computer with USB cable, as the program will search for available serial ports appeared on your system and display them.

Continue reading

Posted in Playground | Comments Off on A tutorial for Arduino Builder

SPI pin difference among Arduino boards

The SPI lines have some differences among different Arduino boards, especially the new Leonardo. Unclearance of this might cause some trouble when making wire connections manually.

For Arduino Leonardo, the pins on the ICSP header are not connected to any of the digital I/O pins as they are on the Uno. They are only available on the ICSP connector. This means that if you have a shield that uses SPI, but does NOT have a 6-pin ICSP connector that connects to the Leonardo's 6-pin ICSP header, the shield will not work.

Continue reading

Posted in Playground | Comments Off on SPI pin difference among Arduino boards

Web-based Arduino Sketch Compiler

I’ve built up an online service for building an Arduino sketch into a ready-to-burn HEX file. The browser submit the sketch to server with a HTTP POST request. The sketch is then compiled and linked against Arduino core (1.0.1) and library files with AVR GCC on the server side. The built HEX file is sent back to the browser as a downloadable file.

At the moment, only standard Arduino libraries are supported. More libraries will be adpoted in future. My ultimate goal may be making a complete web-based development environment featuring code editing, compiling, personal sketch book, library management etc.

Try it online now
Continue reading