Model Hydroelectric Plant Is An Illuminating Educational Tool

There’s more than one way to light up a strip of LEDs. Have you tried building your own hydroelectric power plant to do it? Well, now you can. Replicating [Matic Markovič]’s entry into the 2020 Hackaday Prize is bound to teach you something, if not many things, about the way hydroelectric power is generated and the way the variables play into it.

In [Matic]’s model, water from an adjustable-height reservoir flows into a 3D-printed Pelton turbine. The water jet hits the turbine’s cupped fins at a 90° angle, causing the assembly to spin around rapidly. This mechanical energy charges a brushless DC motor that’s connected to an Arduino Nano, which rectifies the AC from the generator and uses it to light up an RGB strip like an equalizer display that represents the power being generated.

This is easily one of the coolest educational displays we’ve ever seen. The reservoir can move up and down over a 55 cm (21.6″) range with the flick of a three-way toggle, which makes it easy to see that the higher the reservoir, the more power is generated. [Matic] has the STLs and INOs in the usual places if you want to make your own. Flow past the break for a demonstration, followed by an exploded render that gets put back together by invisible hands.

Your hydroelectric setup doesn’t need to be fancy, it just needs to work. One man’s trash can be another man’s off-grid phone charger.

Continue reading “Model Hydroelectric Plant Is An Illuminating Educational Tool”

Beyond Printf(): Better Logging Practices For Faster Debugging

All of us who do some programming know that logging is a time-tested way to output messages about the internal state of our code. With varying degrees of adjustable granularity, these messages allow us to keep track of not only the state of the application, but also its overall health. When things do end up going FUBAR, these log messages are usually the first thing we look at as a software equivalent of a Flight Data Recorder in an airplane.

Spending some time and care in not only designing the logging system, but also in deciding what should be logged and at what level, can make our future self appreciate life a lot more. We’re all familiar with the practice of ‘printf-debugging’, where logging is added as part of the usual post-crash autopsy as one tries to figure out what exactly went wrong. It’s one way of doing it, and eventually it works, but we can do much better.

People are lazy, and you’re only going to stick to good logging practices if they are at least as easy if not easier than sprinkling printf() statement throughout the code. Yet at the same time we want to be able to handle things like log levels and newlines without too much extra typing. The most successful logging libraries are built with this

Continue reading “Beyond Printf(): Better Logging Practices For Faster Debugging”

Flipping A Coin 10,000 Times With A Dedicated Machine

Flipping a coin is often the initial example used to help teach probability and statistics to maths students. Often, there is talk of how, given a fair coin, the probability of landing heads or tails should approach 0.5. Of course, if you want to test this, it pays to have a machine do the hard work for you. [Andrew Consroe] has the rig to do just that.

The build consists largely of 3D printed parts. A large cylindrical shroud is used to keep the coin within the flipping area. A spring-loaded dowel is actuated by a stepper motor spinning a cam, which flips the coin. Once the coin has landed, it is photographed with a webcam. An image processing pipeline then determines whether the coin landed heads or tails. A black spot is used on one side of the coin to aid analysis, as the poor-quality webcam images weren’t good enough to recognise the coin in its standard form. Once the flip has been analysed, a sliding aperture is used to push the coin back towards the flipper for the next cycle.

The machine completes a flip approximately every two seconds, meaning 10,000 flips would take approximately 2.5 days. Unfortunately, due to noise and occasional coin escapes, [Andrew] hasn’t yet been able to achieve his goal. He aims to increase speed significantly before making an all-out attempt.

Coin flips can make for decent random numbers, but if you need better ones, perhaps NIST can help you out. Video after the break.

Continue reading “Flipping A Coin 10,000 Times With A Dedicated Machine”

Window In The Skies: Why Everyone Is Going To Mars This Month

Mars may not be the kind of place to raise your kids, but chances are that one day [Elton John]’s famous lyrics will be wrong about there being no one there to raise them. For now, however, we have probes, orbiters, and landers. Mars missions are going strong this year, with three nations about to launch their rockets towards the Red Planet: the United States sending their Perseverance rover, China’s Tianwen-1 mission, and the United Arab Emirates sending their Hope orbiter.

As all of this is planned to happen still within the month of July, it almost gives the impression of a new era of wild space races where everyone tries to be first. Sure, some egos will certainly be boosted here, but the reason for this increased run within such a short time frame has a simple explanation: Mars will be right around the corner later this year — relatively speaking — providing an ideal opportunity to travel there right now.

In fact, this year is as good as it gets for quite a while. The next time the circumstances will be (almost) as favorable as this year is going to be in 2033, so it’s understandable that space agencies are eager to not miss out on this chance. Not that Mars missions couldn’t be accomplished in the next 13 years — after all, several endeavors are already in the wings for 2022, including the delayed Rosalind Franklin rover launch. It’s just that the circumstances won’t be as ideal.

But what exactly does that mean, and why is that? What makes July 2020 so special? And what’s everyone doing up there anyway? Well, let’s find out!

Continue reading “Window In The Skies: Why Everyone Is Going To Mars This Month”

A Stylish Raspberry Pi Camera

The Raspberry Pi HQ camera module is an exciting product that for the first time puts something close to a decent quality interchangeable lens camera into the hands of hardware hackers. It’s already attracted the attention of those who have a wish to explore the boundaries of camera form factors. Our latest entrant in this field comes courtesy of [BBまどーし], who has opted for a very good 3D-printed analog of a conventional compact camera.

On the front as you might expect is the module, concealed behind a smart plastic ring. Behind that is a battery compartment, concealing not the brace of 18650s or the bare LiPo pouch that you might expect, but a 10,400 mAH USB power bank. Behind that is something approaching a conventional Raspberry Pi case, designed to take a Hyperpixel screen. The battery might seem an unadventurous choice, but it serves to highlight just how much bang for your buck can now be found in compact power banks. It may not have a hacker aesthetic, but you can’t argue with its cost and simplicity.

The details are the interesting part of this design, for instance it has a standard accessory shoe printed into its top. There is also a shutter button, but they admit to not being a software wizard enough to get it working. Perhaps a quick look at this Pi Camera in a 1970s Merlin game would be in order.

A Simple Soft Power Switch Using Common Modules

If you want to easily control the power in a circuit, you’ll probably reach for the classic toggle switch. While there’s certainly nothing wrong with that, physical toggles are a bit dated at this point. A soft power switch that turns your gadget on and off at the tap of a finger is far more 21st century. You might think this kind of modern trickery is too difficult to implement on a DIY project, but as [Sasa Karanovic] shows, it’s actually a lot easier than you might think.

Now to be fair, that wasn’t actually his goal. All [Sasa] was trying to do was come up with a slick way to control the LED lighting in his 3D printer enclosure. Which, as you can see in the video below, he accomplished. But the hacked together circuit he used to do it could easily be adapted for other electronic projects. If you’re using a LM2596 DC-DC converter module to power your gadget, you can add a touch sensitive soft switch for literally pennies.

The trick is utilizing the enable pin on the LM2596. The common buck converter modules tie this pin to ground so the regulator is always enabled, but if you lift the pin off the PCB and connect it to the output of a TTP223 capacitive touch sensor, you can simply tap the pad to control the regulator. Power for the touch sensor itself is pulled from the input side of the regulator, so even when the power is cut off downstream, the sensor is still awake and can kick the chip back into gear when you need it.

If you’re not interested in touch control, you could try connecting the enable pin on the regulator to an ESP8266 and making a cheap Internet-controlled DC power supply. Continue reading “A Simple Soft Power Switch Using Common Modules”

Life Size Lancer Becomes Gears Of War Motion Controller

Gears of War is a franchise famous for its giant gun with a big chainsaw on the front. [Eric] laid his hands on a toy replica, and decided it had to become a usable motion controller for the game.

The build is straightforward, following the usual format for motion controller builds. Fitted with a gyroscope and accelerometer, it’s interfaced to the PC using a microcontroller. The toy has a trigger which is hooked up to the fire button in game. Additional buttons were added to the shell for movement and other actions such as reloading and finding cover. As a nice final touch, the large pull handle on the left of the weapon is used to activate the chain saw in-game.

While it’s unlikely to be competitive with a mouse or even gamepad in practice, it’s hard to argue against the fun of wielding a full-size, 10-pound weapon when playing Gears of War 5. [Eric] has also shared a basic controller hacking guide for those eager to get into similar builds themselves. We’ve featured [Eric]’s work before, too – with this epic Minecraft pickaxe build. Video after the break.

Continue reading “Life Size Lancer Becomes Gears Of War Motion Controller”