Optimizing code for PWM efficiency

For some projects, it’s okay to have a microcontroller twiddling it’s thumbs most of the time. When a project requires the cpu to do just one thing over and over, there’s no loss with inefficient code – it either works or it doesn’t. However, if a project requires a microcontroller to do several things at once, like reading sensors, dimming LEDs, and writing serial data out, cpu utilization can become an issue. [Robert] wasn’t happy with the code he used to control a string of LEDs, so he rewrote his code. With the old implementation, [Robert]‘s code used 60% of the cpu time. With the new and improved code, the cpu was only busy 8% of the time.

The code works by using a hardware timer to trigger an interrupt. After calculating the next time it should run again, and changing the state of the data line, the code just sits quietly until it’s needed again.

It’s not a pretty hack, or even one you can hold in your hands, but [Robert]‘s determination in getting a μC to do what he wants is admirable.

Japanese maid mods a furby

This video has been floating around the web recently and we thought that some of you might enjoy it. After a quick google search, we found out that this is [Julie Watai], a singer/model who also enjoys hardware modification. In this video, she’s doing a tutorial on how to circuit bend furbies. No, we have no idea why she is dressed like a maid.  This immediately brought to mind that Bjork video we saw a few years ago. Enjoy.

Bluetooth media remote in an N64 controller

[Phik] wrote in to share his very first microcontroller project with us. He built a bluetooth remote in an old Nintendo 64 controller to control an audio application on his computer. He had been building up the individual modules with the controller in mind for some time, but initially had no idea what kind of enclosure to put it in. After a failed attempt at stuffing it into an XBox controller(surely there was enough space), he realized he had a broken N64 controller lying around that he cold use. We think he did a fantastic job of mounting it, it looks almost like a commercial product. He documented the construction and testing of each individual module. You can find each of those broken into their own post on his site by checking out the archives. Great job [Phik], especially for your first project!

[Read more...]