Author Topic: Help building my first robot!  (Read 7719 times)

0 Members and 1 Guest are viewing this topic.

Offline DomoArigatoTopic starter

  • Full Member
  • ***
  • Posts: 54
  • Helpful? 1
Help building my first robot!
« on: December 04, 2006, 01:22:40 PM »
I’m new to robotics and was hoping someone could help me choose the parts for my first robot.  My challenge is I only know basic electronics, enough to decipher generally what a simple circuit is doing and that’s about it.  My goal is to start with a simple mobile robot based off of a PIC MCU with maybe a sensor or two.  I’m good with C and I’m familiar with programming assembly and machine code, but I’ve never used an MCU before. Here’s what I’m thinking:

-Build a power regulation circuit straight off the SR site.
-9.6 volt battery pack
-Hacked RC car with Ackerman steering
  (it’s got a dc motor and some sort of left/right electromagnet for the front wheels)
-Solarbotics L293D Motor Driver
  http://www.solarbotics.com
-PIC16F877A Proto Board from CCS
  http://www.ccsinfo.com/product_info.php?products_id=16F877Amp
-Front and rear touch sensors

Then:
-CCS Command Line Pic Compiler
-ICD-U40 In Circut Debugger

I really don't know if I'm getting the right microcontroller, compiler, or programmer/debugger.  I like the idea of a proto board, but I don't want to pay 40$ for every robot I build when the MCU is only like 5$.  Also, it looks like the CCS programmer (if that's even what it is) simply connects to the protoboard, what if I wanted to program another MCU?  Any direction anyone can offer would be GREATLY appreciated.  I just want to get to the point where I can start programming. Thanks!



Offline JonHylands

  • Expert Roboticist
  • Supreme Robot
  • *****
  • Posts: 562
  • Helpful? 3
  • Robot Builder/ Software Developer
    • Jon's Place
Re: Help building my first robot!
« Reply #1 on: December 04, 2006, 01:56:27 PM »
I would strongly advise against getting that board from CCS. Try this one instead:

http://www.junun.org/MarkIII/Info.jsp?item=3#

Same micro-controller, but in DIP format. You can also buy more of the PICs from them that are pre-programmed with a bootloader:

http://www.junun.org/MarkIII/Info.jsp?item=12

That way you don't need a programmer as well.

Note that the CCS board does not include the compiler, which is $125. I use the CCS compiler for my PIC stuff, and I love it.

You can also look into the AVR line, if you're more of a "make" kinda person, you can get a version of gcc for it, and cheap programmers, and so on.

http://www.newmicros.com/cgi-bin/store/order.cgi?form=prod&cat=tiniavr

- Jon

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,703
  • Helpful? 173
    • Society of Robots

Offline DomoArigatoTopic starter

  • Full Member
  • ***
  • Posts: 54
  • Helpful? 1
Re: Help building my first robot!
« Reply #3 on: December 04, 2006, 11:13:46 PM »
Thank you very much for the replies.  I think I'll look into AVR.  It looks like it'll be cheaper, and I read that the C compiler is a lot closer to ANSI C.  So that would be nice.  The proto boards at spark look really nice too.  I didn't really think of AVR before, but maybe thats the way to go.

Offline JesseWelling

  • Expert Roboticist
  • Supreme Robot
  • *****
  • Posts: 707
  • Helpful? 0
  • Only You Can Build A Robot!
Re: Help building my first robot!
« Reply #4 on: December 05, 2006, 12:25:25 AM »
if i'm not mistaken...the avr-gcc is ansi C because ATMEL made their AVR cores to be C code friendly.
AVR's are the way to go in my book (I've always recommended them over pic's) because of their development environments and
the fact that you can develop code on Linux or Windows (Mac?).

If you choose the AVR id grab a Robostix here: http://gumstix.com/store/catalog/product_info.php?products_id=139
It's a pretty good value for the engneering that goes into such a thing
« Last Edit: December 05, 2006, 12:28:26 AM by JesseWelling »

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,703
  • Helpful? 173
    • Society of Robots
Re: Help building my first robot!
« Reply #5 on: December 05, 2006, 10:43:50 AM »
my only complaint about avr's is the lack of online documentation and sample code. because they are newer than pics, its hard to find sample code to help you along. i tried them out last year and struggled (the winavr software version at that time was really buggy too, causing additional frustration).

avr's are often slower than the pic, but usually have more memory than a pic. depends on your requirements.

im going back to avr again in the coming months, as it better fits my requirements for my current robot im working on . . .

Offline JesseWelling

  • Expert Roboticist
  • Supreme Robot
  • *****
  • Posts: 707
  • Helpful? 0
  • Only You Can Build A Robot!
Re: Help building my first robot!
« Reply #6 on: December 05, 2006, 10:48:58 AM »
This has been pretty helpful to me.
http://hubbard.engr.scu.edu/embedded/avr/avrlib/docs/html/index.html

So has this but this is for more software type guys.
http://www.freertos.org/

Offline JonHylands

  • Expert Roboticist
  • Supreme Robot
  • *****
  • Posts: 562
  • Helpful? 3
  • Robot Builder/ Software Developer
    • Jon's Place
Re: Help building my first robot!
« Reply #7 on: December 05, 2006, 11:44:38 AM »
avr's are often slower than the pic, but usually have more memory than a pic. depends on your requirements.

Actually, that's not really true (avrs slower than pics). PICs often run at faster clock speeds, but internally PICs execute one instruction every four clock cycles. So, for example, the PIC 16F87x series (which I use all the time) runs at 20 MHz, but only executes 5,000,000 instructions per second.

The AVR, on the other hand, runs one instruction per clock cycle. Taking an ATMega128 (which I have in my Robostix) which runs at 16 MHz, executes 16,000,000 instructions per second.

The PIC would have to be running at 48 MHz just to catch up to that AVR.

As well, from an assembler point of view, the PIC has a very small instruction set (~35 instructions), whereas the AVR has over 100. The AVR also has 32 general purpose registers, including a couple 16 bit ones in there. The PIC has one register, which makes moving data around in memory cumbersome to say the least.

The AVR is much better suited to modern C compilers, but there's a huge pile of example code and experience out there for PICs. I use PICs because the AVR wasn't available when I started, and I have 9 years and several hundred dollars worth of tools invested in PICs. If I was starting over again now, I wouldn't hesitate to choose AVR.

- Jon

Offline DomoArigatoTopic starter

  • Full Member
  • ***
  • Posts: 54
  • Helpful? 1
Re: Help building my first robot!
« Reply #8 on: December 05, 2006, 01:30:27 PM »
I've decided I'm going to give AVR a shot.  The gumstix board looks sweet.  Is it based off the ATmega128 chip?  If I get the gumstix board, then the only other thing I need is AVR ISP programmer, right?

Offline JonHylands

  • Expert Roboticist
  • Supreme Robot
  • *****
  • Posts: 562
  • Helpful? 3
  • Robot Builder/ Software Developer
    • Jon's Place
Re: Help building my first robot!
« Reply #9 on: December 05, 2006, 02:11:24 PM »
The gumstix is actually a Linux single board computer, with a 400 MHz XScale processor.

The robostix is the thing with an ATMega128. You can plug the robostix into the gumstix, or use it standalone.

If you have a gumstix, you can program the robostix directly from that, but if not, you probably need the programmer. I don't use AVR very much myself, so I can't say for sure.

Lots of info here: http://docwiki.gumstix.org/Robostix
Also: http://docwiki.gumstix.org/Robostix_ISP

- Jon