I'm learning Arduino. I use Arduino Uno board with ATMEGA328-PU. I tried basic codes like LED blink, control of DC motor etc. Arduino board is used only when we program microcontroller, right? I mean, when we finish programming it, we can use microcontroller separately? If it can be used separately, we must have some "external" circuit as replacement for Arduino board, which allow us to use microcontroller in specific application. What type of circuit is used? I'm new in this field so don't blame me because of amateur questions.
5 Answers
Assuming you are going to upload the program into the ATmega328 on the Arduino, then take the ATmega328 out of the socket, and use it in your circuit, then a simple answer is to search for "minimal Arduino circuit"
An example returned by that search is "From Arduino to a Microcontroller on a Breadboard".
It lists:
- a 16 MHz crystal,
- a 10k resistor, and
- two 18 to 22 picofarad (ceramic) capacitors
That is enough to run the chip at the same speed as the Arduino, and the code used on the Arduino to initialise its clock will work unchanged.
This should run okay directly from a battery supply of about 4.5V or 4.8V, or a good 5V power supply.
A better circuit, which runs at the same 16MHz speed as the Arduino is 'Shrimp It'. That shows a similar minimal circuit and a better 'protected' circuit which has a more reliable approach for its power supply. This is all you need to run off a 4.5V (e.g. 3 1.5V) battery power supply.
However, if you don't care about running at 16MHz, you could ditch the crystal and capacitors, and use the internal 8MHz oscillator, that will need the code to be slightly different. For example, the 8MHz clock is 1/2 the speed of the Arduino's standard 16MHz, so code like delay()
will take 2ms instead of 1ms.
Further, the RESET button can be set up so it doesn't need the 10k pullup.
So, with some software changes (search the web for details), an ATmega328 could be used with no external components.
Alternatively, you might want to use a better power supply, for example a voltage regulator with the circuit of the protected 'Shrimp It', and be able to load the program onto the ATmega while on its board.
There are products which bundle that 'standard' set of parts (voltage regulator, plugs and sockets and protected 'Shrimp It' running exactly like an Arduino at 16MHz) with a very compact PCB. They are able to plug directly into a breadboard, and so can be used with veroboard/stripboard (or a PCB) to make the rest of the circuit.
One is a kit called 'Boarduino'from adafruit. That web site gives some details to sow how to do this yourself. It is a convenient-to-use version of the 'Shrimp It', on a compact PCB.
An alternative kit is the "Really Bare Bones Board (RBBB) kit". However it is available as the PCB only, which is the "Really Bare Bones board (RBBB)", though the same supplier as the RRRB kit.
Neither Boarduino nor RRRB has on-board USB upload circuit. However, you can use your Arduino to do that, for example "Using an Arduino as an AVR ISP (In-System Programmer)". Or you could buy a USB to UART cable.
-
Without some capacitor(s) between Vcc an GND the ATMega can sometimes behaving erratic.– GerbenCommented Jan 9, 2016 at 13:37
There are two approaches to this. One is to simply use the Arduino Uno board in your final product! However, if you're making a large number of boards, it may be more cost efficient to develop a custom board with only the features you need. It may be nothing more than a few GPIO pins and a power regulator!
Another thing which can be important in these final products, no matter what board you are using, is that you can permanently burn your program into memory so that it always starts up when power is applied.
Look at the schematics and see which bits you don't need. Leave those out and what's left is what your require. You then would need to design a circuit board for these parts.
Now, who should we blame for your amateur questions? ;^)
-
Thanks a lot for answer! I mean I don't have experience with this so understand me :) English is not my first language and language barrier makes difficulties often :) Best regards– hariCommented Jan 9, 2016 at 2:19
-
1Your English isn't too bad! For one or two projects the ready-made Arduino boards are good value because everything is tested. Building your own circuits is good fun but is expensive and difficult if using surface mount components. If you are going to make, maybe, 20 + of the same device then making your own board might be a good idea. I don't think you are ready for that yet. Commented Jan 9, 2016 at 2:24
-
If you want to buy a cheap almost bare minimum Atmega breadboard, consider a chinese clone of Arduino pro mini. Difficult to fabricate one cheaper yourself.– WirewrapCommented Jan 9, 2016 at 11:41
Arduino board is used only when we program microcontroller, right?
Not necessarily. The Arduino board is useful not only for programming, but because it provides required peripheral circuitry such as power regulation, USB-serial interface, convenient headers, and a crystal.
However, it is perfectly fine to use the Arduino board to program your ATmega328 and then take it out and use it in another circuit.
If it can be used separately, we must have some "external" circuit as replacement for Arduino board, which allow us to use microcontroller in specific application. What type of circuit is used?
All the ATmega328 really needs is a stable power supply. If you're alright running it at 8MHz, you don't need an crystal. If you don't need in-circuit programming, you don't need an ISP connection or any USB-serial stuff.
For more powerful microcontrollers, you might require clock generation circuitry, multiple power rails, debug/programming connections, etc.
See this page on how to put an ATMega329 chip on a breadboard and have it run. I think this will explain things: https://www.arduino.cc/en/Main/Standalone