, for answering the question and has received an EZ-Credit award! Share what you have learned and create a tutorial to help others by clicking here
Ok I am sure someone has it listed in the threads ( cant find a specific one however)
I have hacked printer parts to make a periscope lifter for my R2,and I am using an EZB 360 servo to power it.. however I need to be able to limit the up and down pretty precisely when I have the ezb execute the lift and lower script... I am guessing the only way to do this would be limit switches at the top and bottom of the physical lifer mechanism.. If so can anyone guide me on how that would look like scripted ? And no I cant do a simple "timing" script as the timing varies and a half second off either way will break the lifter.
Thanks in advance
I have found a few conversations, tutorials and activities that may help with your question. Take a look at these links. I've sorted them by what I believe to be most relevant but that is not always the case as I'm still learning.
Also, consider reviewing the Learn section for informative lessons and activities.
Check it out!
As you mentioned you could use limit switches (you will need a pull up or pull down resistor depending on how you wired them) and something like ADC_Wait to monitor the switches
Maybe something like this?
#180 value may need to be 1 if the servo moves in the wrong direction and vice versa
if($periscope = 0) #periscope is down so move it up
Servo(D0,180) #may need to be 1
ADC_Wait(ADC0, LOWER, 50) #might need to use HIGHER instead of LOWER here
$periscope = 1 #periscope is up
Servo(D0,107) #servo 360 stop command
else #periscope is up so move it down
servo(D0,1) #may need to be 180
ADC_Wait(ADC1, LOWER, 50) #bottom switch on adc port 1
$periscope = 0 #periscope is down
Servo(D0,107) #servo 360 stop command
Also I would advise you update to the new ezb4 x/2 board (if you haven't done so already) as it way faster at monitoring analog and digital reads. Not to mention other superior features as well...
Thank you !
Another way you can do this is to wire microwitchs into the motor circuit. One one each of the power lines. Then when the motor hits one of the switches the power will be cut and the motor stops. The trick to get the motor moving again after power is cut by the open switch is to place a diode on each switch in the proper way to get the motor to accept reversed power from a hbridge. Then all you need is script a digital on, sleep() for however long it takes the move to complete and then digital port off.
Also, have you thought about using the electrical PCB and potentiometer of a Standard Servo and hack to your application?
I'm with Richard on recommending the /2 upgrade as well. I see you have a /1 comm board still. The /2 will provide increased communication speed (about 100 times faster): EZ-B v4/2 Comm Upgrade
Thanks for help guys
I got lazy (still recovering from holidays ) and just put a limit switch at top and one at bottom. Now I have a peri up button and peri down with each respective button having a termination of script once digital port reads "true" and its working good for my lazy man fix ( Cant say my bootleg limit switches are pretty ...but they work lol )
I got lazy (still recovering from holidays ) and just put a limit switch at top and one at bottom. Now I have a peri up button and peri down with each respective button having a termination of script once digital port reads "true" and its working good for my lazy man fix Smile ( Cant say my bootleg limit switches are pretty ...but they work lol )
Perfectly legitimate solution. A lot of times a bunch of us will throw out a bunch of answers to a question just to show those coming later that there are multiple ways to do things. Some will work better in a situation than others. Limit switches are perfectly fine as long as you absolutely have the script that listens for them running any time the periscope is moving.