Trimming The Fat From AVR GCC

avr

[Ralph] has been working on an extraordinarily tiny bootloader for the ATtiny85, and although coding in assembly does have some merits in this regard, writing in C and using AVR Libc is so much more convenient. Through his trials of slimming down pieces of code to the bare minimum, he’s found a few ways to easily trim a few bytes off code compiled with AVR-GCC.

To test his ideas out, [Ralph] first coded up a short program that reads the ATtiny85′s internal temperature sensor. Dissassembling the code, he found the a jump to a function called __ctors_end: before the jump to main. According to the ATtiny85 datasheet, this call sets the IO registers to their initial values. These initial values are 0, so that’s 16 bytes that can be saved. This function also sets the stack pointer to its initial value, so another 16 bytes can be optimized out.

If you’re not using interrupts on an ATtiny, you can get rid of 30 bytes of code by getting rid of the interrupt vector table. In the end, [Ralph] was able to take a 274 byte program and trim it down to 190 bytes. Compared to the 8k of Flash on the ‘tiny85, it’s a small amount saved, but if you’re banging your head against the limitations of this micro’s storage, this might be a good place to start.

Now if you want to hear some stories about optimizing code you’ve got to check out the Once Upon Atari documentary. They spent months hand optimizing code to make it fit on the cartridges.

Making The Worst Linux PC Useful

AVR

After seeing [Dimitry] build the most minimal Linux computer ever, [Kyle] decided he needed one for himself. In true hacker fashion, he decided to take this build for the worst Linux PC one step further: he would add I2C to his version, making it somewhat useful, considering the number of I2C peripherals out there.

This build is based on [Dmitry]‘s ARM Linux computer emulated on an 8-bit AVR. It’s a full-blown Linux computer with 16 MB of RAM courtesy of a 30-pin SIMM, a lot of storage provided by an SD card, all running on an emulated ARM processor inside a lowly ATMega1284p. [Kyle] built this clone over the course of a few months, but from the outset decided he wanted to implement an I2C protocol on this terribly under specced computer.

After booting his computer, [Kyle] eventually got an I2C module loaded by the kernel. With an I2C module and a few spare GPIO pins, he set out to create something to attach to this terribly slow computer – an ancient LED dot matrix display. With a real-time clock, this display became a clock  with the help of a homebrew program written in C. Considering the speed of the emulated processor, the program takes nearly three seconds to read the RTC and display the current time to the display. We’re thinking it was a wise choice to only implement hours and minutes in this clock.

If having a useful computer running at about 10 kilohertz isn’t enough, [Kyle] also compiled the classic text-based adventure Zork. It actually runs, proving you don’t need Megahertz of power to do something useful and fun.

DIY Pellet Fed Boiler is Hot Stuff

pelletburner

[Firewalker] has designed a great pellet burning boiler (translated). Wood and biomass pellets have gained popularity over the last few years. While freestanding stoves are the most popular method of burning the pellets, [Firewalker] went a different route. He’s converted a boiler from what we assume was oil to pellet power. An Arduino controls the show, but don’t hold it against him. [Firewalker] is just using the Arduino as an AVR carrier board.The software is all written in C using AVR studio. The controller’s user interface is pretty simple. A two-line character based LCD provides status information, while input is via buttons. Once the system is all set up, thermostats are the final human/machine interface.

Burning pellets requires a bit of prep. A cleanup of the burn chamber must be performed before each burn. The AVR is programmed to handle this. Once the chamber is clean, new pellets are fed in via an auger system. The burner is monitored with a standard flame sensor. When the fire is up the pellets feed in until the boiler gets up to temp. Then the system enters a standby mode where it feeds in just enough pellets to maintain the flame. When the thermostats stop calling for heat, the whole system shuts down, ready for the next burn.

[Read more...]

HeartBeat Boombox Creates Bio Beats

sophi1

If you happened to be wandering the hall of science during MakerFaire NY, you may have noticed a woman walking around with a rather odd boombox strapped around her neck. That was [Sophi Kravitz] with her HeartBeat Boombox. Thankfully [Sophi] lives within driving distance of Makerfaire, and didn’t attempt to get through airport security with her hardware. She started with three medical grade pulse oximeters. These oximeters output a “beep” for every beat of your heart. [Sophi] rolled her own AVR board running Arduino firmware to capture pulses on their way to the oximeter audio transducer. The AVR uses a sound board to convert the pulses into various percussion sounds. The pulse indicators also activate one of three LED strips.

[Sophi’s] biggest frustrations with the hack were the JST connectors on the LIPO batteries powering the entire system. She found that they fell apart rather easily. We’ve used JST connectors in the past with no problem, so we’re guessing she ended up with one of the many knock off connectors out there. [Sophi] tied the entire system together with a custom milled acrylic plate mounted to the front of the boombox.

The final result was very slick. With three people connected to the finger inputs of the pulse oximeters, some complex beats could be formed. We thought we were listening to dubstep when she first walked by. One feature we would like to see implemented would be the ability to record and play back some of the beats created by the boombox.

The Most Minimal Homebrew Computer

chip

Perfection is achieved not when there is nothing more to add, but when there is nothing left to fail. Going by that metric, [Stian]‘s three-chip 6502 homebrew computer is the epitome of perfection. It’s a real, working, homebrew retrocomputer using only three chips: a CPU, some RAM, and a microcontroller to bootstrap the computer and provide a video output,

The key to this minimalist build is having the entire boot process controlled by an ATMega16 microcontroller, This interfaces to the 6502 through a dual-port SRAM, a 1 kilobyte Cypress CY7C130. This dual-port RAM allows the CPU and microcontroller to access the same bit of memory, making it easy to bootstrap a computer from a bit of AVR code.

Output is provided with [Stian]‘s ATMega video text generator putting a 37×17 characters on any television with an RCA jack. While input isn’t handled yet, [Stian] says it should be possible with his AVR PS/2 keyboard library.

While other 6502 homebrew computers such as [Quinn Dunki] Veronica can reach unparalleled heights of complexity, there is a lot to be said about the minimalism of [Stian]‘s three-chip computer. With some clever coding and a modified parts list, it may well be possible to put a retrocomputer in the hands of everyone with a bare minimum of cost and parts.

Couch to 5K with 1K to spare

In a market full of Fitbits, Misfits, and Fuelbands, it’s easy to get carried away with sophisticated personal fitness tracking technology.  That’s why [André] took a totally different approach with his super simple run tracking device, the C25K machine.

C25K stands for “Couch to 5k” which is a slimmed down exercise schedule designed to gradually bring people who have otherwise no exercise routine up to a level of fitness where they can run a 5k in just 9 weeks.  To keep participants from wearing themselves out too early, the routine specifies a sequence of running and walking periods to be completed in series on specific days.  Though simpler than most fitness plans, it’s still a lot to keep track of especially when you’re sweating so hard you can barely see your stopwatch.

André found a solution using a bare-bones circuit based on the ATTiny2313.  After loading the C25k calendar into its firmware (which takes up less than half of its 2K of flash), he needs only to toggle the dipswitch to select the appropriate day of the program, and the little device (scarcely larger than a key fob) will beep to let him know to switch from running to walking or back again.

Definitely a great project for any hobbyist looking for a geeky way to get in shape.

The Straddler makes AVR breadboarding truly plug and play

the_straddler_avr_programmer

It’s not that breadboarding AVR circuits is difficult. But you have to admit that it takes some time to set everything up. We don’t label the top of our DIP chips so that you know what each pin does just by looking. Which means that wiring up the programmer involves pulling out the datasheet. [Vinnie] found the solution to this problem which is to make one of these interface PCBs for each AVR chip family. The long pins make it easy to drop over the top of your microcontroller, which is where the name comes from.

His first stab at the idea was just a hunk of home etched PCB which broke out the programming pins into the 6-pin ICSP standard. This second rendition uses the 10-pin standard and adds a few extras into the mix. He included decoupling capacitors which need to be used in every circuit anyway. There’s a crystal along with its load capacitors. This clock source is a snap to enable by burning some fuses. If you choose to use the internal oscillator instead this hardware won’t interfere. The LED is used to get you up and running with blinky firmware as quickly as possible. He plans to add jumper in the next revision which can disconnect this components from the I/O pin. Now you just need to add a 10-pin header to that USB keyboard AVR programmer and you’re in business.