View Full Version : Electrical Degrees ?

04-09-2007, 08:56 AM
What does "Electrical Degrees" refer to in the Two Channel Wave Form diagram below ?


Oak Grigsby· custom model # 96Q100-50-00345

Two chanel quadrature output

Input voltage is 5V +/- .25V

TTL· output circuitry with onboard Schmitt triggers for a sharp square wave output

1 inch square

Bearings on shafts (not sleaves)

Bracket and gear can be removed for your own application

Pivot tension load springs included (see photos)

Ribbon cable is 5 inches long

100·pulses per revolution (ppr)

Max speed is 3000 rpm

The OakGrigsby 900 Series is well suited for industrial motion and position sensing, their low profile and high resolution also make them ideal for panel mounted applications. A two-channel quadrature code allows the encoder to detect the direction and magnitude of the input motion applied to its shaft.· The device produces 512 changes of state per revolution with full quadrature decoding. Output is completely compatible with TTL circuitry, permitting direct entry of digital data without the cost of A/D conversion.


Post Edited (curious1) : 4/9/2007 6:15:44 AM GMT

T Chap
04-09-2007, 10:07 AM
What do you intend to read them with to track the pulses?

04-09-2007, 10:12 AM
Oh, I forgot to mention. BS2 if possible. Not necessarily for a full PID loop but at least for a simple closed loop that corrects itself for step/position.
Just basics, I'm new.
Thanks T,
·· Is the BS2 capable ?·······If not, which stamp is ?

Post Edited (curious1) : 4/9/2007 3:19:05 AM GMT

T Chap
04-09-2007, 10:22 AM
A few thoughts, first, that is a geared encoder. So, do you have a motor with the same tooth pitch?

Second, I don't underdtand how to count an encoder on a BS2 and drive the pulse train at the same time, AND make error correction and adjustment at the same time :) Maybe you have a solution that isn't obvious to me.

What is the stepper? A .25" dual shaft will allow a shaft mounted encoder to attach to the motor. Visit USdigital.com and look at their encoders, which may happen to be some of the most popular. They have a chip at the site that will decode the quadrature A/B into a pulse and direction output. This IC would make counting much more simplified for a Stamp. Maybe wasted info, but the Propeller already reads 16 quad encoders and can manage all of the needs without any stress.

Overall, I think you are really on the fast track to getting a good understanding of motors and driver processes. It all boils down to what you really want to accomplish.

There are a number of ways to do a job, I know you want to learn but sometimes a target application can help someone make real world suggestions.

I don't see the Stamp counting encoder pulses at any real speeds, error checking, and driving step and direction at the same time. Maybe the Stamp could manage external hardware(counters) by some means, but your request is a minimum of 3 full time jobs anyway you look at.

The problem is, the Stamp can only perform one command at a time. I think there are psuedo interrupts on some or all models, but still, how can the code do 3 things at once? I really advise you to get a Propeller demo product for where you are headed.

www.usdigital.com/data-sheets/ls7183%20ls7184%20Data%20Sheet.pdf (http://www.usdigital.com/data-sheets/ls7183%20ls7184%20Data%20Sheet.pdf)

You don't need real PID calculation for what you want to do I think, you can just count the step outputs, count the encoder and compare on every output, if the encoder count does not equal the step output, you stop the output, and have the motor attemp to move the amount of the error(counter - encoder = error). If the error will not correct, then you have decision based on the assumption the path is obstructed. If the error will correct, then resume the move.

Post Edited (TChapman) : 4/9/2007 4:29:50 AM GMT

04-09-2007, 10:39 AM
Most of that I understand and I appreciate the input. Matching the encoder, pulse to pulse with the motor is easily done mechanically, thats no problem. The gear can come off. (thats my real dept,)

Another thing I'd like to set-up is one of these encoders panel mounted with a knob so that when it is rotated cw or ccw the motor would run in the desired direction the same ammount of pulses as the encoder. Speed would not be an issue.
It would be like a pot but would have a detent at convient intervals for the mechanism that it's moving, say 20 per rev.
That shouldn't be too difficult with the BS2 would it ?
Thanks for taking the time...

T Chap
04-09-2007, 10:43 AM
You could get whats called a rotary encoder, similar to a a pot but it outputs quadrature. You could use the same IC linked above to read it and transfer the count to the Stamp. The stamp simply reads the count, and outputs the error to the stepper in the form of steps = error + direction. Hooking up a knob to the encoder sounds a bit bulky compared to the rotaries that already serve that purpose.

www.usdigital.com/products/s4/ (http://www.usdigital.com/products/s4/)

An SX can be easily programmed to count the quad or pulse inputs, you could let in handle alll those needs, then communicate with it serially from the Stamp to obtain the count info as needed. Maybe there is an I2C counter somewhere. You still need more horsepower to count the pulses and direction from the encoder, while driving the pulse train at the same time.

Post Edited (TChapman) : 4/9/2007 3:52:54 AM GMT

04-09-2007, 11:03 AM
Excellent, the s4 still needs a knob on it. $41 isn't too bad either. I may try the 7183/4 interface with the $5 encoder I have first.

Your first post edit explains EXACTLY what I want to do with the LOOP. I would just add an alarm output and shutdown if the correction didn't occur in a set time.
Thanks for the help,
I'll be back..... and I'm bringing more ? ? ? ? with me.

T Chap
04-09-2007, 01:31 PM
A quadrature output is two signals that are shifted out of phase as you can tell in the drawing. That way, by considering the logic of which one is on and which is off, you can determine the direction of the motion, if you look at the chart for a minute and consider moving backwards and forwards, you see the correlation. So there are really 4 logic states per cycle if you study the diagram. The system allows both a count to take place, and the direction to be determined.

Post Edited (TChapman) : 4/9/2007 6:41:49 AM GMT

04-09-2007, 01:46 PM
I understand that, but it looks like the 360 Electrical Degrees is referring to 1 complete 4 pulse cycle, of which there would be 128 in 1 rev. of the shaft to total 512 ppr ?
I'm guessing,
Thanks T,

T Chap
04-09-2007, 01:51 PM
You would have 4x the ppr, nevermind the division of 360, just consider there will be 4x counts in quadrature. If you output one step on a 200 step motor, you have 4 counts on the quadrature(800 per rev), any comparison would require the quadrature counts to be divided by 4 to get the math right.

Post Edited (TChapman) : 4/9/2007 7:42:26 AM GMT

04-09-2007, 07:16 PM
US Digital has a wealth of info and FAQ listings.
Thanks for the help and direction TChapman !

Bill Chennault
04-09-2007, 08:40 PM
TChapman and curious1 (http://forums.parallax.com/member.php?u=48814)--

This is a fascinating thread. curious1 is trying to do almost precisely what I am trying to get the BS2 to do and probably with about as much success. I am trying to make Melexis 90217 Hall Effect devices act like simple counters. Maybe that is possible. What became obvious to me over the weekend is that the BS2 might count 90217 transitions just fine, but it won't be doing anything else in the meantime. Of course, I am not adverse to learning a little BS2 (or whatever Stamp) serial TTL networking to share the load.

But, maybe the Hall Effect device is the wrong device for the application (counting fractional wheel revolutions) in the first place? Gee. It would be nice to just be able to LOOK at a device using a pin (or pins) and determine wheel or actuator position. In my layman's mind, that might be possible with the Miniature Optical Shaft Encoder (http://www.usdigital.com/products/s4/) offered by Digikey.

Tell me what you think.


You are what you write.

04-09-2007, 11:15 PM
Hey Bill,
What is Melexis 90217 ?

Bill Chennault
04-10-2007, 12:52 AM

You can take a look at the general description of the·Melexis 90217 Hall Effect (http://www.parallax.com/detail.asp?product_id=605-00005)sensor on the Parallax web site. (Just click on the blue link you see in the previous sentence.) Note that the general information found at that link also has links to the Melexis 90217 datasheets.

I have several of them along with the magnets Parallax sells . . . man! are they powerful! The Melexis 90217 detects a passing magnetic field. I glued 8 magnets on a 3" diameter circle on a wheel and had no problem detecting them . . . other than what I actually want is an indication of every time a magnet passes the 90217 rather than what I am getting using PBASIC's COUNT command.

The 90217 is very easy to use. Perhaps I can make it work for my needs. It is very inexpensive . . . maybe you will play with it!


You are what you write.

04-10-2007, 03:15 AM
That is a neat little sensor.
On the mill, the magnet is mounted to the spindle. Looks like the data sheet shows the magnet stationary on the back of the sensor for sensing gear teeth or cam lobes...... is that correct ?
Is the magnet listed by Parallax best for both applications or just for the spindle ?
Have you ever set yours up to sense teeth ?
I'm getting one.
Thanks Bill,

The sample code counts pulses for 1 sec. then * 60 for rpm. ???

Bill Chennault
04-10-2007, 05:57 AM

Yes, I have one of my Melexis 90217 Hall Effect sensors on a BOE/BS2 combination. It·appears to do·everything they say it will, but its potential is severly limited by my PBASIC ability.

I have 8 (of the Parallax magnets) glued to a 3" diameter wheel. If I hold the wheel about 1/4" from the sensor, it finds them just fine. Currently, I have the "output" simply routed to a debug window. My PBASIC is too poor to do what I want; count magnets. I simply want to count, say, 16 passes of a magnet--which would represent two revolutions of my wheel--and then stop the motor or do something else with it.

The COUNT command in PBASIC appears to definitely not be suited for this purpose, although I admit to a lot of ignorance. The samle code from Solutions-Cubed, the manufacturer's of the MMBe (Motor Mind B enhanced) that I am using to control the motor, has sample code using the MMBe's own count command. I cannot make it work like I think it should, either.

However, I am·WAY far from giving up on the 90217! I am beginning to use PBASIC's PULSIN command, suggested by PJ (I believe) with interesting results. It seems to have a much faster response time, if nothing else.

I have found no difference in response whether the north or south pole faces the back of the sensor. I admit, that could be my problem, too!

In answer to one of your questions: The magnet must move past the sensor in order for a reading to occur.

EDIT! It DOES make a difference which pole faces the back of the Melexis 90217! The south pole is the one that must face the 90217!!! More results later!


You are what you write.

Post Edited (Bill Chennault) : 4/10/2007 12:44:33 PM GMT

Bill Chennault
04-10-2007, 07:48 PM

Now that I have re-glued the magnets to the wheel with the south poles facing towards the back (non-lettered) side of the Melexis 90217 Hall Effect sensor, everything seems to be working as it should. I am still have a little bit of an issue with the Solutions-Cubed code, but I am rather sure that is my problem. (I need to mount the BOE and the motor solidly instead of holding the motor so that the magnets pass the sensor on the BOE.)

I would love to play with the optical rotary encoder with the hollow shaft . . . but for about $250 bucks, I think I might pass. However, I might take a look at the solid shaft versions. Hey! I know! YOU buy one and tell ME what they are like! :)


You are what you write.