I have a problem with my Dual micro motor controller, that i never noticed until now.
Hardware, Botboard 2, Basic Atom Pro 28-m.
If i repeat the same control code, and it resends the signals, sometimes the speed will change, even though the speed is hard set.
Motors and Motor Controller share their own 5.0v 1.5A regulator(w/ heatsink). Both motors are Solarbotics GM9’s.
movement
if (cbot = 1000 and switcher = 0) then
SEROUT p10, i9600, [$80, 0, 0, 0]
SEROUT p10, i9600, [$80, 0, 2, 0]
elseif (cbot = 1001 and switcher = 0) ;forward full speed
SEROUT p10, i9600, [$80, 0, 0, 127]
serout p10, i9600, [$80, 0, 2, 127]
PAUSEUS 400000
elseif (cbot = 1002 and switcher = 0) ;backwards full speed
SEROUT p10, i9600, [$80, 0, 1, 127]
serout p10, i9600, [$80, 0, 3, 127]
PAUSEUS 400000
elseif (cbot = 1003 and switcher = 0) ;rotate left, right track forward, left track reverse at reduced speed
SEROUT p10, i9600, [$80, 0, 2, 90]
SEROUT p10, i9600, [$80, 0, 1, 90]
PAUSEUS 400000
elseif (cbot = 1004 and switcher = 0) ;Rotate right opposite of above
SEROUT p10, i9600, [$80, 0, 3, 90]
SEROUT p10, i9600, [$80, 0, 0, 90]
PAUSEUS 400000
elseif (cbot = 1005 and switcher = 0) ;forward Slow
SEROUT p10, i9600, [$80, 0, 0, 40]
serout p10, i9600, [$80, 0, 2, 40]
PAUSEUS 400000
elseif (cbot = 1006 and switcher = 0) ;backwards slow
SEROUT p10, i9600, [$80, 0, 1, 40]
serout p10, i9600, [$80, 0, 3, 40]
PAUSEUS 400000
elseif (cbot = 1007 and switcher = 0) ;rotate left slow
SEROUT p10, i9600, [$80, 0, 2, 35]
SEROUT p10, i9600, [$80, 0, 1, 35]
PAUSEUS 400000
elseif (cbot = 1008 and switcher = 0) ;Rotate right slow
SEROUT p10, i9600, [$80, 0, 3, 35]
SEROUT p10, i9600, [$80, 0, 0, 35]
PAUSEUS 400000
endif
goto main
If i send the code cbot = 1005, multiple times, sometimes the speed on one or both motors will change, sometimes even go in reverse. Most noticable when switching between the two rotate commands, if i’m rotating left, and i put in the rotate right command, sometimes it’ll go in forward or reverse, but at the rotate speeds, meaning 1 of the two commands didn’t go through.
Both of my motors use single 100uf capacitors, i’ll be adding 2nd and 3rd capacitors to each motor in a few minutes, but i don’t think that’s the problem.
Should i change the baud rate? Is the controller itself defective? What about adding a 10-20 millisecond pause in between SEROUT commands.
I’ve had problems before when switching from forward or reverse, to one of the rotate commands, 1 motor will slow/move correctly, while the other will still be going at the previous commands direction and speed.
But only now that i use 2 speed sets has the problem become more noticeable, it’s actually a problem now.
Because now i have to press the input command a few times just to get it to the right speed, Where before, if the first time didnt work, another button tap and it would kick in, Now it takes 3-4 taps to get the speed right.
PS
Pretty soon i’ll be changing the code to only use 5 commands, based on a variable speed. (i’ll use multipliers and (gears) on the speed, from
131.75 for slowest
231.75 for slow
331.75 for medium
431.75 for fast. (4*31.75 = 127)
PPS
i plan on getting Pololu Low-Voltage Dual Serial Motor Controller eventually, but i have no money, and a new wireless adapter comes first.
Edit: are the serial comands for both the dual micro and the Low-voltage dual motor controller the same?
Can i just swap them out? or do i have to change my code?
Also does the one i linked suffer from the same problems?