Showing posts with label mouse. Show all posts
Showing posts with label mouse. Show all posts

Wednesday, July 11, 2012

I Got Spinners Dawg!

I am an engineer. By profession, by hobby and therefore, by passion. And being an engineer requires me to browse through PDFs several pages long, or plow through code confusing enough to make your eyes pop out. I may do this just to look cool, but all the same, I have to do it. Using a mouse scroll wheel with its annoying ‘click’ makes my index finger sore pretty quick. So then I switch to my middle finger. And pretty soon I find that I can’t give someone the bird.

Griffin
Griffin’s $40 PowerMate

Now the simple solution would be to buy myself a jog wheel / spinner. Give the jog wheel a slight twist and its momentum would keep it gliding over pages and pages of the boring PDF. But I’m an engineer. So I decided to build myself one (obviously the phrase “Why buy a cow when milk is so cheap” does not apply to engineers).

The inspiration for the build was not really ‘direct’. I never really got down to building one until I watched one of Dave’s excellent teardown videos. I was actually googling how VCR heads have a helical scan and then opened up a myriad other links, this instructable being one of them.

Osgeld
Osgeld has done a pretty fine job with his jog wheel

I had torn down a VCR about a year ago and mined it for parts, so I already had the basic stuff at hand. I also had an old USB mouse picked up from a dorm trash can. The tactile buttons had gone bust, but the chip itself was pretty useable.

DSC02475 DSC02485
The crusty old VCR head. Oxidized and rusted

Some more googling led me to these tutorials:
http://www.instructables.com/id/Computer-scroll-wheel-bearings-version/step5/Finished-future-improvements/
http://www.instructables.com/id/Desktop-Scroll-Wheel-and-Volume-Control/

Disassembly of the head was was relatively easy. I’m just going to explain it through pictures.

DSC02476 DSC02477
A brushless motor drives the head assembly

DSC02478 DSC02481
The magnetic pickups are clearly visible in the image on the right

DSC02479 DSC02480
The rotary transofrmer

[Digression - the pickups feed the signal to the coils of a rotary transformer. The transformer helps couple a signal across two rotating elements without the use of mechanical elements like slip rings. I’ve never seen a rotary transformer before, so this was the most interesting part of the teardown. The transformer ‘core’ was glued down. A blast of hot air from my heat gun helped dislodge it.]

My mouse chip was an all-in-one solution with the USB comms, the optical sensor, and the click/scroll encoders integrated onto one chip. This is good since I was able to make my circuitry compact. Some mice (mouses?) distribute USB and sensor duties across two separate chips. The particular chip that I used was the A1198. Googling for the chip’s pinout or datasheet proved useless. So I used a multimeter to reverse engineer the PCB. An MSPaint pinout is below; hopefully someone else will find it useful.

Flash
Vreg gives out approx 3.3v All V should be connected to Vreg. Resistors pulldown the quadrature inputs Q0, Q1 to Q_pulldwn. If a mechanical encoder is used, then the common pin of the quadrature encoder should go to Vusb. Xtal is a 12MHz ceramic resonator.

The pin spacing for the chip was a bit odd. Luckily the pins weren’t staggered like you find on some sensors. I had some 2mm pitch veroboard, which, after wiggling the pins a tad, worked just fine. I used the ceramic oscillator from the original mouse, and sprinkled a few SMD capacitors which I had scavenged from old electronics.

DSC02490 DSC02491
Left: IC pins splayed out
Right: I drilled a small hole for the aperture of the optical sensor to sit in

The original mouse used a mechanical quadrature encoder for the scroll wheel. I converted this into an optical encoder by using some cheap IR LEDs and phototransistors. The resistor-phototransistor-combo’s output swung from 0.1v to 3.3v. I found that I didn’t even need to use a comparator on the sensor output since the signal was fairly ‘clean’. The encoder wheel was designed and printed using shimniok’s Wheel Encoder Generator.

DSC02494 DSC02514 DSC02516
Left: The first sensor board I made used one IR LED and two phototransistors ground flat. This didn’t work well at all – very poor resolving power.
Centre: On the second board I used
SG-105 photoreflective sensors. They’re tiny and low profile compared to my earlier sensors.
Right: The back of the SG-105 board. SMD resistors used to bias the opto-elements; 220ohm on the LEDs, 470kohm from the phototransistor collector to
Vusb.

For the base I used a Canon lens holder given to me by a photographer friend. A little bit of drilling here and there made it an excellent base.

DSC02487 DSC02492
A Cannon lens cover was used as the base.

DSC02519 DSC02517
Left: The completely soldered ‘mouse’ board was stuck with some double sided foam tape in the Canon lens holder.
Right: The sensor board was fixed using a screw and a spacer. The USB cable was secured with a dot of hot glue.

DSC02509 DSC02511Scroller
Testing the sensors with the help of my third hand and a DSO. The signal is typical of a quadrature encoder and is quite clean, as you can see in the trace.

Overall I’m really happy with the way this jog/spinner wheel has turned out. No more sore fingers, and zipping over pages in a PDF, or lines of code, or through frames of a movie has become easy and super fun! Infact I’ve used it extensively while editing this very document :-) One possible addition at a later date would be to add a push button at the bottom of the shaft so that the whole spinner can be ‘pushed-to-click’.

DSC02520

Edit: I’ve uploaded a video to Youtube

Jog Wheel

Tuesday, February 16, 2010

Touch Me Please: Video

You can watch the video of my touchpad interface here:

The touchpad is taken from an HP Pavilion dv2000 laptop. A PIC16F628A performs all the necessary PS/2 host functions; and a Nokia 3310 LCD is used to display ‘mouse’ movement.

The LCD uses custom graphics. I wrote both, the LCD driver, and the firmware to run the touchpad. Code is in CCS-C. Both drivers are based on info found online. Do note, that the touchpad code on this page is slightly different from the touchpad code posted in the original page.

You can find the original post here.

Sunday, February 14, 2010

Touch Me Please!

Before I dive into this post I take a moment to profusely apologize for the title of the post – it is tragically horrendous.

OK, so now that I’ve got that out of the way, lemme begin. This post is a little out of ‘order’; it would have been more appropriate had I first blogged about how I procured some of the components mentioned in this post. But heck! Lazy as I am, I guess I’ll leave that for a later date.

A friend of mine (un)fortunately busted his laptop several months back. I managed to persuade him to let me scavenge parts from the laptop. What parts did I get? That’ll be the subject of a different post :-D I managed to rescue several components; a touchpad being one of them. And as usual, I went about trying to interface it.

Electronics being my love, and today being Valentine’s Day, it is most fitting that I have successfully managed to communicate with the touchpad. Now before you start making judgements about me, and why I fool about with electronics on this most awesome day, let me tell you how I went about the interfacing.

The touchpad is a mouse replacement ubiquitous on laptops. Synaptics is by far, the biggest touchpad manufacturer. Alps Electric, Cypress, and a few others are also into the touchpad market. Most touchpads today work on the principle of capacitive sensing.

The touchpad of my trusty IBM Thinkpad R51 

The touchpad I scavenged was from an HP Pavilion dv2000 series laptop. The touchpad used is probably manufactured by Alps Electric Corporation (there is a prominent “ALPS” silkscreened onto the back of the PCB). The touchpad is a capacitive sensing type and is controlled by a 48 pin QFP. The chip is marked 1CA026A. I googled high and I googled low but I couldn’t find anything useful; no datasheets, nothing. So it became necessary that I give experimentation a shot.

There is a four wire flat cable (FFC) heading off the PCB. Having fooled about with electronics for a while now, I knew that it was but obvious that the touchpad used some sort of serial protocol. I figured that there were a few possibilities – maybe USB, possibly I2C. Again, I googled to see if touchpads followed a standard protocol. Most sites on the net said that laptop touchpads invariably use the PS/2 protocol, however, none of them said it with ‘authority’. It was always “apparently, touchpads use the PS/2 protocol” or “the PS/2 protocol is used even on laptops”.

Anyway, I thought I’d give USB a try. I used a hacked-together USB dev board, pulled out V+, Gnd, D+, D-, and connected them to what seemed like the appropriate pins on the touchpad. When the error “USB device not recognized” popped up, I reversed D+ and D-. After I still got the same error, I guessed that it was the PS/2 protocol that the device used.

I don’t have a PS/2-to-USB converter so I had to use one of my trusty PICs (a ‘628A is this case) to emulate a PS/2 host. I wrote my own driver basing my ‘read data’ code on something written by Dheera Venkatraman (who has very kindly made his code available online).

I also referred to these sites for info about the timing specs of the PS/2 protocol:
http://www.computer-engineering.org/ps2protocol/
http://www.computer-engineering.org/ps2mouse/
http://documentation.renesas.com/eng/products/mpumcu/apn/reu05b0121_h8s2100ap.pdf

 

Below are a few pics that I took.

tpboard bottom
Right: The touchpad; left and right buttons are on the PCB
Left: Bottom view of the touchpad PCB

The test rig 

Initially, when the touchpad is powered up, it sends 0xAA (‘passed self-test’), followed by 0x00 (which is the mouse ID). The ‘628 then sends the byte 0xF4, which tells the touchpad to stream data, i.e. continuously send any activity on the touchpad or the buttons. Once all commands are received/issued the PIC asserts a pin connected to an LED.

Init The initialization sequence – 0xAA(self-test OK) followed by 0x00(Mouse ID)

Here is my code if you need it. While you are free to modify it in any way you wish without permission, it would be nice if you remember to give me credit. :-D

Video to come up shortly.

Visitors