HOME > > ELECTRONICS MAIN PAGE     Delicious.Com Bookmark this on Delicious    StumbleUpon.Com Recommend to StumbleUpon
ARDUINO MAIN PAGE

Hobbytronics/ Adafruit 1.8" TFT displays (ec1tft-st7735.htm)

Great easy to use, inexpensive, display for Arduino, Pi, etc.

Great little device! Vivid colors, Crisp image. Very readable.

I speak of the Hobbytronics 1.8" TFT display with microSD socket, £24 inc VAT, but excl p&p, July 15.

A SIMILAR device is available from Adafruit, $20, 7/15. N.B. I have not "played" with one of those. I don't know how it is hooked up. It uses the same display, so should have the same capabilities, and crisp, vivid display. It also has the microSD socket. But!!... I'm pretty sure it does not have the option of the simple "by serial" control. This means programming challenges for you, and also more complex wiring... using more pins. The mail between the UK and the US is pretty good, the device is small. I'd "go for" the Hobbytronics device, if I were you! (But it is a comfort to know that heavyweight Adafruit likes the sub-module it is built around.)

I have to qualify my endorsement with "it is early days". I haven't had mine long. But, in particular, I wanted to tell anyone looking at the Hobbytronics page: Don't be distracted or dismayed or dissuaded by the Adafruit libraries on offer. You don't need them! At least for Arduino use. (Or Pi, unless I am very much mistaken.) Neither should you be distracted by the illustrations showing "complex" connections to Arduino or Pi.

You only need 3 wires! (MAYBE four, if you want to use the reset line... but I don't think you need that.) That's the hardware. (more in a moment)

For software, use what's in the "Example Arduino Sketch" under "Examples" under "Documents".

You CAN just send text to the display. If you are BORING! But that makes a starting point.

Nota Bene: The following is set up for a system where D2 is not being used, and data to display flowing over D3

#include <SoftwareSerial.h>
SoftwareSerial mySerial(2,3); // RX, TX

void setup() {
  mySerial.begin(9600);
  delay(500);
}

void loop() {
  mySerial.println("Hello world ");
  delay(600);
}

You can have different font sizes, and colors (262,144 shades) and graphics if you use the commands explained in the table on the Hobbytronics page. It really isn't hard, especially if you use the subroutines provided for you in the example sketch.

-

Wiring: From the six pad set on the same edge as the SD socket... Run wires from "5v" "Gnd" to the Arduino's, and a wire from the pad marked RX on the display to D0 to use the example sketch. (For just a little more trouble, in the software only, you can use a different pin on the Arduino as the source of your serial data... and avoid the pin that is part of the programming of the Arduino and its serial monitor.

(The "Don't Get Caught" warning is for the following: The module is the HobbyTronics' ("HT") TFT Serial module. The label with the module's name was, unfortunately, placed next to the module's programming pads. The pads for the serial interface are the other set of six, the one's on the right hand side, in the illustration opposite.

The green wire goes to the MODULE's "Rx". In other words, the pad through which the MODULE will RECEIVE the data to control it. I've made such a fuss about "THE MODULE will receive", because for many newbies herein lies an opportunity for confusion. The wire will come FROM an OUTPUT of the Arduino (or Pi, or whatever you want to use to control the display), because it is going to an INPUT on the display. Outputs feed inputs! DO NOT connect the output of one device to an output of another, except in very special circumstances. Input-to-input will (probably) do no harm... but it won't be much use! (Again, except in special circumstances.) Inputs go to outputs. Outputs go to inputs... when you use pad names predicated on the device they are part of.

START SIDEBAR... that, again, in detail...

Starting from the pad nearest the SD card carrier...

I soldered a black wire to pad "1", marked "GND", the left hand-est one. For the ground connection.
Skipped pad "2", (had no text on silkscreen on board.)
Soldered a red wire to pad "3", marked "5v". For the 5v from other parts of my circuit, the Arduino.
Soldered a green wire to pad "4", marked "Rx". For the data to the display.
Skipped a pad "5", marked "Tx". (Would be for data FROM display.)
(Optional... leave this off, if access will be easy later. At least make the wire short, if you intend to let it float. DO NOT connect to 5v... it is the reset line to a 3v3 Atmel... Do not connect to 5v unless you know that would be okay. I doubt it would be. However, don't worry: The data line can be run at 5v.) Soldered a yellow wire to pad "6", marked "/Res". For the reset signal, should I find I need to use it. (Pull that pad low briefly, and then let it float again to reset the device. (Signal is pulled up by a resistor on the board.)

... END SIDEBAR


Getting fancy

If you entered the little "Hello world" program above, replace it with the Hobbytronics demo. But, do the following to make it run with the same wiring as you used above, avoiding D0, which I avoid because it is used for programming the Arduino, and for the useful system-provided Arduino serial monitor

Start by using the editor's "Find" (and replace) to change all instances of Serial to mySerial.

Then put...

#include <SoftwareSerial.h>
SoftwareSerial mySerial(2,3); // RX, TX

... near the top of your program (sketch). I've use "2,3" which would allocate pin D2 for the software serial's receive line (you won't be using it. I'm pretty sure you can use it for other INPUT uses, even though the software serial is also "using" it.)... AND allocate D3 for the line data will be sent on. (You can, of course, choose to use different lines.)

Connect the display's Rx to D3, if you used the numbers I did, if you didn't already do that. You're almost done! When you run the program, you should get...

-

... but with nicer colors, and CRISP!)

Until you have a memory card in the microSD socket, with a .bmp file already saved on it (see below for more on that), rem out the line that says...

tft_command(13,120,85,"rpi2.bmp");

(That little detail was the only reason for the "almost" in "You're almost done")

More Arduino ideas at...
http://www.arunet.co.uk/tkboyd/ec/ec1tft-st7735.htm

Love this little display!

And another thing, as the great Jeremy Clarkson was wont to say: Do you have a "big" PC, running all the time, but doing some task that doesn't warrant having a big display running 24x7 also? Stick one of these on a serial port! (You may have to do some level shifting/ inverting... but that's not hard.)

There's an socket for a memory card on the board. And a command in the serial commands set for loading the screen with an image from a file on the memory card. I haven't tried this. I'm also told you can write data to the card.



Display .bmp from SD card

Note: You do NOT have to use an SD card at all. You an send text and graphics to the display over the serial connection already discussed. The "doing" of that (the software), I will discuss in a moment. An alternative way to get a display on the screen is as follows....

If you can plug an SD card into your set-up, then if....

-- The card is formatted fat16 (despite limitations of the format)(ext4 doesn't seem to work for the display's wants.), and....

-- The card has a bitmap of the right size , and....

-- The bitmap is saved with a 32bit color depth....

... then.... You should be okay! If the bitmap was called, then the code would be...

tft_command(13,120,85,"rpi2.bmp");

(I presume... but I haven't tried it... that you can have several bitmaps on the SD card, and change them as you wish with code, e.g.... (untested pseudo-code...))

if ((ButtonA Pressed)) then tft_command(13,120,85,"PressedA.bmp");if ((ButtonB Pressed)) then tft_command(13,120,85,"PressedB.bmp");if (((ButtonA Pressed=False) AND (ButtonB Pressed=False))) then tft_command(13,120,85,"PressedNone.bmp");

(Many thanks to a helpful reader who sent me some of the .bmp details above). So many fun things out there... but so many ways to go wrong. Sigh.)

I don't, immediately, have an answer for you to "how do I convert my image to the right color depth." I had a look at my favorite image "Swiss Army Knife", Irfan Viewer (free! (Windows))... and didn't immediately find the necessary tool.... but I suspect it is there somewhere. Of course, many, many software tools should be able to manage this simple task... you probably already have one on your machine, if you do anything with images.

Sending text and graphics to the display

There's a set of commands for the device, neatly set out at the Hobbytronics page.

There are commands to set background and foreground colors, clear the screen, change font size, go where you wish on the screen to put a letter (or letters) (If you say "goto(text) 2,4", you will be in the right place to put a letter on top of whatever is currently in the 3rd position of the 5th row of the grid which is sized to put letters on the screen.)(You "say" this with a string of numbers, by the way, not by sending what I wrote.)

You can also "goto" a position specified by the underlying grid of physical pixels. (There's a separate command for that.) Once there, you can draw lines to other places. (There is no command for "make the pixel at x/y such and such a color". (You could "create one" by setting up a function to draw a very short "line".)

I would like to thank Hobbytronics for permission to reproduce the following table, in case anything ever happens to the copy... more clear!... on their site. And for the device itself! I am always happy to pay a little extra for hardware that "takes the load off" of the Arduino. There are other TFT displays available, but I am not aware of another that can be driven so simply, over a single data line.

-

You use the commands by sending the ESC character (decimal 27, hex 0x1B), then the command sequence and then finally decimal 255 (0xFF) to terminate the command. The HobbyTronics page offers sample programs. ("Sketches".)

I have only scratched the surface. (Of the topic. Happily, my display remains pristine.) There are good videos to show you the splendid results which are possible. Plus, I hope you will enjoy trying things in the table above, which I believe to be comprehensive.



   Search this site                 powered by FreeFind
 
Site Map    What's New    Search


Ad from page's editor: Yes.. I do enjoy compiling these things for you... hope they are helpful. However.. this doesn't pay my bills!!! If you find this stuff useful, (and you run an MS-DOS or Windows PC) please visit my freeware and shareware page, Sheepdog Software (tm), download something, and circulate it for me? At least (please) send an 'I liked the parallel port use page, and I'm from (country/ state)' email? (No... I don't do spam.) Links on your page to this page would also be appreciated!
Click here to visit editor's freeware, shareware page.



Here is how you can contact this page's editor.
Click here to go up to general page about electronics by editor of this page.
Click here to go up to general page about electronic projects by editor of this page.
Why does this page have a script that loads a tiny graphic? I have my web traffic monitored for me by eXTReMe tracker. They offer a free tracker. If you want to try it, check out eXTReMe's site. The Google panels and the search panel are also script based.

Valid HTML 4.01 Transitional Page tested for compliance with INDUSTRY (not MS-only) standards, using the free, publicly accessible validator at validator.w3.org


....... P a g e . . . E n d s .....