Take the 2-minute tour ×
Electrical Engineering Stack Exchange is a question and answer site for electronics and electrical engineering professionals, students, and enthusiasts. It's 100% free, no registration required.

I've been working on an Arduino project. After I get everything working using the Arduino, I would like to move to a solution that does NOT use Arduino. That is, I would like to use a microcontroller without involving the Arduino board. This will allow a single board, no shield solution.

I know there are methods to make my own Arduino on a breadboard, but that's not really what I'm trying to do.

I'm not really how sure how to do this.

Unless there is a better option, I'm leaning towards using the ATmega328, which is used by the Arduino. I understand that development tools are available free or at least not very expensive.

For the purpose of this question, assume I can get +5V to my circuit.

My first question is how to program the MCU. I believe there are two options:

  1. Buy a programmer, program the MCU, and then place the chip in my circuit.
  2. Design my circuit to include support for in-circuit programming.

I'm assuming that if I go with option #1, it's as simple as inserting a programmed chip in my circuit; I don't need anything else. Of course changing the software would be inconvenient.

But for option #2, I'm not sure what I need. From the bit of reading I've done, I think I need a programming cable, and a connector on my board (what type?). Then I guess I (properly) wire the connector to certain pins on the ATmega.

Either way, I will need Atmel studio.

Second, other than the power supply, is there anything on the Arduino that I absolutely need? I guess maybe a reset switch?

share|improve this question
2  
You can use an Arduino to program AVR's. I personally like to use command line tools and a makefile, rather than an IDE. –  jippie Feb 28 at 17:03
1  
This question might be more appropriate for the Arduino Stack Exchange. arduino.stackexchange.com It is now in Public Beta –  akellyirl Feb 28 at 17:11
4  
But my goal is a design without an arduino. –  Rick Feb 28 at 17:46
    
"is there anything on the arduino that I absolutely need?" I think you'll need the UART(aka the serial port) pins, it comes handy for debugging. –  vvy Feb 28 at 18:22
    
Atmel studio is absolutely not required. I program my chips from the command line (and a text editor). Though granted for large projects Atmel studio will definitely make it easier –  Chris Laplante Feb 28 at 18:29

8 Answers 8

up vote 9 down vote accepted

Welcome to the wonderful world of Atmel. Let me offer you some answers to your questions based on my hobby and professional experience.

Do not bother with anything BUT in-circuit programming. Unless you are a perfect coder, removing a chip every time you want to program it is a nightmare. I recommend the AVRISPmkII as an entry level programming tool. The disadvantage is there is no hardware debug supported. An alternative is the dragon but I have no experience with that. I can say that the JTAGICEmk3 is a nice capable debug tool.

Atmel studio is good for programming. It is actually my favorite embedded development environment. You can use CLI tools such as AVRDUDE and AVR-GCC but the IDE takes care of that for you.

IN SUMMARY:

Buy an AVRISP for just programming (easier, plug&play) or a DRAGON (I can not offer advice).

On your board, bring out the ICSP pins to a 6-pin dual row 0.100" header -- the connections are described in this datasheet.

Reset switches are not needed.

share|improve this answer
1  
I've had excellent results with an EvUSBasp. –  Ignacio Vazquez-Abrams Feb 28 at 17:44
    
Once I bring out the ICSP pins on my board, do I have to dedicate them for in-circuit programming, or can I still use them as GPIO pins somehow? –  Ricardo Feb 28 at 18:28
2  
You can use them as GPIO since they share the functions with SPI. The programmer puts the chip in reset then communicates with it. –  HL-SDK Feb 28 at 18:46
1  
Related tutorial series on beginning microcontroller programming. They use the AVRMega and go through the process of wiring up the ISP, and luxurious C code to blink an LED. –  BigHomie Feb 28 at 19:33
1  
@HL-SDK is right that only the RESET pin truly needs to be dedicated for ICSP, but some caution is needed for the other pins as well, i.e. they probably should be used as output pins rather than input pins (so the signals don't get disturbed by outside circuitry in ICSP mode), and whatever's attached to them should be designed not to react adversely to whatever random signal combination the programming traffic sends them. –  microtherion Mar 2 at 18:45

I agree with HL-DSK's comment above. I'd spend the extra money and get a programmer with debug capabilities. I use JTAGICE3, about $110 on digi-key.

Read up on ISP programming here. It will show you how to bring out the SPI connections. The SPI connections on your chip will be in the ATmega datasheet. Look on page 2 for MISO/MOSI/SCK/RESET pins. The programmer needs to be able to control the reset line. Remember to use a pull-up resistor on the reset line so that your chip will run after the programmer is disconnected.

Get yourself a 2x3 header here. Or make your own using breakaway headers.

share|improve this answer
2  
I'll second getting a programmer with debug support. Earlier this month I was thrown into the deep end on a PIC32 project with no prior low level experience. Even with someone else writing the lowest level bit banging functionality, I don't even want to think about how much harder figuring out where my problems were if all I had to see inside was a single red/green LED. –  Dan Neely Feb 28 at 22:03
    
This, once you have professional tools, there is no going back. –  Matt Young Mar 2 at 18:04

You don't have to "graduate" all at once. Here's how I converted:

To start, I kept using an Arduino but converted calls to the Arduino library into register reads and writes, one line at a time, seeing if my programs still worked. This way I got used to using registers and saw that they were not radically discontinuous with the Arduino way of doing things. Arduino functions like digitalWrite() simply manipulate the registers -- you are free to read and write to them directly in your sketches.

My next step was to put an ATTiny 85 on a breadboard and program it with Arduino as ISP (http://highlowtech.org/?p=1695). If you buy a breadboard power supply and use the ATTiny's internal oscillator, this requires laughably little wiring. I used the Arduino IDE to compile but kept using registers as much as I could.

Then, I installed the free Crosspack command line toolchain and compiled a blinky program. After some more trial and error, I managed to program the ATTiny with avrdude only, staying completely outside the Arudino ecosystem.

Once you've attained blinky with the command line tools only, you're free from Arduino. Explore the various peripherals and their registers and soon it'll be totally natural.

After all of this, I often find myself using Arduino because it's faster. I've found that poring over register descriptions kinda sucks; no sense in doing that if you don't have to. It's good to know how to, though.

share|improve this answer

The difference between an Arduino and a bare ATmega328 is only two things. The Arduino Bootloader, and the Arduino libraries. You can code an Arduino with bare C or C++ without using any of the libraries. You can also use assembly instead. The bootloader allows you to load new code through serial without going through the (slightly) more complicated in-circuit-serial-programming (basically SPI).

You can use standard programming libraries and avr-gcc with almost any ide. Contrary to what others might say, coding an Arduino is basically like coding a bare microcontroller, with some added conveniences at the expense of some performance.

share|improve this answer
3  
But you can also use the Arduino bootloader and libraries with a bare ATmega328. –  Ignacio Vazquez-Abrams Mar 1 at 1:37
    
@IgnacioVazquez-Abrams which turns it into a bare-bones arduino, natch. –  Passerby Mar 1 at 1:42

I buy pre-bootloaded Atmega328P chips and program them in-circuit with an FTDI cable and avrdude, identically to how I'd program the Arduino. I like the Eclipse IDE but you can use any environment you prefer - Atmel Studio, the Arduino IDE, emacs, or barefoot on the command-line.

This board is under construction at the point where it is complete enough to test with a Hello program, using the cable for programming, power, and terminal. It will still need its power supply - LM2936 ultra-low quiescient current voltage regulator and a battery connector, in my case - and whatever other on-board components and off-board connections the project will need:

NotDuino

Since you have an Arduino, you could save a little money and use un-programmed chips, using the Arduino to install the bootloader. The nice blue pin-out labels help keep my goof-rate down! I use a 16MHz crystal but if you can run with the internal oscillator your parts count goes down by 3 (the xtal and 2 capacitors).

share|improve this answer

Honest Advice

Arduino is for beginners, there are two ways to go from here

Way 1: Understanding how a micro controller/processor works (preferable approach)

Atmel 8051

By that i mean learning architectures and assembly code(or bare metal) for the micro p/c. If you need a starting point for this I would suggest Atmel 8051 which is a 8 bit micro controller with the most simplest architecture and assembly instruction set. Any other modern 32bit or 64bit processor has a derived form of architecture from it. This micro controller is still being used as part of my graduate coursework because it is a good start point and lot of literature is available.

Oh and kits to create your ISP board are sold (completely assembled kits with processo, solder components to a board kits and you can build the development board yourself requires just a couple of IC's and RS-232 cable/sockets )

Since it is low-tech all components will be cheap.

Way 2: Jump to a hardware-software approach (less preferable)

Raspberry Pi Beagle bone Black

This is the approach for slackers who have dipped into a little bit of assembly and "tapped out" OR people who want to shift to more software than hardware . I would suggest moving to another hobbyist board like Raspberry Pi or BeagleBoneBlack with ARM processors and start doing projects n their creativity.

share|improve this answer

To move from Arduino where the hardware is provided and the software is a C language overlay, I would like to make a few suggestions. I see people have posted some useful answers but I have been where you are and I would do things a wee bit different.

  1. Choose a debugger. Debuggers provide you with the ability to program the microcontroller as well as debug which includes 'step by step' processing, 'breakpoints' which allows you to pause the program at a certain line of code to check what the code is up to. ISP (In-Circuit Programming) is a serial interface, uses 3 pins which is good but does not provide full functionality a beginner would want. JTAG interface uses 4 pins which provides you with basically full functionality in terms of using breakpoints and stuff. People usually lean more towards ISP because its 'relatively' easier to setup but if you ask me JTAG is not difficult to setup, but it also comes down to personal preference. And there is Debug Wire interface which I would like to skip in this discussion because you rather use ISP than debug wire.
  2. Buy a debugger which has both ISP and JTAG functionality. I think you buy once but buy good which will help you in future if you wish to change your design. I recommend AVR Dragon or JTAGICE. Both connect to PC via USB and both provide ISP and JTAG. JTAGICE is a bit costlier than AVR Dragon but I definitely recommend AVR Dragon.
  3. You will find that most Atmel microcontrollers have ISP functionality but not many have JTAG. Small microcontrollers such as AT90S2313 or ATTINY series use ISP series as these are small in size. But if you are looking not only to blink a few LEDs but want to interface with say an LCD screen or a keypad or what have you then I recommend to go in for a slightly bigger microcontroller. If you are using a 5V supply I recommend you ATMega8 or even ATMega16 or ATMega128 (my fav). ATMega16 and ATMega128 have ISP and JTAG interface.
  4. As far as IDE is concerned, I used to use Code vision and AVR Studio but I recommend using Atmel Studio 6.0 or newer which caters to all your needs.

I have a few schematic ideas that I learnt on my own so that you have a clean and smooth interface to your micro. Let me know if you need help.

share|improve this answer

You can use the Arduino board, without using the sandbox libraries and environment, you can program everything yourself directly. If you want to use their bootloader via serial/uart to program, that works fine. But most/all the avr parts can also be programmed another way, with the part held in reset which means it is not brickable. it is quite easy to bit bang spi from an arduino or other microcontroller or with an ftdi break out of some flavor. sparkfun has arduino and non-arduino boards (the 32u for example) that the spi header is obvious. and ftdi breakout boards that you can easily bitbang using ftdi's library or the ftdi library that comes with linux.

The documentation for each part shows the booting options and flash programming options. yes it is not difficult to just buy some parts too and make your own breakout board. I wouldnt do that until you have used an existing breakout or simple eval board and then clone that if need be. Ideally start with a part with an internal rc oscillator, basically power, ground, and programming pins...

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.