Tripping Out: A Field Guide To Circuit Protection

My introduction to circuit protection came at the tender age of eight. Being a curious lad with an inventive – and apparently self-destructive – bent, I decided to make my mother a lamp. I put a hose clamp around the base of a small light bulb, stripped the insulation off an old extension cord, and jammed both ends of the wires under the clamp. When I plugged my invention into an outlet in the den, I saw the insulation flash off the cord just before the whole house went dark. Somehow the circuit breaker on the branch circuit failed and I tripped the main breaker on a 200 amp panel. My mother has never been anywhere near as impressed with this feat as I was, especially now that I know a little bit more about how electricity works and how close to I came to being a Darwin Award laureate.

To help you avoid a similar fate, I’d like to take you on a trip (tee-hee!) through the typical household power panel and look at some of the devices that stand at the ready every day, waiting for a chance to save us from ourselves. As a North American, I’ll be focusing on the residential power system standards most common around here. And although there is a lot of technology that’s designed to keep you safe as a last resort, the electricity in your wall can still kill you. Don’t become casual with mains current!

Continue reading “Tripping Out: A Field Guide To Circuit Protection”

Will The Real Schrodinger’s Cat Please Stand Up

The story of Schrodinger’s cat is well known, and one of quantum theory’s most popular phrases on the world stage. You can find his cat on t-shirts, bumper stickers, internet memes and the like. However, few know the origins of the cat, and how it came into being. I suspect many do not understand it beyond the “dead and alive at the same time” catchphrase as well. Not surprisingly, it was Einstein who was at the center of the idea behind Schrodinger’s cat. In a vibrant discussion between the two via letters across the Atlantic, Schrodinger echoed Einstein’s concerns with the following:

Contained in a steel chamber is a Geiger counter prepared with a tiny amount of uranium, so small that in the next hour it is just as probable to expect one atomic decay as none. An amplified relay provides that the first atomic decay shatters a small bottle of prussic acid. This and -cruelly- a cat is also trapped in the steel chamber. According to the wave function for the total system, after an hour, sit venia verbo [pardon my language], the living and dead cat are smeared out in equal measure.

This was the first mention of Schrodinger’s cat, and one would not be incorrect in stating that this paragraph from a letter was where the cat was born. However, the original idea behind the thought experiment was from Einstein and his loathing of the wording of the Einstein-Podolsky-Rosen (EPR) paper. He expressed his frustrations with Schrodinger with a few simple examples, who then catapulted it into his famous paradox . In this article we’re going to explore not so much the cat, but the meaning behind the thought experiment and what it is meant to convey, while keeping it simple enough for anyone to understand. So next time you see it on a t-shirt, you will be able to articulate the true meaning and know the real Schrodinger’s cat.

Continue reading “Will The Real Schrodinger’s Cat Please Stand Up”

Electromagnetic Pulse: Pure Hollywood?

Imagine you’re in charge of a major heist. Right as your crew is about to rob the main vault, you need all of the electronics in the building to fail at exactly the right moment with no other collateral damage (except, maybe, to your raggedy panel van). Obviously you will turn to one of the entertainment industry’s tired tropes, the electromagnetic pulse! The only problem is that if you were to use a real one rather than a Hollywood prop either there would be practically no effect, a large crater where the vault used to be, or most of humanity would be in deep trouble. After all, the real world isn’t quite as convenient as the movies make it seem.

emp-electromagnetic-pulse-jra-1cg_wq4mp4-shot0001Our curiosity into this phenomenon was piqued when we featured an “EMP generator” from [FPS Weapons]. The device doesn’t create an enrapturing movie-esque EMP pulse suitable for taking down a casino or two, but it does spew a healthy amount of broadband electromagnetic interference (EMI) in every direction. It probably also doesn’t send the EMI very far; as we’ve seen in many other projects, it’s hard to transfer energy through the air. It got us wondering, though: what is the difference between being annoying and creating a weapon? And, is there any practical use for a device like this?

Continue reading “Electromagnetic Pulse: Pure Hollywood?”

Beware Common Sense Engineering

I am always torn about the title of “engineer.” When I talk to school kids about engineering, I tell that an engineer is a person who uses science and math to solve or analyze practical problems. However, these days you hear a lot of engineering titles thrown around to anyone who does any sort of technical (and sometimes non-technical) work. “Software engineers” don’t have to be licensed to practice, while civil engineers do. What’s in a name and does any of this matter?

Continue reading “Beware Common Sense Engineering”

Raspberry Pi, Send Me A Letter

The abundance of small networked boards running Linux — like the Raspberry Pi — is a boon for developers. It is easy enough to put a small cheap computer on the network. The fact that Linux has a lot of software is a double-edged sword. On the one hand, it is a good bet that anything you want to do has been done. On the other hand, some of the solutions are a bit large for a tiny embedded system.

Take, for example, e-mail. Historically, Linux hosts operate as mail transfer agents that can send and receive mail for all their users and possibly even relay mail to others. In today’s world, that’s usually overkill, but the capability is there. It is possible to install big mail transfer agents into a Raspberry Pi. The question is: should you?

What Do You Want?

The answer, of course, depends on what you want to do. If you have a dedicated board sending out text and maybe even files using an external mail server (like, say, Gmail), then the answer is no. You don’t need a piece of software listening for incoming connections, sorting through multiple users, and so on.

Luckily, there are some simple solutions if you know how to set up and configure them. The key is to avoid the big mail programs that do everything you don’t need.

Mail Front Ends

Let’s tackle sending mail first. If you try to grab the mailutils package, you’ll see it drags along a lot of stuff including mysql. Keep in mind, none of this will actually send mail. It just gives you some tools to get mail ready to send.

Luckily, the bsd-mailx package has a lot less overhead and will do the job. Look at the man page to see what options you have with mailx; you can do things like attach files, set a subject, and specify addresses.

It is a little difficult to set up for Gmail, though, thanks to Google’s security. You’ll need the certutil tool from the libnss3-tools package. You’ll need to create a certificate store, import Google’s certificate, and then set up a lot of options to mailx. I don’t suggest it. If you insist, though, you can find directions on the Web.

SSMTP

By default, programs like mailx and other Linux mail commands rely on a backend (often sendmail). Not only does that drag around too much overhead, it is also a full mail system, sending and receiving and relaying–overkill for our little Pi computers.

Luckily, SSMTP is available which only sends mail and is relatively lightweight. You need a configuration file to point it to your mail server. For Gmail, it would look like this:

#
# Config file for sSMTP sendmail
#
# The person who gets all mail for userids < 1000
# Make this empty to disable rewriting.
root=postmaster

# The place where the mail goes. The actual machine name is required no 
# MX records are consulted. Commonly mailhosts are named mail.domain.com
mailhub=smtp.gmail.com:587

# Where will the mail seem to come from?
rewriteDomain=yourdomain.com

# The full hostname
hostname=yourhostname
AuthUser=YourGmailUserID
AuthPass=YourGmailPassword
UseTLS=Yes
UseSTARTTLS=YES
# Are users allowed to set their own From: address?
# YES - Allow the user to specify their own From: address
# NO - Use the system generated From: address
FromLineOverride=YES

You can use a mail agent like mailx or you can just use ssmtp directly:

ssmtp someone@somewhere.com

Enter a message on the standard input and end it with a Control+D (standard end of file for Linux).

Google Authentication

There’s only one catch. If you are using Gmail, you’ll find that Google wants you to use stronger authentication. If you are using two-factor (that is, Google Authenticator), this isn’t going to work at all. You’ll need to generate an app password. Even if you aren’t, you will probably need to relax Google’s fear of spammers on your account. You need to turn on the “Access for less secure apps” setting. If you don’t want to do this on your primary e-mail account, considering making an account that you only use for sending data from the Pi.

Sending Files

Depending on the mail software you use, there are a few ways you can attach a file. However, the mpack program makes it very easy:

mpack -a -s 'Data File' datafile.csv me@hackaday.com

The above command will send datafile.csv as an attachment with the subject “Data File.” Pretty simple.

Receiving Mail

What if you want to reverse the process and receive mail on the Pi? There is a program called fetchmail that can grab e-mails from an IMAP or POP3 server. It is possible to make it only read the first unread message and send it to a script or program of your choosing.

You have to build a configuration file (or use the fetchmailconf program to build it). For example, here’s a simple .fetchmailrc file:

poll imap.gmail.com
protocol IMAP
user "user@gmail.com" with password "yourpassword" mda "/home/pi/mailscript.sh"
folder 'INBOX'
fetchlimit 1
keep
ssl

You can leave the “keep” line out if you don’t mind fetchmail deleting the mail after processing. The file should be in your home directory (unless you specify with the -f option) and it needs to not be readable and writable by other users (e.g., chmod 600 .fetchmailrc). According to the fetchmail FAQ, there are some issues with Gmail, so you might want to consider some of the suggestions provided. However, for simple tasks like this, you should be able to work it all out.

In particular, the mailscript.sh file is where you can process the e-mail. You might, for example, look for certain keyword commands and take some action (perhaps replying using ssmtp).

Special Delivery

You might not think of the Raspberry Pi as an e-mail machine. However, the fact that it is a pretty vanilla Linux setup means you can use all sorts of interesting tools meant for bigger computers. You just have to know they exist.

Homemade Capacitors Of A Mad Scientist

Once upon a time I was a real mad scientist. I was into non-conventional propulsion with the idea of somehow interacting with the quantum vacuum fluctuations, the zero point energy field. I was into it despite having only a vague understanding of what that was and without regard for how unlikely or impossible anyone said it was to interact with on a macro scale. But we all had to come from somewhere, and that was my introduction to the world of high voltages and homemade capacitors.

And along the way I made some pretty interesting, or different, capacitors which I’ll talk about here.

Large Wax Cylindrical Capacitor

As the photos show, this capacitor is fairly large, appearing like a thick chunk of paraffin wax sandwiched between two wood disks. Inside, the lead wires go to two aluminum flashing disks that are the capacitor plates spaced 2.5cm (1 inch) apart. But in between them the dielectric consists of seven more aluminum flashing disks separated by plain cotton sheets immersed in more paraffin wax. See, I told you these capacitors were different.

I won’t go into the reasoning behind the construction — it was all shot-in-the-dark ideas, backed by hope, unicorn hairs, and practically no theory. The interesting thing here was the experiment itself. It worked!

I sat the capacitor on top of a tall 4″ diameter ABS pipe which in turn sat on a digital scale on the floor. High voltage in the tens of kilovolts was put across the capacitor through thickly insulated wires. The power supply contained a flyback transformer and Cockcroft-Walton voltage multiplier at the HV side. As I dialed up the voltage, the scale showed a reducing weight. I had weight-loss!

But after a few hours of reversing polarities and flipping the capacitor the other way around and taking plenty of notes, I found the cause. The weight-loss happened only when the feed wires were oriented with the top one feeding downward as shown in the diagram, but there was no weight change when the top wire was oriented horizontally. I’d seen high voltage wires moving before and here it was again, producing what looked like weight-loss on the scale.

But that’s only one of the interesting capacitors I’ve made. After the break we get into gravitators, polysulfide and even barium titanate.

Continue reading “Homemade Capacitors Of A Mad Scientist”

Lock Up Your Raspberry Pi With Google Authenticator

Raspberry Pi boards (or any of the many similar boards) are handy to leave at odd places to talk to the network and collect data, control things, or do whatever other tasks you need a tiny fanless computer to do. Of course, any time you have a computer on a network, you are inviting hackers (and not our kind of hackers) to break in.

We recently looked at how to tunnel ssh using a reverse proxy via Pagekite so you can connect to a Pi even through firewalls and at dynamic IP addresses. How do you stop a bad guy from trying to log in repeatedly until they have access? This can work on any Linux machine, but for this tutorial I’ll use Raspberry Pi as the example device. In all cases, knowing how to set up adequate ssh security is paramount for anything you drop onto a network.

Continue reading “Lock Up Your Raspberry Pi With Google Authenticator”