Society of Robots - Robot Forum

Electronics => Electronics => Topic started by: Trumpkin on December 03, 2007, 05:13:25 PM

Title: best overall microcontroller
Post by: Trumpkin on December 03, 2007, 05:13:25 PM
I was wondering, what is the best overall microcontroller that you can program in C?
Title: Re: best overall microcontroller
Post by: Steve Joblin on December 03, 2007, 05:35:38 PM
the open-source Arduino
Title: Re: best overall microcontroller
Post by: Rebelgium on December 03, 2007, 05:38:34 PM
OH no, not that question again! There have been huge (internet) battles between AVR and PIC users.
I've looked into this issue multiple times, and read quite a few articles about AVR vs PIC, and I think I'm right to say the only correct answer is:

It depends on your application.

In my experience:
AVR is slightly cheaper, (thus better) but PIC is more widely used (thus more help and examples on the internet).

They are both programmable in C btw.

edit:
Quote
the open-source Arduino
The arduino isn't a microcontroller, it's a controller board.
Title: Re: best overall microcontroller
Post by: paulstreats on December 03, 2007, 05:55:21 PM
best in what way?

avr's are cheap and generally c compiler are free for them.
Pic's are more supported but you generally have to pay for compilers.
ARM's are generally a lot faster, but because of small pin pitch not as easy to use for hobby
same with 8051, which you usually have to add your own eeproms to, but it means you can add whatever you lie
microchip Pic has introduced it's new 32 bit PIC to stay up with the more modern markets
Title: Re: best overall microcontroller
Post by: Trumpkin on December 03, 2007, 06:44:20 PM
Is the Arduino useful for robot applications it looks like it's complicated to connect a motor
Title: Re: best overall microcontroller
Post by: airman00 on December 03, 2007, 06:59:52 PM
I think that AVR is the best in the long term  ( you can add it to almost any robotics projects)

But I use PIC because I get them for free as free samples .

The MCUs are basically the same way to connect to a motor - you cannot connect to the MCU directly you need a motor driver
Title: Re: best overall microcontroller
Post by: Trumpkin on December 04, 2007, 08:02:02 AM
I have been trying to find an Arduino robot all I can find are robots that also have another controller board or a breadboard with the Arduino, can you just directly plug in sensors and servos like the $50 robot microcontroller? (the answer is probably really obvious to you guys)
Title: Re: best overall microcontroller
Post by: Trumpkin on December 04, 2007, 08:19:03 AM
Okay, well I found out how to connect 1 servo http://www.arduino.cc/playground/Learning/SingleServoExample but how do you connect multiple servos?
Title: Re: best overall microcontroller
Post by: Ro-Bot-X on December 04, 2007, 08:26:37 AM
Arduino is a really good platform, but lacks power buses for the I/O pins. So you need to build or buy a shield, which is another board, that plugs on the Arduino board. There are special purpose shields, like motor driver, but not sure about shields for servos. Of course you may build a shield from a perf board, but in this case why not build the whole thing yourself...

Here is a way to do it: take a perf board and cut a 4x8 holes piece. Get 3 8 pin headers and solder them to the perf board. Take one 8 pin angled header and solder to the remaining row of the board. Then connect the angled pins with the first row of straight pins, pin one to pin one, pin 2 to pin 2 and so on. After that, connect together all the pins from the third row, this will be the Vcc bus. Then connect together all the pins from the last row, this will be the ground bus. Plug this perf board into the 8 pin digital connector, connect one wire to the ground and one wire to the Vcc.


For people that are looking for prebuilt or augumented micros, Arduino may be the cheapest solution, and has some advantages:
- usb connection (no serial cable or port needed)
- bootloader installed (no need for programmer)
- 16MHz quartz crystal (lots of speed)
- an easy to program software and upload the program to the board (no need to figure out what file to upload, what fuses to change...)
Title: Re: best overall microcontroller
Post by: Admin on December 04, 2007, 10:55:15 AM
If this influences your decision at all, I'll be supporting only the AVR for the next few years :P

(Arduino uses the AVR)
Title: Re: best overall microcontroller
Post by: Trumpkin on December 04, 2007, 11:09:37 AM
my only problem with Arduino is the servo sensor thing would this http://todbot.com/blog/2006/07/11/arduino-breadboard-shield/ work for attaching multiple servos, Im so confused :-[
Title: Re: best overall microcontroller
Post by: Trumpkin on December 04, 2007, 01:44:36 PM
How many servos can Arduino handle without a shield?
Title: Re: best overall microcontroller
Post by: Trumpkin on December 04, 2007, 01:46:41 PM
oh yeah, im guessing that for robotics you would need an nimh battery instead of a 9 volt battery right?
Title: Re: best overall microcontroller
Post by: Ro-Bot-X on December 04, 2007, 03:36:31 PM
How many servos can Arduino handle without a shield?

Directly plugged in, none.
A total number of 20 servos, if you build a power and ground bus for them and you don't use any sensors or serial. Or 12 servos and 6 analog sensors. But to connect anything directly to the board, you need to split the 3 wire connector so that the signal pin will go to one of the ATmega168 pins and the power pins go to the power bus.

oh yeah, im guessing that for robotics you would need an nimh battery instead of a 9 volt battery right?

Because it has a regular voltage regulator, not a LDO, and a diode to protect the board for accidental polarity swapping, it needs a 7.2V NiMH battery pack if you want to drive servos and the electronics from one power source.
But you still use a 9V for the board and a 4.8V up to 7.2V for servos, with a common ground. Or even more, if you are using DC motors and an appropriate motor driver.
Title: Re: best overall microcontroller
Post by: DomoArigato on December 05, 2007, 05:28:15 PM
I've found the robostix board great.  It has an AVR ATMega128 chip on it.  It provides power regulation and easy headers to just plug in sensors and servos.  It has UART headers and 3 LED's + 1 power LED.  The price is obviously more expensive than putting it together yourself, but really it's not that high for what you get.

P.S. I have code for the ATmega 128 I can share if you need it.
Title: Re: best overall microcontroller
Post by: Admin on December 05, 2007, 07:19:22 PM
Ill agree on the robostix . . . Ive never used it, but it looks much better than the Arduino and is definitely worth the $20 extra for what I see . . .
Title: Re: best overall microcontroller
Post by: blueroomelectronics on December 06, 2007, 09:39:06 AM
I prefer the PICs, the 18F2525 (used on my robot kit) has plenty of power to run a small robot. The excellent Swordfish BASIC supports it and has a demo version.
Title: Re: best overall microcontroller
Post by: Nudge on December 08, 2007, 02:00:00 AM
don't forget the Propeller http://www.parallax.com/Default.aspx?tabid=524

Title: Re: best overall microcontroller
Post by: Spoil9 on December 11, 2007, 03:36:39 PM
So if I wanted to do more than 1x project at a time, (or I jsut never complete 1 before starting another...) then the PIC sounds like the best option. I'll pay for the compiler but be able to use that for multiple projects at the same time?
Only question is... does that really work? Can I use 1x good complier to program many different PIC's in C?

blueroomelectronics...
What is the Swordfish BASIC?

- Bill
Title: Re: best overall microcontroller
Post by: Rebelgium on December 11, 2007, 04:07:06 PM
Quote
So if I wanted to do more than 1x project at a time, (or I jsut never complete 1 before starting another...) then the PIC sounds like the best option. I'll pay for the compiler but be able to use that for multiple projects at the same time?
Only question is... does that really work? Can I use 1x good complier to program many different PIC's in C?

blueroomelectronics...
What is the Swordfish BASIC?

- Bill
Offcourse! you can write as many programs as you'd like...
Title: Re: best overall microcontroller
Post by: Spoil9 on December 12, 2007, 06:59:27 PM
So other than ease of programming, what makes the BASIC Stamp so great?
If I want to have more than 1x bot at a time, I need to pay $50 for each microcontroller?
Or if I go the PIC route, then I can spend less than $20 for each controller.

Am I missing something here?
Title: Re: best overall microcontroller
Post by: airman00 on December 12, 2007, 07:46:42 PM
PIC micros are less than 3 bucks each while AVRs are less than   5 bucks

an actual controller board costs more , so you should reuse them on your robots
Title: Re: best overall microcontroller
Post by: Spoil9 on December 12, 2007, 07:52:32 PM
But do you not need a controller board for each PIC to be used?
So what I'm thinking I need is..

1. PIC Programmer
2. Compiler
3. PIC Chips

I write my code in the programmer, use the compiler to "burn" the code to the chip, then I'm good to go?
Title: Re: best overall microcontroller
Post by: bulkhead on December 13, 2007, 04:15:25 AM
don't forget the Propeller http://www.parallax.com/Default.aspx?tabid=524


check this out: http://wulfden.org/PRC/index.shtml
-30 I/O with servo headers built in, with option for current limiting series resistors, DIP switches on each
-breadboard
-jumper selectable servo power source (batt1, batt 2, regulated 5V)
-$45, download IDE from parallax, requires "prop plug" (programmer, $30) or it comes with a serial port adapter if you have a serial port

As for the propeller...it's a microcontroller programmed in either SPIN (high level, like C) or low level assembly (fast, efficient), 80 MHz with 20MIPS in assembly, has 8 cogs (processors) which share global memory, capable of driving a real LCD monitor, analog video signal, etc. It's a nice hobby microcontroller.

For industrial use, atmels are good....
Title: Re: best overall microcontroller
Post by: airman00 on December 13, 2007, 08:10:59 AM
But do you not need a controller board for each PIC to be used?
So what I'm thinking I need is..

1. PIC Programmer
2. Compiler
3. PIC Chips

I write my code in the programmer, use the compiler to "burn" the code to the chip, then I'm good to go?

you don't need a controller board! Just make sure your circuit is correct  ( e.g. Vdd is getting +5 and Vss is getting Gnd )
DId u decide which programming language you will be using yet?
Title: Re: best overall microcontroller
Post by: Ro-Bot-X on December 13, 2007, 11:44:02 AM
1. PIC Programmer
2. Compiler
3. PIC Chips

I write my code in the programmer, use the compiler to "burn" the code to the chip, then I'm good to go?

You write your code in a compiler, compile it and "burn" it to the PIC using the Programmer (a piece of hardware that connects to your PC and PIC pins to transfer the code to it).
Title: Re: best overall microcontroller
Post by: Trumpkin on December 13, 2007, 12:52:00 PM
Can someone please post a pic(s) of an arduino hooked up to multiple servos? 
Title: Re: best overall microcontroller
Post by: ed1380 on December 13, 2007, 02:09:19 PM
google (http://images.google.com/images?hl=en&rls=GGLR,GGLR:2006-48,GGLR:en&resnum=0&q=arduino+servo&um=1&ie=UTF-8&sa=N&tab=wi)  ;D

not several but the concept stays teh same
Title: Re: best overall microcontroller
Post by: Trumpkin on December 13, 2007, 02:17:06 PM
I am to stupid to figure it out from those pictures  :P.
Title: Re: best overall microcontroller
Post by: ed1380 on December 13, 2007, 02:44:47 PM
only one wire from the mcu is connected to teh servo.

the output pin on the mcu is connected to the signal wire.

well and the grounds are connected too
Title: Re: best overall microcontroller
Post by: Mega on December 13, 2007, 02:56:22 PM
http://itp.nyu.edu/physcomp/Labs/Servo (http://itp.nyu.edu/physcomp/Labs/Servo)
Connections are similar for multiple servos.
Title: Re: best overall microcontroller
Post by: Spoil9 on December 13, 2007, 04:32:01 PM
airman00-
I would like to stay with BASIC, but do not want to pay for the Stamp. So I figured I will use C.
Title: Re: best overall microcontroller
Post by: Spoil9 on December 13, 2007, 06:01:58 PM
When looking at the AVR, it says that the 'Boot Logger' software is already programmed. What does this mean?
Title: Re: best overall microcontroller
Post by: airman00 on December 13, 2007, 06:15:16 PM
airman00-
I would like to stay with BASIC, but do not want to pay for the Stamp. So I figured I will use C.

You could use PICBASIC with any PIC microcontroller

but picbasic costs 100 bucks ( however I downloaded it from a torrent website .... ;))

I recommend PIC BASIC
Title: Re: best overall microcontroller
Post by: JesseWelling on December 13, 2007, 08:54:26 PM
When looking at the AVR, it says that the 'Boot Logger' software is already programmed. What does this mean?

This most likely means the boot loader. It's a program that is always on the chip that makes getting your programs onto the chip easier.

So instead of having to use fancy JTAG equipment, you will most likely need a regular serial port. It's a GoodThing but you will want more information about it obviously.

Which AVR is this btw? I use a Robostix (which is an ATmega128, which is to say an AVR) hooked to a Gumstix and I use the I2C (a more specialized kind of serial protocol) to send my boot loader things and it works out all right.
Title: Re: best overall microcontroller
Post by: Spoil9 on December 14, 2007, 12:11:34 PM
Yes, Boot Loader. My bad.
I do not remember where I saw it but it was in another post on this forum and I just wasn't sure what it was.
If I can use PIC BASIC with PIC's, then that is something I am going to look into more as I have no real disere to get into programming as I more perfer the electronics aspect of robotics.

The $100 is not bad for PIC BASIC... but what all does that include? I'm assuming that is just a compiler (but hoping that it's a good one).

Does anyone else have any oppionions on PIC BASIC for simple programming?
(By simple I mean that I am not going to try to use it to program AI, nor speech releated, etc. Just a "If this happens, then do this. If that happens, then do that" sort of programming.)
Thanks to all.

- Bill
Title: Re: best overall microcontroller
Post by: airman00 on December 14, 2007, 12:44:23 PM
Compiler  - http://www.melabs.com/products/pbc.htm (http://www.melabs.com/products/pbc.htm)
Programmer I use http://www.melabs.com/products/usbprog.htm  (http://www.melabs.com/products/usbprog.htm)

PICBASIC is actually pretty complex for the BASIC language http://www.melabs.com/products/pbcis.htm (http://www.melabs.com/products/pbcis.htm)

I personally use PICBASIC Pro, its $250 , but its amazing ! Much more commands and more complex

also, PICBASIC allows you to add assembly code within the BASIC code

Actually, I've seen numerous projects using PICBASIC for speech recognition, AI, and camera equipped robots.


Title: Re: best overall microcontroller
Post by: Trumpkin on December 15, 2007, 02:58:21 PM
It sound like AVR is a ton cheaper than pic, right? Doesn't the pic compiler cost like $100?
Title: Re: best overall microcontroller
Post by: Mega on December 15, 2007, 03:06:02 PM
Quote
It sound like AVR is a ton cheaper than pic, right? Doesn't the pic compiler cost like $100?

That's exactly I started with AVR (Arduino to be more specific), it's cheap and fairly easy which makes it a great start of a journey through the world of robotics. ;)
 
Title: Re: best overall microcontroller
Post by: paulstreats on December 15, 2007, 03:24:11 PM
Quote
It sound like AVR is a ton cheaper than pic, right? Doesn't the pic compiler cost like $100?

and the rest.....

http://www.htsoft.com/purchase/pricelist.php (http://www.htsoft.com/purchase/pricelist.php)
Title: Re: best overall microcontroller
Post by: Spoil9 on December 15, 2007, 06:45:39 PM
This may be just my opnion, but it seems like all MCU's are about the same price. It just depends on wether you pay for the chip or for the compiler or the extra hardware, but in the end I think they all come out about the same.
Title: Re: best overall microcontroller
Post by: airman00 on December 15, 2007, 07:18:04 PM
This may be just my opnion, but it seems like all MCU's are about the same price. It just depends on wether you pay for the chip or for the compiler or the extra hardware, but in the end I think they all come out about the same.

MCUs do cost the same

Compilers and programmer hardware are the ones that cost money

For PIC mcu the compilers and hardwares cost a lot and for the AVR they are much cheaper
s
But, PICs are easier to get ( free samples while AVR is no longer sample) and there is a wider variety of PICs which are suitable for different tasks.

AVR does not have that wide of a selection

My vote is for PIC micro controllers with PICBASIC compiler