Shop OBEX P1 Docs P2 Docs Learn Events
poetimiter with boe bot board to contorl servo — Parallax Forums

poetimiter with boe bot board to contorl servo

What I am trying to do but my knowledge is very limited as far as wiring sensors with resistors go, but what I want to do is to create a program with a bs2 which allows me to move a poetimiter say like on a suite of poetimeters which allows me to move a small robot arm according on how I move. I know this might be possible so any help would be welcome smile.gif Even if i can get help to move one servo that would be very cool smile.gif

Thanks

Andy

Comments

  • D FaustD Faust Posts: 608
    edited 2007-10-12 18:45
    Look at the photoresistor RCTIME circuit. Replace the photoresistor with a potentiometer. You now have an input. Next, make a formula that will calculate the servo position based on the potentiometer postion.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    LOOKDOWN ThisThread, [noparse][[/noparse]Your_?, My_?, Cool_Thing], looknum
    LOOKUP looknum, [noparse][[/noparse]1, 2, 3], subnum
    ON subnum GOTO Hope_this_helps, Thanks!, WOW!!
    END 
    
  • edited 2007-10-17 03:10
    Thank you for setting me in the right direction. I am a little shakey when it comes to programing math so i wonder if you could give me a general like format to follow. This would be greatly appreciated. It doesnt have to be flawless just something i can work with. Thanks again [noparse]:)[/noparse]
  • Mike GreenMike Green Posts: 23,101
    edited 2007-10-17 03:50
    So much depends on the values you choose. The simple solution is to pick resistor and capacitor values to produce an RCTIME value ranging from 500 to 1000 (or close to it if practical). If the actual range of values (X) is too low, add enough to bring the bottom up to 500 (X + adjustment). Obviously, if the range is too high, subtract enough to bring the high end down to 1000. If the range is too wide, divide by something that will make the range smaller (X / factor + adjustment). If the range is too small, multiply by something that will make the range larger (X * factor + adjustment). Sometimes you may need to multiply by some factor, then also divide, like if the factor is 2/3 or 5/3. The result of this is the value you use for the PULSOUT statement which will give you a pulse between 1ms and 2ms in width. Repeat the whole process (RCTIME, compute value, PULSOUT) at least every 20ms and you will be set.
  • Steph LindsaySteph Lindsay Posts: 767
    edited 2007-10-17 15:52
    Chapter 5, Activity 4 of "What's a Microcontroller?" is "Controlling a Servo with a Potentiometer."· You can dowload the book from the bottom of this page:

    http://www.parallax.com/detail.asp?product_id=28152

    -Stephanie Lindsay
    Editor, Parallax Inc.
  • edited 2007-10-18 03:16
    Thanks [noparse]:)[/noparse]
  • edited 2007-10-26 20:25
    I have come up to a huge problem. I do get variables but it is either 1234 or 1456 their is no number in between as I move it using the dial. I was wondering if their was a specific section of code to hanldle this?
  • D FaustD Faust Posts: 608
    edited 2007-10-26 21:58
    You should get values that change like an analog voltage not simply one or the other. Try letting the pot sit for a few seconds in the middle of the range, and watch the numbers. Do you have a mulltimeter? If so, you should wire the pot up separate and test the output of it to see how the output changes

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    --DFaust
Sign In or Register to comment.