Tour : click picture below for previous

Back to Mike's Electric Stuff

Click picture below for next

wpeC.jpg (401956 bytes)wpeE1.jpg (502325 bytes)Hacking the ultra-cheap Sparkfun TFT LCD

Sparkfun super-cheap QVGA LCD  hacking progress....

Resources : Datasheets for other drivers that may have a few similarities, but don't let the closeness in part numbers fool you...

Pinout details HD66781  HD66789  HD66773,66780 and 66787 datasheets are at
Sparkfun forum thread

DATASHEET FOUND!!! hd66790 Datasheet

Info below is all I know so far. Last update 18 Sep 2008. Lunchtime GMT. 

Best image to date : (assorted waveforms being thrown at RGB, G channel varying delay down the frame to produce diagonal)

wpeF7.jpg (44495 bytes)

Please DO NOT ask for code examples or ask dumb questions like how to send SPI commands, where to get a connector, how to power the backlight, how to connect it to an Arduino etc. etc.  If you need to ask things like this, please wait until people have figured out all the hard stuff for you.

Any helpful data/results of experimentation/corrections/suggestions please email.  Most values have been hand-tested so errors are likely!

Connector is designed to be soldered, so don't bother looking for an FFC connector for it. You may be able to improvise something using a SODIMM socket as it has the same pitch.

The small 1.1" LCD, HD66782 based LCD  is possibly similar, and is likely to have its SPI ID tied low, so commands would be 70 to set register index, 72 to write register value. I think this display has RAM so setup likely to be somewhat different. This datasheet has a setup sequence for a different LCD that uses the same driver  chip.
This LCD is too small to be of interest to me so I will not be investigating, but if any one finds any info I'd be happy to add it here or link to it.

Display has no RAM, hence needs a continuous stream of 'video' data via RGB port, DE, Hsync.Vsync and DOTCLK. DE low indicates the active part of the HSYNC period.

When thinking about sync pulses etc., Remmeber that this display is 240 wide x 320 high, i.e 320 lines per frame...

Setup is via SPI interface  :

Take SLCD_CS low, write 3 bytes via D_SCL, D_SDA, then take SSEL high.Data clocked on rising edge of D_SCL ( NB this is SPI, NOT I2C as may be inferred from pin names). MS bit sent first.

To write a register, send ( all hex)  74 00 rl to set address, then send 76 dh dl to write data. Reg address does not auto-increment.

e.g. to set register 6 to 0823 send : <SSEL Low> 74 00 06 <SSEL High> <SSEL Low> 76 08 23 <SSEL High>

Suggested Initialisation sequence so far - UPDATED in light of datsheet
All tests have been done at 3.3v supply - some of the power supply setup may be more critical to get best contrast at lower voltages.

Address Data Comments
Set DE Low ( see notes below)
Set HSYNC period to PCLKx240, low for >2 PCLK
Set VSYNC period = HSYNC x324, low for 1 line period
Take reset low for >1mS
Take reset high, Wait >20ms
6 0823  
5 0000  
1 08E0  
2 0008  
Wait >20ms  
0 0012  
1 00e0  
Wait >20ms  
0 0812  
1 00e0  
2 2008  
3 0100 B8 sets horizontal direction. B14-11 set polarity of Vsync,Hsync,Dotclock,Enable respectively
4 0102  
7 0f00  
8 0007  
9 0008  
a 0008  
6 1823  
5 0010  
1 02E0  

Assorted random notes

It appears to be able to get the driver into a state that requires power-cycling to recover.

HS and VS appear to only look at falling edge - low width seems to have no effect.

HS period can be extended with no obvious effect (apart from effect on framerate) - using PCLK*256 may simplify drive logic. Hsync width = 128 PCLK would also probably simplify things as it could be bit 7 of the pixel clock counter.

DE looks like it can be held low continuously, however I don't yet know if this may cause addressing issues - e.g. pixels at edges not displayable, or rows lost in the VSYNC back porch.


<Ignore stuff below now the datasheet is found - left for historical interest....)


Register map discovered so far    ALL VALUES are HEX
Register address Function Bits mentioned below have some observable effect. Non-mentioned bits within a register have been tried and had no obvious effect
Power-up/reset state assumed to be 0000 except where mentioned (i.e. writing 0000 makes some change from reset state)

"Drastic" generally means display disappears, typically fading out or changing colour in a gradual or uneven way, indicating major wrongness in supply voltages. Possible that these states could  cause long-term electrolysis damage to LCD cell.

"No effect" may be an unimplemented register, or something that didn't produce an effect hat was visible onscreen or change in power draw in the configuration/state and input timings when tested. It does not mean the register is definitely not there!

test method was to write 0000 then FFFF to register - if effects seen, bifields narrowed down to identify bits that did something. 'No effect' means 0000 and ffff made no difference to visual or power draw.

Bits mentioned with no description do 'something'

0000   Setting any of bits 1,2,3 with Bit 0 clear turns on DC/DC converter. DC/DC only runs when pixclk/syncs are present

Bits 7..4 have small effects on current draw. B6,5,4=111 causes voltage on VGH pad on flex to drop significantly and contrast to reduce

Bit 7 may have some latching effect - first rising edge after reset has some signifcant effect, subssequent chnages no effect.

Bits 15..8 have significant effect on power draw & contrast b14,13,12 all high looks "bad" - doubles power draw...



  B0..6 affect black levels and current draw

Bit 7 seems to need to be set to see input data

When Bit 9 set, rgb input data starts having visible effects


0002   Some effect on power draw
0003   Bit 8 set flips horizontal scan direction

Bit 11 ? DE polarity select, 0= active low

Bit 13 does something very funky - could be driver clock related

B14 slight vertical shift

0004   B0 set does something drastic. (bad)

B1,2,3 vsync related, 3 bit value - shifts image up/down - could be related to back-porch length. Increasing this value and then increasing Hsync period seem to cancel each other out.

B8,9 maybe vsync polarity related, flickery if =00.

reset setting nonzero, possibly 0002

0005   Bit 3 set blanks display almost completeky


0006   B12 clear does something drastic (yellow-green) ( bit is set after reset)

B8 and 9=11 does something drastic (yellow-green)

0007   tiny effect on power draw
0008   Slight effect on black level
0009   B0..3 small effect on contrast (gamma correction/drive voltage?)
000a   small effects on contrast (gamma correction/drive voltage?)
000b-0010   Small effects on current draw
0011-1f   No effects
0020   B0..5 something vertical related. Reset value is around 30. A change of 1 affects about 6 lines


0021   B0 set increases power draw to 58mA - this is probably VERY BAD - driver chip gets hot! ( self-destruct bit?!)


0022   No effect seen
0023   b4 some effect on power draw
0024,25   No effect
0026   B0,B1 some effect on power draw
0027   B7 some effect on power draw
B8 set something drastic


0028-2f   No effect seen
0030   b6 Set something drastic
0031   no effect
0032   B12 something drastic
0033-3f   no effect
0040..7F   Not fully tested- addresses 00x0 from x=4 to 7 no effect
0080   Some values have drastic effect, including very high power draw ( 32mA) - DANGER! (bad states include any of B1,2,3 set when B7 is clear)
Some values appear to turn off DC/DC converter

B11 set increases contrast dramatically

Reset value is not 0000.  - 0092 gives similar but not quite identical power draw as reset state


0081   Most bits do something drastic
B9 set does the green/yellow thing
Reset value is not 0000 - reset value not yet determined.
0082   Most bits make very small changes in power draw
0083   possible shadow of 0003 - same effects
0084   possible shadow of 0004
0085   possible shadow of 0005
0086..8f   Not tested
0090   Very small effects on power draw


0091-93   No effect
0094-9f   not tested
00A0   Appears to be shadow of 0020   not tested
00b0   appears to be shadow of 0030
00c0,d0,e0,f0   No effect. 00x1..f not tested
Addresses >100 appear to be shadows of 0..ff, i.e. address MSbyte ignored



  wpeC.jpg (401956 bytes) wpeE1.jpg (502325 bytes)

Click picture above for Previous

Back to Mike's Electric Stuff

Click picture above for next