Help getting into microcontrollers
Mar 31, 2009 at 4:39 PM Thread Starter Post #1 of 26

trains are bad

Headphoneus Supremus
Joined
Aug 31, 2005
Posts
2,221
Likes
12
I'm at the DIY point where I'm wanting to do things that are impractical to do with simple analog circuits. I want a microcontroller, and whatever programming paraphenalia I need to be able to program it.

I want to be able to do things like get analog inputs from phototransistors or pots, and translate that to numbers that I can do math on and display on a LCD panel. I want to do things like run small electric motors and simple buzzers and so on. I want to be able to have a human interface that can be programmed with simple button/menu system.

I have no idea what kind of microcontroller I want, I only know that I would like a flexible one that has an onboard ADC (more than 8 bits) preferably and a PWM output built-in. And I need to be able to program it. Can anyone tell me what kind of microcontroller to buy and what I need to program it?
 
Mar 31, 2009 at 5:25 PM Post #2 of 26
Check out Arduino - HomePage

Really cheap easy to use setup to get started with.

Other uC I would recommend would be the PIC chips, they are cheap and have a simple instruction set to work with.

Some of the arduino boards have ADC with 10bits of resolution. For most applications that should be more than enough resolution. The ADC builtin to these uC is not meant for sampling audio and processing it, while it can do a little that is not really what they are designed for. Note if you need more you can get an offboard ADC chip to work with more controllers.
 
Mar 31, 2009 at 5:49 PM Post #3 of 26
If you don't want to learn a new programming language, but know BASIC, the BasicX BX-24 will have a very easy learning curve. Downside is they cost $39 plus shipping from one of their distributors. The BX-24 has serial ports for attaching an LCD (for example), built in ADC, and many binary I/O pins.
 
Mar 31, 2009 at 8:03 PM Post #4 of 26
Quote:

Check out Arduino - HomePage


I think I don't understand. That looks like a complete board, and computer software and stuff. It looks like that is a complete board, that uses a microcontroller. It looks really cool and I want one...but for many of my projects (electronic paintball gun or universal remote, for example) using a whole one of those would not be space or money efficient enough. In my mind, microcontrollers are little DIP ICs, that you program in some reduced instruction set language using your text editor of choice, which you write to the onboard flash via serial port, and then you stick the microcontroller in your device/robot/doomsday machine and hope it works. Am I making sense?

Quote:

Some of the arduino boards have ADC with 10bits of resolution. For most applications that should be more than enough resolution. The ADC builtin to these uC is not meant for sampling audio and processing it, while it can do a little that is not really what they are designed for.


The ADC was not for audio, but for reading the output of phototransistors and CdS cells for use in photographic light meters...as you know, photographable light covers a vast range of intensities, so I guessed that 256 values might not be enough. I COULD use an ADC, although the only ones I have found are all 8 bits.

Quote:

If you don't want to learn a new programming language


I'm going to have to learn a new language anyway, I think. I only know enough Java to order lunch and ask where the train station is.
 
Mar 31, 2009 at 8:12 PM Post #5 of 26
Just to put it in perspective, I picked up the BasicX dialect of BASIC in about an hour. so, if you plan to do multiples of a project I would suggest one of the less expensive PICs, but if this is a one-off, and I didn't know how to program a PIC, I'd go with the BasicX BX-24. It is pin compatible to the parralax stamp with much more power and a lower price.
 
Mar 31, 2009 at 8:13 PM Post #6 of 26
Quote:

Originally Posted by trains are bad /img/forum/go_quote.gif
The ADC was not for audio, but for reading the output of phototransistors and CdS cells for use in photographic light meters...as you know, photographable light covers a vast range of intensities, so I guessed that 256 values might not be enough.


I'm going to have to learn a new language anyway, I think. I only know enough Java to order lunch and ask where the train station is.



Well for your use I am betting that 10bits is plenty. FYI - Most cameras even high-end ones only have 8bit ADC per color channel. Course they have 3 of them, but if you filter on a single color intensity then 8bits should be enough for your purpose. I think a green wavelength is considering the standard filter to use for determining intensity of broad human visible light could be wrong though.
 
Mar 31, 2009 at 8:15 PM Post #7 of 26
Quote:

Originally Posted by kuroguy /img/forum/go_quote.gif
Just to put it in perspective, I picked up the BasicX dialect of BASIC in about an hour. so, if you plan to do multiples of a project I would suggest one of the less expensive PICs, but if this is a one-off, and I didn't know how to program a PIC, I'd go with the BasicX BX-24. It is pin compatible to the parralax stamp with much more power and a lower price.


Check out Arduino the dev environment is very simple, and the dev boards are CHEAP.
 
Mar 31, 2009 at 8:28 PM Post #8 of 26
Just jump straight in with some prototyping board and a PIC or AVR. You can make a programmer or buy one just as cheaply. Lots of software for them already, and lots of example projects to learn from. With PIC, you can use assembler, C, or there are a few other languages (JAL springs to mind; similar to PASCAL). AVR has excellent support as well, but I'm not as familiar with it. There's a large array of controllers, so you can get as big or as small as you need. I always think things like the Arduino are just a temporary measure, and you'll come to need a "proper" design soon enough...
 
Mar 31, 2009 at 8:42 PM Post #9 of 26
I'm sorry...I really am a noob. Maybe it's a terminology thing. I don't really know anything about drills, I just know what kind of holes I want.

Quote:

Just jump straight in with some prototyping board and a PIC or AVR.


A prototyping board is a board you put the uC in to program it? PIC and AVR are two kinds of uC? My friend is familiar with AVR so I would like to go with that I guess.

Quote:

I always think things like the Arduino are just a temporary measure, and you'll come to need a "proper" design soon enough...


Even after reading their website, I'm not even sure what an "Arduino" is. If it's a microcontroller, or a programming board for microcontrollers, or if it's a programming language, or some kind of program for programming, or some kind of flightless aquatic marsupial.
 
Mar 31, 2009 at 9:01 PM Post #10 of 26
The Arduino is simply an AVR on a programmer with the I/O pins on headers. It also has its own IDE, programming in Java.

So, without meaning to be rude, I think you should read a bit more before starting off. The prototyping board I meant was a breadboard. You can plug in components without soldering them, so you can test your circuit before committing to it. PICs are uCs made by Microchip, and AVR are made by Atmel (although Microchip bought out Atmel, but the lines are still distinct). I prefer PICs myself, but it's probably a case of what you start out on you stay with; they've both got their pros and cons. The big advantage of PICs is they have the same IDE all the way from the most basic to the most advanced, and arguably a bigger user base. There are loads of books available as well, if you prefer. I started off with The PIC Microcontroller: Your Personal Introductory Course by John Morton.
 
Apr 1, 2009 at 1:49 AM Post #11 of 26
PIC is awful. The architecture is strange, inconsistent across uCs, it's difficult to learn if you come from a 'normal' architecture. The IDE might be the same (AFAIK it is for AVR too), but almost any bit of code requires effort to port to a different uC when I last looked at the architecture. AVR makes much more sense, is better designed and more modern. It has better free development tools. The uCs are quite a bit faster. You can do useful work in more operating systems... About all PIC has going for it is that more of them are available in DIP packaging, the reassigning of I/O in the newest chips, and maybe userbase from the old 16F84 days, but I see few PIC projects compared to AVR or Arduino projects these days.

I would say get started with Arduino. You don't have to go with the full-sized 'official' Arduino - as guzzler says the Arduino is basically just a board with a microcontroller and built-in 'programmer', plus a really nice and easy to use software environment (the IDE is written in Java, but the uC code is C with some preprocessor magic and great libraries). This platform has a great community, and it's probably the easiest way to get started as you get a 'programmer', microcontroller and useful development board for very little money. The software is also rather easy to use compared to pretty much everything else out there, and surprisingly capable for a beginner tool.

Once you've outgrown Arduino you can then use the same hardware to get into bare AVR programming. After that, the sky's the limit and you can go from ARM or whatever and you'll probably have the skills to fumble around until you figure it out.

For something a little smaller that you can still use the Arduino platform with try DC Boarduino with the FTDI USB cable and a cheap power supply from around the house instead. Even if you built it yourself it wouldn't be much smaller for the basic components needed. There are lots of other clones out there with various features, pricepoints and sizes; even the Arduino Stamp which is the same size as a wide DIP package, but includes very little support components.

Summary: If you're just in this to make stuff work and do cool things, go with Arduino. It's very powerful, cheap, has a great community and is by far the easiest solution available. If you're in it to learn how the stuff really works inside, pick an arch (*AVR*, PIC, ARM, 8051, 68HC11, etc...) and go buy a cheap development board, programmer (if necessary), and prepare to read that 600 page user guide and data sheet in full, several times, while you try to figure out why your program isn't working
wink.gif
. Try olimex.com and futurlec.com for well-priced dev boards and programmers.

Edit: Forgot to mention - if you don't want to go Arduino, or you want to build one yourself from bare parts, the USBtinyISP is an excellent and quite cheap programmer for it. It's not quite as nice as AVRISP mkII (which costs $45), but it has all the necessary functionality in a cheap and easy to build package - powered by an AVR no less!
 
Apr 1, 2009 at 2:04 AM Post #12 of 26
Apr 1, 2009 at 2:11 AM Post #13 of 26
Quote:

Originally Posted by jcx /img/forum/go_quote.gif
how about a $20 development system in a usb key fob

MSP430 USB Stick Development Tool - EZ430-F2013 - TI Tool Folder

also 16 bit is too cheap today to waste the time with 8 bit processor limitations



Or get 16 bits extra for only $5!

ET-STM32 Stamp

I think you've got it backwards though. It should say Arduino is too easy to waste the time on anything else unless you're serious about this for uC dev's sake or really need the extra capabilities, and not just to get your stuff working.
 
Apr 1, 2009 at 3:24 AM Post #14 of 26
The Arduino board looks good. It's $30 (with the chip), but since I don't have anything with a serial port, I would need to buy a USB or PCI serial adapter anyway to use a serial-based programming board.

One thing I'm not clear on. It seems like this Arduino board is designed for you to put the whole board in your robot/other project. At $30 a pop, that's a lot for a simple project, plus, the board is way too big for a lot of uC projects.

My question is, can you just use the Arduino board as a fancy programming board, to program your uC, and then pop the uC into your actual project, which could be a much smaller (Altoids sized) battery powered board, and have connections for power, possibly xtal and cap, and all your transducers/motors? I don't have a lot of applications that can either fit or justify the expense of using an entire Arduino board in.
 
Apr 1, 2009 at 4:51 AM Post #15 of 26
Both the Arduino boards I linked are pretty small. The Boarduino DC is about half the price, much smaller, but doesn't include the USB->RS232 IC. The USB Boarduino is still quite a bit cheaper and smaller than the 'official' one and does include it. Both have bare boards available, and so are preprogrammed micros. The stamp of course is even smaller, but lacks most of the useful connectors. If you want to completely build it yourself, you can still use the Arduino environment (just read the documentation, basically Arduino is just an ATmega [several uCs are supported] + xtal + psu, and they rename the pins). The caveat though is that Atmel doesn't ship any AVR uCs with a pre-burned RS-232 bootloader, so you need a full ISP programmer to initially flash the RS-232 bootloader on there. Or you can pay a premium and buy preprogrammed chips for a couple extra bucks.

Or, as already mentioned, you can forget Arduino entirely and just use the avr-libc API instead (or raw assembly if you're man enough). With some C experience and a basic understanding of how hardware peripherals interface with the core it's not really bad at all, avr-libc is pretty maure - but still more datasheet reading than you'd get with Arduino. Consider jcx's comment if you're going down this route, it might be relevant - there are much more powerful micros available for about the same price, but the learning curve is much steeper and they don't have the 'newbie friendly' community. If you go this route though you need some way to either flash them directly or load a bootloader onto them. As I mentioned above, USBtinyISP is the best value way of doing this (there are hacks with the parallel port and such, but this is cheap enough it's worth it); otherwise get an official AVRISP.

I actually find these Arduino boards to be handy. I don't use the Arduino environment or even the RS-232 bootloader, but the $5 boards are a handy way to not worry about wiring a bunch of support components, ISP header etc.
 

Users who are viewing this thread

Back
Top