This is a companion discussion topic for the original entry at https://community.robotshop.com/robots/show/micromouse
Servo Problems
hello all =), this is my micromouse that is going to reach the center of a maze (at least thats the plan). I am using 7 sensors, 6 to see the top of the maze and 1 to detect the walls infront. It is running on a BS2 micro and servos. The 6 sensors are designed to function as QTI sensors and work exactly like there more expensive counterparts. I am using case statements to get me to the desired subroutines (gosub forward, gosub right…ect). Everything is working fairly well except that when im in my go forward sub and one side of the sensors is not detecting any wall my servos still go foward but they start studdering which messes up my alignment. So as an example if the right group detects the wall it will read 010 and with corrections it will try to keep the wall in the middle, this is the same with the left group 010…now a wall is not detected on either side the servos start to studder. here is my code for this sub
Forward:
DO
PULSOUT 15, 650
PULSOUT 14, 820
GOSUB Read_Sensor
IF ( RRbit = %0) AND (RMBit = %1) AND (RLbit = %1)AND (LRbit = %0) AND (LLbit = %1) AND (LMbit = %1)THEN
DEBUG “Correction left”, CR
PULSOUT 15, 650
PULSOUT 14, 820 -50
ENDIF
IF ( RRbit = %0) AND (RMBit = %0) AND (RLbit = %1)AND (LRbit = %0) AND (LLbit = %0) AND (LMbit = %1)THEN
DEBUG “Correction left extreme”, CR
PULSOUT 15, 650
PULSOUT 14, 820 -65
ENDIF
IF( RRbit = %1) AND (RMbit = %1) AND (RLbit = %0) AND (LRbit = %1) AND (LMbit = %1) AND (LLbit = %0)THEN
DEBUG “Correction right”,CR
PULSOUT 15, 650 +60
PULSOUT 14, 820
ENDIF
IF( RRbit = %1) AND (RMBit = %0) AND (RLbit = %0)AND (LRbit = %1) AND (LLbit = %0) AND (LMbit = %0)THEN
DEBUG “Correction right extreme”,CR
PULSOUT 15, 650 +80
PULSOUT 14, 820
ENDIF
LOOP WHILE(Fbit <> %0)
RETURN
Now I think the problem is with read sensors sub b/c when i remove there is no studdering but now the little bastard is running blind. here is the read_sen sub
'---------[Subroutines Read_Sensor]----------------------------------------------
'This sub reads the 7 sensor values and converts them to binary
Read_Sensor:
'Middle sensor input
LineSnsrInF = IN9
’Power On
HIGH LineSnsrPwrR ’ activate Right group sensors
HIGH LineSnsrPwrL ’ activate Left group sensors
’Right Group
HIGH LineSnsrInRR ’ discharge Right right QTI cap
HIGH LineSnsrInRM ’ discharge Right middle QTI cap
HIGH LineSnsrInRL ’ discharge Right left QTI cap
’Left Group
HIGH LineSnsrInLR ’ discharge Left right QTI cap
HIGH LineSnsrInLM ’ discharge Left middle QTI cap
HIGH LineSnsrInLL ’ discharge Left left QTI cap
PAUSE 1
’Right Group
RCTIME LineSnsrInRR, 1, SenseRR ’ read Right right sensor value
RCTIME LineSnsrInRM, 1, SenseRM ’ read Right middle sensor value
RCTIME LineSnsrInRL, 1, SenseRL ’ read Right left sensor value
’Left Group
RCTIME LineSnsrInLR, 1, SenseLR ’ read Left right sensor value
RCTIME LineSnsrInLM, 1, SenseLM ’ read Left middle sensor value
RCTIME LineSnsrInLL, 1, SenseLL ’ read Left right sensor value
’Power Off
LOW LineSnsrPwrR ’ deactivate Right sensor
LOW LineSnsrPwrL ’ deactivate Left sensor
’Raw data conversion to 1 bit value
LOOKDOWN SenseRR, >=[500,0], RRbit
LOOKDOWN SenseRM, >=[1000,0], RMbit
LOOKDOWN SenseRL, >=[500,0], RLbit
Fbit = LineSnsrInF
LOOKDOWN SenseLR, >=[1000,0], LRbit
LOOKDOWN SenseLM, >=[500,0], LMbit
LOOKDOWN SenseLL, >=[1000,0], LLbit
RETURN
Any info will bb great, thanks
Hey there! I’m doing a
Hey there! I’m doing a micromouse but unlike yours, I am not using top sensors instead i am using six front sensors and 2 or 4 more for wheel encoders. you can take a look at my post https://www.robotshop.com/letsmakerobots/node/10358