Using Valgrind To Track Down Known And Unknown Bugs In Your Code

We all know what bugs in code are. We don’t like them when they are in programs we use, and they’re even worse when they are in code which we have written. Clearly, the best code is bug-free, but how do we get there?

This isn’t a new question, of course, just one that has become ever more important as the total number of lines of code (LoC) that run modern day society keeps increasing and which is affecting even hobbyists more and more often now that everything has a microcontroller inside.

Although many of us know the smug satisfaction of watching a full row of green result markers light up across the board after running the unit tests for a project, the painful reality is that you don’t know whether the code really is functionally correct until it runs in an environment that is akin to the production environment.  Yet how can one test an application in this situation?

This is where tools like those contained in the Valgrind suite come into play, allowing us to profile, analyze and otherwise nitpick every single opcode and memory read or write. Let’s take a look, shall we?

Continue reading “Using Valgrind To Track Down Known And Unknown Bugs In Your Code”

Raspberry Pi Waters Your Lawn, Serves HTML

It is easy to take a Raspberry Pi and treat it like a cheap Linux PC or server. Running an ad blocker or a VPN gateway is simple and doesn’t require any real interfacing. However, it is a big leap to actually use the Pi to control something and a good example can go a long way to helping you develop your own projects. [Joeseph Luccisano] posted a tutorial with just that aim. The goal: build a low-cost lawn watering system.

It is an interesting project since it has hardware and software components, of course. But it also has a hydraulic part, so you have to deal with all three domains coming together.

Continue reading “Raspberry Pi Waters Your Lawn, Serves HTML”

Cheap Alternative Solvents For PCB Cleaning

If you’re in the habit of using isopropyl alcohol to clean your PCBs after soldering, you probably have a nice big jug of the stuff stashed away. If you don’t, you’re probably out of luck, since the COVID-19 pandemic has pretty much cleared IPA out of the retail market. But don’t fret: depending on where you live, alternative PCB cleaning solutions may be as close as your nearest auto parts store.

[Steven]’s search for a cheaper and perhaps more readily available substitute for his usual dedicated flux cleaner lead him to try automotive brake cleaner on a few test boards. He suspected that they might contain acetone, which is prone to yield unfortunate results with solder resist and silkscreen on PCBs, so some tests were in order. The brand he tried was Normfest Bremsenreiniger MC-1, a German brand that according to its Safety Data Sheet contains only hydrocarbons like alkanes, butane, and propane. It did a fine job cleaning all but the crustiest rosin flux without collateral damage.

In the video below, [Steven] goes through a few more brands with similar results, and we were encouraged enough by his results to check brake cleaners made for the US market. Alas, almost all of the cheap and readily available aerosols have acetone as the principle ingredient, mixed in with methanol, ethanol, and assorted ingredients that together will probably make for a bad day. About the only US-sold brand without acetone that we could find was Keller-Heartt, which lists only naptha and ethanol on its SDS. There may be others, but make sure you test whatever you find.

Aerosol solvents aren’t the only way to clean a PCB, of course. Ultrasonic cleaners do a great job, and as [Steven] discovered, they’re generally safe for most components.

Continue reading “Cheap Alternative Solvents For PCB Cleaning”