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.

Micro Audio Player Can Hide Behind A Postage Stamp

The original iPod shuffle was a pretty small device, there’s no doubt about that. However, in the world of miniature audio players, [Chan] is no slouch either.

A few years ago, he set out to construct a micro audio player that used little more than a small microcontroller and a microSD memory card. He chose an ATinyX5 series microcontroller to run the show, utilizing its pair of PWM output pins to directly drive the speakers. Since there is no built-in amplifier, the audio volume is not loud, but it does sound reasonable if you use a set of high efficiency desktop speakers. He does mention that the sound can easily be amplified after passing the signal through a filter, so there is hope for those of you who like your music turned up to 11.

The only downside we can see is that the audio player can only process Wave files, but it’s hard to expect more from a DIY audio player smaller than a postage stamp. It would be great to see what sort of micro-handiwork [Chan] could perform if he were to update his design and build a full-functioning MP3 player based upon this project.

What Development Board To Use?

Here at Hackaday, we see microcontroller based projects in all states of completion. Sometimes it makes the most sense to design systems from the ground up, and other times when simplicity or a quick project completion is desired, pre-built system boards are a better choice. We have compiled a list of boards that we commonly see in your submitted projects, split up by price range and with a little detail for reference.

After reading our list, sound off in the comments or on this forum post, and we may include your board in a follow-up guide at a later date. We will also be giving away 10 Hackaday stickers to the most insightful, the most original, and most useful advice given on the forum, so if you haven’t registered yet, now would be a perfect time. Winners of the sticker giveaway will be selected from the forum thread, and the final decision for prizes will be judged by the wit and whim of the Hackaday writing team. More prize details to follow in the thread. Read on for our guide based on past project submissions.

Continue reading “What Development Board To Use?”

Pure TTL Based Clock

We’ll just say, [Kenneth] really likes clocks. His most recent is a pure 7400 series TTL based one, ie no microcontroller as seen in the past, here, here, and here. The signal starts out as a typical 32,768 crystal divided down to the necessary 1Hz, which is then divided again appropriately to provide hours and minutes.

As far as TTL clocks go, this is nothing too original; until it comes to his creative button interface. By using a not as sexy as it sounds multivibrator, he can produce a clean square wave instead of the figity signals produced from buttons to advance and set the time. Like always, he also provides us with a thorough breakdown of his clock, after the jump. Continue reading “Pure TTL Based Clock”

FAT Support For Any Microcontroller

[Rahul Sapre] sent us a guide to porting EFSL to any microcontroller (PDF). The Embedded Filesystems Library adds FAT support to C compiled microcontrollers. It is targeted at the AVR line of chips but can be adapted to any architecture that works with a C compiler. [Rahul’s] guide will take you through the process of adapting the latest stable 0.2.8 version to new hardware by using a PIC uC as the working example. The non-stable development branch of EFSL is working toward multiple-platform support so consider lending a hand if this interests you.

STM8S-Discovery: Microcontrollers Reach A New Low

A complete microcontroller development kit for little more than the cost of a bare chip? That’s what STMicroelectronics is promising with their STM8S-Discoveryseven dollars gets you not only a board-mounted 8-bit microcontroller with an decent range of GPIO pins and functions, but the USB programmer/debugger as well.

The STM8S microcontroller is in a similar class as the ATmega328 chip on latest-generation Arduinos: an 8-bit 16 MHz core, 32K flash and 2K RAM, UART, SPI, I2C, 10-bit analog-to-digital inputs, timers and interrupts and all the usual goodness. The Discovery board features a small prototyping area and throws in a touch-sense button for fun as well. The ST-LINK USB programmer/debugger comes attached, but it’s easy to crack one off and use this for future STMicro-compatible projects; clearly a plan of giving away the razor and selling the blades.

The development tools are for Windows only, and novice programmers won’t get the same touchy-feely community of support that surrounds Arduino. But for cost-conscious hackers and for educators needing to equip a whole classroom (or if you’re just looking for a stocking stuffer for your geeky nephew), it’s hard to argue with seven bucks for a full plug-and-play setup.

[thanks Billy]

Review: Mbed NXP LPC1768 Microcontroller

mbed is a next-generation 32-bit microcontroller platform. It’s a prototyping and teaching tool somewhat along the lines of Arduino. On steroids. With claws and fangs. Other contenders in this class include the MAKE Controller, STM32 Primer and Primer 2, Freescale Tower, and Microchip’s PIC32 Starter Kit. The mbed hardware has a number of advantages (and a few disadvantages) compared to these other platforms, but what really sets it apart is the development environment: the entire system — editor, compiler, libraries and reference materials — are completely web-based. There is no software to install or maintain on the host system.
Continue reading “Review: Mbed NXP LPC1768 Microcontroller”