Shop OBEX P1 Docs P2 Docs Learn Events
Measure Pulse or Voltage ..which is best — Parallax Forums

Measure Pulse or Voltage ..which is best

bennettdanbennettdan Posts: 614
edited 2009-06-05 16:20 in General Discussion
Hello,
·· I have a machine that drives a solenoid with a mosfet. I want to read the pulse with a SX48 and know what % Duty cycle the solenoid is. I know the voltage going to the solenoid is around 14 VDC would it be easier to read the voltage with a D/A converter or can I read the Pulse with say the PulseIn command somehow. Any ideas on how to start would be great. I was thinking I would have to know the pulse 0-1-0 and the 1-0-1 pulse widths and then add them together to get the % of the PWM going to the solenoid or am I on the wrong track?
Thanks

Comments

  • Clock LoopClock Loop Posts: 2,069
    edited 2009-06-05 08:44
    whats driving the gate of the mosfet and whats the peak voltage on that gate?

    You might be able to use the gate signal to interface with your sx, then you don't need to worry about 14volt conversion to 5.

    Chances are the gate of the mosfet is being driven with regular 5v logic, if so, your in luck.


    And you can use the pulse in command, depending on what the duration of your pulses are. Pulse in will timeout after only a few seconds i think because the sx has a limited amount of counter space.

    If your solenoid timing is long for both on and off, you can use other sx commands to do that timing.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Meh. Nothing here, move along.

    Post Edited (BPM) : 6/5/2009 8:52:31 AM GMT
  • BeanBean Posts: 8,129
    edited 2009-06-05 11:52
    Use two resistors to get the 14V down to 5V.

    Use can use two seperate PULSIN commands to read the HIGH time and the LOW time.

    Or if the frequency off-time is constant, you could just use COUNT.

    Bean.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    There is a fine line between arrogance and confidence. Make sure you don't cross it...



    Post Edited (Bean (Hitt Consulting)) : 6/5/2009 2:59:12 PM GMT
  • bennettdanbennettdan Posts: 614
    edited 2009-06-05 12:52
    That is what I had in mind Bean..using a pot as a voltage divider then reading the pulse. How would·Count be used to get the % of the Pulse Width?··

    BRM it looks like about 12v on the gate of the mosfet using my scope. but its not easy to hook·a wire to as the output of the mosfet.
  • BeanBean Posts: 8,129
    edited 2009-06-05 14:58
    Oops. Yeah you're right if the frequency is constant, COUNT will return the same value all the time.

    I meant to say, if the frequency is constant you only need to measure one level of the pulse.

    Bean.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    There is a fine line between arrogance and confidence. Make sure you don't cross it...

    ·
  • bennettdanbennettdan Posts: 614
    edited 2009-06-05 16:20
    · I will work up something this weekend I plan to have it report back to a VB.Net program to show the % Duty cycle I will post the code soon. Thanks again.
Sign In or Register to comment.