Can someone give me a basic overview of Arduino, please?

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

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

optiboot is very popular bootloader for most AVRs. Feeware.

hcb:
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.

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

Arduino has a tutorial on how to do what you are asking: https://www.arduino.cc/en/Tutorial/ArduinoToBreadboard

lyndon:

hcb:
I can buy the ATMega328P chips for about 3-4 dollars easily.

I can buy entire Arduinos for less than that!

Well, China will be happy to sell you a very fine thing indeed. Counterfeits and all.

It’s kinda hard to counterfeit something that’s Open Source Hardware…

I’m well aware of the problem of counterfeit parts, but at these prices, I’ll take the risk.

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.

motopic:
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

stevech:
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

lyndon:

hcb:
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

uChip:
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

tinkerspy:
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

darrellg:
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

hcb:
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

I’ve spent hours and hours today messing with this. Here’s what I have so far, somebody explain where I’m wrong, please.

First, one problem may be me; coming from a Microchip/PIC/MPLAB IDE background (but not much of it) I expect to have selections in the IDE for different target chips. With the Arduino, it seems the “different chips” are selected based on the Arduino boards. The Arduino stuff is not a way to program Atmel chips, it’s a way to program certain Arduino boards which implement certain microcontrollers. So, if I choose a certain Atmel chip (say, ATtiny4/5/9/10, for instance), there’s no guarantee I can use the Arduino IDE/software to do this.

Second, the Arduino IDE doesn’ t have (at least in my looking for it) a way to tweak “fuses” for different settings. Specifically, putting a bootloader on a new 328 with the 8 Mhz internal clock, I cannot change it to use an external clock meaning, once I put the bootloader on the chip, I cannot replace it on the Uno board because the chip is set to use the internal clock and selecting the Uno board as the “the board” it fails to upload a sketch. Selecting the (I’m not going to spell this right) Diecimilla/duoina whatever with 8 Mhz onboard clock is what I have to do to then use the Uno with a “new” bootloaded chip. So, once I bootload a new chip set to use its onboard clock, I’m stuck using that onboard clock.

Third, there are a number of bootloaders available but no information I’ve found as to why to use one versus another. The one built into the Arduino IDE works (IDE version 1.7.9) so why would I need another?

All I’m left with is that there is some VERY basic information about how to go from “monolithic”/very simple IC’s to microcontrollers using Arduino and Atmel solutions which I have not found or overlooked.

Where did I go wrong?

Thank you.

–HC

hcb:
While this may read “abrupt”, I don’t mean any offense; where can I find a complete Arduino for less than $3 or $4?

Go on Alibaba/Aliexpress and search for Arduino. I have some ProMicros I got for $2 each @qty 10 ($4 each with USB/serial converter board) and I think the Unos I have were about $5 each at a quantity of 5 or so. Shipping from China runs less than $5, but the shipping time is inconsistent. I received my last order today: it took about 7 days. The previous order took about 3 weeks to get here. I generally buy a lot of stuff that I think I may need so I don’t have to wait so long when I do need it.

You can use the Arduino IDE to program non-Arduino boards, but it can get cumbersome. AVR Studio 6 with the Arduino plugins makes it much easier. I have a Tiny85-based board that I use some Arduino libraries on. Since this is not an Arduino board, I build the code with the Arduino IDE (you can do it in AVR Studio as a non-Arduino project, but it takes a while to fixup all the dependencies manually, so using the IDE is easier), then I find the directory where the .HEX file was saved by the IDE and I use avrdude or Studio 6 to program my board using a 6-pin ISP connector.

That method works once you have it all figured out, but I wouldn’t recommend it for everyday use.

lyndon:
I’m well aware of the problem of counterfeit parts, but at these prices, I’ll take the risk.

So it’s OK to steal intellectual property, use another company’s logo and fake part numbers, and so on?

That’s just nice.

stevech:

lyndon:
I’m well aware of the problem of counterfeit parts, but at these prices, I’ll take the risk.

So it’s OK to steal intellectual property, use another company’s logo and fake part numbers, and so on?

That’s just nice.

So you assume that because parts are low cost they must be counterfeit? I can point you to people who exercise tight control over their supply chain, and still end up with counterfeit components. Paying more doesn’t guarantee squat.