7
\$\begingroup\$

Just before I go out and buy an Arduino starter kit, can someone confirm I understand what it is?

As I understand it, I can use a simulator to create the behaviour I want. Once I'm happy with the code I compile it, connect the Arduino Uno to my computer (with a "blank chip attached) and flash the chip. Then I can remove the chip, and put it on a breadboard, or Matrix Strip or suchlike and work it into a project.

Is that right?

\$\endgroup\$
  • 1
    \$\begingroup\$ what you described is essentially a device programmer, such as the STK-500 \$\endgroup\$ – JustJeff Nov 19 '11 at 2:24
10
\$\begingroup\$

No, you misunderstood. The chip isn't blank (also you don't insert the chip into Arduino. It comes with the Arduino). It has a special bootloader which is actually the core of the Arduino platform and which allows Arduino not to have a special programmer to program the chips. So it will not work with blank chips at all. Furthermore you're limited only to chips which are supported by the bootloader or are very similar.

Also from what I can see, the Arduino IDE doesn't have a simulator, so you're out of luck on that point.

The main point of Arduino is that it hides the physical operation of the chip itself from the programmer making it easier to use for those that find it too complicated to start programming the chip directly. It offers a simplified C-like programming language and it has a large library of functions which make it easy to connect various peripherals. The PCB itself is useful since it allows users to have a good quality base from which to make their own devices and saves them the trouble of making a PCB which will drive the AVR themselves or using some type of prototyping board.

Basically what you want is regular Atmel's IDE called AVR Studio which does have a simulator (you can download it freely and check if it suit your needs). On the hardware side, you'll need either a programmer, if the IDE's simulator is fine, or a in-circuit emulator which will allow you to directly debug the code on the chip. The emulator itself is pretty expensive, but there are some other products that will allow you to step through the code too.

Do note that it is possible to make an AVR programmer using Arduino but that isn't a major advantage over other programmers available on the Internet or the official programmer.

\$\endgroup\$
  • \$\begingroup\$ Thanks for this. Is there an alternative that does what I'm thinking of? Say PIC or AVR? I want to be able to "write" my own chip and then use this on a separate circuit. \$\endgroup\$ – Ben Nov 18 '11 at 11:33
  • \$\begingroup\$ @Ben I already wrote about alternatives in my answer. If it doesn't show, try refreshing the page. Arduino uses AVR chips and you can use any standard AVR tools with them. I'm not a PIC user (yet) so I can't give you good recommendation on it, but from what I've seen, the standard PICkit 3 tool has an ICE in it and appears to be cheaper than AVR ICE mkII. \$\endgroup\$ – AndrejaKo Nov 18 '11 at 11:40
  • 1
    \$\begingroup\$ Also if you want a board, then you can take a look at for example this for PIC or this for AVR. They work with bare chips and don't require a boot loader. There are many more alternatives out there, but these two were the first to come to my mind. \$\endgroup\$ – AndrejaKo Nov 18 '11 at 11:42
  • \$\begingroup\$ @AndejaKo - Thanks for all the advice! Really appreciate it! \$\endgroup\$ – Ben Nov 18 '11 at 22:04
  • 1
    \$\begingroup\$ @Ben icarpt.files.wordpress.com/2010/03/minimal_arduino.jpgthis is how easy it is to take the ATMega chip out of the Arduino and place it into your own circuit. In fact, the reset switch and DTR stuff isn't even needed. If you want to buy plain ATMega168 or ATMega328 chips cheaper in bigger quantities from Mouser or Digikey then you can build a USBTinyISP (adafruit.com/products/46) and use it to program them with an Arduino bootloader and burn your sketch or even burn just the sketch without the bootloader. \$\endgroup\$ – nemik Nov 22 '11 at 3:30
5
\$\begingroup\$

Not quite, no.

The Arduino is a whole system in itself.

While it is possible to remove the chip from the board and use it in your own systems this is seldom done.

With the Arduino you program your "sketch" (as they call it) in a subset of C++ based on a system called "Wiring". You then upload this to the Arduino board. The board already has the chip on it, and you leave it there. There are connections on the board to link it to your other systems.

You can change your "sketch" as many times as you like and re-upload it to the Arduino until you get it right.

While there are simulators, they are seldom used as it's easiest to just upload to the Arduino directly and have it interact properly with your external hardware.

\$\endgroup\$
  • \$\begingroup\$ Using the arduino to clone itself into a bare chip is probably a lot more common than pulling the chips off of boards. \$\endgroup\$ – Chris Stratton Nov 19 '11 at 6:02
2
\$\begingroup\$

You can definitely remove the chip from the arduino, and use it on a bare board or in another project. The chip on the arduino uno and older versions of the arduino duemilanove is an atmega328 (some versions have an atmega168). You can find the actual reference to the chip at the atmel website (can't post links because not enough karma) . The thing to take care of is that the pin numbers are actually quite different from those on the arduino board. Here is a page with the actual pinout, in case you want to use it in another project or read up things in the datasheet: http://www.arduino.cc/en/Hacking/PinMapping168 When you remove the chip, be careful to not bend the legs of the chip. I usually use a flat screwdriver I insert under the chip on one side, and carefully wiggle my way halfway through. Then repeat on the other side, et voila, clean pulling of the chip. Be careful when plugging it back in as well, as sometimes one leg gets a bit outside of its receiving slot and bends when pushing it back down.

What makes arduino "special" as a development board is the environment used to program it. Similar to processing (it uses the same code base), it's a kind of simplified frontend to the c++ language. The code you write in the arduino editor gets some stuff added in front and in back, and is compiled using avr-g++ to a working executable. It also gets linked to what is called the "core", which can be found in the folder hardware/cores/arduino in the Arduino folder. It initializes a few things (like timers and serial interface), and implements the helper functions we all know and love: digitalWrite, analogRead, etc... In case you want to know more about avr-gcc programming in general, there are a lot of tutorials around. I can recommend the website http://www.avrfreaks.net/, which has a lot of links and tutorials.

This binary file is then uploaded to the chip on the arduino using a program called avrdude, which again is called automatically by the processing like GUI. This program will upload the binary file through the serial port, to what is called a bootloader on the atmega328. A bootloader is a small program (usually 2kB or 4kB) that is stored permanently on the chip. If you remove it, use it in another board, and plug it back, you'll be able to use the arduino software again. The arduino chip uses a slightly modified version of the stk500 protocol, and requires a patch to avrdude. It takes a bit of will to actually overwrite the bootloader, but that is something that is quite possible. You can then either use a standard programmer to reflash the arduino. You can actually use another arduino as a flash programmer: google for arduino ISP

\$\endgroup\$
1
\$\begingroup\$

You can in fact use the Arduino to clone itself into a bare ATMEGA chip, using the ArduinoISP sketch. Some might consider that an obscure capability, others use it routinely.

Primarily what the Arduino idea gets you is two things: a bootloader in the chip, so that you can load functional programs using a serial port rather than a special programmer tool (most current boards have a built-in USB-serial converter). Secondarily, there's an IDE and set of libraries intended to make embedded development easier for newbies - it's worth noting that not everyone who uses the hardware and bootloader uses the IDE and libraries - some prefer to code for the AVR chip directly.

Additionally, there is a physical/electrical interface design for accesorry "shields" which stack onto the main board and provide a wide range of add-ons (though these generally are not cost competitive with other micro-controllers/boards that have such peripherals built-in)

You can buy Arduino compatible boards from many sources and in many form factors, either assembled or as kits, you can also buy atmega chips pre-loaded with an Arduino or similar bootloader.

\$\endgroup\$
1
\$\begingroup\$

The Propeller micro controller from parallax.com fits what you describe. The "Propeller Educational Kit" comes the Propeller chip, an EEPROM, a USB to Serial plug, breadboard and other few discrete components and a well written and easy to read manual. It takes few minutes to build the circuit on the breadboard and you are ready to write and download programs to the EEPROM. You program it in an easy to learn language called SPIN, as well as PASM (Propeller Assembly).

The Propeller is the very first micro controller I "played" with. I use the kit to program an EEPROM, then put the EEPROM in another "stand alone" Propeller based circuit I built on a stripboard. Stand alone meaning it does not have the USB to serial plug.

\$\endgroup\$

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.