4
\$\begingroup\$

I'm using an Atmega328 chip with the arduino bootloader in a very small circuit. The sketch simply plays a tune using the tone() function to play a melody through a piezo speaker on a single pin.

Clearly using this chip is overkill, but the programming environment is so simple for arduino, and easy for me to use. Can I use a Attiny with the arduino bootloader or something similar? What would be the right way to miniaturise this project, so I don't feel like I'm wasting components. If it's a case of using a different chip/environment entirely, where do I start?

(for clarity, I am not using an arduino in the circuit, just the Atmega328 chip)

\$\endgroup\$
6
\$\begingroup\$

Using Atmel chips in the Arduino IDE

For the ATtiny45 and ATtiny85 you can use this library that you put in the same directory as your sketches (make a "hardware" directory, then unzip this in there).

I found lots of things just work, but not everything. These chips are pretty tiny. You only get 4 input/outputs (or 5 if you have a high voltage programming device), and you have to be careful which ones can produce the type of output needed by tone (probably only 2 of the pins). These guys are in the $1.25 to $2.25 range.

You can also use ATtiny2313's, but I've not tried using the Arduino IDE with them. I switched to using AVR style GCC, as its not much harder and if something breaks I know its my fault. The 2313 has a ton more pins (not as many as the ATmega), hardware serial support, etc. It is in the $1.50 to $2.50 range.

The ATmega328p is more in the $3.00 to $4.50 range (and currently is often out of stock).

You can think of the Arduino IDE as consisting of 3 main parts:

  • a nice, reduced programming language for AVR style chips (mostly by providing you with simple to use functions like tone)
  • a nice, easy to use upload mechanism for ATmega and larger ATtiny chips (the bootloader)
  • a nice GUI interface that makes it easy to use the right part when you need it

When you work with the ATtinyX5 chips, the bootloader doesn't work, but you can use an Arduino to program the ATtiny's very easily. The library I linked to makes the first and third parts of the IDE available to you.

If you want something cheaper, but mostly the same as the ATmega328p, I would go with the ATtiny2313. If you want something smaller, then the 8-pin ATtiny85 is nice, but it is not too much cheaper and lacks a lot of the nice features of the ATtiny2313 and the ATmega328p.

I haven't tried the other Atmel AVR product lines, but they definitely have others. Luminet (mentioned in another answer) uses the ATtinyX4 line and has a modified IDE to work with them. They appear to be in the $1.80 to $3.00 range.

\$\endgroup\$
  • \$\begingroup\$ that link to the high-low tech wiki is exactly what i needed, thanks very much! \$\endgroup\$ – fearoffours Oct 4 '10 at 14:41
3
\$\begingroup\$

The Arduino libraries don't actually depend on the bootloader - it's merely a convenient delivery method, if you have the serial connection. In theory you could use most any AVR that has some RAM built in, though I never tried (I tend to write directly with avr-libc). Given the task, however, you'll probably want to pay attention to the fuse settings for clock options as Arduinos tend to run at 8 or 16MHz while the chips often default to roughly 1MHz.

LumiNet uses the Arduino environment ported to the ATtiny84 chip, as an example.

\$\endgroup\$
2
\$\begingroup\$

There are plenty of options for another chip entirely. One to consider are TI's MSP430 value line devices.

TI sell a complete dev kit (programmer + 2 DIP MCUs) called the Launchpad for $4.30.

Like AVR, there's a gcc port. So, it's not a huge leap.

http://processors.wiki.ti.com/index.php/MSP430_LaunchPad_%28MSP-EXP430G2%29?DCMP=launchpad&HQS=Other+OT+launchpadwiki

http://hackaday.com/2010/06/22/ti-makes-a-big-bid-for-the-hobby-market/

http://www.43oh.com/

\$\endgroup\$
  • \$\begingroup\$ Do you know if LaunchPads are shipping? For $5 it seems worth while, but I think mouser is a few months behind. TI direct seems willing to sell me it, but they don't seem willing to tell me when it will ship. Order now for Christmas? \$\endgroup\$ – Jack Schmidt Oct 4 '10 at 14:35
  • \$\begingroup\$ I ordered 12 from digikey, they arrived within 48 hours. People have reported problems with TI's eStore though. \$\endgroup\$ – Toby Jaffey Oct 4 '10 at 14:42
  • \$\begingroup\$ TI's not one of those companies (e.g. Kingbright) where you buy it from their store then get a package from Thief River Falls? :P \$\endgroup\$ – Nick T Oct 4 '10 at 16:36
  • \$\begingroup\$ If you order from digikey, and it's in stock, you'll get it right away. Downside: you pay shipping. I ordered from TI, and it took like 2 months. Upside: free shipping. \$\endgroup\$ – davr Oct 4 '10 at 20:41

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.