2

Can I program an Arduino and then remove the micro-controller from it and use it on a breadboard without reprogramming the micro-controller again?

My steps would be:

  1. create my Arduino code.
  2. I upload the compiled code to the board.
  3. I remove the Ic and use it alone without the whole board.

Will the code be preserved on the microcontroller?

3

Yes. The programming of the arduino microcontroller sets the values inside the FLASH. This is non volatile memory and as such won't be erased by taking out the IC.

Please note that this is assuming a DIP package IC as these can be removed without force, heat and stress. A TQFP, and SMT packages like that, IC might get damaged by moving them in such a way. This doesn't mean it has to be erased, it is still non volatile storage, but the moving process is much more dangerous for the chip.

I would recommend connecting the whole arduino or if you really need the whole chip: designing your own board/circuit which allows you to program the chip without moving it around as this is really tedious and not worth the effort. Also moving the chip around is a ESD hazard.

Also please note that you'll need to add a clock source for the chip to work (most of the time). Or you'll need to enable an internal PLL. It will in any case require more effort on your part to make sure that the MCU can work. Therefore using the whole arduino board is preferable.

  • It's not a PLL, it's an RC oscillator. – Edgar Bonet Oct 25 '19 at 16:36
2

Yes you can do it (as said by Tarick).

Note about clock:

Be sure to program it correctly:

  • Do not add a bootloader if you don't need one
  • Do not use an external oscillator if you don't have one on your new board! This is important, since if you remove it you will not be able to start or programming it again!

So, before you remove the IC, set this on your Arduino (I assume it is an ATMega328):

  • 8MHz internal (leave external only if you have an oscillator in the new board!)
  • Bootloader: no

You will see that you do not have this options if you select a normal Arduino, since it already has an oscillator.

So you should use the board manager and add this: https://github.com/MCUdude/MiniCore

0

As code is stored in the flash memory, your code won't erase until some unexpected happens. But the question might comes in whether your code will work properly or not when you remove microcontroller from arduino board and connect with breadboard.

As you are planning to remove the microcontroller, I am guessing you are using Arduino Uno atmega328 DIP package.

You need to do two things for the proper function of the microcontroller in the breadboard. There are other solutions exist. I always prefer this one as easy.

  1. connect 16MHz crystal with 22p(two) capacitor with the corresponding crystal pin(pin 9 &10). The crystal circuit is straightforward. Searching google might help.
  2. Pull the Reset Pin with VCC using a 10k resistor.
0

Don't forget 0.1uF caps on the VCC and AVCC pins to Gnd. AVCC must also have power on it, either direct to the VCC pin, or thru a filter (small inductor)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy