Shop OBEX P1 Docs P2 Docs Learn Events
Interpolation — Parallax Forums

Interpolation

LandryLandry Posts: 17
edited 2008-04-10 12:27 in Propeller 1
is there any object that I can use for transforming an incoming sine/cosine to a pulse using the propeller chip?

Post Edited (Landry) : 3/26/2008 1:56:47 PM GMT

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2008-03-26 13:25
    Can you give more details? How fast? What kind of pulse? What voltages are you talking about?
  • LandryLandry Posts: 17
    edited 2008-03-26 14:01
    I want to know the position of a motor with a sine/cosine encoder. I already have the ADC converting the signal to digital and from the digital part I want to interpolate it to quadrature signal (square pulses).the signal has a pp voltage of 1V with an offset of 2.5V. The speed is in the order of 1sine/2milliseconds.

    Hope this help further.
  • Paul BakerPaul Baker Posts: 6,351
    edited 2008-03-26 18:24
    If I understand correctly you are looking for a zero cross detector. This can be easily acomplished using a voltage comparator and a voltage reference of 2.5, whenever the voltage > 2.5V the output will be high and when it is < 2.5V the output is low.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Paul Baker
    Propeller Applications Engineer

    Parallax, Inc.
  • LandryLandry Posts: 17
    edited 2008-03-27 08:39
    No i'm not looking for a zero cross detector.

    My project consist of a motor surrounded by magnetic sensors. The sensor send an analog signal to an ADC that convert it to digital. then I get the digital numbers and from there I want to create a pulse stream that can be viewed on a scope. Basically, I want to build an interpolator.

    My idea here is to have a lookup table assuming that I have the perfect sine/cosine at a constant speed and from the incoming values from the ADC, I can then approximate the distance traveled by the motor at any moment and create the corresponding pulse.

    I don't know if I'm right in this approach or there is different one.

    Maybe this en.wikipedia.org/wiki/Pulse-code_modulation can give you an idea of what I want to do

    Post Edited (Landry) : 3/27/2008 8:50:09 AM GMT
  • VIRANDVIRAND Posts: 656
    edited 2008-03-28 22:17
    You are measuring the motor's current rotary position angle as sine and cosine and
    you want to decode that to an angle, then generate a pulse whose size is equal to that angle?

    Sounds like the hard way to do something. Minding the polarities to determine the quadrant,
    I think you can get the angle using the arctangent of (the sine divided by the cosine), which
    you would have to make a table of, although there may be other ways to do it.

    An easy way of determining the rotation angle of the motor would be to use a potentiometer
    that can continuously rotate. One of those could even control a LM555 timer chip to generate the pulses.
  • Bill SturmBill Sturm Posts: 11
    edited 2008-03-29 03:48
    I know exactly what you are looking for and I have not seen one here (haven't looked too hard either). It sounds like you will need to write one. Maybe the ADC and quadrature encoder objects would be a good start?
  • stevenmess2004stevenmess2004 Posts: 1,102
    edited 2008-03-29 04:02
    Bill, I think that he doesn't need the ADC as he said he already has the number in a digital format. I think what he wants is something that will measure the amount the motor has turned which is an integrator. Than he wants to output it as a PCM signal so that he can view in on a cro. Is this right Landry?

    If it is than you can use the trig tables in the propeller ROM for the conversion and simply add the change in angle to a running total of the angle and than use something like one of the servo objects to output pulses for you.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2008-03-29 06:52
    No, he's trying to convert an absolute encoder (an analog resolver, to be more exact) into an incremental encoder with quadrature outputs. There actually are boards available that do just that. The Propeller could do it easily, depending on the speed and resolution, but I haven't seen any objects written for this function.

    -Phil
  • LandryLandry Posts: 17
    edited 2008-04-10 12:27
    Hi everybody,

    Thanks for all your answer and sorry for the late reply.

    From the reply, I see part of what I want to do in each of them.
    A while ago, I posted a code where I was using the 'Quadrature encoder' object to find the position of a motor. This is based on the number of pulses that are counted from the encoder. What I want to do now is build a device (encoder) that will take the digital signal from the AD and then make the pulses in such a way that I can see them as squared line on the scope and use the 'Quadrature Encoder' object on it.

    Before the system on which I'm gonna work is ready, I'm testing this functionality on different ADC, the AD7706. I read the output of the chip, but just do'n't know where to start for converting the numbers to the nice pulses.

    Regards,
    Landry
Sign In or Register to comment.