Joystick controlling 08m2 gives irratic output

hippy

Technical Support
Staff member
It may be worth posting your full code. You need to have appropriate PAUSE commands to ensure reliable output of servo pulses.

Rather than using resistors on either side of the pot, it would be better to remove those, read the pot as a 0 to 255 value, and convert those to a suitable value required for servo/motor control.
 

joliebrise

New Member
It may be worth posting your full code. You need to have appropriate PAUSE commands to ensure reliable output of servo pulses.

Rather than using resistors on either side of the pot, it would be better to remove those, read the pot as a 0 to 255 value, and convert those to a suitable value required for servo/motor control.
Have added PAUSE command. What value would you recommend as the output pulse is in usec?

The two resistors either side of the pot were found by trial and error to give min 1050us, central position 1500us and max 1980us. This gives 980us range.

This is similar to the range of a R/C receiver output. This allows the joystick to use a common code already tested for a receiver. Plug 'n' play.

Without the resistors it would be 260 to 2100us.

My expertise is in R/C drum winch servos and my purpose with Picaxe is to control a 4A motor via an H-Bridge module with positive feedback.

As I found it very difficult to find relevant free online tutorials, I am learning, testing and writing so others can learn. I have done the same building my model boats and "Tech Info" about R/C drum servos/receivers and that's another can of worms.

I have just read a suggestion to add a IN4148 diode in the +ve supply to remove -ve pulses, Any comments?

init:
b1 = 0
servo c.1, 0

main:
readadc c.4, b1
servopos c.1, b1
PAUSE ?
goto main

Tony
 

hippy

Technical Support
Staff member
A PAUSE 100 would seem a good start but any length PAUSE may help. Initialising the servo to position 0 is not recommended and may actually adversely affect things. Set it to the initial value you want.

I do not know about connecting a diode to remove negative pulses. Not sure where or why that would be recommended.
 

joliebrise

New Member
A PAUSE 100 would seem a good start but any length PAUSE may help. Initialising the servo to position 0 is not recommended and may actually adversely affect things. Set it to the initial value you want.

I do not know about connecting a diode to remove negative pulses. Not sure where or why that would be recommended.
Thanks Hippy, Problem solved, used 100.

It still worked with the servo initialised to 0 but I take your point about good practice and set the value to 158, the joystick central position.

Diode in +ve supply made no difference.

Thanks again, Tony

Now to code shaft turns with a slotted disc.
 
Top