Simpler than a Shrimp – Arduino with no crystal

As I mentioned at the end of my previous Arduino post, I want to build my “learning timer” into a stand-alone project, with its own battery and enclosure. While I could just transfer the circuit exactly as it is to some proto board, I thought I’d take the opportunity to see how much more I could shrink it down.

There are a lot of pages on the web with “minimal” Arduino circuits, but (like the Shrimp) most of them are designed for in-circuit programming. If I were to program the AVR ATmega chip elsewhere, and just plop it into the circuit when it’s done, then I don’t need any of that. This enables me to remove the serial header as well as the capacitor and resistor needed to reset the chip once it is programmed.

The next external component to consider is the crystal. Although almost all Arduino circuits use a crystal at 16MHz, the ATmega chip will also work at (roughly) 8MHz using an internal RC oscillator. Removing the crystal is not as simple as just taking it out, though. For the microcontroller to work without a crystal, it needs some internal settings (“fuses”) to be set, and these are normally set for use with a crystal as part of programming the bootloader. Having built an “ISP” programmer last time, I can now program any bootloader I like but, unfortunately, the Arduino IDE did not come with a bootloader for 8MHz RC operation. A bit of searching turned up that I need to add an entry to the file boards.txt located in the Arduino program folder.

The Arduino documentation mentions an entry ATmega328 on a breadboard (8 MHz internal clock), but there is no such entry in the file. I found a few possibilities in Q&A forums, but none were quite complete. To cut a long story short, the final entry which worked for me is:

##############################################################

atmega328bb.name=ATmega328 on a breadboard (8 MHz internal clock)

atmega328bb.upload.protocol=stk500
atmega328bb.upload.maximum_size=30720
atmega328bb.upload.speed=57600

atmega328bb.bootloader.low_fuses=0xE2
atmega328bb.bootloader.high_fuses=0xDA
atmega328bb.bootloader.extended_fuses=0x05
atmega328bb.bootloader.path=arduino:atmega
atmega328bb.bootloader.file=ATmegaBOOT_168_atmega328_pro_8MHz.hex
atmega328bb.bootloader.unlock_bits=0x3F
atmega328bb.bootloader.lock_bits=0x0F

atmega328bb.build.mcu=atmega328p
atmega328bb.build.f_cpu=8000000L
atmega328bb.build.core=arduino:arduino
atmega328bb.build.variant=arduino:standard

# remove this line if you want to program the chip normally
atmega328bb.upload.using=Arduino as ISP

I wanted to use my ArduinoISP to program the microcontroller chip before use, but every time I tried, the code would not even compile, giving pins_arduino.h: No such file or directory. If you get this error, the answer is the line atmega328bb.build.variant=arduino:standard. This line tells the compiler to build using the standard Arduino pin names.

SAM_0209

Now that I have compiled and programmed the microcontroller I need to test it in the simplified circuit. I built it on yet another breadboard (smaller this time, of course), and did not bother with the buzzer for now. My objective was to see if the circuit even works, and the LED array and buttons is plenty for that. Having wired it all up, there remained the question of power. I want this to be small and efficient, so a 9V battery and a regulator (even a low-loss one) was not really an option. Instead, I went for a pair of AAA batteries and a 5V step-up board from pololu. This board is tiny, but does the job admirably. I soldered it to the leads from a battery box and plugged the free ends in to the breadboard. My minimalist learning timer was running!

I think I am now pretty much ready to commit to a soldered version. Aside from the proto-board, wires and the enclosure, the final parts list is as follows:

1 x AVR ATmega 328P
8 x LED
1 x 8-way 470 Ohm resistor pack
2 x momentary buttons
2 x 10K Ohm pull-down resistors for buttons
1 x piezo buzzer
1 x 100 Obm resistor for buzzer
1 x Pololu 5V Step-Up Voltage Regulator U1V10F5
1 x SPST power switch
1 x double-AAA battery box

5 Comments

  1. Hi,

    Nice idea, but as you have an 8Mhz clock, it’s possible to configure the Atmega ( via fuses ) to use low energy, so it would be nicer to use only two AAA batteries without the need to have extra hardware ( essentially if it does’nt exists in many shops / countries ).

    Regards,
    Nader

  2. Pingback: Building a “xino” Arduino clone kit | Raspberry Alpha Omega

  3. This is a pretty decent writeup, thanks for taking the time!
    Looking through your boards.txt entry, I notice that the maximum upload size is ~30kb, leaving room for a ~2kb bootloader. This makes me wonder, IS the bootloader actually required, if you’re not planning to use the serial programming interface? Ultimately, the chip doesn’t care in which language the program was written, as long as it can be compiled into a hex file – this leads me to believe that, perhaps, one could use the Arduino language and IDE without saving space for the bootloader.
    Two kilobytes may be negligible – until you need it. I believe I will do some experimentation with this.

    Also, I know this article is fairly old now, but the atmel avr chips typically only need 5v to run at 16MHz; depending on circuit requirements, the majority of chips can be run as low as 3v3 – micropower units as low as 1.8v. Most chips are also capable of running at frequencies as low as 1MHz.

    Thanks for taking the time on this!

  4. Dear Raspberryalphaomega Team

    Greetings for the day,

    We feel glad to inform you that your website/blog titled (Simpler than a Shrimp – Arduino with no crystal and hyperlink”http://raspberryalphaomega.org.uk/2014/06/12/simpler-than-a-shrimp-arduino-with-no-crystal/”) was covered by our teams on our website www.engineersgarage.com

    The coverage can be locate at (Arduino Without Crystal and hyperlink”https://www.engineersgarage.com/mygarage/arduino-without-crystal”). You may use the same link to share the story among your community/followers.

    If you would like to submit more recently developed projects for review, you may contact us using the link (DIY Reviews, https://www.engineersgarage.com/submit/diy-reviews).

    About EG: 

    EngineersGarage is a community of Electrical & Electronics Engineers which interacts with each other to learn and share technical knowledge. We publish high quality technical content which includes experiments, circuit design, tutorials and articles for the electronics fraternity. Our community comprises of active and loyal audience of design, research and product engineers from industries and hobbyists. 

    Key Statistics

    1. EG currently serves 550k+ visitors every month. 
    2. Registered database of 300k+ engineers.
    3. 1Million+ followers on Facebook.

    Best Wishes

    Team EG

Leave a Reply

Your email address will not be published. Required fields are marked *