Wednesday, November 27, 2013

Preliminary tests of Parallax Servos and Glove-Mounted Flex Sensors

5 Parallax standard servos arrived today in the mail. They are quite large compared to the servos that came with the Sparkfun kit:

Left: Parallax servo; Right: SparkFun servo
The servo is both larger and stronger, with a torque about 2 to 3 times that of the SparkFun servo, so it should meet our needs nicely.

http://parallax.com/product/900-00005

I began to hook it up to the breadboard to begin testing them but ran into a bit of a snag. For whatever reason, the servos weren't working. I had the 5V and GND from the Arduino hooked up into the positive and negative rails of the breadboard, respectively. Then I attached the red, white, and black leads of the servo (just like the ones in the Sparkfun kits) to the power rail, ground rail, and digital PWM pin-out.

Next I tried plugging the servo directly into the 5V and GND pin of the Arduino. This worked! However, the problem it posed was that only one Arduino could power one servo motor at a time.

I spent the next hour or so troubleshooting and scouring the internet for answers. No luck. At last, I tried using hookup wire instead of the breadboard wires that came with the Sparkfun kit. This finally worked. I was even able to run two servos at once from the same power/ground rail with more hookup wire.

After this debacle, I wrote some quick code to test out the flex sensor's ability to rotate the servo when mounted on the glove. The servos get jittery once more than one servo is powered and grounded to the same rail, but overall, they are able to run independently. One discovery I made was that the 600-900 analog value for the flex sensors that was recommended in the SIK Guide code isn't far too much. What ended up happening was that the flex sensor was only bouncing between 690 and 800, which when mapped to a servo's angle position of 0 to 180, would only give me from about 70 to 110. I wanted full rotation, so what I did instead was have the "map" function convert flex sensor values from around 675 to 800 to the servo angles of 0 to 180. This way, I got a much broader angular range for the servo. I've included the code to show what I mean:


Perhaps more quality flex sensors would utilize the entire 600 to 900 range, but that's not the case with these flex sensors. Adjusting the range to 675 to 800 will allow for much greater range of motion for the servo. The video shown below uses this updated range for the flex sensor mapping to the servo angle, in addition to using the flex sensor on the glove mount for one servo.


Of course, this is with the flex sensor and the servo attached to the same breadboard and Arduino. Our challenge arises in separating this system into two by utilizing the RF transmitter and receiver, which is the last big challenge for this project.

-Dat

No comments:

Post a Comment