John, may I ask what you're working on, Sir? I apologize if you mentioned it in another thread that I may have missed.
No apologies needed. Simply put, I get a thrill out of trying to write code to make a dumb device do what I want it to do. The project I am working on, which was started several years ago, is just a means to that end. I wanted to make a remote level that will allow me to level pallet forks attached to my tractor's loader when I cannot see them. First attempt used a thermal accelerometer (Memsic). You may recall those early attempts and the help you gave me for controlling a GLCD display. The display and sensor were wirelessly connected with XBee. It all works well, and I am still amazed by the sensitivity of that technology to tilt. Unfortunately, the bounce/vibration of the tractor gave way too much variation in the readings, even when sitting still. Ian Rogers used a different accelerometer with cranes, so maybe my experience had more to do with choice of device rather than the approach. Also, the GLCD was quite hard to see under various light conditions outside.
Nevertheless, I decided that since the lift mechanism is basically a parallelogram, I could measure a couple of angles and get to the same end result. Looked at a few angle encoder technologies (e.g., optical, capacitative, magnetic) and settled on using a magnetic encoder. Tried an Avago chip, but found the AMS AS5048 easier to use. Amazingly, it offers 14-bit resolution and is quite inexpensive (**broken link removed** ). I am using the SPI interface with the sensor to a 16F1519, which will be my sending unit. Will probably use a different chip in the end, as I won't need all the pins and capabilities of that chip.
Here is a link to the prototype sensor that will attach to each of two pivots on the tractor.
The display part of the project is what I am currently working on. I anticipate serial communication via a EUSART or similar between the display and sensor. That part is done. As for the display, I wanted something like a gauge with a needle. Air-core gauges, stepper gauges, model servos have been considered. A model servo, say a digital one with 2uS dead band, is my plan B. I am quite familiar with using such servos. Right now, though, I am working on using a stepper motor that actually is used in instrument clusters of many GM cars. Post #37
here has a demo program I got working. The current program that prompted this thread simply takes the serial data from the 16F1519/AS5048, clips it to 10 or 11 bits, and drives that gauge proportionately.
Best regards, John