Sunday, January 18, 2015

Using Computer Mouse as Scanning Device for Arduino

I happened to have a wireless keyboard/mouse combo lying around with a broken USB-dongle. Basically unusable for regular use, but of course ideal for some thinkering.

I recently read an article about using the image sensor as input device for Arduino or other MCU and I wondered if I could repurpose my mouse for this.

So, I took my mouse apart and found out it is based on the Avago ADNS-5030.

I first cut all the traces going to the local microcontroller, solder some pins on the sensor and hooked up my Arduino Mini Pro 3.3V/8Mhz as follows, I took the 3.3V power from the Arduino too :


NameADNS5030Mini Pro
VCC7VCC
GND6GND
NRST39
NCS48
CLK513
MOSI811
MISO112
Reading the datasheet, shows SPI has to be configured in SPIMODE 2 (Pol=1, Pha = 0). Clockspeed is 1Mhz, so the DIVIDER is set to 4.

A quick check allow to verify register 0/1 and to read ChipId and Revision, respectively 0x11 and 0x00.

I ran a small demo reading the Motion-register and reading the dX and dY movement. No big deal.

Now I wanted to make sure I could readout the 15x15 pixel imagesensor. For this you need to readout the Grabber-register (0x0B), check that the MSB is '1' and then use the 7 remaining bits as intensity.

I connected my IL9301 TFT screen to my Arduino and used the Adafruit GFX library to draw the pixels on the screen.

On the software side it's a bit tricky because IL9301 works in SPIMODE=3 and divider 2, so we are changing the SPI-parameters on the fly to make it happen.

This is the setup :
The image sensor has approx. 0,1mm pixel resolution, the 'e' on the TFT-screen corresponds to 1 character from the cardboard.


Sunday, January 4, 2015

Nokia USB Serial Cable hack for my Arduino Mini Pro

I happen to have a Nokia USB Serial Cable lying around. I used it to program my Openwrt router.
It was perfectly fine. I had cut of the Nokia connector and I used the 3 wires:

WireSignal
Black + ShieldGND
WhiteRX
GreenTX

This worked perfectly fine for all 3.3v gear connected to the serial lines.
Until the day I wanted to connect my Arduino Mini Pro (3V/8Mhz).

It worked ok, but there were 2 drawbacks :
- I needed to provide separate power to the Arduino ;
- Programming from the Arduino IDE, requires a manual RESET of the Arduino to start the download ;

After some research, I found out the Cable uses a PL-2303HX chip. On PIN 2, there's the DTR-signal  but it isn't connected. The Arduino IDE using this signal to issue a reset to the processor in order to put the chip in download mode.

So, I performed following changes :
- Cut trace leading to Black lead between the 2 solder pads ;
- Solder Red wire from Capacitor to Red wire ;

- Solder Blue wire from PIN 2 to Black wire ;




This effectively puts 3.3v on the RED wire, DTR on the black and leaves RX/TX/GND as before.

Works as a charm. I soldered some Dupont-lines to the end of the Nokia Cable, heatshrinked the connections and finally inserted the PL-2303 board back into the moulded housing and glued everything nice and thightly. In order to avoid confusion, I used BLACK for GND and GRAY for DTR.




WireSignalMini Pro
BlackGNDGND
WhiteRXRX
GreenTXTX
Red3.3VVCC
GrayDTRGRN