Shop OBEX P1 Docs P2 Docs Learn Events
Using PULSOUT & PAUSE 1 for Motor Control — Parallax Forums

Using PULSOUT & PAUSE 1 for Motor Control

the_professorthe_professor Posts: 7
edited 2009-07-22 21:38 in BASIC Stamp
So I recently found out about pairing PULSOUT and PAUSE to get more precise control of the motors on my Scribbler. First PULSOUT determines the speed,·PAUSE 1 tells the motor that the next·PULSOUT·indicates time duration.·Here's my question: I found the following code as an example from Parallax:
‘ Drive in an arc to the right for 3 seconds
PULSOUT MotorRight, 2400
PAUSE 1
PULSOUT MotorRight, 2200
PULSOUT MotorLeft, 2600
PAUSE 1
PULSOUT MotorLeft, 2200
Only thing I'm not clear on is how/why a duration of 2200·ms corresponds to a drive time of ~ 3 seconds (I tested this and it is about 3 seconds). I understand there's probably some lag time between the first PULSOUT·command and the second, but considering that all the of the·right motor commands go before the left, it can't be that significant (at least·not about 800 ms worth).·Thoughts?

Comments

  • JDJD Posts: 570
    edited 2009-07-21 22:40
    The Professor,

    What type of controller are you using with this? For example, BS2, BS2pe, BS2sx?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Respectfully,


    Joshua Donelson
    www.parallax.com
  • the_professorthe_professor Posts: 7
    edited 2009-07-21 23:02
    It's a Scribbler, so BS2.
  • JDJD Posts: 570
    edited 2009-07-21 23:23
    The Professor,
    ·
    My apologies, I didn’t catch that the first time I read it. The Scribbler uses an H-Bridge to controller the motors; which normally you would see a value of 1 - 2 ms for the pulse. There is a small amount of tolerance outside the 1 – 2 ms pulse, but I don’t see how the second PULSOUT is controlling the pulse duration.
    ·
    The PULSOUT command is formatted like the following:
    Command, Pin#, Duration

    With that, you can determine that the PULSOUT command is given, it waits 1ms, and then sends a slightly different pulse as though it were ramping or something like that.
    ·
    Can you upload the whole code with the attachment manager? Perhaps the program around that routine will help explain more about the program.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Respectfully,


    Joshua Donelson
    www.parallax.com
  • the_professorthe_professor Posts: 7
    edited 2009-07-21 23:36
    The example I showed above was from this Parallax PDF on the Scribbler downloads page:

    http://www.parallax.com/Portals/0/Downloads/docs/prod/robo/scribbler/HackersHintsWithCode-v1.zip

    The included PDF lists this functionality on pages 5-6.·I attached my own .bs2 file that does this. Could the PDF that's included there be erroneous (IE whoever was writing just wasn't thinking at the time?)

    Thanks in advance for your help!
  • JDJD Posts: 570
    edited 2009-07-21 23:55
    The Professor,

    That is the additional way to program the scribbler; let me speak with the instructor which wrote that application note and I will get back with on that. I have not personally programmed the Scribbler in that manor.

    Thanks for your patience,

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Respectfully,


    Joshua Donelson
    www.parallax.com
  • JDJD Posts: 570
    edited 2009-07-22 15:49
    The Professor,

    I have contacted our editors, and it turns out the material in question was made by an engineer of the manufacturer. Unfortunately that person is no longer with Element (the manufacturer of the Scribbler). The Scribbler has a co-processor that ultimately allows for that alternative programming, but there is not a great deal of supporting documentation other than what you have already·found.·I have sent off for any materials that might help, and I will be sure to post them as I get them.

    Sorry for any inconvenience,

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Respectfully,


    Joshua Donelson
    www.parallax.com
  • the_professorthe_professor Posts: 7
    edited 2009-07-22 16:15
    Ah ok, that particular use of PULSOUT isn't standard BS2 functionality then. That's ultimately what I wanted to get answered, since the students I'm teaching may advance to using Boe-Bots in the future. Thanks for the prompt reply.
  • JDJD Posts: 570
    edited 2009-07-22 16:27
    That is correct, the use of PULSOUT is covered in the Boe-Bot to control servos; which you will see a pulse from 1 to 2 ms. Glad this was helpful.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Respectfully,


    Joshua Donelson
    www.parallax.com
  • ercoerco Posts: 20,256
    edited 2009-07-22 16:53
    Interesting development on a co-processor in the Scribbler. Joshua, I'm a Scribbler fan and I would definitely be interested to learn more about this alternate programming technique from the missing Element engineer. (Did he also take the 100 MPG carburetor when he left?)

    Please update this thread with any details·when·you get them.·Whit and I will be checking back!

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ·"If you build it, they will come."
  • JDJD Posts: 570
    edited 2009-07-22 17:21
    Erco,

    There is a missing carburetor, but it is inconclusive as to its where abouts. lol.gif

    I will be sure to update this thread with any docs that I get that will help this subject.

    Thank you all for your patience.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Respectfully,


    Joshua Donelson
    www.parallax.com
  • JDJD Posts: 570
    edited 2009-07-22 17:41
    Here is the word gents,

    The first pulsout sets the motor speed and direction.· If the second pulsout is sent, it sets a motor run time.· The second pulsout is optional, if it isn't sent then the motor just run forever.· This lets the user program more precise movements but still do other things with the stamp like watch the sensor while the robot is running. See page 5 of the hacker hints for more info

    Here is the PDF that is referenced; however this is the same PDF that is in the zip file above. Please let me know if you have questions.


    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Respectfully,


    Joshua Donelson
    www.parallax.com
  • ercoerco Posts: 20,256
    edited 2009-07-22 17:47
    My 1967 Corvair has 4 carbs, so I would hardly miss one. But sadly,·missing iPhone prototypes are a different story: http://www.iphonefreak.com/2009/07/foxconn-employee-commits-suicide-after-iphone-prototype-goes-missing.html

    As the_professor·stated, the PDF "Hacker's Hints for the Scribbler Robot" has·some minimal·info on this "special function" as it is called. The second pulsout (after the 1 ms pause) uses duration values of 1000 to 3000, where 1000=zero seconds and 3000=five seconds. Proportional values give proportional durations: 1400=1 second, and·per the_professor's findings, 2000=~3 seconds.·Maybe closer to 2.5 seconds if·it's linearly proportional.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ·"If you build it, they will come."
  • the_professorthe_professor Posts: 7
    edited 2009-07-22 17:58
    I'm discovering that the Scribbler is annoyingly imprecise so I'm gonna try playing with this a little more to see if I can get some correlations.
  • JDJD Posts: 570
    edited 2009-07-22 18:01
    It is amazing how different cultures react to situations; trajic in this case.

    The gents over at Element said that was all the docs they had for this alternative to programming the scribbler, so I dont see an addition to the doc anytime in the near future.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Respectfully,


    Joshua Donelson
    www.parallax.com
  • ercoerco Posts: 20,256
    edited 2009-07-22 21:38
    professor: Yes, the Scribbler has some weaknesses· (such as the imprecision you mention) and some strengths, too. IMHO it has a lot of capability for a $99 robot, education being one of its strengths. If it's precision you're after, you may have to modify the robot for your needs. Whit and I added wheel encoders for better navigation in the rambling thread at http://forums.parallax.com/showthread.php?p=772850·, vid at http://www.youtube.com/watch?v=5r2En4hLUBI·. Prior to this, I wrote a ROBOT mag piece on beacon navigation and auto-recharging. Article online at··http://www.botmag.com/articles/scribbler.shtml·, vid at http://www.youtube.com/watch?v=S-nv303EMAE&NR=1·. Hopefully more to come, but with our twins due in September, it may be a while before my Scribbler becomes fully·self-aware. Let us know how your experiments go!

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ·"If you build it, they will come."
Sign In or Register to comment.