Friday, May 22, 2015

Building a SoftRock Ensemble RXTX SDR


The last couple of months I have been listening a lot to the soldersmoke podcast. In case you do not know, it is two guys, Bill N2CQR and Pete N6QW babbling about building homebrew radios. I am very happy I found this podcast. It is highly inspiring, and by listening to the two experienced homebrewers I immediately wanted to melt some solder and build radios myself. Hence, I had to get myself a licence (got it last week: LB0MG) and start soldering radios.

As much as  I would like to be in the possession of a totally homebrew fundamentalist discrete component ham radio station (like Bill N2CQR), I concluded that I rather should start out with a kit. (I guess some homebrew fundamentalists threw up a bit now since I mentioned the word "kit").

Building the Softrock RXTX

Anyway, choosing a kit I might as well do it the modern way and build a SDR. I initially considered the PeaBerry SDR, but ended up with the Softrock Ensemble RXTX SDR Transceiver kit since I have the required sound card capabilities laying around after my previous synth projects.

The kit is nicely packaged and contains about 250 parts. Some through hole and some SMT.
I am pretty sure I will not do much contesting in any perceivable future so I choose to build the Softrock for the 17m, 20m, and 30m bands (two contest free bands).

There is an excellent build manual on the pages of WB5RVZ.  I addition I have had great use of some of the videos from W2AEW to understand the concepts of SDRs and to improve my toroid winding technique. He has some of the best engineering videos on the entire Youtube.


So far I have built the entire RX part of the kit and it has come along quite nicely. The SMT parts are rather easy to solder. Surprisingly enough, the through hole parts are a bit more challenging since there are very little space around the components, and the pads are really small and not gold plated. A lot of flux really helps.

The only mistake I did was that i lost the LT6231 SMT RX opamp (probably in the vacuum cleaner). Straight away I ordered two new chips from DigiKey and when they arrived at my door merely 36 hours later, I was so eager to get the RX working, that I accidentally soldered the small SMT chip in the wrong orientation. Hence I had to use the second one (glad I ordered two of them). But it worked! I got a small Image rejection problem, but traced it down to a setting in the sound card I used (Behringer UCA-202).

In the above picture you can notice the excellent indoor dipole "antenna" connected to the Softrock. The length of the dipole is about 5m, so It is not the best choice for receiving either of the bands. I guess some you antenna fundamentalists threw up watching this picture, but hey, the antenna sort of works. 

To please the homebrew fundamentalists out there, I used my 22 year old homebrew LM317 bench power supply to provide clean and pure 12V DC.

I connected the receiver to HDSDR, grabbing the I/Q signals. I have received SSB, RTTY, WSPR and JT65 on 17, 20, 30 and 40m bands. In the above picture you can see some digital signals popping in at 20m. I tried to use WSPR software directly on the I/Q signals from the radio but with little success. I had to output USB audio from HDSDR via a second sound card and then into WSPR.

From my perspective the RX test was a great success. Even with the indoor "antenna" I received WSPR on 30m from 60 different transmitters over a 24h period, and even across the pond. You might see LB0MG in the above map: Yeah, that's my Softrock sniffing RF from the ether, placed in an attic in Norway. 

I even got reports coming in from K1JT (yes, the Nobel laureate, Joe Taylor, that created WSPR) himself and got a bit starstruck. It is funny to think about the fact that he was transmitting his modest 5 Watts from New Jersey, and that my home soldered Softrock received his RF vibrations all 6000km away, even with a crappy piece of wire as antenna. The radio gods are undoubtedly on my side on this one.  

Now, I am eager to generate some RF myself and will get on finishing the TX part.

Thursday, May 14, 2015

OpenPanTilt electronics

It has been a while since I made the OpenPanTilt prototype. It is now available on Thingiverse:655790 and I am quite surprised about the feedback and attention it has gotten. Billions of people have now downloaded the design files (at least 430) and millions have asked me about the electronics (at least three individuals). It is about time that I provide some details. (I also plan to publish a few more time lapse videos to show this magnificent piece of equipment in action.)

The electronics consist of an Atmel ATMega328P-PU a.k.a barebones Arduino. The AVR is run on 16MHz and driven by 5V from a 7805 regulator. It can be bootloaded using something like this. Two optocouplers drives the camera (shutter and focus). I guess any optocoupler will do, but I used 4N35. Besides from a reset switch and some filtering caps here and there, thats it.

The stepper motors are driven by easydriver stepper motor drivers. I made room for three of these on the board, so it can drive a camera dolly in addition to pan and tilt.

The schematics was created in Kicad. This was my first project in Kicad, and since I was impatient, I used the autorouter in Kicad according to the instructions at Wayne and Layne.  I think the autorouter performed well for this small project.

When the board seemed fine, I created the gerber files using this guide at Toymaker Television. Notice the "mirror X-axis" when creating the drill file. Finally, I submitted the gerbers to OSH-park. The project can be found at OSH-park if you are interested.

The PCBs have excellent quality and the soldering goes like a blast.

Two Easydriver stepper motor drivers are fitted on the PCB (room for one more).

The user interface is simply a TM1638-based 8x7segment display with control buttons. It was ordered from China and can be found everywhere on the interweb. I soldered some wires going from the TM1638 PCB to my own panel mounted control buttons.

In the above picture you can see the extremely simple user interface. It works as follows:
  1. Use the buttons to pan and tilt the head to the desired start position.
  2. Press P1 (programs the start position).
  3. Use the buttons to pan and tilt the head to the desired end position.
  4. Press P2 (programs the end position).
  5. Press Start. The Pan/Tilt head will now return to the start position and will start shooting.
You can optionally press the Menu button before programming to set the interval between each step and each picture.
This is extremely easy, but it works. The display shows the number of pictures shoot and the current pan/tilt position. I choose to use a 7-segment display just because I like the old school looks of it. A 20x04 LCD with a rotary encoder would, of course, be more sensible.  

The box has connectors for 12V DC, camera (shutter and focus), Pan stepper motor, Tilt stepper motor and an auxiliary stepper motor.

Some mistakes 

I did some mistakes while building the control unit. If you want to build something similar, you should try to avoid these.

First of all, the 12V power header for the stepper drivers was was reversed on my PCB layout, meaning that the driver did not initially get any power.

Hence, I had to modify the mounting of the easydrivers a bit (notice the white wire on the above picture). No big deal, but it means that you should not order these boards from OSH-park, even if the board was selected amongst the staff picks of the week. :-)

A second error on the board is that there is no protection whatsoever on the 12V DC. No diode, no polyfuse, no fuse. Nothing. At least a diode should be placed in there, somewhere.

A third thing that I was not aware of is that the easydriver board must be connected to a load. Without a load (i.e., a stepper motor), the driver IC will burn up. Totally stupid, but I burned up two boards this way, and had to wait forever to get some new boards from Shenzhen, China. Thankfully, they are easy to replace.


Ok. Thats it. I learned a lot while building OpenPanTilt. And, best of it all, it works. If you want to build something similar, or have comments, please let me know. I know Josh Sheldon was inspired by OpenPanTilt and has developed some of the ideas further, and I must say, with impressive results.

Wednesday, May 13, 2015

Motion sensor to detect sneaking toddler

Once the kids are asleep at night, you can finally relax. Aahh. Maybe you want to stress down with a violent splatter movie with the volume at 11? In this situation you definitely do not want the kids to sneak around in the house behind you and watch the movie in secrecy. In that case you will have a lot of explanation to do. (Dad? What happened to the man's brain?). Or maybe you and your spouse are in your bedroom making new kids..? You definitely do not want the existing kids to interrupt such a beautiful moment. And difficult questions could possibly be asked.

The trick is to use a motion sensor outside the toddlers bedroom and a portable doorbell with visual and audible alarm. All possible crisis is henceforth avoided.

I bought one of these Nexa doorbells, and a...

... Nexa IR detector.

The problem with the doorbell is that is also chimes when someone are walking around in the house during daytime. It also chimes to loud for the intended purpose. Therefore, I added a volume control, that also serves the purpose as a on/off switch.

The doorbell is a simple design built around a 433MHz receiver

A 100k audio pot for the junk box does the job. I also tried with some resistors to limit the 100k pot with mixed success. It does not matter much for this purpose.

I drilled a hole in the front panel, and ...

Voila. A doorbell with a nice blue LED and fully adjustable volume with a Moog style knob. I glued some eyes to the doorbell to make it seem a bit more friendly.

Thursday, April 23, 2015

Pregnancy countdown device with Arduino

Once you or your spouse gets pregnant, thats all that matters in life. You immediately starts to count down to due date and you constantly want to know the current weight and length of the baby. And trust me; you do not wish to use a freakin iPhone app for that. You (and your baby) deserve a dedicated device for the job!

This is what you are waiting for

I hereby present my pregnancy countdown device. I built this a couple of years ago, and the baby whose due date was steadily counted down with this one is now a walking and babbling toddler. This is a simple weekend project that you can assemble with junk-box parts and an IKEA picture frame.

2 days and 22h to due date. You better pack the bag!

You are in week 40 and the baby is now 51.5 cm!

You are in week 40 and the baby is 3558 grams.

The device switches between due date countdown, baby length, baby weight and the current time (above) with 5 seconds on each.

The device is based on a Arduino UNO R3, a DS1302 real time clock and a 8-digit 7-segment display. The DS1302, and four buttons are soldered on a prototyping shield. The Arduino and the display are "glued" to the IKEA picture frame with sugru. I used an exacto knife to cut a hole in a 10x15cm picture and used an old 35mm film strip as a bezel for the 7 segment display diodes.

The buttons were initially for setting the due date, but I did not care to implement that in the software. Hardcoding is sufficient for this purpose (depending on how many kids you are planning of course).

The core of the code is basically to calculate the length and the weight of the baby given a specified due date. For any day the weight and the length can be interpolated from the tables below (showing weeks). The length (in cm) and weight (in grams) are average values for northern european babies. If all your meals are pure butter and coke during pregnancy (it can happen), you mileage may vary.

double lengthTable[] = {0,

int weightTable[] = {0,

Wednesday, April 22, 2015

10 Great Audio Books for Makers and Geeks

Disclaimer: The DIYcrap blog is meant to be exclusively about crap that I am making. This post is going to be one rare exception to that rule.

I am a sucker for inspirational and geeky audio books. Although there are tons of excellent non-ficion books on paper or as e-books, not all of them are that good when transferred to audio. Some audiobooks are, however, really good and can make a boring commute become the most inspirational time of your day. This is a non-prioritized list of some of the best audio books about making, geeking, nerding (whatever) that I have heard during the last two years.  They are all positive, refreshing and inspirational, and explains why new inventions in technology make the world progress towards a better place. These books are perfect if you are fed up with all the negative news stories telling you the world is going to hell and that we are soon going to die from the melting polar ice, hunger or terrorism.

Enough said. Lets begin with the list, emphasizing again that the list is not prioritized.

1: The Second Machine Age: 

Work, Progress, and Prosperity in a Time of Brilliant Technologies

Written by: Erik BrynjolfssonAndrew McAfee
Length: 8 hrs and 49 mins
Published: 2014

The book explains how digital technology dictates changes in the economy. The authors give many examples on different technologies that contributes to this change, such as robotics, 3D-printing, artificial intelligence and autonomous vehicles. The thesis of the book is very good, but on the negative side, the book is very similar to "The race against the machine" written by the same authors. If you have read (or listened) to the previous book, you can skip this. If you have not read the first book, you should choose "The second Machine age" as it is more updated.

2: Stuff Matters: 

Exploring the Marvelous Materials That Shape Our Man-Made World

Written by: Mark Miodownik
Length: 6 hrs and 34 mins
Published: 2014

This book is all about materials science. The author goes into detail about the history behind some key materials and the impact they have in our everyday lifes. Materials such as glass, steel, plastic and chocolate are explained with lots of humour and with interesting stories. If you have forgotten absolutely everything from your chemistry classes this book can reboot your interest in that direction. 

3: The Innovators: 

How a Group of Hackers, Geniuses, and Geeks Created the Digital Revolution

Written by: Walter Isaacson
Length: 17 hrs and 28 mins
Published: 2014

This book describes the fascinating history of the computer and electronics age. Among the heroes whose lifes and work are described are Ada Lovelace, Charles Babbage, Grace Hopper, Howard Aiken, Steve Wozniak, Steve Jobs and Bill Gates. It is obvious already in the first pages that Walter Isaacson does not like the romantic illusion of a lone inventor often described in biographies. He rather advocates that collaboration between different people is the main driver behind innovation. Overall, the book is really great, it is well written, and it goes through the whole history of information technology.

4: iWoz: 

How I Invented the Personal Computer and Had Fun Along the Way

Written by: Steve Wozniak, Gina Smith
Length: 9 hrs and 12 mins
Published: 2007

The books is told by Steve Wozniak about Steve Wozniak. In fact, the whole book is about Wozniak. Wozniak, Wozniak, Wozniak. As you probably can tell, there is a lot of bragging self-centered Wozniak in there, but who cares? Wozniak is an electronic genius, and he knows it. Although the book is badly edited, there are lots of interesting stories in here.

Walter Isaacson claims in Innovators (above) that Steve Jobs and Steve Wozniak were equally important in making Apple a big success. It might be true from a business point of view, but Wozniaks romantic story of creating a working computer sitting on his own is of no doubt the more interesting story of the two (at least from a geeky point of view).

5: Abundance: 

The Future Is Better Than You Think

Length: 10 hrs and 22 mins
Published: 2012

This book advocates that mankind could not only be causing all problems we face on earth, but we can also do something about these problems. Thanks to recent developments within digital technology, material technology and so on, we can actually improve the life of all people with water purification, diagnostic apps, new means of food production, renewable energy etc. If you are tired of all negative news stories telling you the earth is going to hell, this book will bring the optimist out in you.

6: The Long Tail: 

Why the Future of Business Is Selling Less of More

Written by: Chris Anderson
Length: 8 hrs and 1 min
Published: 2006

This book is already a classic. You can read more about Chris Andersons concept on his web-page, and he explains it like this: "The theory of the Long Tail is that our culture and economy is increasingly shifting away from a focus on a relatively small number of "hits" (mainstream products and markets) at the head of the demand curve and toward a huge number of niches in the tail."

Most of Chris Andersons predictions in this book has already come true, and it might seem somewhat outdated. However, the main thesis still holds, and it is well written, and highly recommended.

7: Automate This: 

How Algorithms Came to Rule Our World

Written by: Christopher Steiner
Length: 7 hrs and 41 mins 
Published: 2012

Although the statement that algorithms "came to rule our world" is very exaggerated, the book has some interesting stories. Most of the use of algorithms described in the book is from Wall street, and there is no doubt that algorithmic trading has changed the way Wall street and that part of the economy is working (or not working). I would not use this book to teach people about algorithms. Novices might even be scared to believe that algorithms are, in fact, taking over the world. But as pure entertainment, this book is recommended.

8: Makers: 

The New Industrial Revolution

    Another book of Chris Anderson made it on my list! This book is about how 3D-printers, laser cutters, digital fabrication, Kickstarter, Arduino and the new DIY/Maker-movement is altering how businesses are created and run, and how the digital age also influences the production of physical stuff (i.e., bits and atoms). 

    Anderson believes that we face a new industrial revolution, and that the new tools and production processes can offer a way for USA and Europe to incource production of physical objects from China. He might or might not be true about this thesis. It does not matter for me. The book is full of optimism about the future and it just makes me want to make stuff right away.

    9: What If?: 
    Serious Scientific Answers to Absurd Hypothetical Questions

Written by: Randall Munroe
Length: 6 hrs and 36 mins
Published: 2014

This book is full of humor and hard facts. It provides answers to questions like "What is the farthest one human being has ever been from every other living person? Were they lonely?", and "What if you tried to hit a baseball pitched at 90 percent the speed of light?", or  "How fast can you hit a speed bump while driving and live?" and " If there was a robot apocalypse, how long would humanity last?". If you have ever read (and understood) Randall Munroe’s iconic webcomic, this book is for you. The book makes you proud that you enjoyed physics and chemistry classes all those years ago while the other kids hated them.

10: Bold: 

How to Go Big, Make Bank, and Better the World

Written by: Peter H. Diamandis, Steven Kotler
Length: 9 hrs and 6 mins 
Published: 2015

This book is written by the same authors that wrote Abundance in 2012. It is sort of an update of this book and sort of isn't. It is mainly a motivational book for business people wanting to understand exponential technology. For an inventor or engineer, it can be quite irritating reading a book that constantly talks about going big, bold and make a billion-dollar company.  Unfortunately, most of the stories and examples in the book are well-known and does not bring anything new to the table.

The book is narrated by one of the authors, Steven Kotler. A very bad idea. Although the book is very optimistic in its style, the narration seems very monotone, negative and depressive. It is as if he is just about to jump off a cliff. Why am I even bothering to recommend this book? Well, it is about creating businesses that changes the the world, it is optimistic, and makes me want to be an entrepreneur.

Tuesday, April 14, 2015

Script for downloading all Popular Electronics magazines

The great page has got loads and loads of old radio and electronics magaizines for download. Among these are the venerable Popular Electronics magazine which was published between October 1954 and October 1982. These old magazines are really great, not only for historic reasons and for fun, but there are also lots of electronic circuits, loadspeaker designs, and more in there that you can still build directly from the articles or you can use them as inspiration for new projects.

The most famous issue is probably the January 1975 issue presenting the Altair 8800 computer kit. Now you can build your own based on the original instructions :-)

I have made a simple Python script that downloads all the 337 isssues of the Popular Electronic magazine. The script is based on a script from Peter B. Mark that downloads all 73 ham radio magazines from (btw, a highly recommended magazine).

Using the script, I can read through all the editions on my iPad even when I am offline, for example when I am waiting for my flight on an airport with nothing else to do and no WiFi.

Disclaimer: The whole bunch of magazines will occupy about 3.5GB of disk space. Furthermore, the naming of the directories on americanradiohistory is not concise, so the script might seem a bit crappy. But it works! Feature: If you exit the script while it runs, it will not download previously downloaded magazines when you restart. Good luck.

Download pdfs of Popular Electronics Magazine

import os
import urllib2
import urllib

END_YEAR = 1982
OUTPUT_DIR = "PopularElectronics"

MISSING = ('PopularElectronics/Pop-1954-01.pdf', 'PopularElectronics/Pop-1954-02.pdf', 'PopularElectronics/Pop-1954-03.pdf', 'PopularElectronics/Pop-1954-04.pdf', 'PopularElectronics/Pop-1954-05.pdf', 'PopularElectronics/Pop-1954-06.pdf', 'PopularElectronics/Pop-1954-07.pdf', 'PopularElectronics/Pop-1954-08.pdf', 'PopularElectronics/Pop-1954-09.pdf')

def main():
    if not os.path.exists(OUTPUT_DIR):

def downloadPopMag(prefix):
    for year in range(START_YEAR, END_YEAR + 1):
        for month in range(1,13):
            fileName = "%s/Pop-%d-%02d.pdf" % (OUTPUT_DIR, year, month)
            if not os.path.exists(fileName) and fileName not in MISSING:
urlyear = year - 1900
tenyear = urlyear - (urlyear % 10)
strtenyear = str(tenyear) + "s"                
if(urlyear > 69):
urlyear = year

editionString = "%s-%d-%02d" % (prefix, year, month)

url = "" % (strtenyear, urlyear, editionString)
                print("Downloading: %s..." % url)
                print("To: %s" % fileName)
                try: pdfData = urllib2.urlopen(url).read()
except urllib2.HTTPError as e:
# Probably wrong prefix. Try with the other prefix later
print e.code
                outFile = open(fileName, "wb")
                print("Skipping: %s" % fileName)

if __name__ == "__main__":

Monday, March 23, 2015

Receiving JT65 with RTL-SDR

A couple of weeks ago I bought a RTL-SDR (software defined radio receiver) dongle with the 820T2 tuner chip. You just cant beat the fun/price ratio on this one. For 11$ (with free shipping) it is a bargain, and it is a great way to learn about radios (at least the reception part).

A bargain on AliExpress

Initially I used Gqrx on my Mac to communicate with the RTL-SDR, but eventually I had to resort to SDR# on Windows 7, as it has a bit more features. I have the impression that most radio (and ham-stuff) is made for Windows rather than Mac or Linux.

Apparently not much activity on 10m, but JT65 lurks there in the noise
Even with the standard antenna I had no problem receiving FM broadcast between 88-108 MHz, DAB around 200 MHz, some public transport transmitting FM on 151 MHz and some sporadic narrow FM around 140 MHz. I could also see that there was a lot of activity on 434 MHz and 868MHz bands from car keys, weather transmitters, baby calls and so on.

A few JT65 signals in the WSJT-X waterfall
However, what I really wanted to receive was amateur radio digital modes JT65 and PSK31 on the HF bands (preferably on 10m and 20m). I made a half-wave dipole for the 10m band (28MHz), and soldered the coax directly on the board. The RTL-SDR seem very noisy on HF and all I got initially was a weak RTTY signal on 10 m (which I was unable to decode), and a brief SSB-reception. I guess that one reason for the bad performance is that the strong FM broadcast signals on 88-108MHz interferes with the lower frequency bands.

Receiving JT65 in WSJT-X

However, after a bit of tweaking with the audio levels in SDR# and WSJT-X, I was able to receive some JT65 messages. It was incredibly fun to receive signals from Spain, Russia, South Africa and Brazil (among others) on this 11$ stick and my home-made dipole antenna. (Now I finally understand what the amateur radio people are so intrigued about.)

Received JT65 on 10 m from ZS6KMD in South Africa (9715km)
JT65 on 10m from PY2RED in Brazil (10550km)

Obviously, there are some improvements that can be done with the RTL-SDR to help HF reception. A FM-broadcast bandpass filter would eliminate the interference from the strong FM broadcast transmiters. As I am mainly interested in HF, and do not care about the performance above 30MHz, a simple low-pass filter at 30MHz will probably also do the trick.  Better shielding and filtering on USB can also help. Many folks are also using an upconverter, for example the Ham-it-up, which is undoubtedly the way to go to improve HF sensitivity.

Although I might try to improve HF reception on the RTL-SDR later, I will rather go building a Softrock RXTX SDR Tranceiver. The said kit is already on my workbench, and the soldering iron is hot. More to come...