Connect with us

Robot Sumo Project - PICAXE

  • Hey Everyone!

    This is my 1.5-2 year project that I have referenced to a couple times. I thought I would start a project log, since I'm kind of proud of it. Unfortunately I'm almost done with it, so this may be a rather short thread. Here it is still in construction:

    IMG_0458.JPG

    I will upload some more photos later.

    ----------------------------------------------------

    Some more photos:

    IMG_0819.JPG

    IMG_0820.JPG

    The main boards with the ICs not on yet:

    IMG_0822.JPG

    ----------------------------------------------------

    Yesterday I did some more work on it and got the front IR sensors mounted.

    FORS.JPG

    IREM.JPG

    ----------------------------------------------------

    Did some more work on it the other day. Got the side IR sensors mounted. And a lot of wires hooked up. I hope to get the back IR sensors hooked up today. The Front:

    FRBSM.JPG

    The side with the sensors distance adjust pots:

    SIDE.JPG

    My work space (kind of messy):

    WORK.JPG

    ----------------------------------------------------

    Well I got a lot more done today then I thought I would! :) I mounted the back sensors, and hooked up just about everything I could before I mount the main boards. I got the tires glued on to.

    FRONT1.JPG

    BACK.JPG

    ----------------------------------------------------

    Well I just finished it. Got everything hooked up and the battery mounted. Then I flipped it on and IT DIDN'T WORK!!!!!!! :mad::mad::mad::mad::mad: It didn't even try to work. Nothing turned on at all. And also the battery are getting kind of hot.

    I guess I have got a long day of trouble shooting tomorrow.:(

    ----------------------------------------------------

    YAY!!:) I just tested one of the main boards and the + and - terminals are a dead short! That explains why the battery was getting hot and why nothing worked. I just hope thats all thats wrong with it. I will find out tomorrow!

    ----------------------------------------------------

    Well I got it kind of working.:) The problem was I did not have the microcontroller hooked up to each other. And there was a small piece of wire stuck between two capacitor pins. Right now it turns in circles and some of the edge sensors don't work. Hopefully that will be an easy fix.:confused::confused:

    ----------------------------------------------------

    Well after a LOT of work, I got it going straight. One of the wheels is faster then the other one (I wonder how that happened), so I programed it to correct itself by going the other direction every 1 second. I think I have got most of it working, but I lost one of the main microcontrollers. Most likely I will find it by stepping on it with the pins up, or I will find it on my desk. :p Heres a photo of it:

    THERSAMCP.JPG

    Right now it weighs some where around 498g. The limit on weight for a robot sumo is 500g. :eek::eek: And I still don't have the front on!

    ----------------------------------------------------

    Well after some thought, I decided to just go ahead and post the whole project. Because it's not like I did anything new. And maybe one day someone else will build it, and possibly even learn something too!

    Here's the schematic:

    RBS__2_09_13_2014-PIC_2.jpg
    Link to Express PCB File

    ----------------------------------------------------

    And here's the code:

    NOTE: This code is some of the first PICAXE BASIC code I ever wrote. It can be simplified greatly and should be. It uses way to many gotos and has almost no comments. One day I will get around to totally rewriting it. :p:D

    Code for U2:
    Code:
    main1:
        high b.0,b.2
        low b.1,b.3,b.5,c.4
        pause 5000
        high b.5,c.4
        goto main
    main: 
        let b0=0
        pwmout b.4, 25, 51
        low b.0,b.1,b.2,b.3
        goto start
    start:
        if pinc.0=1 then
            goto cella
        endif
        if pinc.1=1 then
            goto cellb
        endif
        if pinc.2=1 then
            goto cellc
        endif
        if pinc.3=1 then
            goto celld
        endif
        goto main
    cella:
        if pinc.0=1 then
            pause 100               ;debounce
            if pinc.1=1 then
                goto cellab
            endif
        endif
        if pinc.0=1 then
            pause 100               ;debounce
            if pinc.2=1 then
                goto cellac
            endif
        endif
        goto cella2
    cella2:
        high b.1,b.2
        low b.0,b.3
        pause 100
        low b.0,b.2
        high b.1,b.3
        pause 1000
        goto main
    cellb:
        if pinc.0=1 then
            pause 100           ;debounce
            if pinc.1=1 then
                goto cellab
            endif
        endif
        if pinc.3=1 then
            pause 100           ;debounce
            if pinc.1=1 then
                goto cellbd
            endif
        endif
        goto cellb2
    cellb2:
        high b.0,b.3
        low b.1,b.2
        pause 100
        low b.0,b.2
        high b.1,b.3
        pause 1000
        goto main
    cellc:
        if pinc.2=1 then
            pause 100           ;debounce
            if pinc.0=1 then
                goto cellac
            endif
        endif
        if pinc.3=1 then
            pause 100           ;debounce
            if pinc.2=1 then
                goto cellcd
            endif
        endif
        goto cellc2
    cellc2:
        high b.2
        low b.0,b.1,b.3
        pause 100
        low b.0,b.1,b.2,b.3
        pause 1000
        goto main
    celld:
        if pinc.3=1 then
            pause 100           ;debounce
            if pinc.2=1 then
                goto cellcd
            endif
        endif
        if pinc.1=1 then
            pause 100           ;debounce
            if pinc.3=1 then
                goto cellbd
            endif
        endif
        goto celld2
    celld2:
        high b.0
        low b.1,b.2,b.3
        pause 100
        low b.0,b.1,b.2,b.3
        pause 1000
        goto main
    cellab:
        high b.1,b.3
        low b.0,b.2
        pause 1100
        goto main
    cellcd:
        high b.2
        low b.0,b.1,b.3
        pause 100
        high b.0
        low b.1,b.2,b.3
        pause 100
        low b.0,b.1,b.2,b.3
        pause 800
        goto main
    cellac:
        high b.1,b.2
        low b.0,b.3
        pause 300
        high b.0
        low b.1,b.2,b.3
        pause 300
        goto main
    cellbd:
        high b.0,b.3
        low b.1,b.2
        pause 300
        high b.2
        low b.0,b.1,b.3
        pause 300
        goto main
    Code for U7:
    Code:
    main1:
        low b.0,b.1,b.2,b.3         ;F
        if pinb.5=1 then
            pause 100
                if pinb.5=1 then
                    goto main
                endif
        endif
        goto main1
    main:
        let w0=0
        low b.0,b.1,b.2,b.3         ;F
        goto start
    start:
        if b2=10 then
            high b.2           ;L
            pause 650
            low b.2
            let b2=0
            goto start
        endif
        if pinc.0=1 then
            pause 100
                if pinc.0=1 then
                    goto cella
                endif
        endif
        if pinc.1=1 then
            pause 100
                if pinc.1=1 then
                    goto cellb
                endif
        endif
        if pinc.2=1 then
            pause 100
                if pinc.2=1 then
                    goto cellc
                endif
        endif
        if pinc.3=1 then
            pause 100
                if pinc.3=1 then
                    goto celld
                endif
        endif
        if pinc.4=1 then
            pause 100
                if pinc.4=1 then
                    goto celle
                endif
        endif
        if pinb.4=1 then
            pause 100
                if pinb.4=1 then
                    goto cellf
                endif
        endif
        pause 100
        inc b2
        goto start
    cella:
        if pinc.0=1 then
            pause 100
                if pinc.0=1 then
                     if pinb.4 = 1 then
                        pause 100
                            if pinb.4=1 then
                            goto cellaf
                            endif
                    endif
                endif
        endif
        goto cella2
    cella2:
        inc w0
        if w0=400 then
            goto main
        endif
        if pinc.0=1 then
            pause 100
            if pinc.0=1 then
                if pinc.1=1 then
                    pause 100
                        if pinc.1=1 then
                            goto main
                        endif
                endif
            
            endif
        endif
        high b.1,b.3            ;B
        low b.0,b.2
        pause 10
        goto cella2
    cellb:
        if pinc.1=1 then
            pause 100
            if pinc.1=1 then
                if pinc.2=1 then
                     pause 100
                        if pinc.2=1 then
                            goto cellbc
                        endif
                endif
            endif
        endif
        goto cellb2
    cellb2:
        inc w0
        if w0=400 then
            goto main
        endif
        if pinc.0=1 then
            pause 100
                if pinc.0=1 then
                    if pinc.1=1 then
                         pause 100
                            if pinc.1=1 then
                                goto main
                            endif
                    endif
                endif
        endif
        high b.1,b.3            ;B
        low b.0,b.2
        pause 10
        goto cellb2
    cellc:
        if pinc.2=1 then
            pause 100   
                if pinc.2=1 then
                    if pinc.3=1 then
                        pause 100
                            if pinc.3=1 then
                            goto cellcd
                            endif
                    endif
                endif
        endif
        if pinc.2=1 then
            pause 100
                if pinc.2=1 then
                    if pinc.1=1 then
                         pause 100
                            if pinc.1=1 then
                                goto cellbc
                            endif
                     endif
                endif
        endif
        goto cellc2
    cellc2:
        inc w0
        if w0 = 400 then
            goto main
        endif
        if pinc.1=1 then
            pause 100
                if pinc.1=1 then
                    goto main
                endif
        endif
        high b.0        ;R
        low b.2,b.1,b.3
        pause 10
        goto cellc2
    celld:
        if pinc.2=1 then
            pause 100
                if pinc.2=1 then
                     if pinc.3=1 then
                        pause 100
                            if pinc.3=1 then
                                goto cellcd
                            endif
                    endif
                endif
        endif
        goto celld2
    celld2:
        inc w0
        if w0=400 then
            goto main
        endif
        if pinc.1=1 then
            pause 100
                if pinc.1=1 then
                    goto main
                endif
        endif
        high b.0               ;R
        low b.2,b.1,b.3
        pause 10
        goto celld2
    celle:
        if pinb.4=1 then
            pause 100
                if pinb.4=1 then
                     if pinc.4=1 then
                        pause 100
                            if pinc.4=1 then
                                goto cellef
                            endif
                    endif
                endif
        endif
        if pinc.3=1 then
            pause 100       
                if pinc.3=1 then
                    if pinc.4=1 then
                        pause 100
                            if pinc.4=1 then
                                goto celled
                            endif
                    endif
                endif
        endif
        goto celle2
    celle2:
        inc w0
        if w0=400 then
            goto main
        endif
        if pinc.0=1 then
            pause 100
                if pinc.0=1 then
                    goto main
                endif
        endif
        high b.2               ;L
        low b.1,b.0,b.3
        pause 10
        goto celle2
    cellf:
        if pinc.0=1 then
            pause 100
                if pinc.0=1 then         ;debounce
                    if pinb.4=1 then
                        pause 100
                            if pinb.4=1 then
                                goto cellaf
                            endif
                    endif
                endif
        endif
        if pinc.4=1 then
            pause 100
                if pinc.4=1 then         ;debounce
                    if pinb.4=1 then
                        pause 100
                            if pinb.4=1 then
                                goto cellef
                            endif
                    endif
                endif
        endif
        goto cellf2
    cellf2:
        inc w0
        if w0=400 then
            goto main
        endif
        if pinc.0=1 then
            pause 100
                if pinc.0=1 then
                    goto main
                endif
        endif
        high b.2               ;L
        low b.1,b.0,b.3
        pause 10
        goto cellf2
    cellaf:
        inc w0
        if w0=400 then
            goto main
        endif
        if pinc.0=1 then
            pause 100
                if pinc.0=1 then
                     if pinc.1=1 then
                        pause 100
                            if pinc.1=1 then
                                goto main
                            endif
                    endif
                endif
        endif
        high b.2           ;L
        low b.1,b.0,b.3
        pause 10
        goto cellaf
    cellbc:
        inc w0
        if w0=400 then
            goto main
        endif
        if pinc.0=1 then
            pause 100           ;debounce
                if pinc.0=1 then
                    if pinc.1=1 then
                        pause 100
                            if pinc.1=1 then
                                goto main
                            endif
                    endif
                endif
        endif
        high b.0           ;R
        low b.2,b.1,b.3
        pause 10
        goto cellbc
    cellcd:
        inc w0
        if w0=400 then
            goto main
        endif
        if pinc.0=1 then
            pause 100
                if pinc.0=1 then           ;debounce
                    if pinc.1=1 then
                        pause 100
                            if pinc.1=1 then
                                goto main
                            endif
                    endif
                endif
        endif
        high b.0           ;R
        low b.2,b.1,b.3
        pause 10
        goto cellcd
    cellef:
        inc w0
        if w0=400 then
            goto main
        endif
        if pinc.0=1 then
            pause 100
                if pinc.0=1 then         ;debounce
                    if pinc.1=1 then
                        pause 100
                            if pinc.1=1 then
                                goto main
                            endif
                    endif
                endif
        endif
        high b.2           ;L
        low b.1,b.0,b.3
        pause 10
        goto cellef
    celled:
        high b.0           ;R
        low b.2,b.1,b.3
        if pinc.4=0 then     
            pause 100
                if pinc.4=0 then         ;debounce
                    if pinc.3=0 then
                        pause 100
                            if pinc.3=0 then
                                goto main
                            endif
                    endif
                endif
        endif
        goto celled
    
KeithM likes this.
Electronics Point Logo
Continue to site
Quote of the day

-