THP Hacker Bio: David Cook

thp-contestant-bio-david-cook

[David Cook] has been on the front page with gnarly hacks many times. We’re happy to present his Hackaday Projects profile as this week’s Hacker Bio.

His entry for The Hackaday Prize is something of a one-wireless-pair-to-rule-them approach to connected devices which he calls LoFi. We were delighted by his first demo video which is exactly what we envisioned for preliminary entries; [David] explains the concept and how he plans to implement it using a few visual aids to drive the point home.

Join us after the break to find out more about [David]. Oh, if you’re wondering about the times he’s been featured on Hackaday, check out his capacitor/coin cell swap which is one of our favorites.

[Read more...]

Easily Turn Your Raspberry Pi into an FM Transmitter

RasPi FM Transmitter

Have you ever wanted to be your own radio DJ? [Kevin] has made it easier than ever with his Raspberry Pi FM Transmitter program. The program is written in C. [Kevin] has made source code is available along with a compiled binary.

PIFM allows you to load up any audio file and specify a frequency to transmit. The program will then use PWM to modulate the audio sample through the Pi’s GPIO4 pin. [Kevin] claims that the RasPi alone will only transmit around a 10 cm distance. He says that making a simple antenna out of a jumper wire can increase the distance to around 100 meters. All you have to do is hook up the wire to the GPIO4 pin to drastically increase the range.

The legality of such a transmitter will vary from place to place, so be sure to check out your local regulations before you go transmitting audio on regulated frequencies. If this kind of thing is interesting to you, you may want to investigate ham radio. It’s not all Morse code and old fogies. Some people claim it’s a hacker’s paradise.

[via Reddit]

Roman Headgear Looks Less Silly With Lots of Blinky

centurion-project

Look, it’s not Steam-Punk because the period is way out of whack. And we’ve never seen ourselves as “that guy” at the party. But it would be pretty hard to develop The Centurion Project and not take the thing to every festive gathering you could possibly attend. This sound-reactive helm compels party-going in a toga-nouveau sort of way.

[Roman] tells us that it started as a movie prop. The first build step was to remove the plume from the top of it. The replacement — seven meters worth of addressable RGB LEDS — looks just enough like an epic mohawk to elicit visions of the punk rock show, with the reactive patterns to make it Daft. The unexpected comes with the FFT generated audio visualizations. They’re grounded on the top side of each of the LED strips. Most would call that upside-down but it ends up being the defining factor in this build. Seriously, watch the demo after the break and just try to make your case that this would have been better the other way around.

As a final note, this project was written using Cinder. It’s an Open Source C++ library that we don’t remember hearing about before.

[Read more...]

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.

Tips and Tricks for the C Pre-processor

C Pre-processor

The C pre-processor can help you write more concise, easy to follow code. It can also let you create a tangled ball of macros and #defines. [s1axter] wrote up a guide on how to use the pre-processor and keep your sanity.

We’ve seen some neat hacks with the C pre-processor, such as a full adder implementation, but this focuses on more practical usages. First, [s1axter] explains what the pre-processor does with your code by writing simple macros. Next up is arguments, and usage of ‘##’ directive for metaprogramming. Finally, we get a good explanation of why you need to worry about scope when using macros, and how to safe code by using ‘do {} while()’ statements.

If you’re into embedded programming, this guide will help you understand some of the more complex pre-processor techniques out there. It’s helpful for making your code clearer, and abstracting away hardware dependencies in a few lines of code.

.NET for the STM32 F4 Discovery board

Here’s a technique that will let you use the .NET framework on an STM32 Discovery board. [Singular Engineer] was happy to learn that the .NET Micro Framework had been ported for STM32 chips. It’s doesn’t look like the port has hit a stable version yet, but these instructions will be enough to get you up and running. This lets you use managed code in the C# language to program an embedded device: the STM32 F4 Discovery board.

After flashing a new bootloader to the board a driver needs to be added for Windows to communicate with it. Above you can see that the board will enumerate as ‘STM32 .Net Test’. Once the driver is installed the rest of the firmware can be loaded on the board using a GUI supplied with the NETMF for STM32 package. That takes care of prepping the hardware, the rest is a painless process of configuring Visual Studio to use the board as a target. The ‘Hello World’ application then uses C# to blink an LED.

TinyMatrix derivative uses PIC instead of AVR

[Stu] has a teenage niece whose birthday is coming up and he wanted to give her something unique as a gift. He’s working on an LED matrix pendant that can display pixel graphics, play animations, and scroll messages.

He began the work after drawing inspiration from the TinyMatrix project. That clever design uses a DIP AVR chip soldered directly to the legs of a 5×7 LED matrix. It was powered by a coin cell with the power and ground wires acting as the necklace for the pendant. [Stu] is more comfortable developing using PIC chips, so he based his project on a 16F88. It will not run from a 3V source so he’s got a few issued to work out before the final design is finished.

One thing that’s quite interesting is his side project. After growing weary of hand coding the arrays for each frame of an animation he wrote a GUI in C# that let him design the image and output the code with a few clicks of the mouse.

Follow

Get every new post delivered to your Inbox.

Join 93,839 other followers