Tuesday, December 22, 2020

Jupiter, Saturn, and the Galilean Moons

Jupiter has been on my mind recently. First of all, I've been watching all the action happening on Ganymede in The Expanse on Amazon Prime 😁. And then, Saturn came into its closest conjunction with Jupiter in 800 years. Over the past few weeks I've been listening to Prof. Richard Pogge's Astronomy 161 lectures and I was particularly fascinated by his lecture on Jupiter in which he explained how the Galilean moons of Jupiter are tidally locked in orbital ratios of 4:2:1. 

Here's what I set out to do:

1. Measure the closest conjunction of Saturn.

How close in the sky will Saturn be to Jupiter?

NASA published 0.1 degrees or 6 arc-minutes or 360 arc-minutes. Not many significant figures here.

Astronomy Now published 6 arc-minutes or 360 arc-seconds. Not many significant figures here, either.

When the Curves Line Up published 377 arc-seconds. More significant figures doesn't equal more accuracy, but I'll go with this number. 

Several sources published 6 arc-seconds, but that seems like a misprint.

On the day of conjunction, December 21st, 2020, I was initially plagued with fog and then high clouds. They did eventually clear enough for me to photograph the two planets.


For the measurement, I used a Canon SL1 camera with a 300 mm f5.6 lens. Exposure was 1/60th of a second and ISO setting was 3200.  I tried manual focus, but it was just too fussy. Fortunately Jupiter is bright enough that auto-focus worked. To minimize vibration, I put the camera on a tripod, and put the camera in "live" mode to lock up the mirror. I then used a remote to trigger the camera.


I took photos with these and other settings in raw mode. I then selected the best candidate for measurement and opened it in UFRaw and exported it into .ppm format. I could then use GIMP to mark the coordinates in pixels on the image by moving the cursor over each planet, and reading the coordinates in the lower left. To calculate the distance in pixels I used the following formula:


Now we have the distance in pixels. To convert the distance to an angle, we need to get the resolution of of the camera in terms of an angle, rather than pixels. The trick is to take the arc-tangent of the distance between pixels over the focal length, then do some unit conversions to get arc-seconds. 



aps-c dimensionwidth
pixels5280
mm22.2
mm/pixel4.20E-03
focal length (mm)300
rad/pixel1.40E-05
deg/pixel8.03E-04
arc-sec/pixel2.9

With a distance of  126.6 pixels between Jupiter and Saturn, and a camera resolution of 2.9 arc seconds, we get a distance of 366 arc-seconds, which is within about 3% of the published value. Not bad.

2. Show Orbital Ratios of the Moons of Jupiter.

About a month before the conjunction I started taking practice photographs of Jupiter. I noticed that if I made the exposure long enough, I could see the Galilean moons of Jupiter. Sometimes I also saw interesting things like spent boosters. On the top is Jupiter with Europa to the left. Ganymede and Callisto are to the right. At the bottom is a spent Zenit-2 rocket body which just happened to pass by as I snapped the photo.


I started taking photos every other day, starting on November 23rd, but my efforts were hampered by bad weather, so I wasn't able to get as many shots as I would have liked. However, I was able to make six measurements.

This table uses the methods shown in section one to show the distance from Jupiter to its Galilean moons as a function of the number of days since my first observation.

daysIoEuropaGanymedeCallisto
0.00.0-67.7148.6433.9
2.076.3115.1164.0336.1
4.092.6-147.2-210.655.2
6.057.4151.8-92.0-253.8
8.00.0-118.0237.4-413.2
26.0-84.4-107.5-232.5-405.0

When plotted, they should look like sine waves, but I really don't have enough data points. Since Io orbits about as often as I was taking measurements, it almost looks like it wasn't moving. This is called aliasing. It's what makes wagon wheels in movies look like they're moving backwards. I think there may be have enough data points to curve fit Ganymede, though. Then I can see if sine waves of 2x and 4x Ganymede's frequency overlay Europa and Io, thus confirming tidal lock. Callisto is not in tidal lock, but it does look that I got half an orbit.

I was going to do the sinusoidal curve fit in a spreadsheet, but I decided it would be more fun and more useful to do it in Python. That will be the subject of the next post.


Saturday, December 19, 2020

Tomato Cage Repurposed as a Greenhouse

Winter is coming to Northern California, and with it comes the potential for plant-killing hard freezes. To protect frost-sensitive potted plants, I turned this summer's tomato cage into a greenhouse.

I had made a 5 foot high, 7 foot wide and two foot deep tomato cage frame out of PVC irrigation pipe and strung twine back and forth to support the tomatoes. Now that tomato season is over, I repurposed it as a green house. For the walls I used 20 mil plastic sheeting. The door has a flap in the front that rolls up. It's held in place by adhesive-backed Velcro. To keep rain from pooling on top, I made a support for a peaked roof out of PVC pipe.

This is the result at night with a flashlight inside. Looks kinda cool, huh?

Unfortunately the greenhouse wasn't really getting warm inside. At the time I was listening to Prof. Richard Pogge's Astronomy 161 lecture on the planet Venus and its runaway greenhouse effect. I realized that the sunlight was just passing through my greenhouse. I needed something to capture the visible light entering the greenhouse and convert it to infrared which couldn't escape though the plastic sheeting. I reworked the peaked roof into an angled roof, and along the back wall of the greenhouse I hung some black shade cloth. 

Now it was getting up to 120 degrees at the ceiling! So I took a small solar panel, a motor from an old cassette player, and a propeller from a Cox model airplane and made a fan to mix around the air when the sun was shining.


I had used strips of adhesive backed Velcro to keep the front closed, but in someplaces where the sheeting was slightly damp, the adhesive didn't stick at all. And, in other places where it did stick well the strip was too wide and the sheeting was going to tear before the Velcro released. To fix these two problems, I got some plastic plumbers strapping, some pop-rivets, and washers to securely fasten the Velcro. If I had had some on hard, I would have used narrower Velcro strips to make easier to open the front flap. Instead I just covered half the width of the strap with duct tape.



Now, how well does it work? Enter the return of the garden logger.

I added a DHT22 temperature/humidity sensor and three DS18B20 "one wire" temperature probes. These probes are waterproof so I used them for both outside air and soil temperature measurement. Note that I used one data pin per DS18B20 sensor, even though they are designed to all connect to a single wire. This allowed simpler software at the expense of more complex hardware. If I ever start running low on data pins, I can reclaim the two wires I wasted and re-write the software. You can find the current Arduino sketch on Github.


 
I mounted the logger inside a Japanese bento box, and ran the wires to an Euro-style terminal strip mounted on the lid. The light sensor and DHT22 temperature/humidity sensor were glued to the lid with epoxy.



I put the garden logger on a bench inside the greenhouse, powering it up from a USB power supply connected to an extension cord. I let it run for a couple days. Here's what the temperatures look like.

When the sun was shining, it was much warmer in the greenhouse. Then as temperatures dropped, everything seemed to equalize, and it really wasn't much warmer inside. Then at 2:00 am there was a sudden temperature drop outside, and the temperature inside stayed about 5 degrees warmer. I'm not sure why that happened, but I think I need to improve the insulation by adding another layer of plastic sheeting. 

Just for fun, I've plotted all data channels. You can see that in November when these measurements were taken, the greenhouse gets only 6 hours of maximum sun, and as soon as things start to cool off, humidity hits 100% and water starts condensing inside.



I've been thinking that perhaps I could better measure the performance of the greenhouse -  eliminating day to day weather variations, by convolving the inside temperature history with the outside temperature history. The goal would be to determine the thermal analog of electrical impedance for the greenhouse. I've Googled this and found a few scholarly papers on the subject. However, that will have to be a subject for another blog post.

Pen Rejuvenation - FAIL!

Like a lot of folks, I've got a desk drawer full of non functional pens. It seems wasteful to throw them out. If you shake one of them like an old fashioned mercury thermometer, it sometimes writes for a little longer. I got to thinking that maybe these pens could be rejuvenated by increasing the downward force of acceleration on the ink cartridge. After all, if you leave a pen upside down in your pocket, doesn't it sometimes leak? So shouldn't the opposite apply?

One way that to increase the downward force on the cartridge is to apply centripetal acceleration - like a bicycle wheel experiences. If I fasten pens to the spokes with the point facing the rim, as I ride, the acceleration from the rotation of the wheel should force the ink into the point and rejuvenate the pen. The question is, how many g's of acceleration can I get from a spinning bicycle wheel?

Notice that I'm going to make extensive use of conversion factors. Not only are they an easy way to get from one set of units to another, they can help you actually solve the problem when you don't know where to start.

This is the formula we need to solve:

r is the radius of the bike wheel and omega is the rotational velocity in radians/second.

Here's the math, assuming my usual biking speed of 10 mph:

First, what's the circumference of my 26 inch wheel bicycle wheel?




How many revolutions per second is my 26 inch wheel turning at 10 mph?





What's the acceleration in m/sec^2?




If my math is right (and please feel free to check it), the pen will experience a force of over six times gravity, with plus and minus 1 g impressed upon it twice per second from gravity.

According to www.jetpens.com there are rollerball pens with a water-based dye, gel pens with a water-based pigment, and ballpoint pens with an oil based ink. I've got some of each type.

I imagined that I could fabricate a plastic box that would clip onto my bicycle spokes, into which I could put pens, and by the time I got to work or school, the pens would be good as new. As a test, I flipped my bike upside down and used cloth cable-ties to attach various types of pens to the spokes. Then I spun the crank as fast as I could for about five minutes. 


Then I removed them and put pen to paper.

Wow, it's working, it's working, uh...., maybe not.


Maybe it wasn't the shaking that enables a pen to write for a little longer. Perhaps old pens just get dried up and the pathway to the paper gets constricted. Maybe extra gravity helps only until the ink beyond the obstruction is used. Looks like it's either back to the drawing board, or back to Jet Pens for more pens. 


Sunday, October 25, 2020

Experimenting with APRS

APRS is an amateur packet radio mode on 144.390 MHz in North America. It uses Bell 202 1200 bps FSK to transmit digital packets into the airwaves. It gets used for locating vehicles and reporting weather conditions. It can also be used for point-to-point messaging via digipeaters, or it can be a bridge to email. 

My ultimate goal was to be able to route an email massage through the International Space Station, which has an APRS digipeater operating on 145.825 MHz. Unfortunately, the week before I completed this project, the APRS digipeater on the Space Station was replaced by a cross-band repeater. Still, it's fun to experiment with this technology.

Let's start the hardware I made. If you you just want to decode messages, all you need is to install the software and place your radio in front of the PC's microphone. But if you are going to be using APRS for any length of time, you'll want to have a wired connection, otherwise the constant "bzzzt, bzzzt, bzzt" will drive you crazy. 

I sketched out a little circuit on engineering paper. Somehow I enjoy this more than using CAD tools. I designed this interface board to work with Baofeng radios. To receive APRS signals, you can just wire, straight through from the radio's speaker jack to the PC's line-in connector. The transmitted APRS signals need to be attenuated to match the radio's low-level microphone input levels. Some resistors and a trimmer potentiometer are used for that. I put a capacitor in the microphone lead just in case there was a DC bias voltage there for any connected mic. The way the push-to-talk signal works on Baofeng radios is that when the microphone connector is shorted to ground, the transmitter is activated.  An audio isolation transformer is used to isolate the microphone connector from ground so the radio only transmits when I want it to transmit. Transmit mode is triggered by the software on the PC by toggling a line on an RS-232 serial port. Most PCs don't have this anymore, so I had to use a USB to serial adapter, and run the DTR line to an opto-coupler which shorts the microphone connector to ground, causing the radio to start transmitting.


I built the project on perf-board with vector clips and put it in a small project box. As I've encountered in previous projects, the backshells of standard audio plugs don't clear the Baofeng case, so you should either remove them or unscrew them a few turns before plugging them into the radio. I got these cool connectors with springy metal strain reliefs from Adafruit. However the first time I set the radio down, the strain reliefs touched each other and the radio started transmitting! Good thing I had a dummy load in place of an antenna! In the photo you can see that I've removed one of the backshells.




Now I need to set the transmit level. To do this, I installed the Pulse Audio Volume Control and used Audacity's tone generate function to play a tone through the system. I then adjusted the final output level to about 2.5 mV peak.

Now that the hardware's ready, here's the software. For the Xubuntu 18.04 system I'm working with, the two applications I needed were Direwolf and Xaster. Both of these can be installed with "sudo apt-get install". Direwolf is a software modem, or in ham radio talk, a TNC or Terminal Node Controller. Xastir is an APRS client. The APRS the client talks and listents through the modem to the radio. 

On Linux you will have to configure a couple of things before you can use the apps without running them as root. Do not be tempted to run any application as root. Instead run the following from the command line:

$ usermod -a -G dialout $USER
$ usermod -a -G xastir-x25 $USER

Next, in my home directory, I needed to create direwolf.conf with the following line:

PTT /dev/ttyUSB0 -DTR

This line activates "Push To Talk" when DTR is low. I had to add the "-" sign because it was simpler to do the opto-coupler with negative logic.

Next the receive levels needed to be set so Direwolf can decode signals reliably. To set levels, I again used the Pulse Audio Volume Control. Select Direwolf as the recording source, then adjust the level so that with each digital squawk of the radio you see incoming messages on the direwolf console at an audio level of about 50. 


Now it's time to configure XASTER. First, a map to display received stations on is needed. OSM_tiled_mapnic.geo seems to work well.




Now XASTER needs to know how to get the packets received by direwolf. The packets are served up over the internal network via AGWPE on port 8000. Select Interface, Add, and click Networked AGWPE. 

Check the confirm the configuration and then click OK. AGWPE will then appear on the interface list. 



On the interface list, highlight Networked AGWPE and click Start. Weather stations, trucks, 4WD vehicles on the Rubicon Trail, and even ships should start appearing on the map.


Now it's time to transmit a packet and see if our station appears on the map.

Click Message, General Stations Query. The radio should switch to transmit mode, send a packet, and then switch back to receive mode. However, the first time I tried this, the radio was sitting right next to the interface box, and the energy from the radio jammed the PTT circuit into the transmit mode, and it wouldn't shut off! I quickly yanked the connectors out of the radio! The next time I tried it, I connected the radio through a long cable to an antenna outside the shack. 

There is a website that logs all APRS packets: http://aprs.fi. I searched for my station and there it was!


How did my packet get to aprs.fi? If I hover over my station, I see that a digipeater on Banner Mountain near Nevada City (about 35 miles away) relayed it all the way back to an iGate in San Francisco. It's kind of a long round-about trip, but it worked!

Next step: actually sending an email.

Saturday, August 15, 2020

CHIRP for Baofeng Radios

Programming these things from the front panel is extremely tedious. And, if you're using the front panel, you can't get the alphabetic characters you need to display repeater call signs. There is an application to program your radio called CHIRP. With CHIRP, you can pull in lists of repeaters from the RepeaterBook web site, and then edit and organize them in a spreadsheet-like user interface. If you are using any of the Ubuntu flavors of Linux, you can just install CHIRP from an Ubuntu repository.

The radios don't come with a programming cable, but it's pretty easy to make one. The cable is based on an article by Miklor. I used a CP2102 breakout board that I got on Amazon and some really slick metal stereo phone plugs fom Adafruit. You'll need a 3.5 mm and a 2.5 mm plug.

The thing I like about the markings on this breakout board is that they leave no ambiguity: 

    RXI (Receive In) is a "gozinta"
    TXO (Transmit Out) is a "gozouta"


It turns out that the phone plugs don't clear the radio's body so even though they look like they're fully seated, in fact they are not. I had to unscrew the backshells a few turns to get them to make contact. I found another disadvantage of metal backshells: if you touch the springy strain reliefs together, the radio goes into transmit mode! Next time I'll use plastic backshells.


Connect the plugs to the CP2101 like this:
Now you can start editing your CHIRP spreadsheet. Use "Input from data source" to populate the spreadsheet with repeaters. You can also enter stations like your local NOAA weather channels. Here's another thing you can't do from the front panel. Change the station's entry in the "duplex" column from "(None)" to "Off". This disables the transmit function on that channel, so you don't accidentally key up on it. You may also want to set the value in the "Skip" column to "S", so scanning never stops on the weather channel.

When you program the radio, it's best to turn the volume up to get maximum signal into the PL2101 breakout. Also, when you are downloading from or uploading to the radio, although there's a warning about this, and the status LED flickers, but it doesn't really appear to go into transmit mode. All the same, it may be a good idea to go to an unused channel, and set the power to low, or to use a dummy load.

When CHIRP asks you for a port, you will see something like "/dev/ttyS1" at the top of the drop-down list. Scroll down to the very bottom to find your USB port, which is going to look something like "/dev/ttyUSB1".

When you're using CHIRP, you can expect to see the radio's status LED do the following:

Read:  Flickering Green/Amber
Write: Flickering Green

Now there's one more thing to be done: change the display to show the repeater call signs you entered in CHIRP. Go into the radio's menu from the front panel and set MDF-A to "name". I've left the B channel on "freq" so I still have the option of selecting channels by frequency.


As a bonus, here's one more cheap radio programming trick. The QYT KT-8900R has a library file that may not yet be included in the version of CHIRP that you installed. You can get it here: https://chirp.danplanet.com/issues/6265, but there's a typo in the code, so you will have to search for the string "radio.id2" and change it to "radio._id2".