Shop OBEX P1 Docs P2 Docs Learn Events
ir problem — Parallax Forums

ir problem

I am volunteering teaching a summer science robotics class and I have a girl that will be a high school senior this fall and is interested in being an engineer. We are using the Boe-Bot Basic Stamp BS2 and we are having trouble with the programing. She wants to rotate a servo to a given point about a 360 degree axis using IR sensors. She has currently wired six IR circuits (as shown in the Robotics text that Andy wrote) that are 60 degrees apart. Attached is her program which will increment the servo from whatever current position it is at. However, she wants to be able to wave her hand in front of any one of the six IR sensors and have the servo rotate directly to that position. We were thinking that a Look Up command might work but got confused and are not sure if that would be the correct approach. We started to put the Look Up command at the top of the attached program but went no further. We are using a continuous servo. Not sure if that will work and how we would index it to a given start/reference point. We would appreciate any help.

Comments

  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    Since a continuous rotation servo has no positional feedback you cannot command it to go to a specific position without external feedback. I will leave it to our forum members to offer some suggestions as to how you might best accomplish this, but some sort of encoder or limit switch would be needed if you wish to use a CR servo.
  • ercoerco Posts: 20,257
    Easy peezy. But standard servos only rotate 180 degrees, so to get 360 you can either gear up a standard servo 2:1, or you can buy a pricier 720 sail winch servo.
  • You could use some chains and gears to get the standard servo to rotate your axle the full 360 degrees. That is probably the cheapest and easiest route. This is my choice for purchasing them https://servocity.com/motion-components/rotary-motion/sprockets-chain . If you are using Parallax Servos they have the same shafts as a Futaba.
  • Another option might be to use a ping or other ultrasonic sensor. This can give you a more precise distance than IR. You could then use this to stop when the ping detects an object closer than its reference measurements. Just a thought.
  • ercoerco Posts: 20,257
    Since most servos can be made to rotate 180 degrees, a quick & dirty solution is to stack 2 servos on top of each other. Servo A rotates Servo B, which then achieves 360 degrees. The servos can be wired in parallel.

    Not elegant, but it works. I saw that somewhere, just can't recall where.
Sign In or Register to comment.