Thursday, January 5, 2012

Balloon Flight

The following data are from a recent balloon flight. The blue data were recorded from the balloon, and the red and green data were from local airports. The balloon was a 200 g Kaymont, which should burst around 25 km. So the fact that I'm getting over 30 km is strange. I didn't have a gps or altimeter on board, so the altitude is only estimated from the predicted ascent rate. I carefully measured the neck lift and the payload weight before launch. The point where the temperature starts climbing (about 17 km) is consistent with what I have seen in other flights (and the local data) leading me to believe that the the elevation profile is reasonably accurate. Is it possible to reach over 100,000 ft. with a 200 g balloon?


Further Flight Details

The purpose of this flight was to test the capability and range of my make-shift APRS system. The payload was considered "disposable" and consisted of the following:
  • 1 Maxon FRS-214 radio transmitting at 441.1625 MHz
  • 1 arduino nano running Trackuino (reporting temperature only)
  • 3 thermistors
  • 1 resistive heater
  • 2 3V lithium batteries for power
It was all encased in 1 inch foam insulation and the total payload weight was 6.1 oz.

The radio was nominally 500 mW, converted from FRS to ham frequencies. The stock antenna was replaced with a 1/4 wave length of wire with 2 radials. At the furthest distance (about 40 miles), I was still able to hear the packets, but transcription by the TNC was spotty. I assume, now, that with a good Yagi, 60+ miles should be possible. (For this test, the ground station had only a "rubber duck" antenna)

The balloon was a 200 g kaymont. The nozzle lift was 16 oz, so the ascent rate should have been about 900 ft./min. It stayed aloft for just over 2 hours, so the max elevation was probably around 105,000 ft. (that's just a guess, based on the ascent rate calculations, and my initial elevation of 7500 ft.)

In conclusion, the FRS/Ham radio worked great, as did the trackuino. Since package recovery is often out of the question here in the mountain west, this is a great "cheap" way of doing balloon flights. Unfortunately, though, I don't have any pretty pictures from the edge of space.




Monday, October 24, 2011

Modifying an FRS/GMRS radio for HAM frequencies using a diode

A few years ago I worked on modifying an FRS radio for use on ham frequencies. The modification was complicated, and required some very fine SMD soldering and PIC ucontroller programming. The idea was to be able to use a cheap FRS radio as an APRS transmitter, possibly for high altitude balloon projects. Recently I have taken a second look at this topic and found a very simple method for converting FRS radios to ham. It requires only a diode and minimal soldering!

I'll go into the details of why this works later, but for the short of it, all you have to do is solder a diode between the PLL strobe pin and the PTT switch. That's it. Your radio should now transmit on the channel frequency minus the IF frequency of your radio (usually 21.4 MHz)  Now read-on to find out the details and limitations.

FRS radios operate in the 460 MHz region, and ham frequencies are 430-450. Most FRS radios use a PLL chip to set the operating frequency. If you can control the PLL, you can control the frequency.  The PLL is set by the radio's main processor via 3 lines, data, clk, and strobe. The data it sent one bit at a time and clocked in by the clk line. When an entire command has been sent, the stb line is set high, telling the PLL to start using the settings.

When the radio is going to transmit at 467.5625 MHz (FRS channel 8), the processor sends a command to the PLL to switch to that frequency. For RX, though, it's different. When the radio is going to listen on 467.5625, the PLL doesn't go to 467.5625 MHz. Instead it goes to something like 446.1625 MHz. This is because the radio uses an intermediate frequency of 21.4 MHz (different for each radio). So, 446.1625 + 21.4 = 467.5625. The good news for us is that 446.1625 is right in the ham band. So, we want is stay on the RX frequency while we transmit. That's where the diode comes in. When the PTT button is pressed, it pulls the PTT line to ground. With the diode, the PLL's strobe line also gets pulled to ground, and stops it from switching frequencies. So the radio now transmits in the ham band.

To make the modification, you need to find your PLL chip, and identify the stb line. On most of my radios, the chip is a TB 31202, and the stb line is conveniently locate on pin 8 (right on the end, so it's easy to solder to). I recommend using very fine wire, like 30 AWG or transformer wire. On the PTT switch, identify which side is ground. Solder the diode to the other side, which is PTT. Solder the black-stripe end of the diode to the PTT, and the other end to the stb wire.

There are a few things you have to understand before doing the mod, though. First, you need to know the radio's IF. It's usually around 21.4 MHz. Just look for a crystal on the board with that frequency. If you find one, you're in luck. I have one radio with an IF of 10.7 MHz. This one DOESN'T work. It will transmit somewhere between the ham and FRS bands, which is not good.

Also not all PTT switches go to ground. I have one radio where this is the case. I had to ground the stb line separately to get it to work.

Sometimes the mod doesn't work reliably, and I believe it's an issue with switch bounce in the PTT. When I drive the PTT with a transistor (like with an APRS tracker) it is very reliable.

Complications and work-arounds
I have found some complications and solutions, which I'll try to describe here. The biggest problem arises from the radio's battery saver feature. After some period of inactivity (around 10 seconds) the radio will turn the PLL off, then breiefly re-enable it about twice per second to check for activity. If you happen to TX right when the PLL has been re-enabled, then there's no problem. But the more likely scenario is that you PTT when the PLL is asleep. Because this method works by disabling the PLL input, the PLL doesn't wake up, and you get no TX. I've found a couple of work-arounds. First, just be sure your transmit period is less than the time it takes for the battery-saver to kick in. Then it will never go to sleep and you will always have PLL lock. The second is to pulse the PTT briefly (a few ms) just prior to your real transmission. This wakes up the PLL and puts it on the correct frequency.

A further complication with one of my radios is that the stb line doesn't recover quickly enough when PTT is released. When it's released, the uC should program the PLL back to the listening frequency. If the voltage on the stb line doesn't recover quickly enough, however, the PLL doesn't see the pulse to accept the programming. That's not a problem as long as the PLL is already on the listening frequency (we are trying to TX on the listening frequency, so this should be the case). But, if the radio goes into battery save mode as discussed above, then it's a big problem. Now, pulsing the PTT doesn't get your PLL back to the right frequency. I tried a few solutions involving an RC circuit to delay the PTT recovery, but I couldn't get them to work. The more stable solution was to control the stb line separately with my arduino. I disable stb right before PTT and re-enable a short delay after release of PTT. This ensures that the PLL gets the proper programming.

Friday, September 16, 2011

Using your arduino to program a Turnigy 9X transmitter

I recently purchased a Turnigy 9x transmitter from Hobby King, with the full intention of upgrading the firmware. I had know (or thought) that it was possible to program AVR's using an arduino as the programmer, and being a cheapskate, I didn't bother to purchase one of the recommended programmers. I figured many people must have already done this and there would be some good guides out there. Well, I was wrong. There are some excellent guides on programming the radio with standard hardware, but none using the arduino. That's where this guide comes in. It's meant as a supplement to other guides.

Turn your arduino into an AVRISP programmer
This one is pretty simple. Go to the arduino software, and find the example “arduinoISP”. Open the sketch and upload it to your arduino. See the arduino page for more info.

Attach cable to TX
Open your transmitter, and identify the solder points. There are six of them, and you can refer to other guides if you are unsure. I used a 5S1P lipo connector because it has 6 conductors and I had one lying around. It works pretty slick. I didn't bother to label anything at this point. Just soldered one wire to each point.





Attach test leads
On the other end of the cable, plug in the male portion of the plug with bare pins on the back side. Cut 3 test leads in half and soldered all six pieces to each of the six bare posts. Now with a multimeter, match-up and label each test lead with its corresponding point on the PCB. Label them according to this picture.




Prepare arduino
Connect all the test leads to the arduino using the pin assignments from the sketch. It should be as follows:

// 10: slave reset
// 11: MOSI
// 12: MISO
// 13: SCK

Connect the gnd and +5V to the power block on the arduino, and tripe check that you have the polarity correct.



Disable auto reset
Some arduinos (including my Duemilanove) have an auto reset function that needs to be disabled. To do this, place a 120 Ohm resistor between +5 and reset. The instructions are here.

Prepare eePe
In the eePe software, burn->configure and select the AVRISP programmer from the list. Assuming your radio is like mine, set the processor to m64, and set your port to whatever your arduino uses. In the extra arguments line, put “-b 19200”

Program the radio
You should be good to go. Follow the other guides for programming from here. I suggest you back-up your flash memory first, and all that.

Monday, December 20, 2010

Dropbox Photo Frame

Intruduction
I have a couple of older laptops that I am converting to digital picture frames. There are number of guides out there on how to do this, but none of them did exactly what I wanted, so I'm going to document my own efforts here.

I wanted something that would work on older hardware, so it had to be light. Damn Small Linux has been the go-to light distribution for years, but getting wireless cards to work with it, especially using WPA, can be a real nightmare. I also wanted to run dropbox on it, for seamless, automatic gallery updates. The perfect distro for this seems to be puppy linux, which I'm really growing fond of.

Features
  • Light - runs puppy linux
  • Wifi support
  • Automatic gallery updates via Dropbox
There are number of tasks, some of which I will cover in more detail than others:
  1. Install Puppy Linux
  2. Install Dropbox
  3. Install gqview picture viewer
  4. Modify startup script
  5. Create a cron job
 Install Puppy Linux
Head over to Puppy Linux and download the proper distribution for your machine. I used version 5.1. If you decide to use a newer version, your mileage may vary. Burn the image to a disk, and boot it up.

I'm going to assume you have some experience in installing operating systems, especially of the Linux flavor. I'll detail how I did the installation, so if you want to deviate from my instructions, you're on your own.

The first order of business is to get your network connection working. The installation process accesses the internet to do some updates, and without it, the installation is much messier. So, GET YOUR NETWORK WORKING FIRST!  There is a connection application on the desktop that works fine. I recommend just using a wired ethernet connection during installation, then switching later to wireless if so desired.

Once your internet is working (verify by using the simple net browser application in the "internet" menu), you can begin the installation. Click on the "install" desktop icon, then pick the Universal Installer option. Next, you need to decide where you want to install Linux, which for me was the hard drive (Internal IDE or SATA hard drive). On the next screen you are asked to select a partition, or create one to install to. I chose to partition the disk, which brought up Gparted, a simple graphical disk partitioning application. I erased all the existing partitions, then created one partition with about 500 MB of linux swap, and the rest with ext3. After applying the changes, close Gparted, and you should return to the partition selection dialog. Pick your newly created partition (sda2 in my case), and proceed. Click through the confirmation prompt, then choose "CD" at the next prompt. When prompted to choose between "Frugal" and "Full", choose "Full". You have to wait a while now, while the files are copied to your HD. Next you will install a boot loader.

Installing GRUB
I chose the "GRUB" option, then picked "Install". There will be a prompt about the grubconfig scrip, which you will click through, then choose the simple installer option. For screen resolution, I just picked the standard option. At the next screen you will be asked where to place the GRUB files. The default option is your installation partition. Only change this if you know what you are doing.

At the next screen you need to need to switch to the MBR option (assuming this is NOT a dual boot machine) and proceed. Leave the next screen blank, and hit OK. Hopefully you will get a message saying that GRUB was successfully installed on the MBR. Click on OK, then on "NO" to indicate that you are done with the installation. Take the install disk out, and reboot your machine.

Now that you have Puppy installed on the hard drive you should get your wireless network set up. Again I just used the the connection icon on the desktop, and followed the instructions.

Gqview installation and setup
We need to install "gqview" for displaying the slideshow. This can easily be done with puppy's package manager. First, click on the desktop install icon again, and now pick "Puppy Package Manager". The packages we need to install are not in the default repository, so click on "configure package manager". Lucid-official should be selected by default, so add puppy 4 and puppy 5 to the list. Click on OK, then exit out of the package manager, and restart it. (this is necessary for the new repositories to be recognized.) Search for "gqview", and install it. While you're here, also search for and install the "unclutter" package.
Now that gqview is installed, start it up from the start menu, and go to preferences. Under the general tab, make sure random and repeat are selected, and under Image, select "fit image to window". Apply the changes and exit out.


Dropbox installation and setup
Now, you will need to install the Dropbox application, which is really the heart of this project. Fortunately, the installation only consists of downloading and unzipping the application. One caveat that I should mention is that you need to make sure the system time on your computer is set correctly (within reason). If not, dropbox's certficates will be bad, causing you to read countless posts for hours and even days, trying to figure out why dropbox doesn't connect to the server. (trust me, I know)

In puppy, I was unable to use the basic net browser to download files, so I ended up installing opera. Firefox would work as well. Just click on the "internet" desktop icon, then choose any of those browsers, and it should install automatically for you. Using firefox or Opera, follow this link to download the application. Open and unzip this file to the default location (it should unzip to /root/.dropbox-dist). When done, open a console window, and enter the command:
/root/.dropbox-dist/dropbox &
At this point you should get a dropbox configuration screen. It will ask if you already have an account. If you don't, I would recommend going to a different computer to create one first. Afterward, enter your account info and proceed. It will ask where you want to place your files. I just went with the default location, which was /root/Dropbox. Inside the dropbox folder, I created another folder called "Photos".

Startup scripts and such
Now, all we have left are a few system startup tweaks to automatically start up the slide show, and to disable the screen saver and such. First, you will need to edit the /root/.xinirc file. I used vi, but you are welcome to use whatever editor you find handy in puppy. First, find the line that says:

xset s 600 600 s blank

change it to:

xset s 0 600 s off


This disables the screen saver. Now, go to the end of the file, and right before the line:
#exec $CURRENTWM
Enter:
gqview -r -t -d10 -f &
sleep 10
/root/.dropbox-dist/dropbox &
unclutter &
xset s off
gqview -r -sr/root/Dropbox/Photos &

These start up the slide show and dropbox, and turn off the mouse pointer.


Now we need to tell the slideshow to look for new files in the dropbox folder every once in a while. We do this by restarting the slideshow once every hour. Use the Pschedule application, and set it up as follows:


(note the minutes is changed to "00").

Next we will tell GRUB to continue booting the system at startup, instead of waiting for a prompt. Edit the file /boot/grub/menu.lst, and find the line:
# timeout 30
and change to
timeout 5
Finally the last task is to help puppy recover after an improper shutdown. I've found that pulling the plug on a puppy installation causes it to not boot properly. This is not an option for a picture frame, so I found a workaround which allows it to reboot after a loss of power. Add the following to your /etc/rc.sysini script just after the line "ln -s /proc/mounts /etc/mtab".
#If we were not shutdown cleanly, try and recover
if [ -f /tmp/RUNNING ];then
 echo -n "(Cleaning up after unclean shutdown)" >/dev/console
 rm -f /var/log/X*
 rm -rf /tmp/*
 rm -f /var/lock/LCK*
 rm -f /var/run/*.pid
 rm -rf /root/tmp 2> /dev/null
 rm -rf /root/.thumbnails/* 2> /dev/null
fi

#create a file in tmp that should be deleted on a clean shutdown

echo 'this file is deleted during a clean shutdown' > /tmp/RUNNING

That's it. When you reboot your machine, it should start up a slideshow on your /root/Dropbox/Photos folder. If you add files to your dropbox account, they should show up on the frame within 1 hour. Now, follow any of the excellent guides out there on mounting the laptop into a picture frame.

Monday, November 22, 2010

Hello World

I'm starting a blog to document my projects. Usually I won't finish a project, let alone document it, so we'll see how this goes.  As I work on projects and encounter problems I often find the solution in forums, which is immensely helpful. I'm always grateful that others have taken the time to answer. Since I'm more of a lurker, I don't feel like I give much back to the community, so this is my attempt to change that. When I figure something out that I don't feel is already well documented on the internet, I'll try to detail my solution here.