LED Pendulum Pulses Out Clock Face

You have to admit [Dylan Rush’s] clock is a real swinger. Literally. You’ve seen the desk novelties where an arm with leds mounted on it sweeps out a message? [Dylan] did the same thing to make a clock but instead of drawing numbers, he actually draws an analog clock face. Y’know one of those round things with arms?

IMG_20150824_2156213_rewindBehind the clock is an Arduino driving a MAX7219 LED controller. Using the MAX7219 was a challenge because it expects a grid of LEDs while the clock needs a linear array. [Dylan] used a line of individual LEDs wired to match what the controller wanted. A rotary encoder tells the processor the position of the arm so the Arduino sketch can determine which LEDs should be lit to show the time and clock face.

What’s even more amazing is [Dylan] created this before clocks became infamous.

Swing over to the video after the break.

Continue reading “LED Pendulum Pulses Out Clock Face”

Code Craft: When #define Is Considered Harmful

An icon of Computer Science, [Edsger Dijkstra], published a letter in the Communications of the Association of Computer Machinery (ACM) which the editor gave the title “Go To Statement Considered Harmful“. A rousing debate ensued. A similar criticism of macros, i.e. #define, in C/C++ may not rise to that level but they have their own problems.

Macros are part of the preprocessor for the C/C++ languages which manipulates the source code before the actual translation to machine code. But there are risks when macros generate source code. [Bjarne Stroustrup] in creating C++ worked to reduce the need and usage of the preprocessor, especially the use of macros. In his book, The C++ Programming Language he writes,

Don’t use them if you don’t have to. Almost every macro demonstrates a flaw in the programming language, in the program, or in the programmer.

As C retrofitted capabilities of C++, it also reduced the need for macros, thus improving that language.

With the Arduino using the GNU GCC compilers for C and C++ I want to show new coders a couple of places where the preprocessor can cause trouble for the unwary. I’ll demonstrate how to use language features to achieve the same results more cleanly and safely. Of course, all of this applies equally when you use any of these languages on other systems.

We’re only going to be looking at macros in this article but if you want to read more the details about them or the preprocessor see the GNU GCC Manual section on the preprocessor.

Continue reading “Code Craft: When #define Is Considered Harmful”

Fail Of The Week: Marginally Documented Pad Shorts To Maskless PCB

[Erich Styger] was bit by a nasty gotcha when soldering a QFN surface mount chip. The problem rears its ugly head when combining a chip possessing a padless conductor and a PCB without a solder mask. As you can see in the image above, there is a conductor exiting the side of the plastic QFN, but there is no pad associated with it. For this reason, you won’t see the conductor documented in the datasheet as a pin. It is documented in the mechanical drawing of the package, without any explicit reference to its existence. This is the Jason Bourne of package quirks.

The PCB layout just happens to have a trace exiting right under this conductor. The two aren’t touching, but without solder mask, a bit of melted metal was able to mind the gap and connect the two conductors. [Eric] notes that although the non-pad isn’t documented, it’s easy to prove that it is connected to ground and was effectively pulling down the signal on that trace.

In a recent article on Hackaday I talked about “dangling pointers” and the challenge when interrupts expose the bug. [Erich’s] covered a ton of posts about embedded software. I was doing some poking around and was delighted to find that he covered the same concept and a solution for it using a program called cppcheck.

Could You Repeat That?

Ever been out in a big field and need to tell something to Joe at the other end? If you’re lucky Sally is in between and you can shout to Sally to tell Joe your message. Maybe Joe shouts back to Sally in reply.

That’s how amateur radio repeaters work.

Friend of Hackaday [Kenneth Finnegan] got tired of explaining the details of repeaters so he put together a pair of repeater tutorial videos, the first of which is found after the break.

Balloon2
Image source KV5R

The higher radio frequencies, say 50 MHz and above, typically only propagate within line of sight. Add in limited power and antennas from a hand-held, typically under 5 watts and the ubiquitous ‘rubber ducky’ antenna, and you cannot talk very far. Mobile rigs in vehicles with 50 watts and larger antennas do better but in reality they don’t help all that much.

What really makes an improvement is height to improve range. Height provides a longer line of sight with fewer obstructions. Hams created repeaters and put them on towers, buildings or hill tops to expand the radio horizon. The ultimate repeaters are space satellites. Can’t get much higher than that. A close second are balloons going to near space altitudes with repeaters which will provide multi-state coverage.

Besides providing height, a repeater will also have higher output power and much better antennas, especially important for receiving weak signals from distant handhelds. A signal comes in and is repeated back out on a slightly different frequency. All modern ham gear on these frequencies is setup to handle this offset frequency operation.

Whether hams came up with the idea is arguable, but they were certainly there during the early days.

Continue reading “Could You Repeat That?”

“The Martian” Is A Hacker’s Dream – In Space

You’ve probably seen the ads and heard the buzz about the movie “The Martian”, where a Mars astronaut, Mark Watney, is left on the planet and presumed dead. You may have read our previous article about the eponymous book by Andy Weir. That article wondered if the movie would do justice to the book.

It did.

In summary, Watney survives by creating one glorious, but realistic, hack after another. NASA and the other astronauts support him by coming up with some marvelous hacks along the way. One, encompassing the entire spaceship containing the surviving astronauts, is developed by The_Martian_film_posterthe ship’s Captain, Melissa Lewis. Okay, that one may not be totally realistic but it’s mind blowing.

Reading about the hacks is one thing. Seeing them on the screen adds another dimension. Matt Damon, as Watney, mixing his own waste with water to fertilize potatoes is an image you cannot create in your mind’s eye.

One usual trick Hollywood plays is to switch the actions of minor characters to the major characters. That leaves out the ‘little guy’ in the backroom who frequently has the great idea. Often that’s us. Here they kept the woman who first saw Watney moving equipment on Mars and the astrophysicist who, well, I won’t spoil it, saved the day.

For hackers, this movie should be paired with “Interstellar”, because of their fidelity to science. “The Martian” contains actual NASA technology and plans for Mars missions. “Interstellar”, well, what can you say bad about a movie that originated in the mind of Caltech Theoretical Physicist, Kip Thorne. The science in this movie is so real Thorne wrote an entire book describing it, and managed a few scientific papers based on the research required to accurately present the black hole.

It’s a wondrous trend to see science fiction movies based on real science and not being dumbed down to the point of insult. You know it has to be good if XKCD did a comic. Surprisingly, Hollywood didn’t do a ‘hack’ job on either of these movies.

Movie trailer after the break.

Continue reading ““The Martian” Is A Hacker’s Dream – In Space”

Original Hackers’ New Satellite In Orbit

Ham radio put another satellite in orbit, the FOX-1A. Not many groups have the long-term hacking credentials of hams. Their tradition extends back to the first days of radio communications, which puts the group well over a century old. This newest satellite launched in the early hours of October 8th and, after deployment, was heard later the same day. Anyone with the ability to listen on the 2m band can hear FOX-1A. Tatlas-v-rocket-launches-nrol55-cubesatshose licensed as hams will be able to communicate using a 70cm transmitter while listening on 2m.

This satellite is using the cube-sat format and ‘ride sharing’ through a program offered by NASA and the National Reconnaissance Office (NRO). Twelve other nano-satellites rode along with the FOX-1A. These 10 cm cubes are used for commercial, educational, and non-profit projects. The purpose of today’s satellites covered not only ham radio but educating students in satellite construction, land management by American Indian tribes, and space to ground laser communication. Yeah, what’s cooler than space lasers? Video about the FOX-1A after the break.

We’ve seen some interesting ideas for cube-sats. And if you want to think about the ground portion of a system like this, check out the SatNOGs story — winners of the 2014 Hackaday Prize.

Continue reading “Original Hackers’ New Satellite In Orbit”

Code Craft: Subtle Interrupt Problems Stack Up

[Elliot Williams’] column, Embed with Elliot, just did a great series on interrupts. It came in three parts, illustrating the Good, the Bad, and the Ugly of using interrupts on embedded systems. More than a few memories floated by while reading it. Some pretty painful because debugging interrupt problems can be a nightmare.

One of the things I’ve learned to watch out for over the years is the subtlety of stack based languages, like C/C++, which can ensnare the unwary. This problem has to do with the corruption of arrays of values on a stack during interrupt handling. The fix for this problem points up another one often used by black hats to gain access to systems.

Continue reading “Code Craft: Subtle Interrupt Problems Stack Up”