I just uploaded a sketch of a song to my Arduino and it works well. Could I just take the chip out and hook up speakers to it and a power source to play the song? and just get another chip and put it in the Arduino.
-
There are lots of resources on this subject on the internet. It is possible, but requires some engineering. Try searching: "Breadboard arduino" or "barebones arduino". arduino.cc/en/Main/Standalone You'll need: 5V power supply, or circuitry to provide so. 20Mhz clock or use the internal 8Mhz clock. Something to program it with, an USB<->uart converter or ICSP programmer. (Or just put a programmed chip in) And optionally a reset button,– aaaCommented Dec 9, 2015 at 12:19
-
@FuaZe arduinos use 16MHz, not 20mHz.– GerbenCommented Dec 9, 2015 at 16:07
-
@Gerben ah, ofcourse, no idea why I thought of 20Mhz. Thanks for pointing that out!– aaaCommented Dec 11, 2015 at 9:56
2 Answers
Yes and no.
To elaborate, the sketch you downloaded to the chip has been flashed to internal non-volatile memory. So if you were to move it to another Arduino board or other device with the appropriate support hardware, then it should work just fine.
However, if you're intending to directly hook-up speakers to it and a power source, then I highly doubt it's going to work. You really need some support hardware for the chip (such as an external clock - though I think the Atmega328 has an internal clock, decoupling capacitors, amplifiers for the spearkers, etc.).
-
2More specifically, the ATmega328p in a typical full-size Arduino is typically fused to rely on an external clock. While being provided with such a clock it can be re-programmed for internal clock operation, as those used on some of the various smaller boards typically are. Commented Dec 9, 2015 at 3:49
Easy part first: You CAN put another chip on arduino PROVIDED that chip already has a bootloader on it. If it's a raw chip, burn the bootloader on it first. This guide will help.
You CAN connect the programmed chip to speaker PROVIDED you add the minimal circuit components required for an arduino to run. These include - a 16 MHz crystal, two 22 pf capacitors and a 10K resistor. Use the schematic in the bootloader guide. That will work.
Besides this, you will require a 5V power source. You can alternatively use 3xAA cells (4.5V will work perfectly). Alternatively use a wall adapter of 7V or higher and use a linear regulator (7805) to generate a perfect 5V supply for your arduino. You will need this pin mapping diagram to connect the speaker to arduino once you take it out from the board: