Building a quadrature generator with a PIC10F222

I need to start my new project with my digital RTJ gage and in order to do so I need to use the quadrature decoder chip LS7166. I could use the actual encoder I’m going to use for the project but it is large and unwieldy so I decided to build a generator for it.

The concept is simple, have a knob that produces no waveform in the middle of it’s stroke and as the pot deviates from the center, the speed of the signal increases also changing direction based on which side the knob id turned to. I couldn’t use a PIC10F200 much to my chagrin because it doesn’t have an ADC module built in, the PIC10F222 does however. It still works within my concept of low-end mcu’s doing valuable jobs since they’re still only 55 cents in quantity, from digikey of all places.

Overall, it’s a pretty simple design.

  • GP3 -> unconnected
  • GP2 -> Channel B out (Digital output)
  • GP1 -> Channel A out (Digital output)
  • GP0 -> 10k Potentiometer in (Analog in)

Dead simple. I did program a bit of a dead spot in the middle so that one can stop the quadrature from advancing quite easily. I put 2 LEDs on it to indicate that it is in fact working. Anyways, here’s the source (again it’s in Oshonsoft BASIC)

10f222 quadrature src.zip

I didn’t bother drawing up a circuit diagram since it’s such an easy circuit but here’s an additional image if you’re really curious. keep in mind that the board I’m using is Stripboard (aka Veroboard) so the traces run along one direction

Now for the fun challenge of making a simple serial interface MCU to the LS7166.

Torque Coupling Update

This update is a little bigger than usual since I want keep the images and text as a sort of record of what I did for future reference. For the viscometer project, I’ve discovered that the motor is far too unreliable to produce reliable results despite algorithmic compensation. So now I’ve been charged with the task of creating a torque coupling that fits on to the rotating shaft. Now, there is no problem building the torque sensor, however, what is a problem is making it small and making it send the signal back to the device.
Also, instead of using an Analog Devices AD7705B 16 bit serial out ADC. Frankly, I’ve never used one but the greater resolution should enable more useful measurements.
Anyways, here’s a picture of the torque coupling before I ravaged it with hot glue.

Torque Coupling
Torque Coupling

It’s pretty fucking ugly but it’ll work for the time being. I did have the ribs that sit under the sensors quite a bit thicker, but there wasn’t enough strain to be useful for measurement, I had to hacksaw the chunks underneath right off.Unfortunately, I believe the polyurethane glue I used has caused strain on the sensor as it cured, I don’t know of it will go any further.

So, I’ve started on the circuit as of yesterday. I have it set up to take the PICKIT2 interface so that I can hot-program it and I setup the serial out board so that I can output debug data. This works thus far. Soon, I’ll be setting up the ADC and attempting to interface with it.

Starting on the ADC circuit
Starting on the ADC circuit

Here is an image dealing with the read/write cycle on the AD7705, also to note is that the AD7705 is MSB first.

The timing for read/write on the AD7705
The timing for read/write on the AD7705

Here’s the site they came from http://www.protongeeks.com/index.php?option=com_content&task=view&id=63&Itemid=27

Anyways, I’m glad to have my equipment back and ready for whatever crap I decide to build. Here’s a picture for posterity:

My bench as of Nov, 2008
My bench as of Nov, 2008

Anyways, I’ll attempt to update this as much as possible, for whoever is interested (or not).