Sunday, August 14, 2016

Cheap and easy to build digital modes USB interface for Ham Radio.

The DuinoVOX  Arduino powered digital modes USB interface for ham radio.

   I wanted a better computer to radio interface than what I was using,  straight connection from the computers audio jacks.    Being unemployed for awhile, I couldn't afford $100 to buy a Signalink commercial interface, so I built my own.  Also, I wanted to use an Arduino in a ham radio project.  It came out so well,  that I've decided to publish it here.   If you build it and like it, please let me know.
 Below is the schematic.   I did a youtube video on the project,  watchable at this link.

Circuit Description:
   The USB sound dongle can be purchased on for less than $10.  Search for "USB sound adapter" and you'll find dozens of them.   Look for one with a split plastic case so you can take it apart.  You'll need to tap +5V and ground at the USB connector, the outside pins of the 4 pin connector.
   You can used 1/8" jacks to plug in to it, or desolder the existing jacks and tap audio right off the PCB with thin coax or other shielded cable.
   The audio coming from the USB sound device is low voltage.  1.7 volts P-to-P max volume.  Since the Arduino will only sense positive voltage,  that's 900mv at best.   Depending on the point in time that you sample the signal, you can catch it anywhere from zero on up to .9 V within the waveform.  Not great.
   So,  Q1 is a simple amplifier that takes the input signal up to the full 5V on peaks.
   The amplified signal passes through D1 and charges C4.   D1 prevents the cap from discharging back through the transistor, so you get an accumulated voltage up to around 4.4V DC during a full volume signal.  This gives an excellent range on the input to the Arduino, and allows for sensitivity adjustment to be done in software.
  R6 bleeds the capacitor down when the audio stops.
  Q2 takes the PTT signal from the Arduino and grounds the radios PTT line to key it into transmit.


C1 and C2,  I used non polarized caps since I had them on hand, but regular electrolytics will work fine.  If you're concerned about isolation, you could use two 600:600 Ohm transformers instead.
C4 is not critical.  If you don't have a .22,  put two .1 in parallel
R7 and R8 don't have to be 10K, can be anything from 10K up, don't have to match either.
C3 can be anything from 1uf up to 10uf

One important tip on using this interface.  On your computer, you'll want to set the playback volume for the interface sound card to maximum,  then use the drive control knob to set the audio level to your rig.  This gives the vox circuit plenty of audio to work with.

The Arduino source code is pasted below.  You should be able to copy paste it right into the Arduino IDE.   If you have trouble,  let me know and I'll email the file to you.   Thanks and 73.

If you build this and love it,  and you'd like to leave me a tip,  my email registered with paypal is

Monday, February 15, 2016


   I have a friend.    Met him flying radio controlled planes.    He's a happy kind of guy,  always a smile on his face.  Good for a joke, or friendly story.    He's also a guy who always goes for the top quality item in whatever category has his attention that particular season.    Then it was planes.

   When he wanted a biplane,  he bought the top of the line kit,  the best motor,   best battery, etc.  

   So visiting him the other day,  he was showing me his fishing rods.    Fishing caught his attention last summer, hook, line, and yes, sinker.    He has several for each facet of fishing.    Multiple fly casting rods, of varying weight and length.   Many spin casting rods, each rigged a different way, for a different kind of fishing.     And then,  he handed me a bamboo rod and didn't say anything, just stood there while I looked at it.

    This rod was special.    It was bamboo, but hexagonal in shape.   I lifted it and looked down the tunnel of eye loops down the side of the rod.    It was a perfect shape.   they were absolutely in line.   The rod was coated with a clear surface that had a gripping feel to it, although it was smooth as glass.  The bamboo was stained, and you could see how the strips were arranged to create a longer and larger pattern out of the dark spots in the bamboo.  Strips..     Each segment of the rod was made of straight strips of bamboo, hand cut and fit together so perfectly that the eight sides became one.

   This was not some 3/4 inch thick telescoping bamboo rod like you might be thinking of.    This was about 6 feet in length and about 1/3rd of an inch thick at the handle end.   It tapered to a delicate tip not much larger than the lead of a pencil.   But it was not fragile at all.   Amazing.

    Sometimes quality isn't subtle, it just jumps right out and screams at you.

   My friend is an acquaintance of the guy who makes the rods and was gifted this one.   He explained that it was the low end model,  usually selling for around $1,200.  

   It was a work of art.  The product of a master artisan.   It was beautiful.

Monday, October 19, 2015

How to properly shuffle virtual cards in software.

Last night, during one of many bouts with insomnia, I was attempting to bring on sleep by playing a mindless game,  Solitaire.   I say mindless since it requires only the tiniest bit of skill to play.  All you have to do is not miss a play.  The game will be won if it is winnable,  it depends on the order the cards come out of the deck.

This particular version of the game,  installed from the Chrome web store,  looked beautiful,  had wonderful card animation, nice sound, and terrible card shuffling!  After 30 lost games in a row,  I was quite annoyed, and further from sleep than when I began.

How do I know it was bad shuffling?   Well it was obvious by the regular discovery of two or three of the same number of card in succession.  Three Aces in a row,  or fives, etc.  This poor shuffle, at least in Solitaire,  leads to unwinnable games far more often than winnable games.

A poor shuffle might be advantageous in Poker,  to one player at least, but still a bad thing in the bigger picture.

I see this often.  Poor shuffling in a card game program.    I always remember my high school days and a certain programming contest a few friends and I had.

It was 1983.  My high school had several Apple ][+ computers in the library, as well as a couple in the vocational electronics class I was taking.   This was the early days of personal computers and almost nobody had one at home.   

Myself and a few friends, classic nerds of the day, were very much in love with these little machines.  We often fought over who would get time on them after class.  Our parents had become accustom to us staying after school until the janitor kicked us out and we trudged home to a cold dinner.   We amused ourselves with programming contests we’d come up with.  Each hoping to achieve the position of alpha male in our geeky clique.

The contest of one particular week grew out of a problem one of our group was having with trying to write a good blackjack game.    You see, we were programming in BASIC at the time, and it was not a very fast language.   The Apple ][+ had a CPU running at around 1Mhz.  BASIC, being an interpreted language was slow,  very slow,  unbelievably slow by today's standards.   Akin to comparing a formula one car to a cart drawn by a donkey.

Doug,  the kid working on the blackjack game, was rather cocky.  He was similar to Dr. Sheldon Cooper on The Big Bang Theory.  Very smart, yes, but so incredibly full of himself that we tolerated him only.   His problem was that it took well over two minutes for his card shuffle to complete at the beginning of the game.   He proposed a contest to come up with a better sorting routine.

By the end of the week, when we gathered to present our results, I was the clear winner and not by a narrow margin!    There were four of us, not counting Doug.   Doug had managed to get his shuffle down to one minute and thirty two seconds while sacrificing a bit of randomness.  Faster, but the shuffle was poor with many cards adjacent to their brothers.

The other three guys varied with one being a bit slower, and the other two beating Doug by just a couple of seconds.   All three also had somewhat poor shuffles.

My shuffle took all of four seconds.    Four,  yes,  only four seconds, in BASIC, on an Apple ][+.   Additionally, my shuffled deck was thoroughly shuffled with hardly a single instance of card pairs left. For awhile thereafter, Doug wasn't so cocky.

No,  I didn’t cheat, or use machine language.  It was a method that I came up with that I wish all programmers would use in modern card games.   Not for the speed, that hardly matters on today's incredibly fast machines.  No,  I wish programmers would use my method for the thorough randomness of the shuffled deck.

Here’s how it works.   Now,  I can’t present this in C, or Python,  .NET, or any modern language.   I’m not going to bore you with BASIC since it’s basically a dead language now.   I’m going to attempt to convey the idea,  it’s simple enough.

So first you need the deck to be shuffled.   In BASIC I simply loaded an array with numbers to represent the cards,  one through fifty two. I guess you'd use a table or something today.

Now, to shuffle them  you need a simple loop.   The loop with run fifty two times with a counter that’s incremented during each pass.   This counter will point to the position in the deck we’re working with.

For each pass of the loop,  you take the current card and exchange it with a random position in the deck.   So for pass one,  we’re working with the first card in the deck.  Pick a random number between one and fifty two and swap those two ‘cards’.

After only one pass through the loop, you’ll already have a deck that is shuffled better than what most modern card games end up with.   And it will happen incredibly fast.   Now, run the loop two or three times and you have a properly and thoroughly shuffled deck of cards.

Easy.   Simple.   So please,  programmers,  do this and properly shuffle your cards.  It will make for a much more realistic flow of the card game.


Monday, October 12, 2015

Woa!   Wow, weird....     I haven't posted here for over two years?    I kind of forgot this place existed.

I guess it doesn't help that life got really tough at work and began to encroach upon my home life to the point that I was dreaming a day at work more and more often.   Hell, one week I dreamed work three nights in a row.   Vivid,  realistic dreams with all the detail of a complete day.   That week really and truly felt like it was 8 full days long with only two nights.

I buckled under the stress and pressure,  butted heads a bit with my new boss.  The son of the owners wife's best friend, who was originally just another guy but in a few months was director of our department.   Young and reckless,  he created more work for me weekly with his mistakes.  It all came to a head and I resigned.

That was just over four months ago.   I've sent out many resumes,  but had no interviews.

On top of that, my memory is getting bad,  the days are spinning by, I'm scratching at the walls in frustration and boredom,  and feeling like I'm on a slow descent into some kind of madness.

OK,  that's all off my chest now.   Whew.

There's upsides to losing your memory by the way.  I'm re-watching The Big Bang Theory and enjoying it tremendously.  I can't remember any of the episodes, so it's like watching it for the first time.   If this is my new normal, then I've got a lifetime of television shows that I can watch for the first time all over again,  yay!  And if this trend of worsening memory continues,  eventually I can watch the same show day to day and it will always be the first time.

Come to think of it,  I think my grandfather used to do that.   Not sure if that's a memory, or my imagination trolling me.

I have an acquaintance that got married last weekend.   He's one of the modern connected generation and I've notice a big downside to the Facebook obsessed world.   When one of them get married,  you will be inundated by their wedding.

Ha!  Just realized I have another older friend that also recently got married,  it's not you I'm ranting about here buddy,  this is a more recent co-worker.

So  pre-Facebook,  you could go to a wedding, then the reception, then go home.   It was a social event for a day and then it was over.

But now, thanks to the addiction to 'likes' that people have,  his wedding has been a five day stream of pictures and short video clips, or 'vines'.     Vines are the animated GIF's of the current decade.   And each post is followed by the same stream of drivel.    "Awww so cute",  "You guys look so nice",  "Love it", "So pretty",  and on and on.

It's almost like the person that posts a selfie every few days just to get that stream of compliments that produce the endorphin response they've become so addicted to.

And since I've 'friended' him,  I am at the mercy of the waterfall of his wedding material and a bing from FB every damn time someone else comments on one of the thirty plus photos that have been posted so far.

I came back to Facebook after a year long hiatus due to the boredom of being unemployed.   I hadn't realized how much of my social life was the daily interaction with people at work.

I'd tried going to old haunts like a local coffee shop where I used to hang out with people.  Some of them were still there.  But,  being without a cell phone or Facebook,  those visits turned in to me sitting at the table and waiting for the few seconds when they put their phones down.   Followed by more minutes of sitting and waiting after they picked them back up.

I actually had someone tell me THEY were uncomfortable with me just sitting there looking at them.  Really?  You're uncomfortable with the reality of physical presence outside of your perceptual bubble emanating from your little device that you hide in?  

It was the same in other scenarios.  I was now the odd one, not connected,  forced to interrupt our conversation when they dove back under the digital surface into their small rectangular temple.

So I reluctantly rejoined Facebook.  It seemed the only way to still feel somehow connected to my friends.   And now I fight with myself to not go there too often.  To stay outside, out here in the world, on the planet, feeling like I'm really part of life on this earth.  And it's becoming a lonely place.

I walk down the street some days and don't see another soul.  Just a long row of silent houses and empty porches.   When someone is out, if even just walking to their car,  often they only glance at me and don't return my smile.    Sometimes they do, but the majority of the time I get a suspicious look, like they're wondering if I'm up to something.

How far will this go?    In ten years what will it be like?   Will the average neighborhood be indistinguishable from the set of a post-apocalyptic movie?   Will people be startled by the physical presence of another?  Are we moving toward that strange isolationist society in that Asimov story, The Naked Sun?   It certainly seems so.  Virtual Reality might actually be the catalyst that begins the final descent into the Asmovian conclusion.  And VR is on the cusp of major adaptation.  Just a few more years, or maybe only one or two.

Enough raving for now.   This post certainly seems on topic with the title of the blog.   Sorry.  Or not.

Wednesday, April 10, 2013

A new adventure, 3D printing

This is only the first of many posts to come.   I've ordered a 3D printer, of sorts.  More like a pile of parts.

The most common 3D printer design among hobbyists, is the completely open Prusa Mendel.  One company sells all of the common parts for a base model as a kit.  Not a bad deal if you're inclined towards building things.   Their main page is if you are interested in going this route.

I will be chronicling my build in this blog, with updates and photos.  After the project is complete, I will continue to post updates about modifications, improvements, and projects I accomplish with the 'printer'.

People call them 3D printers, but really, they are additive cnc machines.  Moving a tool head, the extruder, around using the same technique and programming code that industrial milling machines use.

I'm currently waiting for the parts to arrive.  Spending my time researching, planning, and learning software.   I'll dedicate a post this weekend to software, there's a lot of ground to cover there.  

Hopefully, I'll be able to start the build next week.  Stay tuned!

Sunday, November 25, 2012

Cheap and silent desktop Linux box!

In the tech news in the last couple of weeks, there was an announcement of an intel branded mini-pc.  There have been many of these small desktop machines in the last few years.  Very small footprints, low power consumption, most are silent due to a fanless design.

The appeal of such small machines is obvious.  Taking negligible desk space, they can sit out of the way, or even be hidden.  They can be mounted to the back of a monitor for use as industrial signage, or a pseudo all-in-one design for the desktop.  They are ideal for limited space installations like in mobile homes, or a small collage dorm room.

They're considered cheap, yet are still a bit pricey for a lot of us.  Many of them seem to settle around the $300 mark.

I've found an alternative that is widely available and much cheaper, less than half in most cases.  The early intel Mac minis.

Back in 2006, Apple produced their first intel based mac mini design.  Quite a capable box at the time, Apple was always using cutting edge hardware in their designs.  This model contains an intel core duo dual core 1.66Ghz cpu, 1Gigabit ethernet, wifi, bluetooth, four usb ports, firewire 400, and DVI video connector.

Full specs listed here:

The last version of Apples OS that could run on this model was Snow Leopard, 10.6.x.   Since the last two versions of their OS, there has been a glut of these machines showing up on eBay, going for as low as $130 to just over $150.   I picked one up with a bad hard disk for under $80!

Replacing the hard disk is not too complicated, I'll list the steps at the end of this article to help anyone along if they pick up one cheap.  These make a GREAT Linux box,  I'm writing this on mine right now loaded with Debian testing.

In my case, I had a unit with a bad HD, as mentioned, so I installed a 32Gig SSD I'd picked up a year or so ago.  Installing your favorite Linux is easy, Apples firmware has an emulated bios for their "bootcamp" method of dual booting windows on their machines.  When you power up, hold down the 'opt' key if you have a mac keyboard, or the left hand 'alt' key if you have a PC keyboard.  The machine will come up to a graphic menu that allows you to choose your boot device.  Insert your linux CD/DVD, and after a few seconds you'll see a CD icon appear with "Windows" under it.  Arrow over to select it, or click with the mouse and the CD will boot.

From that point, you go through an installation just as you would on any PC box, and after the install is done and it reboots, it will come right up.

These machines are a bit pokey under Apples OS, but under Linux, they perform extremely well.   All hardware works just fine on any recent Linux kernel.  OpenGL performance is not bad at all, making all 3D games that I've tried run smoothly.  I've even played full 1080p video files full screen without stutter.  The machine is nearly silent as the internal fan can't be heard unless you put your ear right down next to the vents on the back.

So there you go.  For not much money, you can have a tiny desktop Linux PC that is fully capable of just about anything you might need to do.  Enjoy.

Here are the steps to get the mini apart for HD replacement.

1) Remove the case.  For this you need a special tool.  Apple sells it for $30.  Since it's basically just a 1" wide putty knife, you can get one at the hardware store for a couple dollars.
   Insert the knife into the seam around the bottom edge of the machine and pry.  It will pop loose, and you just work your way around.

2) Disconnect two cables.  At the back, there is a ribbon cable connected to a small board at the back of the CD rom drive.  It has a ZIF connector.  You pop to small clip up at each side and the ribbon lifts out.
   At the front, next to the small coin battery, is a two wire cable with a snap connector into the main board.  Pop it out carefully.  This is the fan temperature sensor, and if you forget to plug it back in, the fan will run full speed.

3) Remove the wifi antenna.  At the rear corner is the wifi antenna board.  Under it you will find two plastic clips.  Squeeze them in slightly and you can life off the antenna board.  Remove the spring and set it aside.

4) Remove four screws holding the chassis down on the main board.  At each of the four corners of the chassis  there is a small Phillips head screw.  One is at the bottom of a tube, one is right out in the open, and the remaining two are tucked down inside the corner of the plastic chassis.  A penlight will help on those hidden two.

5) Lift off the chassie.  This is only a little tricky.  There is an interconnected socket between the two, and the wifi antenna cable snakes down under the fan exhaust at the back.  Just work the chassis loose with a gentle rocking and lifting motion, keeping the antenna cable from getting snagged.

6) Once the chassis is out, turn it over and you'll see the 2.5" sata HD right there.  Four screws and you can work it loose from the connectors and lift it out.  Drop in your replacement by lining it up with the sata connectors and gently pressing it in until the screw holes line up.

7) re-assemble in reverse.  Take care to guide the wifi cable around the fans exhaust, *carefully* or you'll pop it loose from the wifi board.  With the holes lined up, you'll be able to work the interconnection in.  The ribbon cable at the back will slide into the ZIF connector and has a line drawn across it that will line up with the edge of the connector when it's all the way in.  Alternately press down the little clip edges while holding the cable in.
Don't forget that fan connector up front by the battery!
The two screws with the hidden holes are just a bit tricky.  A small Phillips jewelers screwdriver that has been magnetized helps there.
Finally, guide the case back on, watch the flexible ground at the back and use the guides around the back connector areas.  Press it down and it will snap back on.

Sunday, August 19, 2012

A tablet I can actually use!

    A couple of years ago, when Apple released the iPad 2, I bought one.   At the time, I had an original iPad that I'd bought second hand.  I needed it for work, since I support primarily apple products in a company that uses Macs for all of their workstations, over 400 of them at present.   Executives there all have ipads, as do many of the employees.  The company still, even today, won't provide I.T. with one, so I spent my own money on it.

    I used the iPad 2 for a few months, but ultimately sold it and bought a eeePC netbook.  At home, I'd switched from Mac to Linux, and the netbook was FAR more useful than the iPad.  Also, I grew tired of having to restart the iPad every couple of weeks due to it acting up in some strange way.  (sidebar, Apples iOS devices are built on top of the HFS+ filesystem, which is very broken and corrupts files regularly.)

   I was very happy with the netbook, excepting for portability.  A slim tablet is just more convenient to slip into a bag, or carry with you to a coffee shop, diner, or to travel with.   I still wanted a tablet for that convenience, but being a tinkerer and linux user, I have to have openness and reliability.

    All of those facts in line, I was very happy to see Google release the Nexus 7, and snapped one up.  It fits the bill PERFECTLY!   It's smaller seven inch size is ideal.  Convenient to carry, easy on the wrists for long reading or gameplay periods.  Googles android in it's native form, not hobbled by some carrier or companies crapware piled on top of it.  Quad core CPU in the nVidea tegra three chip is really fast, and the one gig of RAM gives the OS plenty of room for speedy app switching.

    This weekend I took it traveling and found it to be excellent and useful on the road.  We were going deep into a state park forest for some fishing, far from cell service and full of twisty little roads.  A new feature of google maps in the latest android, is offline maps.  You can download areas of the maps to the device ahead of time.  This, along with the built in GPS proved very useful while finding our way through the park.

    Back at the hotel, on the provided wifi, it made quick work of the usual fair.  Checking email, posting some trip pics to facebook, catching up on the news, finding interesting places to visit in a strange city, etc.

    The voice dictation has improved to the point of star trekishness spooky in it's accuracy and speed.  It no longer requires network access, residing completely on the device for nearly instant recognition of spoken words with very little post editing required.

   One final point...   At the $199 price, you could buy two of these and some software for the same price as a single iPad!  I give it a big thumbs up.