Today, I finally finished the hardware setup for the Mr. CR. During the initial preparations I removed all the existing control hardware for the unit leaving only the, motors, pots and LEDs. I wired the motors to 3 L9110 Stepper Motor Driver Controller Board H-bridge units. Powered everything up with the only hiccup being I no longer have control over D1 pin...no big deal just picked another pin.
Started work using ARC... It seems I am struggling to get finite control over the movements of the robot. To return the head from the looking up/looking down pitch position I use this code:
#D4 Up
#D5 Down
#31 adc value is looking up
#192 adc value is looking level
#255 adc value is looking down
#Clear pre-existing state
Set(D4, off)
PWM(D4, 0)
Set(D5, off)
PWM(D5, 0)
:LoopStart
$headPitch = GetADC(adc1)
Print($headPitch)
iF ($headPitch < 190) #looking up then look down
PWM(D4, 0)
Set(D4, off)
PWM(D5, 28)
Elseif ($headPitch > 210) #looking down then look up
PWM(D5, 0)
Set(D5, off)
PWM(D4, 28)
Else #is inside the range of 190 to 210
PWM(D4, 0)
Set(D4, off)
PWM(D5, 0)
Set(D5, off)
Halt()
EndIf
Goto (LoopStart)
The code is simple, yet I can not get predictable reads on the the pots. The motors over overshoot an go to far down outside the value buffer(190-200 on the adc) and head moves back up trying to correct. This leads to unpredictable head bobbing in order to position the head's pitch angle inside the value buffer. During testing I was randomly getting timing hops/delays between the EZ-B reading the pot.
So based on this conclusion I am making the assumption that controlling DC motors via pots with EZ-Robot is not a good idea. Additionally, I can only seem to get 0-255 resolution on the analog ports which offer significantly limited resolution in movement degrees.
So I ask the community a couple of questions:
Does anyone have any experiences with controlling precise angles with DC motors via pots, optical or any other sort of encoder?
Is the assumption that EZ-Robot works best with servos and using any other precise method of actuation is a fools errand?
I am I clear in my post? Any other thoughts, ideas, etc...
You will need to hack some servos , connect the servos pots and the power from the control board to the motor your controlling. Also I noticed the top of the heads a great place for a Camera.
I believe the jaw does not have a pot so you will need to take one from a servo and hot glue it to the jaw so you have its position. Troy / flick click has already done the jaw mod with success.
Try using these new commands: https://synthiam.com/Community/Questions/3883
They will work for your application
Is the problem like this at 1:20 in?
Edit I forgot to mention it in the video but the problem was also the flexing of the plastic servo horn disk that added to it.
I have that problem with my wall-e in his neck turn. I do something and he starts to say "NO". I think its just that there's a lot of weight placed unevenly on the servo. try an analog servo. Apparently they make that disappear.
@Troy , where did you get that head?
Same as leversofpower. It's from a Mr. Clock Radio and I got it from Ebay. You rarely see them.
@leversofpowers Thats a great looking project.