measuring Lunar Eclipse Brightness - Mercury WWW ...mercury.pr.erau.edu/~houlahap/Arduino/Arduino...

10
Measuring Lunar Eclipse Brightness with an Arduino Microcontroller Dr. Padraig Houlahan Department of Physics Embry-Riddle Aeronautical University, Prescott, AZ. 2014 Apr 17

Transcript of measuring Lunar Eclipse Brightness - Mercury WWW ...mercury.pr.erau.edu/~houlahap/Arduino/Arduino...

Page 1: measuring Lunar Eclipse Brightness - Mercury WWW ...mercury.pr.erau.edu/~houlahap/Arduino/Arduino Lunar... · Web viewMeasuring Lunar Eclipse Brightness with an Arduino Microcontroller

Measuring Lunar Eclipse Brightnesswith an

Arduino Microcontroller

Dr. Padraig Houlahan

Department of Physics

Embry-Riddle Aeronautical University, Prescott, AZ.

2014 Apr 17

Page 2: measuring Lunar Eclipse Brightness - Mercury WWW ...mercury.pr.erau.edu/~houlahap/Arduino/Arduino Lunar... · Web viewMeasuring Lunar Eclipse Brightness with an Arduino Microcontroller

Astronomical hardware available for amateurs has become very technologically sophisticated; amateurs can purchase guiding systems, focusers, cameras, planetarium software, observatory control systems, and computerized sky condition and weather systems. The essential common denominator is that all of these technologies use software to control or interact with these devices in one way or another.

Since I am not an engineer, even after decades of working with computers and networks, with many programming projects in addition, I never had an opportunity to learn how this was achieved. I found myself fascinated by the potential offered by microcontrollers to create real world actions at the command of software. Scripts and programs are great for upfront number crunching and data management tasks, but there always seemed to be a daunting learning curve whenever I have been curious to learn how to computer control devices and tried to dig deeper into the world of ports and sockets, and device drivers, dlls, and /dev trees in the world of UNIX.

So, when I was browsing through my local bookstore’s Technology section, I started paging through books on robotics and hobby electronics, and came across references to things like Raspberry Pi, and Arduino. Since high-school kids can create robots for competitions, and since they apparently were capable of using these devices, it seemed obvious these might offer solutions for device control that would not entail an unacceptably steep learning curve. After seeing a few demonstration sketches (aka an Arduino program) I was impressed by their elegance and I decided to explore the Arduino brand.

Arduino is a type of microcontroller, and from a traditional programmer’s point of view, it bridges the gap between program variables and hardware signals. Arduinos come in many varieties, and the one I have been using is the UNO and it looks like a circuit board smaller than a cigarette pack. (see Fig. 1.)

Figure 1. The Arduino UNO. Note the 13 digital ports at the top and the 6 analog pins on the bottom right.

Key aspects of the UNO is it can accept analog voltages from sensors (temperature, voltage, pressure for example) and send directives to external devices from LEDs to motors, to relays, to servo- and stepper-motors. It essentially acts as a man-in-the-middle between sensors and devices to be controlled.

Page 3: measuring Lunar Eclipse Brightness - Mercury WWW ...mercury.pr.erau.edu/~houlahap/Arduino/Arduino Lunar... · Web viewMeasuring Lunar Eclipse Brightness with an Arduino Microcontroller

Writing sketches is quite simple – a sketch to have a temperature sensor activate an LED if the temperature exceeds a specified threshold takes less than a dozen lines. For example, if an LED is attached to digital pin 13, the programmer can turn it on or off simply by issuing commands like digitalWrite(13, HIGH) and digitalWrite(13, LOW). If I wish to measure what voltage is coming from a temperature sensor to analog pin 4, I can do this by a command like:

Temperature = analogRead(4)

and this would give me a number between 0 and 1023 corresponding to the anticipated 0 to 5V input range; a number stored in a variable that I can manipulate whatever way I wish (analog pins have a built-in Analog to Digital Converter that converts the voltage into an integer for us!) Now that’s empowering!

What about getting information back from the Arduino UNO? It’s simple – it has a built-in serial communications capability, and Serial.println(Temperature) is the command needed to send the Temperature value back to the computer via a USB connection – the results can be seen in the Serial Monitor window (see Fig. 2.) In short, looping over an analogRead and a Serial.println combination is all it takes to send sensor information back to the computer.

Figure 2. The Serial Monitor is accessed from the Arduino IDE Tools Menu and show results returned from the microcontroller sent using the Serial.println() command.

I had a wonderful opportunity to try out my Arduino UNO with the 2014 April lunar eclipse. I knew lunar eclipses could create a major change in sky brightness so I expected an inexpensive photo-resistor ought

Page 4: measuring Lunar Eclipse Brightness - Mercury WWW ...mercury.pr.erau.edu/~houlahap/Arduino/Arduino Lunar... · Web viewMeasuring Lunar Eclipse Brightness with an Arduino Microcontroller

to be able to detect the changes. I hadn’t planned to do anything special, but at the last minute, I realized I had a light-sensitive resistor, and having recently demonstrated reading temperature sensors using an UNO to my physics students, I decided to try and use the photo-resistor to measure the lunar eclipse brightness. The circuit is very basic; the photo-resistor is in series with a 100k Ohm resistor and these are placed between the 5V source (red) and the ground (white.) The signal line (yellow) connects an analog pin to the junction between the regular and the photo resistor – see figure 3.

Fig. 3. The circuit shows how we take the signal level from between the resistor and the photoresister (yellow wire.)

Page 5: measuring Lunar Eclipse Brightness - Mercury WWW ...mercury.pr.erau.edu/~houlahap/Arduino/Arduino Lunar... · Web viewMeasuring Lunar Eclipse Brightness with an Arduino Microcontroller

Fig. 4 The actual implementation. The circuit takes voltage signals from between the photo-resistor and the 100k Ohm resistor on the left, to an analog port on the right using the yellow wire. Red and white wires provide 5V and Ground to power the resistors.

Not having yet mastered how to store the information, I basically had to use a pen and notepad to record the output. As for technique – I simply pointed the photo-resistor in the general area I estimated would be the midpoint of the event – about 25 degrees to the right of the moon and started collecting data.

Figure 5 shows the sketch entered into the free Arduino IDE (Integrated Development Environment.)

Page 6: measuring Lunar Eclipse Brightness - Mercury WWW ...mercury.pr.erau.edu/~houlahap/Arduino/Arduino Lunar... · Web viewMeasuring Lunar Eclipse Brightness with an Arduino Microcontroller

Figure 5. The Arduino IDE is where you build sketches and send them via USB cable to the microcontroller. Here, the photo-resistor is attached to pin 4, and in the loop, it is read and the results

sent back to the computer every second.

I plotted the values returned during the eclipse (scaled by dividing the intensity by the maximum so the resulting plot is between 0 and 1) and these are shown in figure 6, and to show how the Moon’s brightness changed over this period, I also took a series of photographs for comparison - shown in figure 7. They were taken appx. 10 minutes apart during the course of the eclipse.

Page 7: measuring Lunar Eclipse Brightness - Mercury WWW ...mercury.pr.erau.edu/~houlahap/Arduino/Arduino Lunar... · Web viewMeasuring Lunar Eclipse Brightness with an Arduino Microcontroller

5.50 6.00 6.50 7.00 7.50 8.00 8.50 9.00 9.50 10.00

-0.1

0.1

0.3

0.5

0.7

0.9

1.1

2014 Apr 14 Lunar Eclipse Flagstaff, AZ

Intensity Photograph Times

UTC (hrs)

Rela

tive

Brig

htne

ss

Figure 6. The Relative brightness during the eclipse as reported by the inexpensive photo-resistor over the 4 hours of the event was entered into Microsoft Excel to create this chart. The times for the images in

the image sequence are marked for comparison.

Page 8: measuring Lunar Eclipse Brightness - Mercury WWW ...mercury.pr.erau.edu/~houlahap/Arduino/Arduino Lunar... · Web viewMeasuring Lunar Eclipse Brightness with an Arduino Microcontroller

Figure 7. 2014 April 14 lunar eclipse photographed from Flagstaff AZ. A 400mm telephoto and a Canon T3i on a tripod was used. All photographs were taken at ISO 400, with the mid eclipse exposures being

Page 9: measuring Lunar Eclipse Brightness - Mercury WWW ...mercury.pr.erau.edu/~houlahap/Arduino/Arduino Lunar... · Web viewMeasuring Lunar Eclipse Brightness with an Arduino Microcontroller

about .8 seconds, all others were 1/1600 secs. The longer exposures allowed the color to show up, while ingress and egress underexposed the shadow to avoid over-exposing the uneclipsed part of the moon.

The results exceeded my expectations, and demonstrated how a few dollars in components could provide interesting data for students to explore – facilitated by microcontroller technology. There are improvements I would make for the next eclipse i.e. I certainly will have automatic logging to a file and I would start earlier since suspect the eclipse had already begun before I started taking measurements at the nominal start time.

Arduino enjoys considerable support from a large user community and there are thousands of sketches available for you to learn from and modify to suit your own needs. Microcontrollers like these can be used for an enormous number of projects to help amateur astronomers be more effective and to simply enjoy learning about this increasingly important and relevant technology. In the eclipse brightness project I discuss here, it was a success and fun to undertake, with more fun in the future as I plan for refinements. So, if you have been curious about how to computer control devices and systems, there are easy to learn microcontrollers that might just meet your needs, and offer opportunities to pursue your astronomy interests in new and fascinating ways. I have been pleased at how easy it was to get to a point to have the Arduino microcontroller achieve something useful, and I think there are many amateurs who could have just a much fun applying it to their own projects for less than a $75 investment.