Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Joystick potentiometer

Status
Not open for further replies.

DrWhoF

Advanced Member level 1
Advanced Member level 1
Joined
May 6, 2005
Messages
402
Helped
24
Reputation
48
Reaction score
11
Trophy points
1,298
Activity points
4,388
joystick potentiometer

I need a circuit which will take signal from 5k joystick potentiometer and will control a 12V dc motor outside an aircraft. The motor moves camera platform up and down and it has internal limit switches for top and bottom position.
The operation of joystick should be proportional: the further operator moves joystick the faster the platform moves and in central position (joystick released with a spring) no power should be applied to motor.

Any help is appreciated.

Thanks.
DrWho
 

farnell bdx33

You haven't mentioned the power requirements of the motor, but at this stage this is not important ..

This project can be easily built around the PICAXE-18X (PIC16F88) ..

The 5kΩ potentiometer can be connected to one of it's analog inputs ..
Both motor's limit switches can be connected to any input ..
The PWM output can drive H-Bridge (Up and Down + Speed) ,or a MOSFET (Speed)+ a Double-Pole Relay (direction Up and Down) ..

The rest is just the PICAXE-Basic ..

Regards,
IanP
 

    DrWhoF

    Points: 2
    Helpful Answer Positive Rating
Thank you very much for your response.
The motor's maximum current is 3A @ 12V.
I prefer not to use any relays because this circuit will be use inside an aircraft.
Can you suggest schematic with PICAXE-18X?
Thanks.
DrWho
 

Before I suggest any circuit just one question: is the power supply from your other thread for the same project? the same aircraft?

Regards,
IanP
 

    DrWhoF

    Points: 2
    Helpful Answer Positive Rating
Yeah, the same project.

Thanks.
DrWho
 

Take a look at the attached picture ..
Of cours, it is not the final design, so if you, or anyone else, have any comments they are welcome ..
Please note that the type of the NOR gates is ACT - they can deliver +/-50mA of current either way (sourcing or sinking) per gate ..

Regards,
IanP
 

    DrWhoF

    Points: 2
    Helpful Answer Positive Rating
If I can't get 74ACT02 what it can be replaced with?
DrWho
 

Try FARNELL ..
They have the ACT series, including the CD74ACT02 ..
**broken link removed**

Regards,
IanP
 

    DrWhoF

    Points: 2
    Helpful Answer Positive Rating
I have problems with 74ACT02. Farnell can only supply surface mont version and I find it rather impossible to mount it on a strip-board. Any alternative?
Can you help with software?
Thanks.
DrWho
 

I wouldn't worry much about SOIC (8-Lead Small Outline IC) package as long as you can get the 74ACT-series gates ..
What you can do is, you can get a 14-pin turned pin DIL IC socket and using thin wire solder pin-to-pin with the IC roughly 2-3mm above the socket .. If you want, you may apply some glue from the top - and - vuala!!! - IC is now housed in 14-pin DIL ..

As far as the software is concerned - yes, I can help you, but a little bit later ..

Regards,
IanP
 

    DrWhoF

    Points: 2
    Helpful Answer Positive Rating
Code:
start:

	pause 1000
	low 0				; pin 6 goes low - enable

main:
	readadc10 0, w5			; read 10-bit resolution from pin 17 - ADC0
	if w5>1023 or w5<0 then main

	if w5<486 then moveL		; 512-5%
	if w5>538 then moveH		; 512+5%

	pwmout 3, 0, 0			; switch off PWM - pin 9
	high 2				; Forward OFF
	high 1				; Reverse OFF
	goto main

moveL:
	w3 = 2 * w5
	low 2				; Forward ON - pin 8 LOW
	pwmout 3, 255, w3		; PWM ON ..
	goto main

moveH:
	w3 = 1023 - 2 * w5
	low 1				; Reverse ON - pin 7 LOW
	pwmout 3, 255, w3		; PWM ON ..
	goto main

end

I don't think this is the final version of the code, but it should be a good starting point ..

Regards,
IanP
 

    DrWhoF

    Points: 2
    Helpful Answer Positive Rating
IanP.
I build this circuit without transistors and temporary with 74LS02. After downloading software to PICAXE it started to generate PWM but I have problem with upper half of the potentiometer adjustment.
When I turn potentiometer from 1/2 to 0 it starts with 2.5% deadband and then generates PWM from 5 to 100% but when I do the same with upper half it starts with deadband and then PWM jumps from 50% at 2.6V input to 100% at 3.3V input then it starts from 0% and ends with 100% at 5V input.
What is wrong?
 

Code:
w3 = 1023 - 2 * w5
The above line is not correct .. My deepest apologies ..

In the PICAXE Basic maths is executed strictly from left to right and on top of that the idea was not exactly right, so replace the above line with the following:

Code:
	w5 = 2 * w5
	w3 = 2047 - w5

When executed this should start with the deadband and then produce the PWM output (after 74XX02 gate) from low duty cycle to 100% ..

Regards,
IanP
 

    DrWhoF

    Points: 2
    Helpful Answer Positive Rating
Yeah, it is working fine on both channels. Thank you very much!
I thought that motor has 2 limit switches but it doesn't. It has a 1k multiturn potentiometer geared to motor's shaft.
How it can be used instead of two limit switches?
 

This potentiometer can be easily used to set required limits at both ends ..
PICAXE-18X has three ADC pins .. at this moment you use only one: ADC0 on pin 17 (joystick reference) ..
Connect this additional potentiometer in the same way as the joystick: 0V, 5V and the middle pin to, say, ADC1 (pin 18) ..
Read this potentiometer in the main loop - you may use w0, w1, or any unused w-register - and add the following conditions:
0-10 => the bottom-end deadband ..
1023-1013 => the high-end deadband ..
or as required ..
If you have any problems I'll give you a hand ..

Regards,
IanP
 

    DrWhoF

    Points: 2
    Helpful Answer Positive Rating
Code:
start:
	symbol DUTY = w0
	symbol LIMIT = w1
	pause 1000
	DUTY = 512 
	low 0					; pin 6 goes low - enable

main:
	readadc10 0, w5			; read 10-bit resolution from pin 17 - ADC0
	readadc10 1, LIMIT		; read 10-bit resolution from pin 18 - ADC1
	if w5>1023 or w5<0 then main
	if w4>1023 or w4<0 then main

	if w5<486 then moveL		; 512-5%
	if w5>538 then moveH		; 512+5%

stopLH:
	pwmout 3, 0, DUTY			; switch off PWM - pin 9
	high 2				; Forward OFF
	high 1				; Reverse OFF
	goto main

moveL:
	if LIMIT < 20 then stopLH	; low dead-band

	DUTY = 2 * w5
	low 2					; Forward ON - pin 8 LOW
	pwmout 3, 255, DUTY		; PWM ON ..
	goto main

moveH:
	if LIMIT > 1000 then stopLH	; high dead-band

	w5 = 2 * w5
	DUTY = 2047 - w5
	low 1					; Reverse ON - pin 7 LOW
	pwmout 3, 255, DUTY		; PWM ON ..
	goto main

end

LIMIT(s) potentiometer connected to pin 18 (ADC1) ..

Regards,
IanP
 

    DrWhoF

    Points: 2
    Helpful Answer Positive Rating
IanP
Thank you very much.
I will try it out.
I can't get TIP transistors which you suggested in schematic diagram.
Instead I can have BDX33 and BDX34. Do you think they will work?
Also do I need 10k base-emitter resistors? BDX transistors have them insisde.
Thanks
DrWho
 

BDX33/34 are rated for 45V ..
In theory this should be enough but you should really try to get BDX33/4 B(80V) or BDX33/4 C(100V) ..
As the BDX-darlingtons have internal resistors all external 10kΩs can be omitted ..

Regards,
IanP
 

    DrWhoF

    Points: 2
    Helpful Answer Positive Rating
WOW !!!
It is working !!!

I have to change period of PWM because of an annoying whine.
How this can be done?
 

Good to hear ..

The period is 255 or just below 4.0 kHz but you may easily double or quadruple this by adjusting the period to 125 or 63 resulting in 8.0 and 16.0 kHz ..
That is going with frequency up ..
To decrease the frequency you have to treat PICAXE-18X as PIC16F88 and look into the T2CON register ..
You can use the following to poke the T2CON register so as to provide a clock pre-scale of either 4 or 16:
Code:
	PWMOut 3, 249, Duty
	Poke $12, $05		' provides a pre-scale of 1:4


	PWMOut 3, 249, Duty
	Poke $12, $06		' provides a pre-scale of 1:16
The result is frequencies of 1.0 kHz and 250 Hz respectively ..

Regards,
IanP
 

    DrWhoF

    Points: 2
    Helpful Answer Positive Rating
Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top