Society of Robots - Robot Forum

Electronics => Electronics => Topic started by: DomoArigato on December 04, 2006, 01:22:40 PM

Title: Help building my first robot!
Post by: DomoArigato 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!


Title: Re: Help building my first robot!
Post by: JonHylands 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
Title: Re: Help building my first robot!
Post by: Admin on December 04, 2006, 08:02:32 PM
microcontroller introduction
http://www.societyofrobots.com/microcontroller_tutorial.shtml

various microcontrollers
http://www.societyofrobots.com/robot_parts_list_microcontrollers.shtml

tons of prototyping boards
http://www.sparkfun.com/commerce/categories.php?cPath=2_9
Title: Re: Help building my first robot!
Post by: DomoArigato 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.
Title: Re: Help building my first robot!
Post by: JesseWelling 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
Title: Re: Help building my first robot!
Post by: Admin 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 . . .
Title: Re: Help building my first robot!
Post by: JesseWelling 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/
Title: Re: Help building my first robot!
Post by: JonHylands 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
Title: Re: Help building my first robot!
Post by: DomoArigato 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?
Title: Re: Help building my first robot!
Post by: JonHylands 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