Skip to content
Your Ad Here

Recent Articles


Due to exchange rate fluctuations, app prices are rising in Australia, Sweden and Indonesia

App prices are subject to change, and for iOS users in Australia, Sweden and Indonesia, prices are about to get a small hike.

Continue reading
iPhone Hacks | #1 iPhone, iPad, iOS Blog


Passive, but not Innocuous

Maxim Integrated recently posted a series of application notes chronicling how there’s more going on than you’d think in even the simplest “passive” components. Nothing’s safe: capacitors, resistors, and even printed circuit boards can all behave in non-ideal ways, and that can bite you in the reflow-oven if you’re not aware of them.

You might already know that capacitors have an equivalent series resistance that limits how fast they can discharge, and an equivalent inductance that models departures from ideal behavior at higher frequencies. But did you know that ceramic capacitors can also act like voltage sources, acting piezoelectrically under physical stress?

For resistors, you’ll also have to reckon with temperature dependence as well as the same range of piezoelectric and inductance characteristics that capacitors display. Worse, resistors can display variable resistance under higher voltages, and actually produce a small amount of random noise: Johnson Noise that depends on the value of the resistance.

Finally, the third article in the series tackles the PCB, summarizing a lot of potential manufacturing defects to look out for, as well as covering the parasitic capacitance, leakage currents, and frequency dependence that the actual fiberglass layers themselves can introduce into your circuit.

If you’re having a feeling of déjà-vu, the same series of articles ran in 2013 in Electronic Design but they’re good enough that we hope you won’t mind the redundant repetition all over again. And if you’re already quibbling with exactly what they mean by “passive”, we feel your pain: they’re really talking about parasitic effects, but we’ll let that slide too. We’re in a giving mood today.

[via Dangerous Prototypes]

Filed under: hardware, how-to


Homemade Soldering Station Does it Better

Soldering stations are probably one of the most important tools in the hacker’s arsenal. Problem is — good ones are expensive, and sometimes the only difference between being okay at soldering versus being great at it, is the quality of the tool you’re using! Which is why [Albert] and [Matthias] decided to make their very own home-made Weller clone.

Since the most important part of the soldering iron is a good tip, they’re using a needle from Weller — they just need to be able to control it. They designed a 3D printed housing (source files here) for a small 1.8″ LCD screen, an Arduino Pro Mini and a MOSFET shield, and the 12v 8A power supply they chose. There are only two controls — on/off, and a potentiometer for adjusting the temperature.

They spent a while prototyping it and the end result is a pretty slick product. They actually sold a few but realized they weren’t making any money, so they stopped offering it — instead, you can get all the source files yourself from their GitHub. There’s also more information on [Matthias’] blog.

For a cheaper build, you could use a regular iron with a thermocouple strapped to it… but we like this one better.

[Thanks for the tip Luis!]

Filed under: 3d Printer hacks, Arduino Hacks, tool hacks


Scratch Your Itch for 3D Modeling with BeetleBlocks

If you want to create a 3D model, you’ll probably either use a graphical CAD tool or a programming-based tool (like OpenSCAD). Although BeetleBlocks is graphical, it is more akin to OpenSCAD than a graphical CAD program. That’s because BeetleBlocks is–more or less–Scratch for 3D modeling.

Scratch is the graphical block-structured language developed by MIT for teaching kids to program. You may have seen Lego robots programmed with similar blocks as well as Android App Inventor. In this incarnation, the blocks control a virtual robot (the beetle) that can extrude a tube behind it as it moves. The beetle is reminiscent of the Logo turtle except the beetle moves in three dimensions. The system is actually closer to Snap, which is a reimplementation of Scratch that allows custom blocks.

If you open the editor (you need Chrome for this alpha version) and open one or two of the examples, you’ll get the idea. In addition to the default palette of blocks, you can use the library item on the menu to import more blocks, including one to work with a Leap motion controller. When you are done, you can export to several formats, including STL. Of course, like any tool, you can draw things that would be hard to print, so if that’s your goal, be sure you understand the limitations of the printer you are using. Many of the examples looked like they would be tough to print on conventional home printers.

The Raspberry Pi offers a Scratch environment that we looked at recently. If you’d rather use a more traditional text-based programming or graphical interface, you might check out our recent coverage of browser-based CAD tools. Be sure to check out the short BeetleBlock demo video, below.

Filed under: 3d Printer hacks


YTOldNav jailbreak tweak brings back the old navigation to YouTube app

YouTube rolled out a new update to its iOS application recently that completely changes the visual look of the app along with bringing a few new video editing features. Some users have been leaving one-star reviews on the App Store and complaining about the new design of the app and how YouTube has failed to include iOS 9 features such as picture-in-picture.
Continue reading
iPhone Hacks | #1 iPhone, iPad, iOS Blog


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.

Filed under: radio hacks


Vintage Computer Fest: Berlin 2015

Berlin was a good city to be a geek in last weekend. Alongside the Berlin Maker Faire, there was the 2015 meeting of the Vintage Computing Festival: Berlin (VCFB). Each VCFB has a special theme, and this year it was analogue computers, but there was no lack of old computers large and small, teletext machines, vintage video game consoles, and general nerdy nostalgia.

Analogue Computing

We spent a lot of time playing with the Electronic Associates, Inc. EAI Mini-AC that came from the collection of the Heinz Nixdorf Computer Museum. It’s a miniature analog computer that was probably designed for training purposes, but could be used for a few interesting demos. It has most of the analog circuits you need to do math: integrators, adders, multipliers, limiters, comparators, switches, etc. It was programmed up with a bouncing ball in a box simulator (with gravity!).

A very clever feature of this computer is that the entire faceplate pulls off so that you can save a working program. (You can see another program plate sitting on top of the machine.) The pins poke through the faceplate and make contact inside when it’s properly installed. Unfortunately for modern vintage computer curators, this means that the machine has special pins compared to the other machines on display which all used regular banana plugs.

Another very cool feature of the EAI Mini-AC was that it had a run/stop button. How can you stop an analog computation, you ask? Lots and lots of internal switches and some clever circuitry. In addition to hand-wiring (programming) the computer, there’s a switch inside just before each amplifier circuit that disconnects the incoming signal. When the stop button is pressed, all the inputs to all of the amplifiers gets disconnected, and the value should hold for a while. If you’re us, you’d expect the voltage on the capacitors to sag slowly over time. As we stood there watching and talking about how it was built on the inside, the displayed number didn’t change in the third decimal place for at least five minutes.

There’s a ton of other fancy circuitry inside this beast. The op-amps of the day were all built out of discrete transistors, and nonetheless had chopper stabilization to minimize the offset voltage. Differences of very tiny voltages matter tremendously in an analog computer, and it is exactly analog’s amazing demand for precision that ended up killing off the analog computers in the end.

[Dr. Stephan Höltgen] brought along these racks of analog gear from the 60s and 70s. Included was a tube-based(!) Heathkit EC-1 learning computer, and a bunch of Telefunken gear.

Even with the beautiful lights and hands-on pleasure of plugging in patch cables to implement mathematical functions, nobody I talked to in the analogue computing exhibit would want to turn back the hands of time and ditch their digital computers, much less spend the time to make a recreation of one of these analog beasts. We think that this is all the more reason that they’re preserved as-is: they’re a great deal of fun to play around with, but once these are gone nobody will have the patience and knowledge to rebuild them.

PDPs Galore

You might be forgiven for thinking that if nobody would recreate analogue computers, the same would hold true for the early exemplars of the digital era, but you’d be very, very wrong. To look at the east wall of the exhibit, you’d think you were in a DEC PDP museum.

SONY DSC[Phillipp Hachtmann] brought along a complete vintage PDP-8/e running just as fast as the day it was built, which was reading in tapes that were driven up from Munich just for the festival. (All of the data on the tapes was being saved to more modern media for convenience. The one loading at the time we asked seemed to contain largely computer games.) The computer itself and even the tapes that it was running seem surprisingly robust, having remained readable from the mid-70s until today. Good luck saying the same about your current laptop and its hard drive in 2055.

SONY DSCNext to the real PDP-8 was a slew of real PDP faceplates. [Jörg Hoppe] and his project brought a bunch of these back to life again, albeit with modern internals. We’ve actually covered this particular build before, but the short version is that there are custom adapter boards attached to the faceplate that then allow it to be run from a BeagleBone utilizing PDP-10 emulator software. [Jörg] also has fantastically-detailed simulators of each of his faceplates available online for you to check out. Built from real photos of the real faceplates, each LED is unique and many of the switches are slightly wonky; the simulations have 95% of the charm of the actual faceplates, but weigh about 100 pounds less. If you use a touchscreen, you may not even miss the difference.

SONY DSCProgressing from the vintage to the half-vintage, we came to a fully-modern rebuild of one of the earliest PDP-8 models, the PiDP-8/l, which is also a project on in the running for our 2015 Hackaday Prize Best Product award. When I asked [Oscar Vermeulen] why this particular computer, he pointed out that it’s the PDP-8 model with the most blinkenlights. We don’t need further convincing.

Anyway, the PiDP-8 project takes [Jörg]’s adaptation of the old PDP faceplates a step further and re-creates them entirely from scratch, drastically simplifying all of the interface electronics and shrinking a fully realistic looking PDP-8 clone that runs on a Raspberry Pi and can sit comfortably on your desktop. If the actual PDP-8/e takes a small moving van to carry around, and the faceplates can probably fit in your hatchback, the PiDP-8 project gives you a PDP clone that you can bring in your carry-on luggage. But you don’t get that old-tape-drive smell.

Video Games

SONY DSCMost time spent at the VCFB was in yakking about old computers, but when it was time to take a break there was a whole room dedicated to old video game consoles, and even many of the regular exhibitors were loading up their favorite games on their exhibited computers when they had a little downtime. Mario Cart in the original SNES version was a crowd pleaser, and was occupied each time we tried to sneak by and give good old Yoshi’s tires a spin.

There was an old Atari Activision Track and Field game with these original hardware pedals that seem to have been designed for the game. Instead of mashing buttons as fast as you could to make your character run, you had to tap your feet. It gave the game an entirely more realistic feel, and was probably half-decent exercise to boot. The Wii Fit isn’t looking so revolutionary anymore.

SONY DSCEven 3D gaming doesn’t seem so forward-thinking. We’d never played Nintendo’s 1995 3D Virtual Boy console until last weekend, and it was good fun. It had Mario’s Tennis installed, which made good use of the 3D effect. Apparently, the Virtual Boy has a vibrating mirror inside that alternately projects a channel to the left and right eyes to produce the 3D image, and you could hear the machine whirring a little bit.

Until Next Time…

SONY DSCIf you’ve got any kind of technostalgia (we just invented that word) or just want to see what all the fuss is about, have a look at the US or European (read: German) Vintage Computer Festivals near you, troll through our archives, or simply stay tuned for more coverage because we’ll definitely be going back.

And if there’s any particular old-computer fetish that you want to get off your chest, or just have us be on the lookout for, let us know in the comments.

Filed under: computer hacks, cons, Hackaday Columns


How Analog Tide Predictors Changed Human History

If you’re completely landlocked like I am, you may dream of ocean waves lapping at the shore, but you probably don’t think much about the tides. The movement of the ocean tides is actually quite important to many groups of people, from fishermen to surfers to coastal zone engineers. The behavior of the tides over time is helpful data for those who study world climate change.

Early tide prediction was based on observed changes in relation to the phases of the Moon. These days, tide-predicting is done quickly and with digital computers. But the first purpose-built machines were slow yet accurate analog computation devices that, as they were developed, could account for increasing numbers of tidal constituents, which represent the changes in the positions of tide-generating astronomical bodies. One of these calculating marvels even saved the Allies’ invasion of Normandy—or D-Day— in World War II.

Tidal bulge caused by the Moon's gravitational pull. Image credit: NOAA
Tidal bulge caused by the Moon’s gravitational pull. Image credit: NOAA

What Are Tides, Exactly?

In Sir Isaac Newton’s classic scientific trilogy Principia, he lays out the idea that the glue of the universe is in the gravitational pull of the bodies that comprise it. Newton proposes that the ocean tides of Earth are governed by the gravitational pull of the Moon, and to a lesser extent due to distance, the Sun. The Moon’s gravitational pull causes a peak in the ocean water nearest it. There is a peak of equal magnitude on the opposite side of the globe because inertia counteracts gravity. These peaks in the ocean bodies are called tidal bulges.

Illustration of a continental margin from Science Clarified
Illustration of a continental margin from Science Clarified

What Newton didn’t account for is the effect of the continents on tidal behavior. The distance between the low and high tide marks of any given shore is called the tidal range. Underneath every shoreline, there is a range of ocean floor where the ocean crust meets the continental crust. This graduation is called the continental margin. Wherever wide continental margins are found, the tidal bulges tend to produce higher tides. In contrast, islands located far from these continental margins tend to have small tides. Shallow water estuaries can distort the tide and cause it to rise faster.

Tidal behavior is influenced by many other factors, including local weather patterns. Winds out at sea can pull the tide out further, while inland winds can exaggerate tidal heights. A shore’s proximity to the Earth’s poles increases the tidal range.

Thousands of obstacles built by the Germans along the beaches of Normandy. Image credit: Military History Now
Thousands of obstacles built by the Germans along the beaches of Normandy. Image credit: Military History Now

Seaside Obstacle Course

Planning the invasion of Normandy was no walk in the park for the Allied forces. The tidal range in this area of Nazi-occupied France exceeded six meters, and the tide rose at a rate of over one meter per hour. This meant there was a whole lot of beach to cross if the Allies made landfall at low tide. The Germans were well aware of the value of tide tables, and they were sure the Allies would arrive at high tide. Under the command of German Field Marshal Erwin Rommel, they constructed thousands of large obstacles along the beach. They built the obstacles about halfway up the tidal range so that they would be obscured at mid-tide and covered completely by high tide. The intent of this part of what Hitler dubbed the “Atlantic wall” was to destroy the undercarriages of Allied boats, should they arrive at high tide as expected.

Here’s the thing about building millions of obstacles on the beach, though: they can be seen quite plainly when the tide is out, especially from the sky. In fact, the Allies watched them multiply like rabbits over a couple of months in the early spring of 1944. Rommel was sure the boats would arrive at high tide, but the Allies now knew that it was out of the question.

Hand-Cranked Tidal Calculators

French mathematician and physicist Pierre-Simon Laplace built upon Newton’s tidal theories. He derived equations that described the way the oceans move in accordance with the gravitational pull of the Moon and Sun, and figured out that all tidal energy is focused at a small number of frequencies. Laplace’s equations, which are built on the conservation principles of mass and momentum, calculate the energy at each of these astronomical frequencies. He believed that these calculations were the best way to accurately predict the tides.

Laplace’s hydrodynamic approach to tide prediction was first put into use by William Thomson, who would later become Lord Kelvin. The thrust of Thomson’s harmonic method was to collect tidal data and analyze the frequencies using Laplace’s equations. While effective, this method involved a great deal of laborious calculations that could be performed far more quickly by mechanical means.

William Thomson/Lord Kelvin's first tide predictor. Image credit: UK Science Museum
William Thomson/Lord Kelvin’s first tide predictor. Image credit: UK Science Museum

Thomson created an analog computer to plot the tidal motions on a continuous graph that illustrates tidal heights over a period of time. The device was operated by hand crank. Turning the crank drove pairs of toothed disks, each representing a tidal constituent such as the lunar semi-diurnal period of twelve hours and twenty-five minutes. The ratio of a given disk pair determined the speed at which the upper disk moved.

This movement was transferred to a wheel through a rod connected to both. At the disk end, the rod is connected to one of a number of pins. The position of the pin determines the phase and amplitude of the tidal component. All of the components are tied together by a common band that sums them together, and this system converts the rotary motion of the disks into the sinusoidal motion exhibited by the pen on the graph.

Later known as Kelvin’s tide machine (you just have to love that name), this device could predict a year’s worth of tidal data in about four hours. His first iteration could sum ten tidal components. Kelvin ultimately made three versions of increasing complexity, the last of which summed 24 components.

William Ferrel's tide-predicting machine from the early 1880s. Image credit: U.S. Dept. of Commerce
William Ferrel’s tide-predicting machine from the early 1880s. Image credit: U.S. Dept. of Commerce

At about the same time, William Ferrel was constructing a similar machine for the U.S. Coast and Geodetic Survey. Ferrel’s tide predictor accounted for 19 different tidal components. It worked a bit differently from Thomson’s machine, though. Instead of graphing a curve, a series of dials and scales displayed the times and heights of successive periods of high and low water. The operator cranked it with one hand from the left side and took down the results. These numbers were copied to forms and used to create tide tables for general marine navigation. Ferrel’s machine was in use from the early 1880s until 1910. It was replaced by the U.S. Tide Predicting Machine No. 2, which was capable of summing 37 tidal components. This machine, a.k.a. “Old Brass Brains” (again, amazing name for a computing device) spent 55 years in service before being replaced by a computer.


While it’s true that these machines could predict a year’s worth of tidal activity in an afternoon, harmonic analysis of the data took several weeks to complete. After entering WWII the U.S. military made several successful amphibious landings in the Pacific and elsewhere based on the news from Old Brass Brains.

In England, tide prediction was handled by Arthur Thomas Doodson from the Liverpool Tidal Institute. It was Doodson who made the tidal predictions for the Allied invasion at Normandy. Doodson needed access to local tide data, but the British only had information for the nearby ports. Factors like the shallow water effect and local weather impact on tidal behavior made it impossible to interpolate for the landing sites based on the port data. The shallow water effect could really throw off the schedule for demolishing the obstacles if the tide rose too quickly.

Image credit: Physics Today magazine
Image credit: Physics Today magazine

Secret British reconnaissance teams covertly collected shallow water data at the enemy beaches and sent it to Doodson for analysis. To further complicate things, the operatives couldn’t just tell Doodson that the invasion was planned for the beaches of Normandy. So he had to figure it out from the harmonic constants sent to him by William Ian Farquharson, superintendent of tides at the Hydrographic Office of the Royal Navy. He did so using the third iteration of Kelvin’s predictor along with another machine. These were kept in separate rooms lest they be taken out by the same bomb.

After the Allies discovered the Atlantic wall obstacles in the early spring of 1944, the mission had to be re-evaluated. The new plan? Make landfall just after low tide, and send demolition teams to blow up obstacles, creating safe channels. This way, the larger crafts could come in as the tide rose, drop troops off, and get back out to sea.

The plan was further complicated by the beach locations along the English Channel, which they pretty much had to cross at night. The Allies needed to figure out when low tide would line up with first light and a late-rising Moon. Three days in June 1944 fit the bill perfectly: the 5th, 6th, and 7th.

Under the Weather

Although General Eisenhower chose June 5th for D-Day, the weather just wasn’t cooperating. It was simply too windy to make the landing work. Fortunately, his staff predicted a break in the weather that made June 6th a real possibility. Rommel figured the weather and unfavorable tides would deter the Allies completely, so he greatly reduced his forces with the exception of Omaha Beach and left his post. The rest, as they say, is history.

[Main image: U.S. Tide-Predicting Machine No. 2 via NOAA]

Filed under: classic hacks, Featured


Amazon now rumored to jump into live TV streaming as well

When one company is said to be doing something, it’s usually not too long before another company, probably even a competitor, gets rumored to be doing the same thing.

Continue reading
iPhone Hacks | #1 iPhone, iPad, iOS Blog


Bootstrapping Motion Input with Cheap Components

Motion control is a Holy Grail of input technology. Who doesn’t want an interface that they can control with simple and natural movements? But making this feel intuitive to the user, and making it work robustly are huge hills to climb. Leap Motion has done an excellent job creating just such a sensor, but what about bootstrapping your own? It’s a fun hack, and it will give you much greater appreciation for the currently available hardware.

Let’s get one thing straight: This device isn’t going to perform like a Leap controller. Sure the idea is the same. Wave your hands and control your PC. However, the Leap is a pretty sophisticated device and we are going to use a SONAR (or is it really SODAR?) device that costs a couple of bucks. On the plus side, it is very customizable, requires absolutely no software on the computer side, and is a good example of using SONAR and sending keyboard commands from an Arduino Leonardo to a PC. Along the way, I had to deal with the low quality of the sensor data and figure out how to extend the Arduino to send keys it doesn’t know about by default.

The Plan

The plan is to take an inexpensive SONAR module (the HC-SR04) and an Arduino Leonardo and use it to perform some simple tasks by mimicking keyboard input from the user. The Leonardo is a key element because it is one of the Arduinos that can impersonate a USB keyboard (or mouse) easily. The Due, Zero, and Micro can also do the trick using the Arduino library.

I wanted to determine how many gestures I could really determine from the HC-SR04 and then do different things depending on the gesture. My first attempt was just to have the Arduino detect a few fingers or a hand over the sensor and adjust the volume based on moving your hand up or down. What I didn’t know is that the default Arduino library doesn’t send multimedia keys! More on that later.

How the SONAR Works

The SONAR boards come in several flavors, but the one I used takes 4 pins. Power and ground, of course, are half of the pins. In fact, my early tests didn’t work and I finally realized the module requires more power than I could draw from the Arduino. I had to add a bench supply to power the module (and, of course, I could have powered the module and the Arduino from the same supply).

The other two pins are logic signals. One is an input and a high-going pulse causes the module to ping (8 cycles at 40kHz). There is a delay and then the other pin (an output) will go high and return low when the module detects the return ping. By measuring the time between your signal to ping and the return, you can judge the distance. In my case, I didn’t care about the actual distance (although that’s easy to compute). I just wanted to know if something was farther away or closer.

pingThe scope trace to the right shows the sensor pointing at something relatively near. The top trace is the start pulse and the bottom trace is the input to the Arduino. The center trace is the output of the SONAR transducer. All the signal conditioning is inside the sensor, so you don’t need to worry about the actual signal processing to generate and recover the audio. You only need to measure the width of that bottom pulse.

The scope has persistence and you can see that the bottom trace does not always come out right at the same time (look at falling edge and you can see “ghosts” for previous samples. It shouldn’t come as a surprise that it may take a little effort to reduce the variations of the signal coming back from the SONAR.

Noise Reduction and Actions


I wound up trying several different things to attempt to stabilize the input readings. The most obvious was to average more than one sample. The idea is that one or two samples that are way off will get wiped out by the majority of samples that are hovering around some center value. I also found that sometimes you just miss–especially when looking for fingers–and you get a very large number back. I elected to throw out any data that seemed way off when compared to the majority of received data.


One other tactic I used was to verify certain elements with a second reading. For example, the start event occurs when the SONAR reports a value under the idle limit. The idle limit is a number less than the reading you get when the SONAR is pointed at the ceiling (or wherever it is pointing) and you don’t have anything blocking it. To recognize a valid start, the code reads twice to make sure the value is under the limit.

The code inside the Arduino loop is essentially a state machine. In the IDLE state, it looks for a reading that is below the idle limit. When found, that causes a transition to the sampling state. When the reading goes up or down more than some preset value, the code in the sample state sends a volume up or down key via the keyboard interface. If the sample goes back over the idle limit, the state machine returns to IDLE.

I got pretty good results with this data reduction,  but I also found the NewPing library and installed it. Even though it isn’t hard to write out a pulse and then read the input pulse, the NewPing library makes it even easier (and the code shorter). It also has a method, ping_median, that does some sort of data filtering and reduction, as well.

You can select either method by changing the USE_NEW_PING #define at the top of the file. Each method has different configuration parameters since the return values are slightly different between the two methods.

I said earlier that the code sends volume up and down commands when it detects action. Actually, the main code doesn’t do that. It calls an action subroutine and that subroutine is what sends the keys. It would be easy to make the program do other things, as well. In this case, it simply prints some debugging information and sends the keys (see below). I didn’t react to the actual position, although since the action routine gets that as a parameter, you could act on it. For example, you could make extreme positions move the volume up two or three steps at a time.

Sending Keyboard Commands

I wanted to send standard multimedia keys to the PC for volume up and down. Many keyboards have these already and usually your software will understand them with no effort on  your part. The problem, though, is that the default Arduino library doesn’t know how to send them.

Fortunately, I found an article about modifying the Arduino’s library to provide a Remote object that wasn’t exactly what I had in mind, but would work. Instead of sending keys, you have methods on a global Remote object that you can call to do things like change or mute the volume. The article was for an older version of the Arduino IDE, but it wasn’t hard to adapt it to the version I was using (version

The action routine really only needs the UP_IN and DN_IN cases for this example. However, I put in all four branches for future expansion. Here’s the action subroutine:

void action(int why, unsigned value=0)
 switch (why)
 case START_IN:
 Serial.println(" Start");
 case STOP_IN:
 Serial.println(" Stop");
 case UP_IN:
 Serial.println(" Up");
 case DN_IN:
 Serial.println(" Down");

The Final Result

sonarThe final result works pretty well, although the averaging makes it less responsive than you might wish. You can turn down the number of samples to make it faster, but then it becomes unreliable. You can download the complete code from Github. The first thing you’ll want to do is check the top of the file to make sure your module is wired the same (pin 3 is the trigger pin and pin 8 is the echo return pin). You’ll also want to select if you are going to use the NewPing library or not. If you choose to use it, you’ll need to install it. I flipped my Leonardo upside down and mounted it on a breadboard with some adapters (see picture to right). It really needs a more permanent enclosure to be useful. Don’t forget to give the SONAR module its own 5V power supply.

If you look near the top of the loop function there is an #if statement blocking out 3 lines of code. Change the 0 to a 1 and you’ll be able to just get averaged data from the sensor. Put the module where you want it and see what kind of numbers you get. Depending on the method I used I was getting between 4000 and 9000 pointed up to the ceiling. Deduct a bit off of that for margin and change IDLETHRESHOLD (near the top of the file) to that number.

The DELTATHRESHOLD is adjustable too. The code sees any change that isn’t larger than that parameter as no change. You might make that bigger if you have shaky hands or smaller if you want to recognize more “zones”. However, the smaller the threshold, the more susceptible the system will be to noise. The display of samples is helpful because you can get an idea how much the readings vary when your hand is at a certain spot over the sensor. You can try using one or two fingers, but the readings are more reliable when the sound is bouncing off the fleshy part of your palm.

If you want to add some more gestures, you may have to track time a bit better. For example, holding a (relatively) stationary position for a certain amount of time could be a gesture. To get really sophisticated gestures, you may have to do some more sophisticated filtering of the input data than a simple average. A Kalman filter might be overkill, but would probably work well.

If you look around, many robots use these sensors to detect obstacles. Makes sense, they’re cheap and work reasonably well. There are also many projects that use these to show an estimate of distance (like an electronic tape measure). However, you can use them for many other things. I’ve even used a similar set up to measure the level of liquid in a tank and earlier this week we saw ultrasonic sensors used to monitor rice paddies.

If you really want to get serious, [uglyduck] has some analysis of what makes spurious readings on this device. He’s also redesigning them to use a different processor so he can do a better job. That might be a little further than I’m willing to go, although I was impressed with the 3D sonic touchscreen which also modified the SONAR units.

Filed under: Arduino Hacks, Featured, peripherals hacks