Saturday, June 8, 2013

I wanted to do something different for ARRL Field Day this year.  So, I came up with two different ideas on what I could do that we would be interesting at our Field Day.   I have been playing a bit with both a Raspberry Pi and Arduino's lately so I started thinking what kind of things I could do with those devices.

  1. Periodically Send SSTV images from a webcam over our VHF repeater.  This would require building some sort of device to take the images, and send them over the repeater.  I decided I would use my Raspberry Pi, and old USB webcam, and my old IC-2100H 2m mobile radio to accomplish this.
  2. Let's have a Fox Hunt!  We have never had a fox hunt at field day, so I thought this would be a good year to have one.  I decided to build one out of a Yaesu VX-5R radio(because you can adjust the xmit power way way down via the service menu), and use an Arduino to create the fox beacon.

The Arduino Fox Hunt Transmitter will be documented in another post, in this post I want to document the Raspberry Pi SSTV Field Day Beacon.

The one thing that I don't like about the Raspberry Pi is that it only has digital input/output logic lines.  It has no built in analog capabilities to read voltages, etc.. so you can't use it to easily interface with reading a potentiometer, a temperate probe, a light level meter, a sound meter or any of the other gazillion things that are analog and usually just a matter of reading the analog voltage or resistance or something similar.  With the Raspberry Pi, you just have I/O lines that can either send or read HIGH(3.3V), or LOW(0V) and that is all. If you want to do anything else you will have to build your own connections to an outboard ADC chip or something else via SPI or I2C bus connections.    So, keeping this in mind I tried to stay within the digital in/out capabilities of the Raspberry Pi in order to keep things simple as possible. 

In order to create a SSTV Beacon we need the following things:

1) A webcam to take the pictures with.  I have a USB Webcam that has built in support on the Raspberry Pi so that was easy.
2) A radio to be a transmitter.  I used my old ICOM IC-2100H 2m Mobile that I keep as a 'spare'.  This is very rugged radio and used to be in my car, but now I keep it as an extra.  
3) An interface with the radio.  The Raspberry will need to be able to control the PTT line of the radio, and to be able to send audio into the radio to transmit.  
4) Software requirements:
  • Do this every 15 minutes
  • Take a snapshot of the field day site with the Webcam, overlay some text and a timestamp on the image
  • Encode the snapshot image into an SSTV AFSKsignal
  • Turn the PTT line ON
  • First play some voice audio files that do announcements of the beacon, what it is doing, and maybe the same time announce where our field day site is located, the website to find more info etc..
  • Play(transmit) the SSTV AFSK image sound to send the image over the air
  • End the transmission with a quick audio CW ident
  • Turn the PTT Off.
5) After getting most of this working. I decided to think about how to add one more feature.  Since it will be doing these broadcasts every 15 minutes over our club repeater, it would be nice if the beacon had enough smarts to a) not transmit over top of anyone already talking, b) make sure the 'coast is clear' before it began its transmission sequence.  

At first I attempted to do this by "listening" to the audio out of the radio, building an ADC circuit using a MCP3008 10bit ADC, etc.. but after I got it all built, I found it to be very unreliable because the ADC is really made to measure 0-3V signals, and the signal coming from the audio out of the radio is in the mV range.   I could have used an OpAmp or something to bring the audio signal into a more measurable range but the breadboard was already getting full of wires just to support connecting to the MCP3008 over a SPI bus style circuit.  So, at first I decided to just scrap the idea.  But them I started thinking about how repeaters work and how they just use COR/COS lines which go high/or low do signal squelch, or pl tone detection.  I then started looking for a signal on the IC-2100H board that would provide me a simple squelch detection hi/lo signal.    Eventually I found one, in the connector that goes to the front LCD panel that probably turns on the "Busy" display on the LCD screen.  It was normally 5V High when the squelch was closed, and the radio was silent, and went to 0V when the squelch was open and the radio was receiving.  This was perfect, since the Raspberry Pi's GPIO digital IO lines can handle up to about 5V input with no problems.  It would be a simple connection of this right up to a digital GPIO pin and just read the line for high or low.  This is the difference between 10 different connections going to a 16pin DIP chip to a single wire going to a single GPIO pin on the Pi board.  Much more simple.

6) I also decided I wanted to be able to have an accurate timestamp on the images.  But the Raspberry Pi has no accurate clock built-in and it resets its clock to 1969 on bootup everytime.  It is totally dependent on having normally getting a time source over the network via NTP to set its clock with during the operating system startup. But on Field Day it will be running at an isolated location with no network/internet connectivity. So it would not be able to have an accurate time as is.  I found a easy to add RTC clock chip that is available on a little board that plugs right into the first 6 pins on the Raspberry Pi header.   The RTC is called "RasClock", made by AfterThought Software and available from several vendors on the net which sell Raspberry Pi accessories.  I got the RTC board, connected it to the Pi, and got it running in just a few minutes.  Now the Pi has a perfectly accurate on-board clock and will bootup with the correct time already set.  Now putting timestamps on the webcam snapshots will be easy and accurate.

I also purchased one of the little micro SD card holders made by the same people, and found it solved the problem I had of every so often accidentally bumping the regular SD card that always stuck out a little bit from the board.  This would often cause the Raspberry Pi to reboot or start having io errors which forced me to reboot to get it to work again.  I did not like the way that the SD card slow was designed on the Raspberry Pi to begin with myself, but their little micro card hides the SD totally under the board and makes it impossible to bump and solves that design issue.

Ok, now to document the actual build of this SSTV Beacon.

Here is a couple of images of the basic physical connections made between the Raspberry Pi, and the IC-2100 radio. 

One image shows the IC-2100H radio sitting next to it on the bench, and one is just the Raspberry Pi and its breadboard.  In the pictures you can see the cable to the front panel RJ45 Mic Connector which is the main connection made.  And you can see the little red wire I have that is connected to the squelch detection signal inside the radio and comes out of the case with the 12V power cable through a hole in the back of the radio.  



Here is the circuit diagram of all the connections I ended up making.  

Without the MCP3008 ADC stuff it turned out actually very simple to do. You can see in the pictures above  how much room that left in the middle of the breadboard after I took it out.



There is nothing complicated in the circuit above:
  • I used a NPN transistor to take the 3.3V HIGH signal of the Raspberry Pi GPIO digital output pin and use it to switch the MIC PTT to ground and activate the push to talk line.
  • There is a simple voltage divider on the 1/8 audio out from the Raspberry Pi's built-in soundcard to attenuate the audio before it goes into the MIC input line and keep from overloading and distorting the mic input.
  • And there is just a 1k resistor inline with the 5V/0V squelch detection signal from the radio in order to protect the Raspberry Pi GPIO input pin from getting any excessive current.  Normally you would want to use a 5v-to-3v logic level converter, or maybe at least a voltage divider when connecting a 5v device to the GPIO pins, but I measured only a few mA of current on this signal from the radio, and everyone says that the Pi seems to work fine with 5v incoming on its 3v logic inputs without much problem anyway. 

After the physical circuit design comes the software work.  


The Raspberry Pi is pretty much a full blown Linux computer. This makes almost anything possible as far as software.  You can write in pretty much any of the regular Linux programming languages you want such as Python, C, Java, Perl, etc.   I had originally planned to write something in Python or Perl, but it turned out that the stuff I was using all had simple standard utility commands to control them all, and I could just write a simple shell script that could be called by a cron job to do the periodic beacon.

I am using the standard Raspbian Linux distribution, with the following popular additional utilities installed:
  • For webcam snapshots: fswebcam - this is the utility that takes the snapshot from the webcam device and creates a jpg
  • To encode the image into SSTV: I originally thought about doing digital SSTV but I ran into some problems. Its very much a new thing and the software out there not very reliable, and it also is very wide bandwidth and requires nearly crystal clear signals to work.  And I found that the hardware driver for the Raspberry Pi on board broadcom soundcard introduces a bit of noise into the audio and this would causing problems with the digital signal.  I decided to stick to old fashioned analog SSTV which are very robust in their transmissions.  I chose the ROBOT36 image encoding because it only takes 36-seconds(hence the name) to transmit the image which is important since this will be taking over our club repeater every 15 minutes, and its the most popular encoding format used for automated systems such as the SSTV pictures from satellites, space probes etc.  They even use ROBOT36 for the SSTV on the ISS, and it was used on the MIR space station.  It's not the best image quality SSTV encoding type, because its so fast, but its a good trade off between quality and speed which I put more importance on speed of transmission.  For the source code, I found a decent robot36 encoding C program someone had written here: https://gist.github.com/anonymous/5723053/, that I downloaded and compiled on the Pi.  This simply takes the image file, and turns it into a wav audio file with the SSTV signal that you can then playback and transmit.
  • Controlling the Raspberry Pi GPIO digital input/output: There are libraries for nearly every popular programming language from C, Java, Perl, Python, Ruby, etc.. but I chose to just use a simple set of utilities that allow you to control the GPIO lines from the command line and in shell scripts which was perfect for the sort of cron job I wanted to write for this application.  They are available here: https://projects.drogon.net/raspberry-pi/wiringpi/download-and-install/
  • Audio Files:  The other thing I have is I generated several voice wav file recordings to play each time along with the image for announcements etc.  You can generate these with the built in text to speech feature built into MacOS, or you can use one of the websites on the internet that can do this for you.  I  also have a 1200hz tone, that will start the beacon transmission, and I used a website to generate a wav file of a CW ident that is the last thing that gets transmitted.
Putting all of those things together and using them as the building blocks, I wrote a shell script that I will use to be called every 15 minutes from a cron job.

Here is the source of the shell script that runs the job.  Its pretty self explanatory, and well commented. The last thing I added was the logic to "listen" to the radio for 10 seconds, and make sure it didn't hear anything before it begins its transmissions.  And if it does hear something, then wait 30 seconds and try again.  Hopefully it will be a nice polite little automated beacon on our repeater and play nice with others.

Cron Job Shell Script Source Code:

Wednesday, November 21, 2012

Joined the 43ft Vertical Club

Well, I have officially joined the 43ft vertical club.  The ubiquitous 43ft these days seems to be turning into the vertical antenna equipment of the G5RV.

Having a couple of days off, I finally got a chance to do the full install of this antenna, just in time for winter.

First I had to run a new coax line of RG-213 out to the back corner of the yard from the shack.  I took the 'shallow trench' made with a spade approach which I have used in the past.  I also am starting to like RG-213 more than LMR-400.  The specs are nearly the same, but the RG-213 has a solid PE (looks like hard plastic) dielectric inside it, where the LMR-400 has foam.  I think the RG-213 will actually hold up better long term outdoors and buried.   I have concerns about LMR-400's foam getting full of water seeping in the coax over long term.  But, that being said I do have 2 runs of LMR400 already in the ground that have been there for about 4 years now with no problems.   But if I ever have to replace them, I think will go with RG-213 next time for those as well.

After the coax was run, I decided I needed to upgrade my single point ground panel.  I had used a pretty nice all aluminum NEMA box I got from a surplus site when we first moved into this house(see it in this previous blog post), it was kinda small inside being only 8x8 inches and it was going to be very full by the time I put a 3rd coax line and polyphaser through it.    I had originally purchased some of the nice watertight cable feedthrough couplers from DX Engineering to use with my box, so I went to their website to look at ordering some more for this new cable run, but then I came across a new offering.  They now offer their own nice weatherproof box, along with some of those coax feed through couplers, an aluminum panel for inside, and even a little copper bar to use in mounting copper strap like I have to the grounding panel.  Pretty much everything you need to setup a single point ground box.  AND, it was 13x14 so quite a bit bigger than the one I originally used.  I decided to spend just a little more money and get the whole kit.  Really, at $49.95 this is a very good price.  

Most of the time, just finding a NEMA box will run you that much by itself, and this has pretty much all you need.  I highly recommend it if your wanting to setup a single point ground panel yourself.

So I ended up replacing my entire single point ground box, and remounted and reconnected everything including a new HF PolyPhaser and coax for the new antenna.

Here is what it looks like now:


So now, that I have to coax run and connected, it was time to install the vertical antenna.  I did not purchase a pre-made antenna such as the S9, or ZeroFive, I decided to build my own.  

I had visited a number of companies at Dayton this past year who were selling telescoping vertical sections of fiberglass.  After checking some out, I decided that the ones I had seen that were being sold by the SpiderBeam people were the best.  They were much heavy duty than the ones that were being sold by people like S9.  In fact the ones that SpiderBeam sells can hold up a small beam or easily the center of the lightweight dipole.  The fishing poles used by S9 are very thin and flexible at the top and will not hold any weight at all.    But the Spiderbeam poles are still light enough (only 7 lbs)  for one person to put up and take down easily.   I purchased the 12m long pole, which is available here for $119 US: 


They have other lengths available as well, including 18 and 26 meter long versions.  

The other part of this antenna consists of a unun at the base of the antenna to convert from the coax to the vertical, and radials.  I used a 4:1 unun made by Balun Designs that they recommend for the S9 verticals, http://www.balundesigns.com/servlet/the-76/unun-4-cln-1-wire-vertical/Detail.  

For the actual antenna conductor, I used electrical tape to affix a wire to the entire length of the fiberglass pole, taping it at the top, and then taping it at each fibreglass section.  I did not want it to be too tight since the pole will bend in the wind, and the wire needs a bit of play.  I used a single wire of "silky" 14 AWG wire from thewireman.com which is very flexible wire and perfect for this purpose.  

For the installation, I decided the most stealth location I have is to attach it to my kids 'tree house' which is right under my best tree, and the same tree I currently have the center point of my 80m OCF diple hung in.   I attached the fiberglass pole to one of the legs of the tree house and extended the poles up into the branches of the tree.




It is attached with bungee cords right now to the tree house legs but I am going to come up with a more permanent solution using pipe clamps or something soon.   I might make a little wood platform attached to the tree house leg to sit it on as well, and that would allow me to raise the bottom up off the ground 3-4 feet or so to get it a little higher in the air.



I also built a little loop of copper plumbers tape and some stainless bolts and nuts to serve as my radial base and put it around the leg of the tree house.  I then laid out 10 radials(more coming soon) of 40 ft or less in all directions from the tree house and connected everything to UNUN and it was done.




Hopefully, this will be stealth enough not to get any neighbors upset with me.  It does blend in pretty well with the tree after you get far enough away.  

Here is a picture from a distance and you can kind of see how it starts to disappear.  And in the spring when there are leaves on the tree, there is no way you would be able to see it much at all.






So far doing some tests sometimes the vertical is louder than my 80m OCF inverted V, and sometimes it is a little lower on the signal receive.  I am sure it is going to depend on the station I am trying to work, I imagine some will work better on the vertical and some on the horizontal dipole.  But at least now, I will have the two antennas to switch between and see which works better.  Before I only had a dipole and it either worked or not.  

Here is the first pass of the antenna analyzer on the new vertical.  You can see its really pretty decent for 40m-10m at 4:1 or less which is well withing the range of my LDG Tuner and the loss will not be very high, but its not that good on 80m where the SWR is up about 7:1 and the losses will start to add up..   I will probably use it mostly for 40 and up, and I might consider building a loading coil for use on 80m.  But for now I will just see how it works within its known limitations.


Friday, March 16, 2012

New Weather Station

This is something I have been planning for a while, and finally got around to doing.  I setup a weather station at home.

The weather station itself is made by "Fine Offset" http://www.foshk.com/, and sold and marketed by several different brands, including Ambient, Zepher, WeatherWise, Tycon Power, dr Tech and others.

The specific one I purchased is sold as the "Zepher PWS-1000TD-TZ".   The reason I purchased that kit is because it comes with TWO wireless remote display units, and I have one in the house, and one in the shack connected to the radio for sending weather data out via APRS.  It is functionally the same as the WS-1090 model weather stations marketed by the other brands.

It provides wind speed, wind direction, rainfall, barometric pressure, wind chill, in/out humidity, and in/out temperature.

It also has a built in USB Computer interface, which is something that many other stations charge $100+ additional for.

I had considered purchasing a Davis Vantage unit, but your talking $500-$800, by the tame you purchase a base system, their expensive proprietary computer interface, and software.

There is a huge jump in price from the $100-150 for the Fine Offset type of weather stations to the expensive Davis Vantage weather stations, and I decided since its my first time trying this I would keep it simple.  Not to mention that while people say the Davis Vantage systems are a little more reliable, there is no denying I could purchase a whole handful of the fine offset replacement type stations for the cost of a single Davis station.

I mounted the station around 25+ ft. hight on a 6 foot mast mounted to the peak of the roof.  This gives it a clear view to every direction except for a large tree to the NW which is my antenna tree, so I am not going to complain.  That tree is about 60 feet away, which I think it meets the minimum obstruction distance recommendations, so it should not be an issue.  The temp/humidity sensor is mounted on the north side of the building under the eves and should be protected from direct sunlight as required, and still have sufficient airflow for accurate measurements.  I read the information on the Citizen Weather Observer Program website to help figure out where to place the unit.

Here is a photo of the station mounting:

Inside the shack, one of the remote consoles collects the data from the wireless sensors.  I am using the free Cumulus software to capture the weather data from the station, and it then feeds the weather data to the UI-View APRS Software running on the shack computer which sends the data out over VHF APRS using the TNC built-in to the Kenwood TM-D700 radio in the shack which sends the weather data out every few minutes over the air.

Here is the various places you can view my weather station data:


It turned out to be much easier than I thought it would be to get this stuff going.  But, I have only had the station a week so far, so I will have to watch it to see how well it works where I mounted it

Saturday, March 10, 2012

Cheap and Easy To Build Antennas Presentation

March 2012 ARTS Ham Club Meeting Presentation - Cheap And Easy To Build Antennas

I did the program for this past months W4CN ARTS Club meeting on "Cheap and Easy to Build Antennas".   I wanted to share how fun and interesting building your own antennas can be compared to buying pre-built antennas.  Hopefully, it will encourage others to try to do some on their own.

Here is a copy of the presentation, I gave on the subject.



The importance (not so much) of SWR Sidebar


I also did a sidebar discussion about how high SWR does not necessarily mean that much loss of power radiated in your antenna, and just how important your feed line is when it comes to such situation

As I have learned more about designing and building my own antennas, one thing I have learned is that SWR is not the most important factor.  After all, your dummy load has perfect 1:1 SWR.

For example, most people think that at a 5:1 SWR, the antenna will always consume about 56% of any power given to it and it will always return the remaining 44% to the antenna tuner, and then  point to the 44% returned power and call it lost power.   But here is the important bit – the antenna tuner says “No problem, I will just send it back to the antenna again!”.  The antenna tuner adjusts the electrical length of the antenna and coax #2 so that the reflected energy has the exactly correct phase to be re-reflected at the antenna tuner.  The first time, the tuner forwards 100 watts and gets 44 watts back from the antenna. It then forwards the 44 watts and gets back 20, it forwards 20 and gets back 9, and so on.  This goes on until finally the full 100 watts is delivered to the antenna and nothing is returned.  The real losses in all these power reflections come from traversing the transmission line, back and forth, and the losses that are inherent in the transmission line.  Except for the losses in the coax, 100% of the energy that leaves the transmitter will be radiated out of the antenna, no matter how high the SWR, because of the re-reflections.

I had created a spreadsheet awhile back to do some of my own calculations and play with the numbers to see what types of transmission line, brands of coax etc have on your output power... and I showed that spreadsheet during the presentation.  It accounts for the losses of the forward and reflected power through the feed line, which is the greatest source of loss due to high SWR.  It does not account for the loss that might be inside an antenna tuner, but from my research those are actually quite negligible compared to the transmission line losses.


Eham.net had an article last year that discusses some of these things as well, and tries to dispel some of the myths about SWR as well: http://www.eham.net/articles/26720


The formulas I used in creating the spreadsheet are not that complicated, but there are multiple steps involved in calculating the actual losses, because you have to calculate the numbers for various forward, reflected, and re-reflected signals.  First I calculate the initial loss of power going up the transmission line, based on the published db losses for that type of cable.  Then, I calculate how much of that power is radiated, and how much is reflected.  Then I calculate the losses of the reflected power back down the transmission line which gives us the amount of power that arrives back at the tuner, and will be re-reflected back up the transmission line.  The losses of the re-reflected power from going back up the coax are then calculated, and we get how much of the re-reflected power arrives back at the antenna and gets added to the power from the initial radiated power.  You could run this calculation a few more times, since there are few more reflections and you could calculate all the way out until there was no more power being re-reflected, but after the first big one, your talking about some very small portions of the initial transmission power, sort of like fractions of fractions of fractions...but for the sake of doing a little simpler math, you can assume that eventually all the re-reflected power should even out to be very close to these calculations made from the first couple of power reflections that occur in the antenna system.

If you would like to run some numbers yourself, here is a copy of my spreadsheet.

Tuesday, January 24, 2012

OCF/Windom Antennas

I thought I would take time to share my HF antenna experiences since I am very happy with the antenna I have up now.  I built an 80m OCF/Off Center Fed antenna and have found it to be one of the best mufti-band antennas you can use.  Most people are familiar with G5RVs and I think many new hams are steered in that direction as the solution for the best antenna to use for beginners to get them on many bands.  But, after my experiences with the OCF antenna, I think if your requirement is to have a single wire antenna, and be able to work multi-bands then maybe this might be a better choice then the old G5RV.

I built mine using a 5:1 balun, the dipole fed off-center with approx 95ft on one side and 45ft on the other(give a take a few for trimming/tuning).  It's up in a tree with the center hung at about 50 feet, and the ends coming down into another tree on the long side at about 15 feet tall giving that side of the dipole a gentle sloping down, and the shorter side goes down at about 30 deg and tied to the top of a 6 foot wooden privacy fence.  It is fed with about 80 feet of LMR-400 Coax with about 60ft of that underground in the yard going out to the base of the tree in the corner of the back yard.

When I first started out, like many one of my first antennas was a 80m G5RV, it worked ok but it required a very good wide range antenna tuner such as the LDG I had at the time just to get it tuned to be usable.  Now I don't need an external tuner at all, and the simple internal tuner in my FT-450 can tune nearly every band to 1:1 with ease. In fact chances are that you could work this antenna without any tuner at all in some cases, the SWR match is quite reasonable on most of the bands.  I know that SWR is not the end all of antenna performance measurements, but it helps.

Here is a plot from my antenna analyzer:




You can see its 2.1-3.0 on 80m, 1.5-2.0 on 40m, ~4.0 on 30m(too high for my internal tuner), <1.5 on 20m, ~2.25 on 17m, <4.0 on 15m, <1.5 on 12m, and 2-3ish on 10m, its also 2-2.5 on 6m which is not shown on this chart.

Compared to my first antenna which was a G5RV, which had many bands with SWRs in the 5-10+ range, this antenna seems to be much less work to tune and a better all around multi-band performer.


I am not going to try and say that this antenna will save the world, but I do think it's worth thinking about if your goal is like mine to try and sneak in one good multi-band wire antenna in a restricted neighborhood back yard.

Monday, January 9, 2012

Picture of Ye Old Ham Shack

Well, since I spent the time cleaning up, I figured I would take a picture of the ole shack.  So here is what it looks like when its clean and I don't have a project all spread out in progress. It's nothing elaborate, just a couple of folding tables really. But I am finally comfortable with the layout of having one work space for radio work on one side and having a project building area and test bench on the other side. I find myself really enjoying being able to work on building a radio kit and be and able to swivel over and work the radio at the same time. Besides we all know that solder smoke makes you sound better on the radio while also makes you able to hear that rare DX better at the same time.

Monday, December 12, 2011

Not a white elephant to me



I got this present in our local radio clubs annual White Elephant Gift Exchange.  I think its great!  From what I can tell based on the markings, is a 200W power triode that was used in many WW2 radios, and is from about 1943-1945 or so.  I am already thinking of a few ham related craft or woodworking projects to use it in.