potentiometer following another potentiometer

#1
hi
simply trying to adjust a pot and having a reversable motor take up the required position (which is connected to another pot)
please see attachments for better understanding
i am using a 20m2 picaxe chip and a L293D.

using logicator
have been using the compare command, but unsuccessful

also, i am having trouble uploading picures and a word doc. what is the max size allowed. the word doc is only 252KB is there an easy way. i have lots os pictures to help explain my situation

regards
 

Attachments

Technical

Technical Support
Staff member
#4
Try attaching the actual PICAXE file rather than a photo of the computer screen.

You probably need to add some hysteresis into the system, adc values wobble about a bit rather than sit exactly on one spot, particularly with carbon pots like this.
 
#5
attached is my logicator file
i move the start button across to test run the other programs
when i run the middle program, the debug works well when i adjust both pots
 

Attachments

Technical

Technical Support
Staff member
#7
1) You use readadc to get the values into varA and varB at the start of the loop. Therefore your compare cells should use varA and varB, not adc_C.1 and adc_C.2
By using adc_C.1 you are creating an extra, unnecessary, read of the ADC (if you convert flowchart to BASIC you will see this process).
So change all the adc_C.1 back to varA and adc_C.2 back to varB.

2) It is unlikely that varA and varB will always be exactly the same even if at the exact same position, as the ADCs value always move around a little. You should allow some hysteresis, for instance allow them to be within +/- 5 of each other, not only just excatly equal.
 

hippy

Technical Support
Staff member
#9
The attached flow chart shows how to create a +/-5 range in which to stop the motor, effectively -

accC = accB - 5
accD = accB + 5

Motor will stop when "accA is >= accC And accA <= accD", "accA is >= (accB-5) And accA <= (accB+5)" ...
 

Attachments

Top