Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Joystick Theory

Status
Not open for further replies.

Pepsiiuk

New Member
Hey

For a little background; I have an analogue joystick connected to two ADCs (one each for x and y axis) which in turn (thought some process) are connected to two DACs (one each for left and right motors).

I have thought of two ways which in theory will work but in practice they didn't. The most successful calculated the % of the x and y axis and then combined them differently to achieve values for the left motors and y motors.

Has anyone any ideas/theories how to translate the readings from the joystick to values for the DACs?

Apparently it can be done using the cos and sin rules but I can’t think how.

Any ideas?

Sorry if I haven't given enough information.

Thanks
 
Well seeing as you don't give the slightest hint about what the relationship between joysticks and motors is supposed to be, it's rather difficult to offer suggestions - other than what's with the DAC's? - sounds a very poor way to feed the motors?.
 
Well seeing as you don't give the slightest hint about what the relationship between joysticks and motors is supposed to be, it's rather difficult to offer suggestions - other than what's with the DAC's? - sounds a very poor way to feed the motors?.

It is a poor way to drive the motors but unfortunately I don’t have a choice.

Sorry, I forgot about that. The relationships are given bellow.

joystick fwd: left motor=full fwd, right motor=full fwd.
joystick fwd right: left motor=full fwd, right motor=stop.
joystick right pivot: left motor=full fwd, right motor=full back.
joystick back right: left motor=full back, right motor=stop.
joystick back: left motor=full back, right motor=full back.
joystick back left: left motor=stop, right motor=full back.
joystick left pivot: left motor=full back, right motor=full fwd.
joystick fwd left: left motor=stop, right motor=full fwd.

However, they also have to be proportional e.g. with the joystick half forwards the motors should be motors half forwards.

I’ve been racking my brain over this for a while but I just can’t get it.

Thanks
 
So basically you're talking about tank type steering (skid steering) from a single joystick.

There's a simple PWM example in my tutorials, which give 128 speeds both forwards and backwards for two motors using a 16F876 or similar.

It doesn't do the required maths though, although I did it ages back using the PICBASIC compiler I wrote, I'll see if I can find it?.
 
So basically you're talking about tank type steering (skid steering) from a single joystick.

There's a simple PWM example in my tutorials, which give 128 speeds both forwards and backwards for two motors using a 16F876 or similar.

It doesn't do the required maths though, although I did it ages back using the PICBASIC compiler I wrote, I'll see if I can find it?.

That would be great. Im not using any sort of microcontroller but a computer running linux to run the program but none the less it would be of use.

and thanks for the heads up on the tutorial. Ill have a look in a min.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top