I want to learn how to control/program microcontrollers for robotic
application. I came upon Parallax (http://parallax.com/) and saw that
they sold various models of the BASIC Stamp models, as well as various
Other than Parallax...do you recommend other companies? Also, any
feeling on using Parallax as a starting point?
Thanks for your time and advice,
Microcontrollers with a built-in high level language, like the BASIC
Stamp, are great for starting out. There's also the OOPic, which I
personally like, the BasicX, and several others. Support with plenty of
example is important. This is one reason the Stamp is so popular,
because Parallax supports its products very well.
From there I'd look into a microcontroller programmed via high-level
language via a compiler. My personal favorite is the Atmel AVR line of
8-bit microcontrollers, using either Bascom or gcc. There's also the PIC
microcontroller, and it has its own wide variety of compilers.
I started out with the boebot and although I was already advanced in
terms of programming and digital design skills, it was a great intro to
basic robotics, sensors and motion control. Pretty reasonably priced as
well and the support was great. I agree with Gorden, the AVR line is a
good choice after that.
I would also recommend the atmel/bascom route. Being a compiled language you
get the best of both worlds (speed of writing/debugging code and speed of
Also the demo version of bascom allows up to 4Kb code which is alot, believe
My camera controller base (MEGA8515,NE2000 network card + UDP stack, 2 RC
servos, VFD display and some LEDs) fits in about 3.5Kb.
Home of the Atmel based UDP mobile web cam http://www.planet-ian.com
All mails scanned with av-filter.pl (F-Prot / perl)
I don't know if I should take that as a complement or not :).
All I can say is that I've been programing for about 20years on everything
from Z80's and 6502's in assembler up to a large IBM host system (mainly SQL
queries/reports) but I programm ATMELs for "fun".
I also see myself as a lurker in this news group :)
Home of the Atmel based UDP mobile web cam http://www.planet-ian.com
All mails scanned with av-filter.pl (F-Prot / perl)
I highly recommend the Parallax products as well as the company.
Their support to me has been top notch, at times going above and
beyond the call of duty.
My first "real" bot used a Basic Stamp clone - the "counterfeit
controller" by Scott Edwards. When it comes to programming, I tend
to strongly favor C / C++, but there is nothing wrong with PBasic
at all ! I have owned several Basic Stamp products, and have never
had any problem reselling them on eBay after I satisfied my
learning curve and/or wanted to move on to something else, so I
*highly* recommend them.
James C. Deen
Let me answer the sensor question first. I like two companies that sell
sensors. One is www.junun.org, which is very reasonably priced. The
second is www.Acroname.com for a wide range of sensors. I'm sure there
are other resellers of sensors, but these are my personal first choices.
Now. Comparing processors and the companies that make them is and always
will be somewhat of a religious issue. Different people prefer different
models, just as there are loyal Ford, GM, and Chrysler owners, then a
few, who select particular cars for features per price, rather than by
manufacturer. Different strokes for different folks.
Still, since you asked, I feel I can respond. Please note my commercial
bias and understand I have a vested interests in what I say. Don't think
that doesn't mean I am not 100% sincere about what I say, though. For
reference, I am also a Senior Adjunct Instructor teaching robotics at a
university at the upper undergraduate/graduate level.
My company www.newmicros.com sells very reliable microcontrollers, and
we've been doing it about 10 year before Parallax got started at it. Our
current 'Pod controllers about 10 years newer, more-modern design than
the Basic Stamp, are excellent for motion control, and particularly
robotics. I think they are muh a better choice, and I doubt you will
outgrow them anytime soon.
There are many other owners of companies which supply boards which post
here, who also make excellent boards, which I think would be better to
start with than Basic Stamps. Dan Michaels www.oricomtech.com for PICs
and Brian Dean www.bdmicro.com for AVRs come to mind.
Since you ask about using Parallax as a starting point, in my opinion,
if you are a beginner and want to progress to the end goal of being an
advanced beginner, it will do. If you want to really progress beyond
being a beginner, you will need (sooner or later) to leave Basic and
stamps behind. So to me, the issue is how much do you learn using Basic
and stamps, vs., how much do you learn to do wrong. To wit:
The Parallax Basic Stamp can only do one thing at a time. As a result,
you can easily learn how to write a program to control one thing at a
time. (No robot of significant utility can be programmed that way.) You
also learn some very bad design habits when you try to control more than
one thing at a time, in my opinion.
For instance, you can control one RC Servo by using pulse generation
command, PULSOUT. But for the milliseconds the processor is doing this,
you can not do anything else. Then for another 18 to 19 milliseconds,
you should not output a pulse.While the processor is doing this, you can
not do anything else. If you use the PAUSE command to get this quiet
time right, all your processing power is consumed driving that one
Servo. You can't control another thing, not even a second RC Servo on
your robot's other wheel.
Consequently, for a two wheeled robot, you will usually have to cheat on
the timing. You do two PULSOUT commands in a row, then hope other
processing is done roughly at 16 milliseconds. You hope you get close
enough to fool the Servos into seeing it as a valid refresh cycle. Or
you can't drive your robot reliably. And you can forget about reading a
serial channel with a long string, or timing something else like the
echo from sonar ranger. etc.
See their own forums to verify this is the case:
So what do you learn to do here using a stamp? Well, most folks quickly
learn it is easy to program a stamp to do one thing. They then learn its
hard to do useful programming with three or four things going on at
once, and never get much further. Or they conclude they need more micros
to get several things done. Some folks buy a Serial Servo Controller
(about the price of another Basic Stamp) to be able to off load the RC
Servos from the stamp. Later they start splitting up the tasks using
more and more controllers either stamps, or by then, PIC's or AVR's
programmed in some other language, each doing one thing at a time (plus
a second task of talking to a central controller telling them what to do
which is hard to do while controlling the one thing).
But virtually no one learns the "right" way, the way serious roboticists
and programming professionals do multitasking on several complex
problems at once, from a Basic Stamp.
I started learning BASIC as about my fifth language, in the early '70's,
well before it came to microcomputers. I liked it so much (not), I soon
switched to assembler for micros. Since 1980, when I went to work for
Rockwell as a professional, I've seldom touched Basic for my own use.
Also, from my experience as a supplier of Basic as well as other
languages on some of our past products, I've found the programmers using
Basic are often the most lost, and need the most help completing their
Likewise, others have noted problems. For example, most non-beginers are
aware of things like this, taken from Wikipedia BASIC article: "In a
1968 article, Dutch computer scientist Edsger Dijkstra considered
programming languages using GOTO statements for program structuring
purposes harmful for the productivity of the programmer as well as the
quality of the resulting code..."
I think you'll find plenty of amatuers that will vouch for Basic. Many
professionals got their start, or had early experience as did I, with
Basic. But I doubt you can find many serious professionals who would
recommend it today, beyond as a beginner's first stepping stone. I can't
even do that, because I think you learn bad habits which are hard to
Thanks for the mention, Randy.
Regarding the Stamps, I'll be the first to say that they do have
excellent documentation. I was looking through one of their manuals a
few years ago on the Stamp and was very impressed with the
explanations about some of the very basic fundamentals. My impression
was that the documentation was geared to the very uninitiated
beginner, and even then, to those of very limited technical experience
- to the point of explaining the barest of fundamental concepts.
If you fit into that category, they are probably an excellent starting
But I will dispell a myth - even rank beginners can pick up an Atmel
AVR, PIC, or other bare chip or board and start from there. Randy's
Pod's would fit into that category too. You don't have to start in
the childproof section where all the tables have padded corners and
all the outlets are covered and breakables are put high up out of
reach. After all, many folks that come to amateur robotics already
have a good bit of experience in at least one aspect of the field
whether it be programming, electronics, mechanical, or other
discipline. So why choose a route that assumes little or no
experience with limited growth potential?
Admittedly many of my customers are experienced folks who know exactly
what they want. They don't ask for help, they don't need it - they
buy their boards and start right away putting them to use solving real
world problems. However, occasionally I'll get someone who's never
programmed a microcontroller before, but knows some programming, and
wants to learn programming or maybe has a project in mind and chooses
one of my boards as the basis to solve it. There have been sooo many
times I will tell you that after just a few questions that we work
through, usually by e-mail, that person is off and running and never
looking back. I've had folks that started off with many questions
like "how do I control a pin" or "measure a pulse width" or "control a
servo" since they had no microcontroller experience. Many times those
same people end up developing the most amazing things. I will also
say that, on a personal level, it is a wonderful experience to be a
part of that.
What is the common thread among these successful people? First off,
they _want_ to learn and have a burning desire to accomplish their
goals. They are tenacious - there are so many little things to trip
you up when working with computers and robots. When something doesn't
work right the first time, and believe me it rarely does, chances are
there is not some fundamental design flaw or compiler bug that you are
the very first to uncover on your very first project that the many
thousands before you have somehow not noticed. Chances are, it is
something small - wire connected to the wrong pin, ground from your
controller to your sensor/servo/display is not connected, forgot to
enable a pin as an output and thus it can't drive the LED, etc, etc.
You have to be able to not get too frustrated, think logically and
patiently enough to troubleshoot the problem by "eliminating the
impossible", what remains, no matter how improbable, must be the
answer to paraphrase Sherlock Holmes.
Second, they ask questions and _listen_ to the answers. None of us
knows everything and even highly experience folks get stuck every once
and a while. But to get help, you need to be able to formulate your
question such that you can get a useful answer. And it kind've goes
without saying, but you also need to ask your question to the right
audience. Asking the right question to the wrong person or group will
be as fruitless as asking a poorly formed question to a panel of
experts. You know you haven't asked a very good question when you get
a lot of questions back in return. You can tell a thoughtful question
because it really gets to the core of the problem - most likely a
result of a certain level of person's own study. They are learning,
after all, and a certain amount of effort is expected - no pain, no
gain, and all that. A good question also contains enough relevant
surrounding details so that your audience can best answer - but not
too many, "Just the fact, Mam."
Given those two qualities, there is very little you can't accomplish,
no matter what tools you use.
So I personally think that if you stand back and look at who is doing
the cool stuff, those people have those successful problem solving,
can-do personalities. That is the "tool" that all the neat nifty
projects have in common from autonomous helicopters to balancing
robots to lawn mowing robots to ... just do a few Google searches and
you'll find hundreds without trying too hard.
We like to say the project is successful because of this processor or
that microcontroller or sensor X. I'm guilty of it too. I love a
good project which showcases the capabilities of my boards. In a way,
it's kind've a paternal feeling - something I made is doing this
really amazing thing. But the reality is that it's the person or team
behind the project that make it successful, not the processor or
board. The microcontroller or board can make certain things easier,
more reliable, faster, etc, but successful people and teams find ways
to overcome those in spite of the limitations of their tools (and
every tool has limitations). Look at the great architecture
throughout the past few thousand years. Some amazing buildings and
structures have been built with just the barest of tools and the
crudest of materials - the Sistine Chapel, for example - truely works
of art. Today, we have fantastically advanced tools and materials by
comparison, yet it's rare to find a house that will last longer than
the mortgage to pay it off. What does that tell you about gaging
success by the tools? It's the people and their desire to accomplish
Good tools can make things easier, of course, though :-)
The NMIH-0050 are very popular H-bridges. Does quite well up to 20KHz
(by our testing and can even operate at 30KHz with some heating due to
the high speed switching). Also it has good internal protection;
undervoltage, over-current, thermal shutdown, etc. It will save itself
if it can. You really have to slam it around to get it to overheat.
Free wheeling diodes mean the diodes built across the motor in reverse
direction. There are four. One each goes from ground (anode) to motor
terminal (cathode), and one each from motor terminal (anode) to +V
(cathode). What these do is allow the back emf of the motor to be
shunted off into the battery. You know, if you build up a field across
an inductor (in this case the coil of the rotor/stator) and suddenly
switch if off, as the field collapses, the energy has to go somewhere.
The voltage will rise until a conduction path is found. On cheaper
H-bridges, like the original L293 lower power H-bridge for example,
this spike can wind up killing the output transistor. So you put
external diodes across the transistor backwards. So as long as the
voltage behave themselves and stay below the battery voltage, there's
no problem. But if they should kick higher, they reverse bias the
diodes and get dumped into the battery.
Found a write up on it here
if you want to know more
Randy M. Dumse
Caution: Objects in mirror are more confused than they appear.
I'm new to all this and was studying your NMIH-0050 board and the schematic
to try and understand how an H-Bridge works. Maybe some people here can
What stuck me as odd, was that was no input combination that would just
allow the H-Bridge to turn off (i.e., all 4 transistors off). It must
either be on, or in one of the two braking configurations. And then there
was the suggestion that one typical way to drive it would be to simply
alternate between forward and reverse in varying duty cycles to control the
I understand how alternating between forward and brake, or forward and
reverse would work nicely to control the speed, but my first thought was
that it would be wasting a lot of energy and generating a lot of extra heat
by doing that (instead of alternating say between forward and all off).
So, why is it done like that? Is it the nature of DC motors that they
don't actually waste the energy when a forward spinning motor is put into
reverse by the H-bridge? Does it instead (maybe with the help of the
freewheeling diodes) actually just pump the energy back into the battery?
What would happen if you had an H-Bridge that could be turned off, and then
alternated between forward and off to control the speed instead of forward
and brake or forward and reverse? What would be the advantage or
disadvantage of each of these three techniques in terms op all the relevant
factors like torque or energy wasted etc?
And another related question. Do the free wheeling diodes effectively cause
the H-Bridge to go into a brake mode if you turn all for transistors off
(and it's connected to the battery to allow the energy to flow back into
the battery)? In which case the actual brake mode of the H-Bridge is
somewhat redundant and energy wasting since it short-circuits the motor and
causes the energy to just turn to heat in the transistors and motor
Thanks ! That is very informative & a big help !
I will probably be snatching up a couple from you soon!
Parallax is a well-established group; couldn't go too wrong. basicx.com
supplies a similar chip that also works well.
Another source of useful electronics is www.sparkfun.com. Lots of good
stuff from processors to displays to wireless and sensors.
As far as processors go, ARM chips are generally faster than PICs,
Stamps, or AVR; they're also 32 bits instead of 8. If you like a
cookbook approach and want a large hobby community, stay with the
simpler chips. If you want a serious processor and would like compiling
with gcc, then give the ARM chips a look. www.olimex.com supplies
numerous processor boards, but I've not purchased from them, so I can't
vouch for their quality yet. TI has a nice set of DSP processors (e.g.
the TMS320x2812 or the TMS320C6713), but their dev kits are generally
I bought one of the Olimex boards from www.sparkfun.com. I think they carry
the entire Olimex line. I have no complaints about the quality of the board,
but not much in the way of support is available. Several people in my local
robotics club have purchased ARM boards from www.newmicros.com, and been quite
happy with them.
The downside to ARM chips is that the initial learning curve can be steep.
The biggest downside of the ARM chips IMO is that the development
environments can be quite expensive. Even if you use GNU tools, you
still have to program the chips. For that reason the "smaller" chips
are a bit easier to bite off. The PIC and AVR are great, the AVR has
the best advantage in that with the GNU-AVR tool chain you can get free
open source stuff. The Atmel FAE's tell me that the GNU AVR compiler
comes in a close second for code efficiency. Add that to the very
inexpensive chip programmers and learning boards and it is a hard
platform to turn down.
Dennis Clark TTT Enterprises
Polytechforum.com is a website by engineers for engineers. It is not affiliated with any of manufacturers or vendors discussed here.
All logos and trade names are the property of their respective owners.