Showing posts with label USB. Show all posts
Showing posts with label USB. 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

Friday, January 15, 2010

My First ‘Proper’ T&M Instrument

I haven’t written in AEONS! And I figured, “Hey! What better way to begin my two-zero-one-zero archive than by bragging…..oops!….I mean blogging about one of my new acquisitions”. I’ve recently bought myself a DSO. Not the fancy Agilent or Tektronix scopes; I bought myself something much more affordable – a DSO2090. I’m pleased with it. Very pleased. And, since there are very few reviews about it online, I’ve decided to write one.

I had initially decided to build my own DSO, but as I soon found out, building test and measurement equipment is no child’s play. I tried in vain to get my hands on a decent ‘scope on eBay, but most of the scopes were out of my budget, and the ones that were in, wouldn’t ship to India. A lot of manufacturers make  USB scopes – PicoTech and BitScope being the notable ones. But again, too expensive. And I really got sick of trying to use my soundcard as a low cost ‘scope. So after much forum-trawling and  late night ‘research’ I settled on the DSO2090. Do note that the price of this instrument can vary from 160 bucks to over 300 bucks on the net!

The ‘2090 is a good piece of equipment. It’s priced reasonably well (obviously, a lower price would be better! :-P), and it has most of the functions that higher end DSOs have. A few words of warning – don’t expect the ‘2090 to match up to a dedicated bench DSO. The ‘2090 is more like a tool that the moderate-to-advanced-level hobbyist, rather than a test engineer at Texas Instruments, would have.

1Scope Ripped from the seller’s (www.getbetterlife.com) eBay page 

I still haven’t test driven the socks of the DSO, but I have managed to get my fingertips dirty. Read on for the lowdown.

The ‘2090 is a USB driven, two channel digital signal oscilloscope. Mine is a Hantek clone. It can measure at 100 megasamples per second (MSps), and has a bandwidth of 40MHz (for a nice explanation about the difference between sampling rate and bandwidth go here, and also read this).

Specs:

  • 100MSps real time sampling
  • 2.5GHz equivalent sampling (also called ‘ETS’)
  • 40MHz (-3dB bandwidth)
  • 8 bit resolution
  • Max input voltage 35Vp-p
  • Vertical deflection: 10mV – 5V @ 1x probe (9 steps)
  • Horizontal deflection: 4ns – 1hr (38 steps)
  • Trigger: external, or either channel (edge based, single, normal)

Software features:

  • Several convenient measurements (P-P, frequency, RMS, etc)
  • FFT/Spectrum
  • Math (add, subtract, multiply, divide)
  • Saving screenshots (JPG, BMP
  • Logging (DAT, Word, Excel)
  • Nice demo function
  • Other useful features

I ordered my DSO2090 from a China-based site. The cost was the lowest from among all the web-based dealers, AND more importantly, shipping costs weren’t atrocious. The base price was USD161.20, and shipping was USD29.71, for a total of USD191.91 (~INR 9,324). Customer service on the site was very prompt and courteous. Shipping to Gurgaon, India, took a little long – 10 days. But in all fairness, it was the Christmas week. Packaging was very good, and the DSO came unscratched and unharmed. I had no issues with customs (both Bombay, and Delhi released the parcel in less than 3 hours).

2Packing3Packing
Really good packaging

4Box5Kit
The box, and its contents

The scope is totally USB driven – no external power required. The cable supplied is a USB ‘Y’ type cable – One for power and data (black), and the second (red), to supply additional power, if necessary.

 6Ycable7Front
The ‘Y’ cable to the right and the BNC jacks to the left.

Two BNC clip probes and a few probe accessories come as part of the kit. The probes supplied are compensated 1x/10x probes. Considering the price, they’re very good quality.

8Probes9Probe
Left: The Probes Right: One of the clip probes with its sheath pulled back. Also visible is the 1x/10x slide switch.

 10Probes
Close-up of the probes (from some site). The colour coded rings are really useful.

At the back of the scope there are two metal tabs – “Ground” and “Cal”. The calibration tab gives a 2Vp-p square wave at 1kHz.

 11back12cal
The back of the probe on the right. The probe’s own calibration signal is on the right.

The body of the DSO is plastic, and build quality is fairly good.

As with almost all digital T&M equipment these days, the ‘2090 can be interfaced with custom software. As a bonus, sample C++, VB, and LabVIEW programs are included on the driver CD.

Below are a few screen shots of some measurements.

13noisePower supply noise when my CFL table lamp turns on

14PWM
A 50% 6.13kHz PWM from the Super Probe that I built some time back.

15motor
Brushed motor noise. The BEMF spikes when the brushes break contact are clearly visible. RPM of the motor is approximately 20000 RPM.

What the DSO2090 is NOT:

  • a Tek or an Agilent ‘scope
  • a full-fledged DSO with benchtop features
  • a standalone device
  • a super-accurate device that you can trust your life (or other’s lives) on

What the DSO2090 IS:

  • an awesome hobby ‘scope with lots of features
  • a very low price test and measurement device
  • very portable
  • a very cool device that will enhance your geek image

The final word? If you’re a poor student hobbyist like me, and have reached the stage where you ‘absolutely need’ a way of seeing what signals are zooming around in your circuit, then the DSO2090 is certainly for you. There are variants to the ‘2090:

  • the DSO2150 (150MSps/60MHz)
  • the DSO2250 (250MSps/100MHz)
  • the DSO5200 (200MSps/200MHz)
  • the DSO5200A (250MSps/200MHz)

I find that the ‘2090 is the best value for money, and it fulfils my need, at least for now :-D . A recommended buy for those looking to purchase a ‘scope.

Wednesday, November 26, 2008

Of Scopes and SMDs

I've always loved electronics for its 'minuteness'. I'm fascinated, even today, by how small consumer electronics can get. Have you ever opened up your cell phone or iPod and seen the myriad tiny chips and resistors and capacitors and whatnot? And do you realize that what you see is actually not small; it is HUGE when compared to what is on the inside of those silicon chips.

With Intel, using the 45nm process to manufacture its current processors, now talking about switching to the 30nm, and progressing to the 10nm fab, everything is set to get very, very small. The SMD resistors on your Nokia motherboard seem gargantuan in comparison.

Anyway, I absolutely needed to get myself a piece of this deliciously small pie. So in the past few months I've stared working with surface mount devices. Naturally, if I've reached the level where I'm working with SMDs, I would also have reached the level where I would need the services of an oscilloscope. Problem is, an oscilloscope, even a government-office-used, second-hand, two channel, 100MHz scope - the minimum demanded by any respectable hobbyist - costs about 10 grand. 10 grand is something I would like to have, but sadly, I don't. A new plain-jane CRO-oscope is about 25-30K, while (drool) Agilent DSOs start at a prohibitive 70K. Even cheapo entry-level USB oscilloscopes are a minimum of 10K, and to make matters worse, they aren't available in India.

So, like any other respectable hobbyist (all respectable hobbyists have what is called 'electronics-ego' - some may call it a touch of madness, others, an obsession, and yet others, an incurable disease; to hell with you, you vile naysayers! May you all burn!). Umm, yes, where was I? Aah, as I was saying, like any other respectable hobbyist, I decided to go the DIY way, and build my own scope.

The advantages of building your own scope - it's dirt cheap, and you learn a ton of other stuff (analog layout design, ADC nitty-gritties, USB firmware coding, and host data-handling to name just a few).

The scope would follow this kind of layout:

(Analog front end) --> (Data packaging for USB, on the PIC) --> (Host data display)


AFE:
(Buffer) --> (PGA) --> (Hardware AA) --> (High speed dual-channel parallel-out ADC from MAXIM/TI)

PIC:
(PIC 18F4550)
-> (8Mbit memory from Cypress, for deep capture)
-> (External trigger sources)
-> (USB2.0 Full speed @ approx 1.2MBytes/sec bulk transfer)

Host:

(LabVIEW software frontend)

Upto now I've built, and tested various parts of the AFE - I still need to throw everything together, and see if I actually get the desired results (this, without a doubt, is the biggest thorn in any engineer's side; everything works perfect in the lab, it works well as individual modules, and then, when you try to put stuff together, it all just falls apart. You start swearing and tearing your hair out in frustration; that's the reason why I'm.....uuh, forget it).

Last night (in Sid's words, and CCS-C) I was on cloud [unsigned int8 cloud 0b00001001]. I got USB bulk transfers to work with LabVIEW, albeit, in a crude way. Nevertheless, it worked, pleasing me tremendously. LabVIEW makes development super-easy. Easy, in a way that makes you feel dumb. Amit Sabne, who I've been brain-storming with, puts it very concisely - "Yaar, feel hi nahi aati!" - which is kind of true. The chaps at NI have done a great job of making hardware interfacing a snap. Wait for your USB device to enumerate, enter its VID and PID (device/manufacturer specific 'serial numbers'), throw a few icons and VIs here and there, and voila! You have délicieux transferts de USB bulke, served hot! (yes, translate.google.com is most helpful). The NI engineers have robbed hardware-software hackers from the trials and tribulations of mind-messing driver-writing, back-breakingly long hours of prouring over hardware, and sleepless red-eye-rubbing nights. Damn! Where's the joy and satisfaction if you can do something in 10 minutes, what used to otherwise take hours?

Now that I've got a rough and dirty implementation of PIC to USB transfers to work, what remains is putting it all together. Gimme a few days, and I'll upload the PIC firmware in CCS-C, and the LabVIEW VI here for you to use, enjoy, redistribute!

Visitors