When 4 + 1 Equals 8: An Advanced Take On Pointers In C

In our first part on pointers, we covered the basics and common pitfalls of pointers in C. If we had to break it down into one sentence, the main principle of pointers is that they are simply data types storing a memory address, and as long as we make sure that we have enough memory allocated at that address, everything is going to be fine.

In this second part, we are going to continue with some more advanced pointer topics, including pointer arithmetic, pointers with another pointer as underlying data type, and the relationship between arrays and pointers. But first, there is one particular pointer we haven’t talked about yet.

The one proverbial exception to the rule that pointers are just memory addresses is the most (in)famous pointer of all: the NULL pointer. Commonly defined as preprocessor macro (void *) 0, we can assign NULL like any other pointer.

Continue reading “When 4 + 1 Equals 8: An Advanced Take On Pointers In C”

Mechanisms: Hook And Loop Fasteners

As a species, we’ve done a pretty good job at inventing some useful devices. But as clever as we think we are, given sufficient time, natural selection will beat us at our game at almost every turn. So it makes sense that many of our best inventions are inspired by nature and the myriad ways life finds to get DNA from one generation to the next.

Hook and loop fasteners are one such design cribbed from nature, and the story behind this useful mechanism is a perfect example that a prepared mind, good observation skills, and a heck of a lot of perseverance are what it takes to bring one of Mother Nature’s designs to market.

Editor’s Note: As some predicted in the comments section, we were contacted by representatives of Velcro Companies and asked to change all mentions in this article to either VELCRO® Brand Fastener or to use the generic “Hook and Loop” term. If it seems weird that we’re calling this hook and loop, now you know why.

Continue reading “Mechanisms: Hook And Loop Fasteners”

When Hackerspace Directors Burn Out

A friend of mine once suggested that there should be a support group for burned-out former hackerspace directors. We could have our own Village of the Damned at summer camps, where we’d sit moodily in the gathering twilight sipping our bourbon and Club Mate and decrying whatever misfortunes came to our space to leave such visible mental scars, or gazing hollow-eyed into the laser-tinged haze and moving gently to the pulse of the chiptune music. “See that’s Jenny over there, she don’t say much“. Hackerspace noir, where the only entry criterion is being crazy enough to stand for election to your space’s board.

You can tell [Dr. Seuss] is thinking about his next volume: <em>How The Grinch Stole Whoville Hackspace</em>. Al Ravenna, World Telegram [Public domain].
You can tell [Dr. Seuss] is thinking about his next volume: How The Grinch Stole Whoville Hackspace. Al Ravenna, World Telegram [Public domain].
There must be spaces somewhere that live in such perfect harmony, in which a happy membership support a board for whom everything falls into place. Maybe the makerspace in [Dr. Seuss]’s Whoville would have that kind of atmosphere, but the reality of life is that every group is made up of both Grinch and Who. Keeping a diverse group of people harmonious is a huge challenge, but that’s what hackerspaces are really about — the people make the space.

There are several defined periods in the gestation of a hackerspace, and at least from where I’m sitting they relate to its member count. Some spaces pass through them all as they grow, while others are lucky enough to reach an equilibrium and spare themselves some of the drama.

If you recognise yourselves in some of the following then you have my commiserations, while if your space hasn’t got there yet or has managed to dodge some of the bullets then consider yourselves lucky.

Continue reading “When Hackerspace Directors Burn Out”

Beatrice Tinsley And The Evolution Of Galaxies

It seems almost absurd now, but cosmologists once assumed that galaxies of a given type were all the same and didn’t change. Because of this assumption, galaxies were used as a redshift or light-based yardstick to measure distances in the universe. But what if some galaxies were intrinsically redder than others? Little to no thought was given to their origins, compositions, or evolution until Beatrice Tinsley came along.

Beatrice saw galaxies as changing bodies of stars. She believed that they grew, evolved, and died because they’re made of stars, and that’s what their star populations did. To lump all galaxies together and use them as a standard candle was an oversimplification. Beatrice created the first computer model of a galaxy to prove her point and in doing so, she founded the field of galaxy evolution.

If you’ve never heard of Beatrice, don’t feel bad. Just as her career was really beginning to take off, she developed cancer and died shortly after her 40th birthday. Though her life was short, her influence on cosmology is long-reaching. Continue reading “Beatrice Tinsley And The Evolution Of Galaxies”

Beeping The Enemy Into Submission

In July 1940 the German airforce began bombing Britain. This was met with polite disagreement on the British side — and with high technology, ingenuity, and improvisation. The defeat of the Germans is associated with anti-aircraft guns and fighter planes, but a significant amount of potential damage had been averted by the use of radio.

Night bombing was a relatively new idea at that time and everybody agreed that it was hard. Navigating a plane in the dark while travelling at two hundred miles per hour and possibly being shot at just wasn’t effective with traditional means. So the Germans invented non-traditional means. This was the start of a technological competition where each side worked to implement new and novel radio technology to guide bombing runs, and to disrupt those guidance systems.

Continue reading “Beeping The Enemy Into Submission”

Two-Cent Temperature Sensors

When they need to add temperature control to a project, many hackers reach for a K-type thermocouple for their high-temperature needs, or an integrated temperature-sensing IC when it doesn’t get that hot. The thermocouple relies on very small currents and extremely high gain, and you pretty much need a dedicated IC to read it, which can be expensive. The ICs aren’t as expensive, but they’re basically limited to boiling water. What do you do if you want to control a reflow oven?

There’s a cheaper way that spans a range between Antarctic winter and molten solder, and you’ve probably already got the parts on your shelf. Even if you don’t, it’s only going to run you an extra two cents, assuming that you’ve already got a microcontroller with an ADC in your project. The BOM: a plain-vanilla diode and a resistor.

I’ve been using diodes as temperature sensors in three projects over the last year: one is a coffee roaster that brings the beans up to 220 °C in hot air, another is a reflow hotplate that tops out around 210 °C, and the third is a toner-transfer iron that holds a very stable 130 °C. In all of these cases, I don’t really care about the actual numerical value of the temperature — all that matters is reproducibility — so I never bothered to calibrate anything. I thought I’d do it right for Hackaday, and try to push the humble diode to its limits for science.

What resulted was a PCB fire, test circuits desoldering themselves above 190 °C, temperature probes coming loose, and finally a broken ramekin and 200 °C peanut oil all over my desk. Fun times! On the other hand, I managed to get out enough data to calibrate some diodes, and the results are fantastic. The circuits under test included both best practices and the easiest thing that could possibly work, and the results are pretty close. This is definitely a technique that you want to have under your belt for most temperature ranges. The devil is in the details, of course, so read on!

Continue reading “Two-Cent Temperature Sensors”

Mechanisms: The Spring

Most people probably don’t think about springs until one kinks up or snaps, but most of the world’s springs are pretty crucial. The ones that aren’t go by the name Slinky.

We all use and encounter dozens of different types of springs every day without realizing it. Look inside the world of springs and you’ll find hundreds of variations on the theme of bounce. The principle of the spring is simple enough that it can be extended to almost any shape and size that can be imagined and machined. Because it can take so many forms, the spring as a mechanism has thousands of applications. Look under your car, take apart a retractable pen, open up a stapler, an oven door, or a safety pin, and you’ll find a spring or two. Continue reading “Mechanisms: The Spring”