Interested to program, yet seeking guidence from the learned

Hello everyone,
My name is Phil. I am a CNC machinist and programmer from Florida. I called and talked with Jim at Lynxmotion about getting started with robotics. I explained to him I was looking to learn to program a microcontroller. I have no real need or goals it is just something I’ve always wanted to do. Even since I was a little kid I wanted to do something in electronics. During high school I took some classes and did alright, but there weren’t exactly years of study. At about that time cars became my life and I have been slaving over them since. I always needed something I could not get or buy, so I decided to explore the machine trades realm. I quit my job in construction and went to college using a scholarship I earned in high school. I took a few classes and actually found I enjoy manufacturing, and I would like to think I’m relatively good at it. When graduating college I took on a job running a machine shop where we make sport bike parts. I do it all from drafting, design, programming, to making parts. During college I even worked as a teacher at my college. I taught kids 8-15 years old about robotics. I ran the colleges machine shop and helped kids make parts with the CNC and iron out designs for their remote control, task oriented robots. Even though my focus is manufacturing and making things from metal, I still desire to have more mastery over those little bits of silicon. So, here I am. Robotics is not exactly my goal but it sure looks fun and challenging. I think if it is fun I will continue wanting to learn and continue to push myself to perhaps a point of greater education.

Now that my reasons are clear I would like to ask a few questions. Jim was very helpful in giving his valued advice and also referring me to this forum for perhaps a wider array of opinions. My questions are as follows:
  1. I seek to learn to program microcontrollers. I considered the PIC directly, the basic stamp2, and now the Atom. PIC in assembly seems to be a little above my skill level. I would like to think I’m a pretty smart guy, but I don’t want to set myself up for failure. Am I wrong to think assembly is too hard?

  2. Assuming I’m correct about assembly being a little bit much. What about the Stamp2 or Atom? I understand the atom is faster and holds more code. I read the stamps in school tutorial book online and I understand what I’m reading without actually having the stamp. It all seams reasonable so far. Since the Atom is 90% similar should I just get the atom and dive in?

  3. If I choose the Atom, would my learning be hampered due to the lack of project examples?

  4. Clearly the BS2 has tons of documented projects and data in its long career. Even though the BS2 is old and slow in comparison. Does its shear popularity provide an easier learning experience that will help me step into the Atom at a later date based on a solid footing of knowledge?

  5. Chips all down, buy some books get a PIC and go at it in assembly like a man?

My normal personal Ethos says to take on the fiercest challenge which I see to be assembly. Fortunately, even with my limited years of existence, wisdom tells me to go to the stamp2 or Atom. Build on its lackluster triumph and decide where to go from there. If you guys think the Atom is not any more difficult. I will just take that road and run.

Personally before asking all this I planned to order a SSC-32, carrier board, and a basic atom. Not the pro which I have heard is a little too flakey. I want to know that the chip is stable and I’m making mistakes. Not that the chip is fussy and I could fix the problem with some tomfoolery.

Thanks everyone,
Philip

In terms of learning ease, the STAMP is unparalleled.
If you still want an easy time of it, but want enough processing power for more interesting things, get an ATOM.

But, if you want to save a lot of money and learn a whole lot more (though it is indeed a bit more difficult) get a PIC.

I wouldn’t say that assembler is terribly difficult.
It just puts a different spin on things.
Instead of being able to directly give a virtual “storage space” (a.k.a. variable) a value, you have to do it the way the micro actually works:
First load the literal value into the “Working” register (a register is just a byte of storage) and then transfer that into the register you want it to be in.
Why two steps?
Well, as I alluded to before, that’s the way the micro actually works; it can’t have more than one piece of data on it’s data bus at one time.

It’s little things like that which can seem difficult at first, but become increasingly “duh!” as you progress.
I started programming PICs in C for fun, on my own, and am now taking a class in college that teaches PICs in assembler.
Comparing the two, I’d have to say that assembler is the most rewarding, educationally.
It’s a pain to do very complicated tasks with it, but it’s definitely worthwile for the learning experience.
There were so many misconceptions that grew into habits when I learned C that were immediately dispelled as soon as I started learning assembler.

If you don’t wish to have to learn a new language at the same time that you’re trying to learn a new piece of hardware, then download a copy of the free C18 compiler.
It’s technically an evaluation copy, but I couldn’t even tell you what perks they disable after the evaluation period, since they only seem to have disabled vague things which I’ll probably never need.

If you get comfortable with C, you can always go back and learn it the assembler way as I am now doing.
I’m finding that assembler is a great way to learn, but definitely not what I’d want to… say… program a robot with.
:stuck_out_tongue:

For a programmer, I’d suggest Olimex’s Tiny-ICD2 knockoff from Sparkfun.
It’s cheap enough at only $50, and it’s entirely compatible with the MPLAB software.

For a micro, I’d suggest the 40-pin 18F4620.
As of the last time I checked (about a month ago), that bugger is still one of the best choices for overall performance.
It can operate at up to 40Mhz, has 13 analog converters, a heaping of timers, and 3 dedicated interupt pins.
It’s definitely powerful enough to run with, if not flatten any other similar-sized micro out there.
That’ll set you back another $8 or so.

More importantly, though, both Pete (saipan) and I are currently using these in our projects.
So, if you’ve got questions, you’ve got help only a few keystrokes away.
:wink:

After that, the only other thing you’ll need is a board for the micro itself.
You could take the easy route and buy a kit/premade board, but that isn’t very rewarding.
Methinks the best way to go is to get a breadboard.
Other things you might want:
5V regulator
9V battery
10 Mhz TTL oscillator (your micro can multiply that to the max 40Mhz)
lots of 10k resistors (for pullups/pulldowns)
lots of 1k resistors (for LEDs)
lots of water-clear LEDs (they tend to be more efficient)
a handful of .1uF caps
and whatever caps your 5V regulator says it needs.

Most of this can be picked up at Radio Shack, but I’d suggest www.jameco.com to save money.

If you’d like to see a schematic of a basic setup or wish to see some C18 starter code, feel free to ask.

:slight_smile:

The Stamp is a great first micro. The atom is much better but there is less “beginner” material out there. I started on a Stamp and will be going with a Atom as my next micro.

My programming skills are rather weak so I like easy languages. :laughing:

NickReiser,
Thanks for the encouragement, but I’m pretty sure assembly is a bit much for the first step. I think the BS2 or the Atom will be my way to go. Even though the lynxmotion bot board is practically free and I dont really seek to build a robot, could I perhaps get a programmer elsewhere? I didn’t do the necessary research yet, but appears to me that the serial connection can be hooked up dirrectly to the pins of the BS2 or Atom along with logic power and I can program it. All the I/Os are obviously available at the pins, so can I just breadboard it with a LM7805 and call it a day.

I looked over the “Ping” range finders code and I was trying to figure it out. The math part seems wierd. Is the stamp not capable of division? Which is why values are multiplied?

Also why the heck are there so many variables? Is it just so that you can change one line to swap what pin the output and inputs are on easily? It seems there is alot of unnecessary code that just points all over the place.

Phil

I’m a bit upset at myself for not learning how to use a PIC in the first place. The problem is that since I know how to do the project with a stamp, when I get frustrated trying to use a PIC, I just throw in a stamp to get it working and don’t make much progress learning the PIC.

The questions I think you need to ask yourself are:

  1. How many microcontroller projects do you think you’ll need (at the same time)? How much money do you want to spend on this?

  2. What’s your EE experience? Are you comfortable with grabbing some perfboard or a breadboard and wiring up a new circuit after you envisioned it?

  3. How patient are you? If something doesn’t work do enjoy spending hours going through documentation? Or do you just want to throw it through the wall at that point?

If you are moderately patient and have some EE experience, I would seriously suggest you go with the PIC. Similarly if you have some patience and want to have a lot of microcontrollers, I’d go with the PIC. I’m only advise the stamp is you have very little EE experience, aren’t very patient, or only want to have a few microcontrollers since the price of those stamps add up.

As far as the math goes… The problem with microcontrollers is they are 8-bit, meaning division is integer division. You get things like 3/2 is 1. To actually approximate 16-bit floating point (i.e. decimals 3/2=1.5) you need to do some extra work. I had to implement sine and cosine in 8-bit for my BOE-bot since I added IR motor encoders. I wish I had the MMU unit Parallax now sells at that time, since it wasn’t very fun. Granted I did learn a lot.

I dont think I will be making tons of things using a microcontroller. In fact I can’t think of a single thing to do with it other then I want to learn.

I did some basic theory in school. Ive made a few projects, but I always had guidance. I only ever once just picked up a pile of parts and made something and it was nothing complicated.

I’m okay reading if I have to, but I would like to be sure Im sucessfull.

The above really had me totally sold on the Atom. It just is better, even I can see that. My gripe is the lack of documentation of projects to learn from. I don’t know anything about programming a device like this. I think I will just buy the BS2. As much as Ide like the increased power of the Atom. Im not sure I’m ready to learn that independently. Tis a shame the project documentation is so lacking. The atom really seems to be the superior product and I really want to buy it.

Unless the data I see for the stamp is very much the same for the Atom. This is a point that Im still unsure of. If I were to plop some copy and pasted code from the stamp to the atom will it work?

Thanks,
Phil

I just started out with the Basic Atom and so far am loving it. :slight_smile: I am in the process of perfecting a rover program that uses nothing but an IRPD (IR Proximity Detector) sensor. So far, the program performs wonderfully, even with just one side of the IRPD working properly.

I have programmed professionally in six different computer languages and have had quite a bit of course work in electronics, so I know my way around digital stuff pretty well. I’ll be here writing and debugging new code for the Basic Atom.

I strongly suggest getting one of the Starter Kits, and the Basic Atom Starter Kit is excellent for getting started - you get the Basic Atom chip, the Mini Atom Bot Board, Basic Atom Programming, and 9V and 4 cell AA battery holders plus more jumpers than you will ever need.

I did consider getting a Basic STAMP 2, but it seemed a bit underpowered for what I want to do. I think I made a great choice in starting out with the Basic Atom and can recommend it highly.

I really don’t think the Basic Atom will be any mode difficult to learn than the Basic STAMP 2. We have a very active support group here for all phases of robotics experimentation, so take advantage of that and jump in with the Basic Atom.

You can’t just cut and paste STAMP code into the Atom IDE and expect it to run unmodified, but that’s true between any two different microcontrollers. There will always be some level of modifications to the code necessary to make things work with a different microcontroller. There are several similarities between the STAMP and Atom BASIC langauges and statements though.

I just completed my first robot build (a two wheel BOE-Bot type robot) and wrote/debugged my first program for the Basic Atom and IRPD.

8-Dale

My only real gripe with the stamp is that that are expensive at $40 and up, and to use it in multiple projects you need multiple stamps. This is exacerbated by the fact a PIC that is about 100x more powerful than a BS2 (and 16-bit) costs $6, and low-end PICs can be under $1 in bulk. If you’re only going to have one microcontroller, that isn’t such a problem. However, if you’d want the power of a higher end Stamp be prepared to spend $80. Again, the $6 PIC is more powerful, though not by as much.

Considering you’re concerned with there not being enough documentation or step-by-step examples for the Atom, I’d say you probably should avoid the PIC, since higher-powered PICs are currently giving one of the forum’s resident electronics experts a bit of a problem. Since I’m buying a copy of his kit, I’ll be slugging it out too fairly soon.

I’d say your best bet is to go with the stamp. I’d recommend going to eBay and purchasing a BOE-bot kit for around $75. This gives you a BS2, interface board, cable, Windows software, and the BOE-bot components. It runs about double that on Parallax’s web site. You might want to buy the What is a Microcontroller book if you find the starting examples in the book too hard, but if you’ve already had some EE, you should be fine. After you complete the BOE-bot book quickly you might then want to look into the Stampworks series. If you like the BOE, you might want to look into the Parallax encoders. This is more or less the road I took (both Stampworks and BOE projects), and I feel pretty confident in my knowledge of the Stamp. After completing all of that you should be able to design your own stuff more or less. If you really need inspiration, you can do a web search. One of my favorite advanced learning projects was implementing a Parallel EEPROM reading/programing circuit for 29xxx series chips.

This is not a fair comparison. The stamps and their clones are complete basic microcontrollers on a chip. It’s a hybrid in a DIP like package. This costs more to make, it has a $6.00 PIC or similar on it! :smiley: A pic chip is just an integrated circuit. In order to use it you must provide a ceramic resonator, a voltage regulator, a method of connecting things to the I/O pins, and a board to solder everything on to. You also need a programmer which can be cheap, but still adds to the cost. Yes it’s still probably cheaper, but it’s the ease of getting things going that you are paying for here.

I considered starting out with a BOE-Bot, but am much happier with the path I chose. What I have is actually the same thing as a BOE-Bot, but with far more space (expandable) to put stuff. Heck, it even uses the Parallax continuous rotation servos. What I got costs around half of the price of a BOE-Bot but does not come with any microcontroller. I just added an Mini Atom Bot Board and Basic Atom to my Octabot II chassis. I have also switched the stock wheels for these large buggy wheels (requiring filing of the body for wheel clearance). The BOE-Bot just wasn’t expandable enough for me and did not have enough space.

This Octabot II can become just like a BOE-Bot with the addition of a BOE Development Board and Basic STAMP 2 microcontroller chip.

8-Dale

Great to hear someone interesting in programming!!

I haven’t read the whole topic so sorry if I repeat stuff or not aware of stuff.

For a beginner I would suggest BS or BA as they are in Basic and much easier to program. However, these buggers cost between $40-60 + like a 20$ dev board if you don’t want to make your own or use a bread/perf board.

PICs, Atmels .etc are wonderful little ICs and cost like $1-10 each. You can buy a big batch of like 10 or so on sites like digikey and save a few $. They are great for a project that will need multiple micros (e.g. having a few micros that are each responsible for differen tasks and networked together via rx/tx) To use one you would need to buy a ~$50 programmer. The super high end ones are like $100 but a $50 programmer works just as well. I know there are certain models of PICs that have tutorials for them online on building a cheap ~$10 homemade programmer. PICs and Atmels are programmed in C unless you wanna pay for a C++ compiler (according to Nick as thats what he said to me on AIM before). You can also program PICs with MBasic (same language used by the Basic atom) but this software costs between $100-300 based on what “edition” you want of it.

I am excited to hear there are more users out there that are interested in getting into programming :smiley: I absolutely love the puzzle solving and logic that is used while programmming. Very enjoyful :slight_smile:

I am going to get into using PICs, Atmel chips, and others soon. I am anxiously awaiting easy availability of the AVR32 MPU so I can get into working with that. And of course, I am getting into working with the Parallax Propeller as soon as I get another kit and have it built.

I already have the GNU Tool Chain for the Atmel and AVR chips. :smiley:

I am just getting seriously back into programming after being away from it for many years. Now that I can develop software on my terms for my own projects, programming is becoming fun again. :smiley:

I’ve worked in BASIC, Pascal, APL, and C/C++ as main languages and am getting into Java. There are two microcontrollers that run a subset of Java now (Javalin STAMP and one by Muvium).

8-Dale