A Description of Maddening Battery Terminology

Once again, [Afroman] is here for you, this time breaking down electrolyte and the terminology behind batteries.

Volts and Amps are easy mode, but what about Amp hours? They’re not coulombs per second hours, because that wouldn’t make any sense. An Amp hour is a completely different unit podcast, where a 1Ah battery can supply one amp for one hour, or two amps for 30 minutes, or 500 mA for two hours.

Okay, what if you take two batteries and put them in series? That would double the voltage, but have the same Ah rating as a single cell. Does this mean there is the same amount of energy in two batteries as what is found in a single cell? No, so we need a new unit: the Watt hour. That’s Volts times Amp hours, or more incorrectly, one joule per second hour.

Now it’s a question of the number of cells in a battery. What’s the terminology for the number of cells? S. If there are three cells in a battery, that battery has a 3S rating. You would think that C would be the best letter of the alphabet to use for this metric, but C is entirely different. Nothing here makes any sense at all.

What is C? That’s related to the number of amps a battery can discharge safely. If a 20C battery can discharge 2200mAh, it can deliver a maximum current of 44 A, with 20C times 2.2Ah being 44A.

So there you go. A complete description of something you can’t use logic and inference to reason through. Video below.

Continue reading “A Description of Maddening Battery Terminology”

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.

Continue reading “THP Hacker Bio: David Cook”

Easily Turn Your Raspberry Pi into an 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.

Continue reading “Roman Headgear Looks Less Silly With Lots of Blinky”

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.