SparkFun Forums 

Where electronics enthusiasts find answers.

For the discussion of Arduino related topics.
#189285
Hi, all, I have been looking at the Arduino boards for awhile and I have an Uno but I'm trying to plan stand-alone uses of the Arduino and I'd like to get some clarification, please.

My goal is to develop code on the Uno board then buy the naked chip cheap and have the code run on that new chip so it's inexpensive to build a project and leave it in place with the chip (instead of having an Arduino board for every project or having to buy a bootloaded chip). Reading online gives me a variety of ways to "DIY" an Arduino but I've not read anything which seemed very clear to me. Maybe it's just me.

What I understand (which may or may not be right) is that the Arduino is an implementation of the ATMega chips like the ATMega328P-PU (IIRC, for the Uno). I can buy the ATMega328P chips for about 3-4 dollars easily. What I further understand is that the actual Arduino chips have a bootloader installed which I guess enables it to communicate with the other functions on the board like the USB adapter so it can be programmed from the computer. But some reading about programming the ATMega328P chip indicates that, if you have one which does not have the bootloader installed, you can wire it up to your Arduino board to program it (with the Arduino chip removed from the Arduino board, Uno in my case). This gets me confused because I would think then that one could simply put a blank chip in the Uno board and just program it but apparently it doesn't work that way.

Further reading, as always, "if I understood correctly what I read", indicates there are different bootloaders available for the ATMega328P (and similar chips). If that's correct, why choose one bootloader over another? Another observation I'd like to have cleared up is this: it seems "Arduino" as a brand is a commercial product with its own programming IDE and that IDE is what is enticing about using an Arduino instead of another IDE or chip (like the PIC microcontrollers with Microchip's IDE).

Is there a good discussion of this somewhere you could link me to?

Your time and information is appreciated.

Thank you.

--HC
#189296
You CAN use a Uno board to program a 328 chip. Search for that.
Or other tools, like a ATDragon, etc. google this.
If you just cant figure it out, moderndevice.com will sell you a 328 preprogrammed with a bootloader.

You just can use the name "Arduino" by itself.

See the FAQ, you can use your source developed on the IDE without restriction, just note the use of LGPL with any supporting libraries. Be sure to verify any 3rd party library licenses (I make my libs free to use, I don't care).

https://www.arduino.cc/en/Main/FAQ
#189312
hcb wrote: I can buy the ATMega328P chips for about 3-4 dollars easily.
I can buy entire Arduinos for less than that! It's gotten to the point that the only times in the last 5 years I've bothered to do a PC board design it's because an Arduino would have been physically too large. Besides that, it's simpler to just put an Arduino in everything.

The main attraction of a bootloader is that you don't need an external programmer and it's easier to update the software in the field. If neither of these matters to you (a low-end programmer is like $10), then you don't need the Arduino bootloader and like you said, you can put any chip on a bare Arduino board and program it through the In System Programming (ISP) interface that all Atmel AT devices have.

I have a board I designed years ago that is not an Arduino, but I use the Arduino IDE to take advantage of the libraries to write software for it, then I program the board using ISP.

TBH, while I am a proponent of Open Source Hardware and I love the openness of Arduino libraries, I find the IDE limiting since I'm used to professional software development tooling. I much prefer AVR Studio and the plugins for Visual Studio.
#189313
You can use your Uno as an AVR programmer, similar in functionality to this one: https://www.sparkfun.com/products/9825

With the programmer you can install the bootloader onto your own board by including the AVR programming port (ISP connector) in your design. This can usually be included without sacrificing any pins, but not always.

The Arduino IDE has a bootloader included (I think it is optiboot) with the distribution that works with your 328P (don't forget the "P" when ordering your parts). That bootloader assumes that you are running at 16MHz (or 8MHz if you choose the 3.3v in the board type). If you are running at a different speed then you can still do it but you'll have to jump through some extra hoops.

Probably the easiest way to experiment with this is to wire up a minimal Arduino on a breadboard and use your Uno (or the referenced product) as a programmer. Then get blink going on your breadboard. This is written up well in Nick Gammon's article here: http://www.gammon.com.au/breadboard

NOTE: The Uno has a USB port to talk to the IDE. Your breadboard Arduino probably will not have one because it requires some extra parts. Therefore your breadboard will not talk with the IDE. You can use a USB to serial converter to add that functionality to your breadboard OR you can program your application program using the programmer (choose File->Upload Using Programmer). If you upload your application using the programmer and you don't communicate with the IDE in your app then you really don't need the bootloader.

Good luck with your projects.
- Chip
I do not work for SparkFun
#189410
If you want to use just the chip you could also have a look at the ATtiny line of AVR microcontrollers. They're cheap, you can run them basically without support components and for some projects that don't require much memory or pins they're a great solution. I have a Sparkfun Tiny Programmer and I use it with ATtiny85 and ATtiny84 chips. It all works with the standard Arduino IDE.
#189491
motopic wrote:You CAN use a Uno board to program a 328 chip. Search for that.
Or other tools, like a ATDragon, etc. google this.
If you just cant figure it out, moderndevice.com will sell you a 328 preprogrammed with a bootloader.

You just can use the name "Arduino" by itself.

See the FAQ, you can use your source developed on the IDE without restriction, just note the use of LGPL with any supporting libraries. Be sure to verify any 3rd party library licenses (I make my libs free to use, I don't care).

https://www.arduino.cc/en/Main/FAQ
Thanks for your reply and sorry for turning into a black hole on this end. I was out of town.

I did look up the UNO to program a 328 chip; looks easy enough. I looked up the "ATDragon" but what I found was the AVR Dragon. If that's what you are talking about, that looks a lot like a development board I got about 6 years ago from Microchip when I was trying to mess with the PIC16F84 (I think it was) and the MPLab IDE (IIRC the name). And I can't think of where that little device go to. What was neat, and probably part of my confusion with trying to mess with the Arduino, is that the MPLab IDE could target many different PIC chips using that programmer and the part number of the chip (PIC16F84, etc.) With the Arduino it seems it's like targeting a specific board, not a specific chip. I'll spend some time reading about the AVR Dragon.

Thank you.

--HC
#189492
stevech wrote:optiboot is very popular bootloader for most AVRs. Feeware.
Thank you for the reply. I looked this up. To see if I've got this right; the bootloader is necessary for ISP (In-circuit serial programming), correct? If I don't want to use ISP, I don't have to have a bootloader; is that correct?

--HC
#189495
lyndon wrote:
hcb wrote: I can buy the ATMega328P chips for about 3-4 dollars easily.
I can buy entire Arduinos for less than that! It's gotten to the point that the only times in the last 5 years I've bothered to do a PC board design it's because an Arduino would have been physically too large. Besides that, it's simpler to just put an Arduino in everything.

The main attraction of a bootloader is that you don't need an external programmer and it's easier to update the software in the field. If neither of these matters to you (a low-end programmer is like $10), then you don't need the Arduino bootloader and like you said, you can put any chip on a bare Arduino board and program it through the In System Programming (ISP) interface that all Atmel AT devices have.

I have a board I designed years ago that is not an Arduino, but I use the Arduino IDE to take advantage of the libraries to write software for it, then I program the board using ISP.

TBH, while I am a proponent of Open Source Hardware and I love the openness of Arduino libraries, I find the IDE limiting since I'm used to professional software development tooling. I much prefer AVR Studio and the plugins for Visual Studio.
Thank you for your reply.

While this may read "abrupt", I don't mean any offense; where can I find a complete Arduino for less than $3 or $4? Briefly looking, I found (via Amazon) a Lanmu for about $10 and a IEIK (?) for about $6, both claim to be UNO R3 compatible. Those prices are not bad. I would also like a smaller board for some work I'm trying to do like a flashing light controller which will go on a motorcycle.

I would not mind a separate programmer and, at this time, I have no intention of deploying anything which would need to be updated; my simplistic stuff is for my personal use and it'll either work or it won't.

I used to program professionally in VB 6 (yikes) and did a little with Visual Studio. I haven't used the Arduino IDE that much, but it does not have the feel of the IDE for VB 6 or Studio. I'll look up AVR Studio. One thing that I find confusing partially due to not having experience and partially because I'm thinking of Microchip's MPLab IDE, is that in Arduino we choose a target board, not a target chip. I feel like an idiot. There's a steep learning curve at the beginning, I feel.

Thanks again and I've got some searching to do.

--HC
#189496
uChip wrote:You can use your Uno as an AVR programmer, similar in functionality to this one: https://www.sparkfun.com/products/9825

With the programmer you can install the bootloader onto your own board by including the AVR programming port (ISP connector) in your design. This can usually be included without sacrificing any pins, but not always.

The Arduino IDE has a bootloader included (I think it is optiboot) with the distribution that works with your 328P (don't forget the "P" when ordering your parts). That bootloader assumes that you are running at 16MHz (or 8MHz if you choose the 3.3v in the board type). If you are running at a different speed then you can still do it but you'll have to jump through some extra hoops.

Probably the easiest way to experiment with this is to wire up a minimal Arduino on a breadboard and use your Uno (or the referenced product) as a programmer. Then get blink going on your breadboard. This is written up well in Nick Gammon's article here: http://www.gammon.com.au/breadboard

NOTE: The Uno has a USB port to talk to the IDE. Your breadboard Arduino probably will not have one because it requires some extra parts. Therefore your breadboard will not talk with the IDE. You can use a USB to serial converter to add that functionality to your breadboard OR you can program your application program using the programmer (choose File->Upload Using Programmer). If you upload your application using the programmer and you don't communicate with the IDE in your app then you really don't need the bootloader.

Good luck with your projects.
- Chip
I do not work for SparkFun
Thank you for your reply. I'm getting a clearer view of things as I read through the replies to my post. I will experiment with the breadboard and see what I get. I don't need (at this time) to communicate with the IDE so I'm okay for now with a simple setup.

Thanks again.

--HC
#189499
tinkerspy wrote:If you want to use just the chip you could also have a look at the ATtiny line of AVR microcontrollers. They're cheap, you can run them basically without support components and for some projects that don't require much memory or pins they're a great solution. I have a Sparkfun Tiny Programmer and I use it with ATtiny85 and ATtiny84 chips. It all works with the standard Arduino IDE.
Thanks for the reply. I'm going to pull them up on Atmel's site now. I guess then there's a plug-in for the Arduino IDE which includes the target board which is the Sparkfun Tiny Programmer?

--HC
#189500
darrellg wrote:Arduino has a tutorial on how to do what you are asking: https://www.arduino.cc/en/Tutorial/ArduinoToBreadboard
Thanks for the reply. I did this. I didn't think I was an idiot but I may be wrong.

I did this for the minimal on a breadboard with no external clock.

I wired everything up as shown. I loaded the ArduinoISP sketch, selected Arduino Uno as the board (as I've always done), then AVRISP mkII as the programmer (as it was set for the other sketches I've loaded). I Uploaded the sketch to the Arduino. I then wired in the new chip on the breadboard as indicated, selected ATMEGA 328 on a breadboard w/8Mhz internal clock as the board and Arduino as ISP as the programmer, then I hit Burn bootloader. That ran fine.

Then I replaced the 328 on the Uno board with the new chip with bootloader and reset my board/programmer to Arduino Uno and AVRISP mkII, respectively. I then attempted to upload a sketch to the 328 and it failed.

I repeated this several times with the same result and two different chips. Finally, for grins, I selected the board as Arduino Duemilanove or Diecimila and it uploaded my sketch with no problems and it ran successfully. Why can I not select Arduino Uno as I did before? Is this because it's set to run on it's own internal 8 Mhz clock now instead of the external 16 Mhz clock?

Thank you again.

--HC