A Precipitation Sensor

Getting rain or snow on the primary mirrors is bad.

Open Dome
The Keck 2 primary mirror
The normal method of detecting conditions that might lead to rain or snow is by monitoring the humidity or dew point. If the dew point approaches the current temperature, to within a few degrees the operators must close the domes. This is much the same thing as the humidity approaching 100%. Thus I have installed several new humidity/dew point/temperature sensors over the last few years. These replaced some old and troublesome equipment that had been in place for over a decade.

The problem… You can have both rain and snow occur with low humidity. Moist air above the telescope can produce rain or snow which falls into drier air at the summit level. This can catch the operators by surprise, a situation we have observed on a number of occasions.

To help detect this you can deploy a precipitation sensor, something some of the neighboring telescopes have done. The engineers over at CFHT were kind enough to show me the units they had installed during their remote operation project.

Keck Weather Mast
Various instruments atop the Keck Observatory weather mast
Yes, I just went out and bought one. Not just any old unit either… The best precipitation sensor I could locate on the market, a Vaisala DRD11A. The sensor uses a capacitive detection method. Moisture on the top of a plate will change the capacitance and trigger the sensor. The plate is tilted to allow rain to run off and heated to melt snowflakes and sleet. testing on my work bench showed this to be pretty effective and quite sensitive. Yes, you can visualize me sitting at the bench dripping water on a sensor… It worked.

Not that the project was finished there… The new sensor does not come with any sort of network interface. Rather surprising given that just about everything else Vaisala sells has either a serial interface or an ethernet interface. This sensor has just a couple simple outputs… A logic level indication of precipitation, an analog output representing roughly how much, and a frequency output representing the same thing. I needed to interface this unit to the network. As I have installed a terminal server in the rack below the weather mast, at the minimum I needed a serial port.

While I was at it there are a couple other little devices I want to install on the weather mast. These need a network interface as well. May as well put together another little PIC controller and assemble it all together in one neat little package. a few evenings of coding and I had my solution, an interface that allowed remote computer control and status read-back. How many microcontrollers do I have performing little tasks at the summit now? Quite a few.

A LED Streetlamp Replacement

It may be the day after Thansgiving, but that did not stop the electrical contractors installing new streetlamps in Waikoloa Village.

The New LED Lights
The electrical contractors show off the new LED lights for our neighborhood
We noticed the truck and crane setup mid-morning under the light across the street from our house. It was no surprise, the streetlights have been getting changed throughout the neighborhood over the last couple months. The new LED lamps are far better, with almost no glare seen from the side.

We are not sad to see the old low pressure sodium light go, it has been a nuisance. The poorly designed sodium lamp creating glare into our windows We had called to complain with the county, but nothing was ever done. The glare intruded on our bedroom window, a real issue, somewhat alleviated by the growth of our plumeria along the front blocking the light, a deliberate solution on my part.

The big question is whether the new LED light improves the astronomy situation from my driveway. The old sodium lamps along the street made it impossible to do visual observing, there was simply too much glare. The new lamps should darken the sky and create far less light directed at my driveway.

Even better, the lamps in question are C&W Energy Star Friendly® units with reduced blue emissions. Elimination of almost all of the blue light greatly reduces scatter in the atmosphere and is better for the observatories.

LED Street Lighting
The view down the street from the driveway with the new LED lamps
This seems to be the case. I can see the light from our driveway where it is strong enough to cast shadows. Still, it is much darker than it was with the sodium lamps. The overall amount of light is way down, indeed the entire neighborhood is darker.

With the old light I was able to do astrophotography from the driveway using an LPR filter that blocked the 589nm of sodium light. The new lights will have a broader spectrum and be more difficult to block. On the other hand they send very little light upwards, possibly improving the situation. It will be interesting to see what the difference is. When the Moon is a few days further gone I will have to setup the camera and find out.

It may also be a good idea to check the old CloudCam images against new images as the replacement continues. It will be interesting to see if the emissions from the neighborhood are effectively reduced as seen from the top of the mountain.

To Build a Clock

As I teenager I taught myself digital electronics. Working from the classic books of the day, mostly the TTL Cookbook, I built a succession of projects. Among these was my first clock. Unlike other projects, this clock was a kit from Jameco Electronics. It actually had a printed circuit board, a wooden case, and a red acrylic face. Not only did I get to solder a real circuit board for the first time, I learned every gate and flip-flop in the circuit. When I finished I knew how it worked.

Point-to-Point
A GPS observing clock or a bomb?
I have built a few more clocks over the years, sometimes with classic seven segment LED displays. The latest was a GPS clock built in the 1990’s to provide accurate time on my observing table beside the telescope in the night. To a nerd like me the glowing LED displays are simply cool, something about this red glow contains a quality missing in the slick color LCD display of my modern phone or tablet computer.

On Monday this week a teenage high school student was arrested and interrogated by police for bringing a digital clock of his own construction to school. Like any young budding engineer Ahmed Mohamed wanted to show off his creation. Unfortunately the closed minds of MacArthur High School in Irvine Texas only saw a Muslim student with a possible bomb. It is clear someone has been watching way too much Fox News.

The most poignant part to me is Ahmed being led out of the school in handcuffs wearing a NASA t-shirt. In those photos I saw myself, a nerd in High School, doing the same things, starting on a road that would eventually lead me to an engineering job on the world’s most powerful telescopes.

Digital Clock
A digital clock built by Ahmed Mohamed, photo released by the Irvine Texas police department
Fortunately the nationwide condemnation of the school administration and local police force has been swift and unforgiving. Social media has seized on this incident, the school’s Facebook page roiling with sharp criticism. Nationwide press articles have been equally unforgiving. Tech industry celebrities like Facebook’s Mark Zuckerberg have shown their support. Ahmed has even received a tweet and an invitation from the president…

Cool clock, Ahmed. Want to bring it to the White House? We should inspire more kids like you to like science. It’s what makes America great. – Tweet by President Barack Obama

It is gratifying to see that the message of many of these comments is that a young person building an electronic project is something to be celebrated, not feared. We should be encouraging students to experiment, to build, to learn. True engineers start this way, exploring technology for themselves, the experience gained can not be taught in a classroom. In my career I have met and worked closely with dozens of engineers, I can tell which ones were tinkerers and makers before they started college, who build and create for the sheer joy of it.

Ahmed is not sure if he will return to school immediately and the family is consulting with attorneys. Police are currently holding the clock as evidence. Thirty years later I still have my first clock.

Absurd Inefficiency

A small box with my name upon it, sitting on the shelf in our shipping department for me to pick up. The procedure is simple… Grab the box and note your receipt on the clipboard hanging at the end of the shelf.

Overpackaged
A ribbon cable, one of three in a shipment.
I have been awaiting this shipment for a while now, hoping to continue a project to build a new test fixture. But the shipment is not complete. The latest box contains three little bags, not what I am really hoping for.

What is it this time? I open the box, open one bag, take out the anitstatic bag within that and find… A ribbon cable.

I just have to sit back and stare at this in sheer disbelief.

The disbelief has been building for a week now as the boxes have appeared in our shipping department one by one. A single order, a pair of A/D units and accessories. I have now received four separate boxes, all delivered FedEx, and not received the actual A/D systems themselves, only the various accessories.

One box with three double bagged ribbon cables that weigh all of a few ounces each and are ten inches long. All of the accessories I have received in the four boxes could easily have fit in one box. The anti-static bag is even more unbelievable. These metallized mylar bags are not cheap. Why would you put one around a component that is totally immune to static damage? A ribbon cable with connectors at each end? To be static sensitive it would have to at least contain a semiconductor component of some sort. One transistor? Then you seal a poly bag around that? At least it was brown paper and not foam peanuts used to fill the rest of the box.

With this order National Instruments has by far topped the worst overpackaging I have seen to date. Quite something in the electronics industry where overpackaging is the norm. It used to be Digikey was the worst I had ever seen, but they have gotten much better over the last few years, shifting to all brown paper packaging aside from the plastic bag around the parts themselves.

How is it even possible to receive a small order in four separate FedEx shipments and not even get the primary thing you ordered? To Hawaiʻi? How can you construct a shipping system that inefficient and make any profit after paying the shipping bills? It is not like any of the accessories do me any good without the main units, no need to rush them. One box with everything would be quite acceptable.

Still waiting for the A/D units. Maybe tomorrow?

An Extra Second

Today will be 86,401 seconds long. That number may seem odd, particularly when you consider that most days are 86,400 seconds long. The difference is a result of the leap second being added to our clocks at the end of June 30, 2015 at 23:59:59.

Observatory Clocks
Two new GPS time servers installed in the Keck 2 computer room
The need for an extra second comes from the irregular rotation of our planet. Due to gravitational interaction with the Moon our planet is gradually slowing its rotation. Other shifts can also cause slight irregularities in the planetary rotational rate. In order to keep Coordinated Universal Time in phase with the Earth’s rotation it is necessary to insert an extra second every so often when the error becomes too large.

Since zero hours universal time occurs at 14:00 Hawaii Standard Time, this extra second will occur at 2pm in the afternoon for my readers in the islands. If you are watching a clock that can account for this leap second you will see this second appear. The clock can do a few things, it could simply stop for a second, holding at 23:59:59 for two seconds. The clock could also count the extra second, displaying 23:59:60.

Update: A small group of true nerds gathered in the Keck 2 computer room at 0hUT today and watched our timeserver do leap second. The display notably remained at 23:59:59 for two seconds.

Generally only high precision time servers and GPS receivers will contain software to correctly implement the leap second. Most clocks do not correct for leap seconds, it is just not that important that this feature be implemented perfectly in most devices.

Network connected clocks will simply adjust the time on the next opportunity. Connected clocks routinely synchronize with an online time standard. Your computer requests the correct time via NTP protocol from an internet time server once each day, this is the usual default configuration for a net connected computer unless you have changed it. Cell phones get their time from the network and may receive their extra second more quickly, maybe within a few moments of the leap.

The rest of the clocks in your life are usually more than a few seconds off in any case.

Last time this occurred in 2012 there were some troubling software crashes around the world. Airline departures were delayed and some major websites went down. There is some concern that similar occurrences may occur this time. As a result some experts have argued to do away with leap seconds and just let the error accumulate. The argument rages and we may see leap-seconds abolished, in the meantime this one will occur.

Now that you know about it, enjoy your extra second today. Remember to watch that clock at zero hours universal time and see what happens.

Dome Control PLC Replacement

The time came.

Keck Dome
The Keck 1 dome lit by the glow of sunset
I pressed the button.

It moved.

700 tons of steel and aluminum smoothly rotated until I hit the stop button.

Nothing crashed or seriously broken.

It even moved the right direction.

The risk of breaking something was a real possibility. A mistake here could leave the dome damaged for days or weeks and the telescope useless. I reviewed my plan one more time before starting. A fully written plan with a step by step testing method carefully thought out and reviewed by the other engineers in the department. The plan also had a whole section of “what can go wrong” risk analysis, with risk mitigation steps. What if the brakes release but the motors do not come on? What if the old controller fails when removed from the system?

After a fitful night’s sleep and a long ride to the summit the moment came when I brought the new controller online. Swapping out the connections with the old controller and applying power, the correct indicator lights came on. Even better, as I tested each of the controls in turn the dome and shutters operated perfectly. It worked from the control panel, from the radio controller, under computer mode from the control room. I even tracked the telescope and dome together for an hour without trouble. The tracking was excellent, within 0.1° the whole time.

Continue reading “Dome Control PLC Replacement”

A New Hammer

“I suppose it is tempting, if the only tool you have is a hammer, to treat everything as if it were a nail.” – Abraham Maslow

The above statement is an adage that goes a long way to explaining many engineering decisions. Often referred to as Maslow’s Hammer it is a concept that has been well understood in science and technology for a very long time. In engineering we tend to use the tools we know to solve every problem in front of us, even if the tools we have may not be the best solutions.

Inclinometer Controller
A hand wired microcontroller circuit intended to be used to control a pair of inclinometers in the Keck 2 dome.
There are good reasons to sometimes use the same old tools. The time and effort it takes to learn new tools, particularly with very complex technologies, is considerable. A decision needs to be made… The old tools may not be the most efficient way to solve the problem, but the time and effort it takes to change outweigh any gains to be made. Thus many wise engineers put off updating until the gains to be made are worth the investment of time and resources.

Or the old tools are simply obsolete and you are forced to update.

I am as guilty as any engineer in this. The major example, at least in my case, are microcontrollers. For many decades I have used Microchip PIC16F controllers each time I encountered a problem that required some form of complex control. Specifically I have always loved the PIC16F73 and the later PIC16F873 parts. they had everything I usually needed… A serial port, plenty of I/O pins, a few channels of 10-bit analog to digital, a convenient 28 pin DIP package. If I needed more I/O or more memory just step up to one of the larger packages like the PIC16F876.

Then Microsoft Windows 7 happened. How is this even related? The old versions of MPLAB I used to write the software and program the parts does not run of 64-bit Windows 7. When I updated my machine, I was forced to update to MPLAB X, a totally different platform. A new hammer to learn.

Continue reading “A New Hammer”

Creating a Clock in a Microchip PIC18F

Engineering is full of these little exercises. A set of numbers that must be arranged to achieve the desired result. In this case I need to keep time in a microcontroller, as there are events that I wish to occur every few seconds.

If you are using a crystal oscillator with the microcontroller, the frequency is reasonably accurate, about 50ppm at 25°C. As long as your application does not require high precision time, the result is a decent clock. Some form of clock or timekeeping is a very typical function in many microcontroller projects.

To do this I have a standard set of subroutines that I simply import into each microcontroller project. Well tested and used for years, requiring little effort to set up each time. The routines count seconds, minutes, hours, and even days and months if needed. This time is different… I am using a PIC18F25K80 in place of the PIC16’s I have used for decades. A newer processor, little differences in the hardware and instruction set… I need to rewrite the code.

PIC18F Timer
The layout of timer 2 in the PIC18F25K80 microcontroller

Timer 2 on the PIC18F25K80 is typical of timers found in both the PIC16 and PIC18 family. There are always a handful of timers in any microcontroller, usually with different arrangements for different tasks. At least one will be set up much like this one, with a comparator to provide a repeating fixed and timed interval.

Continue reading “Creating a Clock in a Microchip PIC18F”

A Matter of Time

Time… It is simply a matter of time. At 00:00UT May 3rd, many of the observatory computers suddenly started reporting that the date was September 17th, 1995. To say that this created some problems is a dramatic understatement.

Datum TS2100 Time Servers
Two Datum TS2100 time servers installed above the telescope drive control computer (TDC)

The problem came from the primary observatory clock. This clock, properly called a time server, uses GPS signals to create a time reference that is accurate to microseconds. This is made possible by referencing to the atomic clocks carried by each GPS satellite. A time server is intricately connected to the network to distribute this time. Any computer in the building can ask it for time via the NTP protocol, but that has some inaccuracy due to network delays. For equipment requiring more precise time the server distributes a hard wired time reference using the IRIG-B protocol or a 1PPS timing pulse.

Without accurate time a telescope will simply not point in the correct direction. The calculation that the computers perform must take into account our rotating planet. Feed incorrect time to that calculation and you will point to the wrong piece of sky. A few milliseconds off can result in a pointing error of arcseconds, a large error for a large telescope.

Continue reading “A Matter of Time”

A Pop, a Puff of Smoke, and an Ominous Red Glow… Not Good

When powering up a nearly three decade old computer for the first time I should really have a video camera running…

The loud pop, and the stream of smoke issuing from the side vents was bad enough. It was the ominous orange glow seen for just a couple seconds from the same vent that really sent me the message…

Not good.

Compaq Portable III
A Compaq Portable III personal computer, circa 1987, photo courtesy Wikimedia Commons
I yanked the power cord as quickly as I could, then just sat there for a moment considering the implications of disaster. A Compaq Portable III, a design first marketed in 1987. A computer that runs DOS, predating the first versions of windows. This is the computer that holds the software that operates the Keck II dome.

Without this machine it will be very difficult to program the old PLC the dome runs on. I do have a replacement for that PLC controller running in my office, but I face the challenge of verifying the design, I would like to run the old software in the test setup to compare it to the new. I would also like to have a backup in case something goes wrong during the transition, a way of putting the old PLC back into the system and programming it.

Continue reading “A Pop, a Puff of Smoke, and an Ominous Red Glow… Not Good”