Shop OBEX P1 Docs P2 Docs Learn Events
PWM Output from an ADC Input — Parallax Forums

PWM Output from an ADC Input

ArchiverArchiver Posts: 46,084
edited 2003-12-18 17:23 in General Discussion
Can anyone help me out. I am writing my first program. What I am
trying to achieve is to output a PWM signal to control a
proportional solenoid. I want to control it using a potentiometer. I
am passing the potentiometer through an ADC. How do I link the PWM
output to the ADC output so that if the potentiometer moves 50% the
outputted PWM will move the solenoid 50%. I would be most greatful
for any ideas.

hugh

Comments

  • ArchiverArchiver Posts: 46,084
    edited 2003-12-18 17:23
    Input ADC? What pin are you referring too? You can put a POT on any pin and
    use the Pot command....or RCtime... I guess if you wanted to get fancy you
    could hook up an ADC to the stamp...get that running then use that to control
    the PWM....

    Here's how I'd do it....
    Pick an output pin....then get PWM cycle going on that pin. Pbasic has a
    command for this....you could do the loops yourself...no need to reinvent the
    wheel.

    Take that pin's output and run that into a nice N Channel Logic level MOSFET.
    The MOSFET has three poles....one to ground...the other to your ground on your
    Proportional Solenoid and the last pole goes to the stamp. The MOSFET acts like
    a high current switch....it handles the load...the stamp just tells it when to
    come on and turn off.

    Does this make any sense?? Considering this is your first project I'll give you
    some hints. First off you need to read up on the commands. Get the PWM command
    running on a sample program. Make sure it's slow and easy to test...maybe hook
    up a DC motor to the MOSFET so you can get that all worked out fist. Then you
    can read up on the POT or RCTIME commands. Decide how you want to do that part
    of the program. Then get a simple program working with RCtime. The parallax
    website is full of great documentation and sample programs to get you running.

    If you think of big projects in terms of smaller tasks it makes a bit more
    sense. You don't build a house in one day.....you have to break it up into
    manageable chucks. And it electronics there is a learning curve with each step.
    Once you get all the smaller chucks running you can put the entire thing
    together and away you go.

    And not to knock the stamp....but you could actually do a pot on an 555 chip and
    do the same thing. Not as cool or fun...but it can do it too...

    Tim

    >>> hughgoodbody@y... 12/18/03 10:18AM >>>
    Can anyone help me out. I am writing my first program. What I am
    trying to achieve is to output a PWM signal to control a
    proportional solenoid. I want to control it using a potentiometer. I
    am passing the potentiometer through an ADC. How do I link the PWM
    output to the ADC output so that if the potentiometer moves 50% the
    outputted PWM will move the solenoid 50%. I would be most greatful
    for any ideas.

    hugh



    To UNSUBSCRIBE, just send mail to:
    basicstamps-unsubscribe@yahoogroups.com
    from the same email address that you subscribed. Text in the Subject and Body
    of the message will be ignored.


    Yahoo! Groups Links

    To visit your group on the web, go to:
    http://groups.yahoo.com/group/basicstamps/

    To unsubscribe from this group, send an email to:
    basicstamps-unsubscribe@yahoogroups.com

    Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
Sign In or Register to comment.