Tuesday, December 10, 2013

How Long is a Nanosecond? (Grace Hopper aka Amazing Grace)

[I originally posted to a mailing list I'm on.]

Google's doodle for today (December 9th, 2013) is commemorating Grace Hopper's birthday.

Time.com has a pretty good summary here:

I suggest watching/listening to the 2 minute youtube video. One of the things she is known for is talking about how long a nanosecond is by giving away 11.8 inch lengths of wire, which is how far light can travel in one nanosecond.

Part of the reason for talking about this is to explain the delays in communicating through satellites.  Though the most direct relevance is in computer (and now most modern microelectronic) engineering and training programmers.

It's a good reminder of how intertwined electronics, physics, and software are and how almost every device we touch today has some sort of microcomputer (microcontroller) running software it.


Adafruit Products of particular interest to Amateur Radio DIY Projects

[hopefully I will come back and expand this post a bit later]

Adafruit.com has a few products that are of particular interest to me for amateur radio DIY projects.
These products have been well research and seem to be currently best-in-class to me. Read the product pages and tutorials on the Adafruit site to see what I mean. The projects I'm thinking about are:
  • Yaesu VX-8DR
    • DIY GPS Module with the Adafruit GPS Module.  The stock Yaesu GPS seems to be overpriced and is reported by many to underperform.  The Adafruit Ultimate GPS seems like it should do a much better job, but the VX-8 seems to have bugs in it's parser so it requires some field padding that is particular to the Yaesu GPS.
    • Bluetooth Serial Link to use an Android Phone's built-in aGPS via a serial bluetooth connection.
  • Yaesu FT-857D
    • Bluetooth Serial Link
      • Eliminate the need for the direct CAT cable connection for better isolation from the computer
      • Rig control via an Android Phone app. The FT-857's small control panel has a number of compromises. The stock radio mic doesn't have a keypad for direct frequency entry.
  • Uniden BC346XT Scanner
    • Bluetooth Serial link for logging scanner activity. Hopefully this will let me get the scanner farther away from the noise generated by the computer while still allowing me to log hits.
Hopefully I'll be back soon to log my progress.

Best Chinese Dual-band HT? (Good amateur radio blogs)

Here is a good run down of which Chinese HTs are the top performers in a number of categories from Hans, PD0AC's Ham Gear Blog. The Wouxun which I've been very happy with since 2011 rates pretty well. I still need to pick up a Baofeng one of these days for comparison.
Hans' Ham Gear Blog is a great source of reviews and tests of radios, mostly the new crop of inexpensive gear from China. Anyone who is interested in new radio gear should follow his blog. While there seems to be a new model coming out everyday many are just repacking of the same components.  Hans identifies many of the common cores for each radio. Even though this post will be quickly dated in some ways, the cores of these radios, especially the system/radio-on-a-chip that enables the low prices don't change that often.

Good Amateur Radio Blogs to Follow

There are a number of really good amateur radio blogs to follow.  Some of my favorites in no particular order are:
 Dan Romanchik, KB6NU, has a post of what he considers 10 Great Ham Radio Blogs.  My opinions overlap with his a bit, though I haven't yet gotten into QRP.

I post some of these things here because I usually I can find things most quickly via google.  Then when it takes my a whole bunch of tries to find what I was looking for again, I think I should be posting this stuff for others as well as myself.

Saturday, November 30, 2013

USB Serial Converters, You don't need to buy one for each device.

I've been meaning to write about how to avoid having to buy a USB serial converter for every single radio, wireless router, microcontroller, or home automatic project.  Particularly because of all of the issues with counterfeit Prolific chips and driver woes. FTDI is the most desirable USB serial converter chip to have, but the premium is $10-20 at least for each cable.

You can use one USB to serial converter cable and adapt it to multiple devices, but you need to match voltages.  Devices can either be
  • RS-232 (-12Vdc to +12Vdc, or more commonly -5Vdc to +5Vdc).  This is the good old-fashioned serial that has all but disappeared from modern electronics.
  • TTL (0 - 5Vdc)
  • LVTTL (0 - 3.3Vdc)
[I Still Need to Add a Lot More Here]

The Chinese radio manufacturers (or maybe I should say accessory manufacturers have come up with an answer which could be a blessing or a curse.  They are now selling 6-in-1 or 8-in-1 radio programming cable kits which include one USB serial adapter which brings out 3 wires (RX, TX, Gnd)  in a 3.5mm TRS phone plug/jack set.  There are a set of cables to adapt to a number of different radio styles.

The Good news -- These are available for around $10 and should be useful to peuple who own multiple radios or need to program other people's radios, like clubs and emcomm groups.

The Bad news:
  • The converter is based on, you guessed it, the same crap counterfeit Prolific chips that fill every group I read with the same driver related questions over and over.
  • Because it's plug and pray, it will be easy to experiment and possibly/probably damage some electronics. 
Fortunately, it should be pretty easy to replace the USB serial converter component with one that is based on the FTDI or CP2102 (or CP2103).  I should probably write up a project.  Bonus points would be:
  • Adding TX/RX LEDs to assist with diagnosis
  • Adding over-voltage protection
  • Detecting and protecting against reversed connections
  • Ability to get at RTS/CTS lines for other uses.

Raspberry Pi vs BeagleBone Black Comparisons

The Raspberry Pi has gotten a lot of attention as a DIY microcomputer module for building all sorts of things. The low price, $35 which was in line with what Arduinos were being sold for a few years ago helped attract a lot of attention.

For many projects, the BeagleBone Black may be a better choice.  It's available for $45, but has nearly twice the CPU performance, 2 GB flash built-in, and perhaps most important for some projects, has lots more I/O capabilities.  Sure at $10 more, it seems almost 30% more expensive than an RPi, but in most cases that won't matter especially after adding an SD card, and a cable to the Rasbberry Pi.

There are lots of comparisons already written. Some also try to compare with the Arduino which is really a different beast but it's somewhat understandable given the prices and that it's all "DIY".

Here's a useful comparison:

Without summarizing/rewriting the whole comparison, here are the bits that I think are most useful.

Choose the Raspberry Pi (RPi) if you want to:
  • Build an HDTV connected media player or DIY Linux computer with a full GUI.  The RPi does 1080p 1920x1080 with a regular full size HDMI connector.
  • Learn or give a gift to someone who wants to learn as the RPi has a much larger community and better tutorial coverage.
    • Note the BeagleBone Black, is actually much easier to get started with, and most of the tutorials for RPi should be able to be translated without too much effort, but that might be too daunting for some just learning with no support network.
 Choose the BeagleBone Black (BBB) if you want to:
  • Build projects that need more compute power or lots more I/O connectivity
  • HDTV connectivity at 1080p isn't important to you.
  • Get started more quickly, the OS is already installed.
  • have both USB Host and Client mode.  (The BeagleBone Bone can act like a computer, USB host mode, or it can act like a device that needs a computer to control it.)
Of course you could have one of each for $80 and still not break the bank. ;-)

Wednesday, November 27, 2013

Exploring the Wireless World with Software Defined Radio

From the rtl-sdr.com blog: links to a 12 minute video, and a longer  40 minute version, by Balint Seeber showing some of what is available in the VHF and UHF bands using a computer and a software defined radio receiver.

While the videos are from a company that produce high-end SDRs, most of what is shown can be done with a $20 RTL SDR USB stick and freely available software.


If you are interested in playing with one of these, make sure you get one
that has the R820T tuner chip which can receive from 24 - 1766 MHz.  These
will do FM, AM, Broadcast (wide) FM, LSB, USB.  You will need some
adapters to hook it up to a better antenna.

Good sources are: NooElec and Adafruit:   NooElec also sells through Amazon.
Adafruit is a great source for all sorts of do-it-yourself electronics.


If you are looking to save a few bucks, you can get these from china direct
sites like Deal Extreme, but it will take a few weeks to get to you.


Wednesday, November 20, 2013

HOWTO: Create a bootable Mac OS X Mavericks DVD/.iso (Bonus: uses the command line)

Almost all of the instructions only cover USB thumb drives, figuring that DVDs are dead in the Mac world.. This one makes a bootable .iso from the downloaded installer using only command line utilities. This is aimed at virtualization environments, where an .iso file is often used to bootstrap a virtual machine.

I've tested this, burned to a dual layer DVD and successfully booted a (mid-2011) Mac mini.

Note: you need to have the Mavericks installer already downloaded from the app store. Ideally, you will snag a copy before you upgrade.  If you buy a machine that is already pre-loaded you won't be able to download it from the app store.

HOWTO: Create a bootable Mavericks ISO - http://forums.appleinsider.com/t/159955/howto-create-bootable-mavericks-iso,  by user CrEOF. 

This is pretty cool, I learned a few things, but I need to learn more about hdiutil and sparse bundles. I suspect that older tutorials for making bootable OS X Lion DVDs would probably work the same way for OS X Mavericks.

# Mount the installer image
hdiutil attach /Applications/Install\ OS\ X\ Mavericks.app/Contents/SharedSupport/InstallESD.dmg -noverify -nobrowse -mountpoint /Volumes/install_app

# Convert the boot image to a sparse bundle
hdiutil convert /Volumes/install_app/BaseSystem.dmg -format UDSP -o /tmp/Mavericks

# Increase the sparse bundle capacity to accommodate the packages
hdiutil resize -size 8g /tmp/Mavericks.sparseimage

# Mount the sparse bundle for package addition
hdiutil attach /tmp/Mavericks.sparseimage -noverify -nobrowse -mountpoint /Volumes/install_build

# Remove Package link and replace with actual files
rm /Volumes/install_build/System/Installation/Packages
cp -rp /Volumes/install_app/Packages /Volumes/install_build/System/Installation/

# Unmount the installer image
hdiutil detach /Volumes/install_app

# Unmount the sparse bundle
hdiutil detach /Volumes/install_build

# Resize the partition in the sparse bundle to remove any free space
hdiutil resize -size `hdiutil resize -limits /tmp/Mavericks.sparseimage | tail -n 1 | awk '{ print $1 }'`b /tmp/Mavericks.sparseimage

# Convert the sparse bundle to ISO/CD master
hdiutil convert /tmp/Mavericks.sparseimage -format UDTO -o /tmp/Mavericks

# Remove the sparse bundle
rm /tmp/Mavericks.sparseimage

# Rename the ISO and move it to the desktop
mv /tmp/Mavericks.cdr ~/Desktop/Mavericks.iso
Now copy the .iso file or burn it to DVD with Disk Utility 

Opinion: Infinite Scrolling Web Pages Considered Harmful,

This article could also be titled:
  • Bring Back Pagination - it worked fine for all those years
  • Why does Slashdot suck (keep crashing Safari) on my iPad?
Lately, it seems that the new shiny is to have web pages that automatically load more content as you scroll down.  This saves you from having to hit a link to go to the next page of older content. At first this seems very cool and intuitive. Auto-filling in content saves you from reloading all of the page's chrome and ads again. However, if you need to go back any more than that and this feature winds up being a step back in functionality.

Consider what happens when you come across a new blog you've never read and you might want to do something unheard of like read the whole thing.  How do you know where you are?  How do stop and come back to it?  How do you access one of the pages in the middle?  All of the pagination controls are now gone. If you need to come back to it, say because your browser crashed, you need to start at the beginning and reload all of the content all over again, scrolling, scrolling, scrolling until you find what you've last read.

Where this really blows up, literally, is devices with limited amount of memory like tablets. A guaranteed way to crash Safari on iOS is to access one of these infinite pages. As soon as the page gets big enough, iOS will run out of memory, and kill Safari as the largest process.

Slashdot doesn't actually auto-fill, but requires you to hit a button to load more into the current page. (The regular "desktop" version of the site still uses classical pagination, where there is a "more / older" button to go back a page.)  Depending on the state of my iPad, between two and five loads of additional content will cause Safari to crash. Slashdot has it exactly backwards from what it should be. "Desktops" have oddles of (virtual) memory when compared to mobile devices.

How bad this behaviour is depends on how much memory your device has.  The first iPad had 256MB. Ok, that's old news, what about current models?  The iPad 2 which is still being sold for an astonishingly small discount of $100 less than the current fifth generation iPad only has 512 MB.  The last three generations of iPads (third though the fifth) have maxed out at 1 GB of ram. Clearly Apple doesn't believe more is needed, while there are web designers who feel an infinite amount of memory available and their content is the only thing you'd be looking at on your device. Am I surprised, unfortunately no.  Hopefully this yet another new trend will fade away when it's no longer the current new shiny.

Tip of the day:
At least for Slashdot you can get a paginated version if you can find the links for "classic" mode and bookmarking those.  Slashdot.org tries to be smart and redirects you to m.slashdot.org if it thinks you are on a mobile device.

Wednesday, November 6, 2013

ham.stackexchange.com: Additional resource for amateur radio information using social/community technology.

Summary: New site for amateur radio questions and answers that could become very useful.


The background (aka my editorial):

For a number of years, software developers have been using web sites like stackoverflow (part of stack exchange) as a way of getting questions answered and using the results to build a searchable resource of higher quality information that avoids many of the problems associated with the typical forum or mailing list.  Questions and answers have plus and minus buttons that allow members to vote them up or down.  Higher rated questions and their answers appear closer to the top which makes useful information much easier to find. This "crowd moderation" helps move the noise of unhelpful responses that are typical on forums and mailing lists out of the way of the useful nuggets.

Members get reputation points as they get voted up and down.  Messages can be edited after they are posted which helps improve the quality of the information.

This type of community driven Q&A system has also been used to help make the free on-line college courses (aka Massive Online Open Courses or MOOCs) such as those offered by Coursera, edX, much more feasible by having students help other students rather than relying on the professor.

In my (not so) humble opinion, good on-line sources of information are critical to getting (and keeping) new, more technology literate people involved with amateur radio. Looking at the quality of tutorial information for the maker movement and things like Arduino, show why there are so many more people involved.

Here's a relevant example: What's a cost effective way to boot the range of my cheap handheld?


Wednesday, October 23, 2013

Bluetooth KISS TNC for Android devices $50 with Li-Ion Battery (MobilinkD)

This looks pretty interesting.  It's a nicely done bit of integration, to provide a hardware TNC for APRS operation at a reasonable price as long as you have an Android phone or tablet handy.

There are several HTs with APRS built-in. I own a Yaesu VX-8DR.  However the user interface on the radio is very limited and there is no direct access to the TNC.  The APRS on my VX-8DR isn't all that useful to me because the GPS is external. The GPS from Yaesu is very expensive and reportedly doesn't perform very well: poor reception, high power drain.

A cheap, Chinese HT could be combined with this to make a nice functional APRS unit that is still pretty portable.  See my other posts about APRSdroid.

  • Small battery operated TNC for attaching to an HT in a backpack style setup. 
  • Connect to Android via Bluetooth serial protocol, so no cable needed to the phone or tablet.   Only an audio cable is needed to connect the TNC to the HT.
  • Designed to work with APRSdroid, a great free or paid APRS application for Android.
  • Has a 1,200 mAh Li-Ion battery for 48 hours of operation, includes USB port and battery management chip to charge the battery.
  • Open source design.   Code and schematics are available.
  • Easily hackable, microcontroller is Atmega 328 same as Arduino, An Arduino can be used to program it if you are building it from a bare atmega328
  • Based on an AVR/Arduino TNC design that uses a real time OS (BeRTOS) by KI4MCW.  This has been on my list to build and experiment with for a while. https://sites.google.com/site/ki4mcw/Home/arduino-tnc
  • Could reuse the hardware for other projects/digital audio protocols. The board is basically a battery powered Arduino with a bluetooth serial interface, and rudimentary audio input/output.

Mobilinkd's site:

Other side notes of possible interest

  • Android Only - This will not work on iOS, because Apple doesn't have (or won't allow) Bluetooth Serial Protocol access from iOS apps.  Openness is the primary reason I have an Android phone instead of going with the flow and having a locked down iOS device like everyone else.
  • The Yaesu VX-8DR GPS unit requires buying not only the GPS module but either a bracket to attach it to the top of the radio or the external waterproof mic unit. The external mic is also pretty overpriced. The connectors for both the mic, and the GPS are proprietary.
  • The Yaesu VX-8GR had the GPS built-in and allowed getting the waypoints from the serial connector. However it has been discontinued as of sometime in 2013. It was going for a reasonable price, approximate $350 before it was discontinued.
  • I've considered building a GPS for the VX-8DR using Adafruit's Ultimate GPS module which sounds pretty cool. However, the GPS parser in the VX-8 will only handle GPS sentences with the same padding as the Yaesu unit. It's possible that the Adafruit unit, which has an onboard microcontroller could be adapted to make it VX-8D friendly, but it's not clear if that is achievable, at least without a ton of effort.

Thursday, August 8, 2013

Yaesu FT-857D Crashes (reboot loop) after programming a 4 character channel label with CHiRP

I found a small latent problem in the Yaesu FT-857D firmware which could cause the radio to crash and go into a reboot loop when a 4 character or less label was created using the free CHiRP radio programming software. I isolated the problem, the Yaesu FT-8[59]7 driver in CHiRP now works around the problem starting with daily builds around June 27th, 2013.

This blog post just archives the info in case someone else stumbles across the problem either by using an outdated version of CHiRP or writing their own software for manipulating the Yaesu FT-8[59]7 memory. This probably applies to the FT-897(d) as well.

The problem has to do with how the 8 character memory label is padded.  The older versions of CHiRP were padding unused characters with 0xFF.  An unused memory label defaults to eight bytes of 0xFF on the radio.   When a label is created for a memory (channel) on the radio, it is set to 'CH-NNN  '.  There is no way that I found, from the radio to create a memory label that wasn't space padded.  Padding with 0xFF for labels that are 5 characters or more doesn't seem to cause any issues. The corrected version of CHiRP now space pads the label out to 8 characters.  I believe G4HFQ's FTbasicMMO, only space pads as well.

Marco Filippi, IZ3GME the primary author of the FT-8[59]7 driver made the change within hours of me reporting the problem.  The very next CHiRP build had the fixed version of the driver.  The current release of CHiRP, 0.3.1 from April 2013, has the old driver.  Until a version later than 0.3.1 is released, you need to download a daily release.

I believe I'm justified in calling this a small bug in the Yaesu firmware, because when the radio accesses the memory with the 0xFF padded label, it goes into a continual reboot cycle with lots of clicking of relays and a beep each time it restarts.  From the radio itself, the only way to resolve this is to force a reset which will clear some of the settings and/or memory entries depending upon which reset is used.  My opinion is the radio's firmware should be a little more forgiving than this.

Note: if your Yaesu FT-857/897 ever does get stuck in a crash/reboot loop, you can still get into clone mode, and save a copy of the whole set of radio settings and memories before you reset it. 

Another thing I learned about the FT-857/FT-897 firmware during all of this is that it is nearly impossible to get a pristine memory image from the radio.  The radio has three different types of resets which will clear all memories, some settings, and a "full microprocessor reset" which is supposed to return the radio to all factory settings.  However, the way this is implemented, the eeprom isn't really reset to a known default, just select bits are cleared marking all of the memory entries unused.  Most of the previous memory channel settings, including the label are still there, which makes things confusing if you were looking for clear, reproduceable state.

(Note: There probably is a way to completely clean the EEPROM to a known, reproduceable state, but you don't want to use it.   For some reason, Yaesu's firmware writers included a CAT command which would completely reset the radio including the specific calibration settings that are written into EEPROM for each radio.   Unforatunely, it's not that improbable to accidentally trigger this when using the CAT interface a lot, possibly with a baud rate setting mismatch.  Every FT-8[59]7 owner should use the service menu to record all of the calibration settings in case they are ever lost.  This has been documented on the FT-857 and FT-897 Yahoo group's.   There is also a few pieces of software, including a PERL script from 0xdecafbad.com for reading out the calibration settings over the CAT interface using the undocumented CAT peek command.

Hopefully I'll get around to posting and documenting more of the things I've learned about the FT-857d.  All of the information is out there, but not necessarily organized to make it easy to find.


Understanding the Arduino platform (You don't need a separate Arduino board for everything you build)

From time to time, I've heard some objections about using the Arduino platform to build things because of the costs. Arduino prices have come down, but it's also worth understanding you don't need an Arduino board for every project.
The Arduino is essentially a board that has an Atmel AVR ATmega328p microcontroller chip on it with a USB interface, power supply, clock crystal, and a lot of sockets for the pins in a (now) well known form factor that allows stacking additional board/modules called shields for additional functionality.
The older units had an FTDI USB serial interface chip on it which added significantly to the cost, but had some interesting alternative uses. Newer Arduinos use another Atmel AVR chip that has USB support built in, which winds up being less expensive than the FTDI chip.
The form factor (size of the board with pin sockets) makes it easy to get started and prototype but also adds to the cost.
The Arduino software environment also makes it significantly easier to get started with microcontroller programming.  There is an small, development environment for Windows/Mac/Linux which completely wraps the C/C++ compiler and chip programmer making it a simple push button operation to compile your sketch and program the chip.
The AVR microcontroller is essentially a full system on a chip, with an 8 bit CPU, a small amount of RAM, 32K of flash memory, a small EEPROM, and a TTL level serial interface.  There is even an internal oscillator so you don't have to use a separate crystal, or resonator, if you have an application where you don't need the timing stability offered by an external crystal.
Bare ATmega328P chips cost $2-4 in single quantities.  They come without any programming, so you need hardware to program the chip.
The Arduino gets around the need for having hardware to program the microcontroller chip by preloading a bit of firmware, a boot loader, that allows the chip to receive code over the USB/Serial interface and write it to the 32K flash to program itself.
An Arduino can be used to program bare AVR chips, so you can use one Arduino to create more Arduinos.
So the moral of the story, once you've built something using an Arduino, you don't have to dedicate a whole Arduino board to each device.  You can easily build your project with a bare AVR chip and only the supporting components you need for your projects.  Typically this can be done for less than $5.

Note: This post is another reply that I had sent to a mailing list that I thought would be worth preserving and sharing as a blog post.