Wozzy
Well-known member
A friend asked for my help to create an emulator for an old shaft encoder.
Of course I answered "No problem... A Teensy 3.0 can do that."
But now I'm struggling with the best way to go about it.
While I was finally able to understand the PIC product spec sheets, the Freescale documentation still spins my head around.
The encoder is mounted on a shaft that varies in RPM from 10 to 3000 RPM.
It has 4 outputs which vary in frequency proportional to the shaft RPM.
1) 60/Rev - a 50% square wave with 60 cycles per revolution.
2) 1/Rev - 1 single pulse the same width as 60/rev, and aligned to one of the 60/Rev Cycles.
3) Flip Flop - a square wave that toggles each revolution aligned with the rising edge of the 1/Rev
4) Ramp - and analog sawtooth wave from -10V to +10V that resets on the rising edge of the 1/Rev
See the attached image
He really didn't need the the ramp, but I took the challenge to try and include it... But I'll probably end up using an external function generator chip.
So I've set up an input encoder knob as the RPM adjust, and tried Interval Timer, and assorted PWM functions, but each runs into limitations with range, or resolution.
I looking into using one output to drive a base frequency, then reading it back into other pins as timer/counters, then triggering yet other pins set as outputs.
I'm also considering that I may need to use multiple Teensy 3.0s, or a possibly a different model.
I was hoping you guys could steer me in the right direction so I can save face with my friend.
I promise to share whatever I learn.
Thanks
Of course I answered "No problem... A Teensy 3.0 can do that."
But now I'm struggling with the best way to go about it.
While I was finally able to understand the PIC product spec sheets, the Freescale documentation still spins my head around.
The encoder is mounted on a shaft that varies in RPM from 10 to 3000 RPM.
It has 4 outputs which vary in frequency proportional to the shaft RPM.
1) 60/Rev - a 50% square wave with 60 cycles per revolution.
2) 1/Rev - 1 single pulse the same width as 60/rev, and aligned to one of the 60/Rev Cycles.
3) Flip Flop - a square wave that toggles each revolution aligned with the rising edge of the 1/Rev
4) Ramp - and analog sawtooth wave from -10V to +10V that resets on the rising edge of the 1/Rev
See the attached image
He really didn't need the the ramp, but I took the challenge to try and include it... But I'll probably end up using an external function generator chip.
So I've set up an input encoder knob as the RPM adjust, and tried Interval Timer, and assorted PWM functions, but each runs into limitations with range, or resolution.
I looking into using one output to drive a base frequency, then reading it back into other pins as timer/counters, then triggering yet other pins set as outputs.
I'm also considering that I may need to use multiple Teensy 3.0s, or a possibly a different model.
I was hoping you guys could steer me in the right direction so I can save face with my friend.
I promise to share whatever I learn.
Thanks
Last edited: