“Pedrone” Part #1 – Trimming stop point on modified servo

I am going to build my new “Pedrone” (Pedestrian Drone), a device that can be remotely controlled by smartphone, running at home. I did the same in 1998, now it’s time to make one better. In the picture below, you can see the old model. The internet server was set on the home PC and the data exchange with the rover was done by means of 866 MHz transceivers using half-duplex packets communication. The “camera” was a GameBoy gadget modified for the purpose, giving a fantastic 128*128 pixels gray scale image at every command received from the Internet.

My first Rover, built in 1998, controllable via a standard browser on the Internet.

My first Rover, built in 1998, controllable via a standard browser on the Internet  (click to enlarge)

For the new model, I decided to use a couple of cheap Servo-Motors, purchased on ebay at VERY low price. The servo motors have a good torque and so are very efficient. The second advantage of servo motors is that they just require a single microcontroller output to be driven in both directions. Obviously, a servo motor has to be modified, because its purpose is to move in the arc of 180° (someone more, some other less). I want a continue rotation to drive a wheel in both directions, plus a stop condition. I have written a small test program on Atmel ATmega48 microcontroller to generate a waveform to control the motor, then I have modified the servo substituting the feedback potentiometer with a couple of smd fixed resistors, both of the same value. Connecting the servo to the microcontroller, I had a problem: no one of the values that can be set in pulse width gave a real STOP condition. One value gave slow rotation clockwise, one other slow rotation counterclockwise. This problem can happen if the center tap of the two resistor is not exactly the median point, or because the pulse width is not exactly 1.5 mS or for the combination of the two things. Actually, my solution for controlling 2 motors with a single 8 bit timer (TMR0) using two output compare registers (OCR0A and OCR0B) gives me a step factor of 64 uS on a full range of 256 * 64 uS (the total repetition time is 16.384 mS, that’s inside the specs for servo-motors). The classical 1.5 mS center point can’t be set, cause 1500uS / 64uS is not an integer value (23.4375) and then we have to decide if the center point is 23 (*64uS = 1.472mS) or 24 (*64uS = 1.536mS). In any case the stop position depends upon the feedback supplied to the motor controller by the potentiometer (in our modified servo, the couple of SMD resistors with the same value).  To solve the problem, I decided to use an external multiturn trimmer (in place of the smd resistors) to trim the correct stop point. In the picture below you can see that I connected three wires on the pads where the potentiometer was originally soldered.

Servo circuit. Internal potentiometer has been disconnected

Servo circuit. Internal potentiometer has been disconnected (click to enlarge)

I modified the slot in the plastic cover to have enough space to go out with the 3 additional gray wires, then I soldered a multiturn trimmer to set the stop point. Note that the internal potentiometer was 5KOhm, but I used a 10KOhm trimmer without problems. Anyway, the best solution is to measure the resistance of the original potentiomenter and then buy a 10 turns linear trimmer of such value.

The 10 turn trimmer soldered on gray wires

The 10 turns trimmer soldered on grey wires (click to enlarge)

Finally, I used a biadhesive tape to fix the trimmer on the case of the servo-motor.

Trimmer fixed on the Servo-motor case

Trimmer fixed on the servo-motor case (click to enlarge)

Alternative version: using 2KOhm trimmer, a couple of resistors and a filtering capacitor makes easier setting the stop point.

Modified circuit (1KOhm resistors used, but 1.5K is better) - click to enlarge

Modified circuit (1KOhm resistors used, but 1.5K is better) – click to enlarge

Well, after connecting the servo to the microcontroller prototype board (using a default pulse width for stop position), I rotated the trimmer near its middle position, finding the exact point for motor stop. Actually, with my microcontroller’s test program, the stop point is at value 22, while the full speed in one direction is 15 or 30 in the other.

Driving two modified servos di robotop

My prototype board (the one visible in the video) has this schematic:

Schematic diagram of the prototype (click to enlarge)

Schematic diagram of the prototype (click to enlarge)

The C source file, the HEX object to burn the micro and the schematic in PDF format can be downloaded in the zip file EF190Pedrone.zip (when you unzip it, give password: eficara). Here is the C source listing compiled with IAR V5.50.0.