Let's Make Robots!

Yay! The parts have arrived!

Took a couple of days for the parts to trickle in, but the components for the 'start here' bot arrived. I soldered all the pins I'll ever need on the picaxe and, so far, I managed to not solder any wires to the board. Everything uses cables with female connector and pins.

I'm sure this doesn't give the best signal, but right now I'm mostly concerned with being able to reuse and reconfigure parts, largely because I haven't decided on configuration and build. I'm still debating using a servo vs turning the whole bot to look around, what it should look like, etc... For the time being I have the darlington installed.

The initial LED test worked and seeing that led blink during the setup was just great. I went ahead and did some soldering, then went on to test the IR and motors. The parts are still sitting around the table, but it all seems to work great. Unfortunately, it's time for bed and I have to stop playing :/

Here's my test code:


#no_data
#no_table
;b1 = IR reading
;b2 = LED flash counter
;w2 = motor test counter

symbol LEDPIN = 0
symbol IRPIN = 1
symbol LED_FLASH_DELAY=127

init:
    let b2 = 0
    let w2 = 0
    

main:  
    gosub updateLed
    gosub updateSensor
    gosub updateMotors
    goto main


updateLed:
      let b2 = b2 + 1
    if b2 = LED_FLASH_DELAY then      
          high LEDPIN
    elseif b2 = 255 then
        low LEDPIN
    endif
    return

updateSensor:
    readadc IRPIN, b1
;    sertxd("IR ",#b1,13,10)
    return

updateMotors:
    let w2 = w2 + 1
    if w2 > 400 then
        gosub goNowhere
    elseif w2 > 300 then
        gosub goBack
    elseif w2 > 200 then
        gosub goRight
    else if w2 > 100 then
        gosub goLeft
    else
        gosub goForward
    endif
    
    return;
    
goNowhere:
    low 4: low 5 : low 6 : low 7
    return
goForward:
    low 4: high 5 : low 6 : high 7;might need to fix this
    return
goLeft:
    high 4:low 5:low 6:high 7;might need to fix this
    return
goRight:
    low 4:high 5:high 6:low 7;might need to fix this
    return
goBack:
    high 4: low 5: high 6: low 7;might need to fix this
    return


 

 

 

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Both lights and sound. You're on the right track, man.

Dont worry about the connections. I haven't had any trouble using connector pins (at least no problems that could be fixed with soldering). I think that's more of an issue when you operate in the Mhz frequency range. 

You're right, the SRF05 is a much better sensor, but don't let that bother you. Just hook up the IR and make it work. Unless you plan to make a really really speedy robot, the IR sensor will be fast enough to do obstacle avoiding.

Ah thanks. Yeah it's not too bad now that it's mounted on a moving robot. It seems to work well.

I really only wish it had a longer range because I could use it to detect when the bot is stuck against something outside the IR field (ie if motors are on and the distance isn't changing). But it's not terribly important. It was excellent for the first bot :)

 

 

Thank you for the replies :)

Tonight I hooked up a speaker (ripped out of broken headphones) and spent a lot of time creating little chirps and mini-tunes that are triggered randomly. This is much too much fun. I'm already hooked!

I still have the darlington driver in place. I added a 330Ω resistor in line with speaker to control volume a tad and I'm setting the pin on low after playing sound. I read about adding a capacitor in line with the speaker and I'm chosing to be lazy for now and ignore the issue ;)

Tomorrow I'm going to look for a body and assemble it. Then it's time to code navigation. Speaking of which, from what I have seen so far I'm not terribly impressed with the GP2D120 IR Sensor unit. Seems to be very short range and have fairly slow response time. At some point I think I'd like to replace it with the  SRF05. Or better yet, build another robot that uses the SRF05 *smirk*

 

Sounds good man, I wouldn't worry too much about the connectors affecting your signal quality though, unless you plan on adding some sensitive high-frequency or analog data lines in the near future you should be more than fine. Basic digital communication is pretty damn robust after all.
I did not use servos i just made my whole robot turn to look both ways here is the link http://letsmakerobots.com/node/6776