My first robot

This is my first complete robot project. It's my take on the "Start Here" project. It's made from K'Nex, with electronics I had mostly on hand.

I used mosfets to build two very basic H-bridges to get power to the two motors. It seems like overkill, but I already had them.

I did have to go out and buy a 5 volt regulator, a battery holder, and a couple of switches. This was about twenty one dollars.


The Sharp IR sensor I used is the digital variety, so although I started writing the assembler to use the ADC on the pic, I didn't use it. I admit, that builing with the K'nex went fairly quick, it isn't as rugged as I'd like.


It constantly scans as it rolls foward. When it detects an obstacle, it stops the motors and looks to the right. If nothing is detected,  it turns that way. If it "sees" something to the right, it looks to the left. Again, if the way is clear, it turns to the left. If both ways are blocked, it will back up, stop and blink an led for help.

Object Avoidance

  • Actuators / output devices: one servo/ two K'Nex geared motors
  • Control method: Full autonomous
  • CPU: PIC16f690 micro controller
  • Power source: Alkaline 12 Volt Battery
  • Programming language: Assembler
  • Sensors / input devices: Sharp IR (the digital one)
  • Target environment: indoor

This is a companion discussion topic for the original entry at

**Cool robot my friend :slight_smile: **

Cool robot my friend :)  Great job!  I like it very much. Keep up the good work.


Thank you! I’m planning my next robot already.

Nice to see another

robot made with a pic and programmed in asm. Thanks for posting your code. I noticed in your comments that you explained the purpose of the RP0 and RP1 bits as page select bits. What you mean is bank select bits. This doesn’t in any way affect your program just thought you might like to correct the comments for anyone new to pic to avoid confusion.When talking about registers it is bank and program memory is page. Did you know that a page on the 16F690 is 2k long? Just as well it’s pesky enough having to worry about which bank we’re in. I’ve found that unless you are really trying to write tight code that the compiler directive “banksel” easier to use. Say you want to make sure you are in the correct bank for ANSEL then instead of bsf or bcf RP0 & RP1 just write Banksel ANSEL. This saves you having to remember which bank registers are in.

Good job I look forward to seeing your next robot.



Thanks for the tips. I didn’t know about the banksel command until after I finished this robot. I will use it in the future. Yes, you are quite correct about the bank versus page issue, but I have seen it commented both ways in the microchip lessons that come with the pickit 2.

Nice robot, Gorf :)Very

Nice robot, Gorf :slight_smile:

Very smooth operation, and good speed as well. Well done.


Thank you very much!

Great program man do you have the project file or the schematic diagram