a lot of questions
johnproko
Posts: 121
hello all, again. i have two simple questions still i cant manage to solve them.
first question is about servos. can i, using bs2, take from a servo a signal? what im trying to say is: using pulsout i can move a servo. can i use pulsin or some else command in order to get a signal from the servo and understand its position?
second i have a force button and some tact switches. for the force button i cant find how to program it. i have seen some examples in the forum but the dont work. probably it is the connectivity wrong. as for the tact switches i have the same problem. wiring one leg to pin, one to power and one to ground, does it need a resistor? i cant figure it out!
thank you all in advance :-)
first question is about servos. can i, using bs2, take from a servo a signal? what im trying to say is: using pulsout i can move a servo. can i use pulsin or some else command in order to get a signal from the servo and understand its position?
second i have a force button and some tact switches. for the force button i cant find how to program it. i have seen some examples in the forum but the dont work. probably it is the connectivity wrong. as for the tact switches i have the same problem. wiring one leg to pin, one to power and one to ground, does it need a resistor? i cant figure it out!
thank you all in advance :-)
Comments
R/C servos are not very precise but you can get close to the position you want if you vary the pulse width.
You need a pull-down resistor if you want the switch to be active-high (down = 1) or a pull-up resistor if you want the switch to be active-low (down = 0). The resistor is usually 10K and it's a good idea to also place a 220-ohm resistor in series with the I/O pin to protect it.
One frequently used method to measure the speed of a wheel is to use a quadrature encoder (or single channel encoder). Here are a few links on the topic.
Reading Quadrature Encoders (Make sure and watch the videos linked to in post #25)
Make Your Own Quadrature Encoders (Apparently real men make their own.)
Sensors Used to Make Quadrature Encoders (Check out post #77 to see an encoder added to the inside of a servo.)
I took the encoder inside a servo a step further and made a small PCB so I could mount a quadrature encoder inside the servo (post #13).
One of the members here (JonnyMac?) posted a discussion on measuring approximate servo position by "starving" the servo of power to move, providing just enough to power the electronics, then measuring the current draw (by putting a resistor in series with the power lead and measuring the voltage across the resistor or the servo). When the control pulse is the proper width for the servo position, the current drawn will be at a minimum since the electronics is not trying to move the servo. You send a series of servo pulses and see which width causes the least current draw. You then send another series of pulses closer together centered at the position you've found and refine your detected position.
Is this the one Mike?
http://forums.parallax.com/showthread.php/84991-Propeller-Application-Proportional-feedback-from-a-Standard-Hobby-Servo-(Upda?highlight=Servo
It was Beau.
That's it .... the method describe using a Propeller, but just about any micro (even the BS2) could be applicable here using the same method.
http://forums.parallax.com/showthread.php/138101-Feedback-Servo
dgately
One way to always know the position of the wheels will involve adding a simple circular disk to the inside of both wheels. There should be some system of timing marks around the outside edge of the disk. Then you add two LEDs and two photo resistors to read the marks on each wheel. It depends on the sensitivity of your sensor as to how much accuracy you can get. With the addition of a little bit of 'off board' logic hardware you could build a differential accumulator and hold the output until your mule needs it.
Making an add-on for my BS2 'to do' just that is on page three on my list of things 'to do'. I am presently in the middle of a project with a friend to put together a system that has the potential of producing money. We are both buoyed by the knowledge of how much fun we will have giving demonstrations.