Hacked a Toupad + VFD with AVR

agent420

[H]ard|Gawd
Joined
Sep 6, 2001
Messages
1,388
Got a couple of additions to the junk inventory this weekend, a dead Dell Insprion 1100 and a defunct HP Laserjet 4. The touchpad in the laptop and the VFD board in the printer caught my eye, so I decided to see if I could get them to be friends...

p1.jpg


The only chip I'm using on the breadboard is the Atmel AVR microcontroller in the center, the rest of the parts are leftover from testing my stepper driven Etch-A-Sketch project.

Turns out that most Synaptic Touchpads used in laptops communicate via the standard PS2 protocol, using the same wiring scheme as a conventional mouse and keyboard. The pad could probably be wired to a pc and operate as a mouse without any special drivers. But as PS2 is not a common protocol used in microcontroller applications, I had to write my own interface code for the Atmel 8535 AVR I planned on using. Fortunately, the PS2 protocol is not that complex, and references describing it are easily located on the net. Synaptics also has a very good interfacing document available for download that details the electrical interface and the commands used to control the device.

Here's the connections on the back of the touchpad (pins functions in pairs):
p4.jpg


The VFD control panel turned out to be a bit more elusive, but after some detective work with a multimeter and the datasheets from the chips on the board I was able to determine how it operates. It's actually a great little board with a nice 16 char VFD, 3 programmable leds and 8 buttons - it makes a great testbed tool and requires only a single +5V supply. The VFD is also a nice change from boring everyday lcd displays (it's the tubes, man :D ).

Here's the VFD board displaying the coordinates of the touchpad:
p2.jpg


While working on this project I wondered if I could get the pad to operate like a qWheel type of device, like used on the iPods. Well,a little bit of geometry math coding later and tada, rotary encoder emulation.

Here's the VFD displaying a bargraph indicating input from circular motion on the pad:
p3.jpg


This feature and the ability to devide the pad into multiple zones makes it a great input device for projects. Uses can be fan speed controllers, light dimmers, etc.; the possibilities are endless!

It turns out that the touchpads and this model VFD board are available and inexpensive in the surplus market or eBay, making them great experimenter devices. Unfortunately, neither will natively hook to a pc through parallel or serial interfaces, so a microcontroller has to be used. However, if the interest level in a project using these is there, I might design and offer inexpensive interface boards that would translate the PS2 to RS232 or similar.

Here are some resources I used for this project, as well as the source code I wrote that is well commented and contains additional technical information:

Synaptics Developer Resources - Interfacing Guide available here
Mitsubishi M66004M VFD datasheet (pdf)
PS2 protocol
My source code
 
wtf... is that an Etch-a-Sketch driven by a stepper motor?!?!

:cool: :cool: :cool:
 
That's a nice project. Ive done something similar, but luckily I have a touchpad that outputs standard serial data, like a standard dsub serial mouse. Unfortunately I don't think I could get many more of these.
 
Cool..

but..

first

PS2 interface is a regular sychronous serial interface.. there is nothing complex about it.. it's just a start bit followed by data.. followed by your optional parity, followed by a stop bit..

and it't very easy to get a PS2 device to work with a micro controller..

i got a barcode scanner that connects via PS2 to work with an AVR (Mega128) in literally 30 minutes... i just used the Sychronous serial interface on the controller..
 
gee said:
wtf... is that an Etch-a-Sketch driven by a stepper motor?!?!
Yeah :D Last testing was with a hacked ball mouse, I just hooked straight to the optical encoders. Works very well actually, draws as fast as you can move the mouse. Long term goal is to replicate a photo or scanned image. I can hardly cliaim to be the 1st to do this, Google returns several other examples. But I haven't seen anyone try to replicate an image.

[edit]

btw gee, the green board in the center of that image is a 1972 nixie counter board ;)

[/edit]

RancidWAnnaRIot said:
PS2 interface is a regular sychronous serial interface.. there is nothing complex about it.. it's just a start bit followed by data.. followed by your optional parity, followed by a stop bit..

and it't very easy to get a PS2 device to work with a micro controller..
Well, certainly recieving data is straightforward, but it seems to me that sending data to the ps2 device has a couple of quirks, most notably the need to pull the clock low for a minimum period of time before beginning the packet. Also, I didn't say it was difficult; not having used the PS2 format before the easiest thing for me to do was to refer to the Atmel AVR AT Keyboard Interface app note. I figured if anyone would know how to interface an AVR to PS2, it would be the manufacturer of the chip. I took the principles and wrote my code so that it wouldn't require an interrupt like the example did. I try to avoid using the interrupts when I can, so that they are available when I really need them. The problem was that the AT908535 chip I used doesn't have the USART your 128 had. Probably took me about 29 minutes :p

Actually, reverse engineering the VFD board was a way bigger challenge than any of the touchpad coding.

Commenting the code and documenting the project so I could share the knowledge here took much longer than getting the hardware operational.
 
Very cool. I applaud the work.

Do you mind if someone (not myself since I have no free time now) converts your BASCOM code to AVG-GCC? BASCOM isn't free sadly.
 
agent420 said:
Yeah :D Last testing was with a hacked ball mouse, I just hooked straight to the optical encoders. Works very well actually, draws as fast as you can move the mouse. Long term goal is to replicate a photo or scanned image. I can hardly cliaim to be the 1st to do this, Google returns several other examples. But I haven't seen anyone try to replicate an image.

[edit]

btw gee, the green board in the center of that image is a 1972 nixie counter board ;)

[/edit]

Well, certainly recieving data is straightforward, but it seems to me that sending data to the ps2 device has a couple of quirks, most notably the need to pull the clock low for a minimum period of time before beginning the packet. Also, I didn't say it was difficult; not having used the PS2 format before the easiest thing for me to do was to refer to the Atmel AVR AT Keyboard Interface app note. I figured if anyone would know how to interface an AVR to PS2, it would be the manufacturer of the chip. I took the principles and wrote my code so that it wouldn't require an interrupt like the example did. I try to avoid using the interrupts when I can, so that they are available when I really need them. The problem was that the AT908535 chip I used doesn't have the USART your 128 had. Probably took me about 29 minutes :p

Actually, reverse engineering the VFD board was a way bigger challenge than any of the touchpad coding.

Commenting the code and documenting the project so I could share the knowledge here took much longer than getting the hardware operational.


i see i see....
 
DocNsane said:
Very cool. I applaud the work.

Do you mind if someone (not myself since I have no free time now) converts your BASCOM code to AVG-GCC? BASCOM isn't free sadly.
Thanks. I've changed my 'license' to BEERWARE, so feel free to do what you'd like with it... I posted it here as a learning tool anyway. Of course, if you create a product based on this code and makes millions of $, the price goes up to [H]ard liquor :p

The irony is that all the example code I looked at while researching this was in C, that I translated to Basic ;)
 
I wonder what I could do with one of those in the car. :hmm: "Finger gestures" for volume controls :dunno: :hmm:
 
Back
Top