<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/atom10full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><feed xmlns="http://www.w3.org/2005/Atom" xmlns:openSearch="http://a9.com/-/spec/opensearch/1.1/" xmlns:georss="http://www.georss.org/georss" xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr="http://purl.org/syndication/thread/1.0" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" gd:etag="W/&quot;CEACRn84fCp7ImA9WhRaFEk.&quot;"><id>tag:blogger.com,1999:blog-545611806283275210</id><updated>2012-02-16T19:39:27.134-06:00</updated><category term="arduino" /><category term="images" /><category term="processing" /><category term="dark sky" /><category term="night sky" /><category term="diy" /><category term="guide" /><category term="photography" /><category term="open hardware" /><category term="stars" /><category term="light" /><category term="tutorial" /><category term="spectrography" /><category term="soil" /><category term="how to" /><category term="image stacking" /><category term="uno" /><category term="hacking" /><category term="open source" /><category term="agsensors" /><category term="stacking" /><category term="deep sky stacker" /><category term="sensors" /><category term="raw" /><category term="thermal" /><category term="sun" /><category term="star trails" /><category term="astrophotography" /><category term="project" /><category term="solar" /><category term="dss" /><category term="milky way" /><title>GuiltyPixel's Hacker Lab</title><subtitle type="html">Hacking hardware, software, firmware, biology, and more.</subtitle><link rel="http://schemas.google.com/g/2005#feed" type="application/atom+xml" href="http://www.guiltypixel.com/feeds/posts/default" /><link rel="alternate" type="text/html" href="http://www.guiltypixel.com/" /><author><name>James Dice</name><uri>http://www.blogger.com/profile/06530861365373560215</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://4.bp.blogspot.com/-3sJO7FZIw04/Tkyq0_2GcII/AAAAAAAAApU/E4b3SMtCBb0/s220/me_again_by_demarchand-d31w7n2.jpg" /></author><generator version="7.00" uri="http://www.blogger.com">Blogger</generator><openSearch:totalResults>4</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/atom+xml" href="http://feeds.feedburner.com/guiltypixel/iHPE" /><feedburner:info uri="guiltypixel/ihpe" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><entry gd:etag="W/&quot;Ck8NSXY9fCp7ImA9WhRTFks.&quot;"><id>tag:blogger.com,1999:blog-545611806283275210.post-4306359219479571843</id><published>2011-11-02T22:08:00.000-05:00</published><updated>2011-11-07T04:14:58.864-06:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-11-07T04:14:58.864-06:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="raw" /><category scheme="http://www.blogger.com/atom/ns#" term="astrophotography" /><category scheme="http://www.blogger.com/atom/ns#" term="photography" /><category scheme="http://www.blogger.com/atom/ns#" term="images" /><category scheme="http://www.blogger.com/atom/ns#" term="milky way" /><category scheme="http://www.blogger.com/atom/ns#" term="night sky" /><category scheme="http://www.blogger.com/atom/ns#" term="guide" /><category scheme="http://www.blogger.com/atom/ns#" term="processing" /><category scheme="http://www.blogger.com/atom/ns#" term="star trails" /><category scheme="http://www.blogger.com/atom/ns#" term="stacking" /><category scheme="http://www.blogger.com/atom/ns#" term="deep sky stacker" /><category scheme="http://www.blogger.com/atom/ns#" term="dss" /><category scheme="http://www.blogger.com/atom/ns#" term="tutorial" /><category scheme="http://www.blogger.com/atom/ns#" term="image stacking" /><category scheme="http://www.blogger.com/atom/ns#" term="dark sky" /><category scheme="http://www.blogger.com/atom/ns#" term="how to" /><category scheme="http://www.blogger.com/atom/ns#" term="stars" /><title>Great Astrophotography - A How-To Guide</title><content type="html">Many of us have looked up into the night sky in a particularly dark place and thought, "This is incredible! &amp;nbsp;I really wish I could take a picture!" or we've seen others' photos of the stars and the Milky Way and wondered how on earth they got such incredible images. &amp;nbsp;As it turns out, it really isn't as hard as you might think. &amp;nbsp;This guide will teach you how to plan your shoot like a pro.&lt;br /&gt;
&lt;br /&gt;
&lt;table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style="text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/-lyhCctmt4aw/TrHrqF_tTPI/AAAAAAAABL8/lKvUj-Tp6Pk/s1600/Silent+Effigy.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"&gt;&lt;img border="0" height="553" src="http://4.bp.blogspot.com/-lyhCctmt4aw/TrHrqF_tTPI/AAAAAAAABL8/lKvUj-Tp6Pk/s640/Silent+Effigy.jpg" width="640" /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class="tr-caption" style="text-align: center;"&gt;A prime example: proper use of foreground elements by a master&lt;br /&gt;
of astrophotography, Brad Goldpaint.&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;a name='more'&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
Photographs of the night sky fall into a peculiar category of technical photography, where the final image is dependent on planning and knowledge more than looking through the viewfinder and visualizing what you want the image to look like. &amp;nbsp;Since we can't really see our target through the viewfinder, and some aspects of the final image may not even be visible to the naked eye, we need to do a little research. &amp;nbsp;You can't expect astrophotos to look the way you want without planning any more than you can take a sunset photo in the middle of the day. For this, we will need some software to visualize the night sky in advance, and it is very helpful if this software can simulate viewing conditions. &amp;nbsp;I recommend an easy to learn, free, open source, multi-platform program called &lt;a href="http://www.stellarium.org/" target="_blank"&gt;Stellarium&lt;/a&gt;, which is used in planetariums and by astronomers around the world. &amp;nbsp;For field use, you might want to make sure you have &lt;a href="http://www.google.com/mobile/skymap/" target="_blank"&gt;Google Sky Map&lt;/a&gt; installed on your Android device, or a similar app on your iPad, iPhone or other device. &amp;nbsp;If you still don't have a tablet or smartphone or anything, you can print out star charts for the time you'll be shooting and bring a compass with you. &amp;nbsp;For a simple map, you can go to Tools &amp;gt; Screenshots &amp;gt; Invert Colors in Stellarium and print the screenshots you need (invert to background is white) or you can use more advanced star charting software. &amp;nbsp;You'll only need charts or maps if you really want to plan things to the last detail or photograph a particular night sky object however.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;span class="Apple-style-span" style="color: #0b5394; font-family: Verdana, sans-serif; font-size: large;"&gt;&lt;i&gt;Planning&lt;/i&gt;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
This section of the guide will assume you are using Stellarium, but the instructions apply to other packages as well. &amp;nbsp;First, make sure the software is set to display the sky from the location at which you will be shooting. &amp;nbsp;Enter GPS coordinates if possible, to get the most accurate planning for backroads locations like the dark sky places most of us shoot from.&lt;br /&gt;
&lt;br /&gt;
&lt;table cellpadding="0" cellspacing="0" class="tr-caption-container" style="float: left; text-align: left;"&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style="text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/-VkmWdtd273g/TrGwbbTrwfI/AAAAAAAABK8/Qp_eRNBSqfc/s1600/stellarium+screenshot.jpg" imageanchor="1" style="clear: left; margin-bottom: 1em; margin-left: auto; margin-right: auto;"&gt;&lt;img border="0" height="239" src="http://2.bp.blogspot.com/-VkmWdtd273g/TrGwbbTrwfI/AAAAAAAABK8/Qp_eRNBSqfc/s320/stellarium+screenshot.jpg" width="320" /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class="tr-caption" style="text-align: center;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;Stellarium Displaying the Milky Way&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
Enter the time and date when you plan to go shoot into your planetarium software. &amp;nbsp;Now you can use the simulation controls (much like a media player control) to slow down, pause, or speed up time in the simulation to see how the sky will change during the shoot. &amp;nbsp;If there is a particular foreground object you want to include in your photos, it is helpful to go during the day and scout the location with a GPS or compass to see where you will need to set up to capture the terrestrial objects with the appropriate star background. &amp;nbsp;For now however, keep in mind the compass heading of the sky objects you're interested in photographing. &amp;nbsp;If you want to photograph Lake Whatever with the Milky Way rising above it, pay attention to where it will be during the shoot, and plan to &amp;nbsp;position yourself accordingly. &amp;nbsp;The exposures you will be doing will be in the 15 second to several minute range, and any lights nearby (and the moon) will invade your images. &amp;nbsp;With a partial moon out of the frame however, you can get neat pictures where you can see stars, the sky is blue, and the landscape looks like daytime however. &amp;nbsp;Pay attention to the moon.&lt;br /&gt;
&lt;br /&gt;
If you don't already know of a dark sky site, free of light pollution, you can use the &lt;a href="http://www.jshine.net/astronomy/dark_sky/" target="_blank"&gt;Dark Sky Finder&lt;/a&gt;&amp;nbsp;(USA)&amp;nbsp;to locate such a place, or try some of the various dark sky maps and services on the web which are useful globally. &amp;nbsp;You'll need a spot away from cities, several miles from high intensity lights used on highways and checkpoints. &amp;nbsp;Preferably with relatively unobstructed horizons, i.e., no trees, power lines, not next to a big hill or building, unless of course you want those in your photos. &amp;nbsp;Pictures of the sky are great, but the best of them have interesting foreground objects which are lit with a strobe, flashlights, or other means to expose them enough to show in the image as well. &amp;nbsp;Mastering this takes practice, so bring several light sources with you to experiment with during your shoot.&lt;br /&gt;
&lt;br /&gt;
The next important thing to consider is the environment. &amp;nbsp;Weather is a huge factor in this, but wildlife can be an important issue. &amp;nbsp;Many times I've been approached by coyotes and other animals, had scorpions and snakes get curious, and have been eaten alive by&amp;nbsp;mosquitoes. Malaria, West Nile Virus, and other diseases which use mosquitoes as a vector are no joke. &amp;nbsp;I counted over 600 bites after making the dumb mistake of shooting in an area I hadn't scouted. &amp;nbsp;If only I had known there was a stagnant irrigation canal 75 meters from the site, I never would have chosen it. &amp;nbsp;Ranchers also fall into the potentially dangerous wildlife category. &amp;nbsp;I live in the country, and I know how things work out here, but I understand that city dwellers might not. &amp;nbsp;Out here, people are generally friendly and helpful but if they see some weird guy hanging out by his parked car on the far side of their cow pasture, they might investigate and don't be surprised if they approach armed. &amp;nbsp;First, don't trespass! &amp;nbsp;Second, if you attract attention, just explain what you're doing. &amp;nbsp;Most people will be curious, ask questions, and if you're lucky they may even bring you a hot cup of coffee.&lt;br /&gt;
&lt;br /&gt;
&lt;table cellpadding="0" cellspacing="0" class="tr-caption-container" style="float: left; margin-right: 1em; text-align: left;"&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style="text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/-1rvChCQuTJA/TrGxViM-LWI/AAAAAAAABLE/563aOAQanqI/s1600/noaa+goes+wv+image.JPG" imageanchor="1" style="clear: left; margin-bottom: 1em; margin-left: auto; margin-right: auto;"&gt;&lt;img border="0" height="240" src="http://2.bp.blogspot.com/-1rvChCQuTJA/TrGxViM-LWI/AAAAAAAABLE/563aOAQanqI/s320/noaa+goes+wv+image.JPG" width="320" /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class="tr-caption" style="text-align: center;"&gt;NOAA GOES WV - East CONUS&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
Weather, as I mentioned, is a key ingredient to this type if photography. &amp;nbsp;If you've never done amateur astronomy or anything, you might get some surprises. &amp;nbsp;Weather does weird things at night, and humidity does even weirder things. &amp;nbsp;Optics like camera lenses will fog over with dew, tripods collect condensation, etc. &amp;nbsp;Some basic meteorology information is essential. &amp;nbsp;You need to check satellite images before leaving the house, use the IR and WV (water vapor) images to see how clear the sky is. &amp;nbsp;WV will tell you just how much moisture will be absorbing light and distorting it, interfering with your exposures. &amp;nbsp;I always use the National Oceanic and Atmospheric Administration's geostationary satellite server &lt;a href="http://www.goes.noaa.gov/" target="_blank"&gt;NOAA GOES&lt;/a&gt;&amp;nbsp;which is USA based, but has images from different parts of the world as well. &amp;nbsp;Watch the time lapse videos associated with the image you're viewing in order to see how things are changing and to predict what will happen later in the night. &amp;nbsp;Check temperatures, wind, humidity, and dew point temperatures where you will be. &amp;nbsp;Understand that in rural locations, especially deserts, the temperature can drop from 80°F to below freezing in a matter of hours. &amp;nbsp;If the ambient temperature drops below the dew point temperature, water will condense causing dew on equipment, potentially fog, ice, and other issues.&lt;br /&gt;
&lt;br /&gt;
Ideal conditions for astrophotography would be stable temperatures, little wind, arid, no cloud cover and little water vapor, a new moon or when it is below the horizon, high altitude above pollutants in thinner atmosphere, with no major light sources for 10 miles. &amp;nbsp;This sounds almost impossible but it really isn't if you are willing to drive a bit. &amp;nbsp;Wind shakes your camera and changes air density, distorting light as it passes through different gas densities at different speeds. &amp;nbsp;Moisture in the atmosphere absorbs and refracts light. &amp;nbsp;Condensation... Well that's obvious I hope. &amp;nbsp;One thing that might not be obvious is "seeing". &amp;nbsp;Seeing is an astronomy term which refers to distortions in the atmosphere caused by temperature differentials from the Earth radiating heat absorbed throughout the day. &amp;nbsp;If the air temperature is very low, but the surrounding environment is radiating a lot of heat, then you will get subtle degradation of light, like a large scale version of the heat haze ripples which come off of hot asphalt during the day. &amp;nbsp;The atmosphere itself interferes with light transmission as well, so higher altitudes generally yield better results. &amp;nbsp;Even a few hundred meters can make a difference, so try to get to high ground. &amp;nbsp;For these reasons I prefer to shoot in the high deserts of the southwest during winter, later at night or early morning. &amp;nbsp;Also, different interesting objects are visible at different times of year, such as the Pleiades cluster or the Andromeda Galaxy.&lt;br /&gt;
&lt;br /&gt;
&lt;span class="Apple-style-span" style="color: #0b5394; font-family: Verdana, sans-serif; font-size: large;"&gt;&lt;i&gt;&lt;b&gt;Equipment&lt;/b&gt;&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;
Shooting from a tripod, you'll need a wide angle lens. &amp;nbsp;In the span of 30 seconds, objects in the sky move a lot. &amp;nbsp;Stars, planets, and other objects will leave streaks, or "star trails" at longer focal lengths. &amp;nbsp;If you want a crisp image, use wide angle lenses with the widest aperture you can for shorter exposures. &amp;nbsp;If you want star trails for your image, tighten up the shot a bit, stop down your lens, and go to a lower ISO setting. &amp;nbsp;How long you expose for depends entirely on how much sky is in the frame, and how much light your setup can collect. &amp;nbsp;If you're zoomed in at 250mm, just a few seconds will leave long trails, but at wide angles, you may need 20 minutes or more to get the desired effect. &amp;nbsp;If you do not want star trails, this is why you need a wider lens. &amp;nbsp;If trails are what you want, then also consider that the earth's axis is quite different from the celestial axis. &amp;nbsp;Find Polaris and you'll know where the approximate celestial north pole is, and around what axis the stars will revolve. &amp;nbsp;Stars will move more if they are closer to the celestial equator, so shooting away from the equator will yield less noticeable trailing if you are avoiding this. &lt;br /&gt;
&lt;br /&gt;
If you want to capture images of faint deep sky objects like galaxies, you will need to look into other options for mounting your camera so it can follow the objects accurately during long exposures. &amp;nbsp;Some common options include mounting the camera "piggyback" on a robotic guided telescope with a long telephoto lens, shooting through the telescope itself with a "T-adapter", shooting through the eyepiece of the scope, or using a simple "barn door" or "scotch" mount. &amp;nbsp;This article will not attempt to explain these options in depth, but I have given you some keywords to search for more specialized articles.&lt;br /&gt;
&lt;br /&gt;
Camera shake is the enemy of astrophotography, and it can come from many sources. &amp;nbsp;Wind, as mentioned earlier, can cause movement of your camera which causes artifacts from shaking in the worst cases, and in minor cases can cause subtle vibrations which make the image appear fuzzy or out of focus. &amp;nbsp;Simply walking on the ground nearby can cause this as well. &amp;nbsp;It is imperative that you have a sturdy mount on a stable surface which absorbs impact. &amp;nbsp;Sand is great, dirt is good, a porch or deck is probably less than ideal, and rock or concrete might be bad since they vibrate with footsteps. &amp;nbsp;Use the sand spikes on your tripod if yours is equipped with them. &amp;nbsp;Weight your tripod down with sandbags or something similar, but make sure the weight is touching the ground so wind doesn't cause it to swing. &amp;nbsp;If you are using a less rigid telescopic tripod like the&amp;nbsp;collapsible&amp;nbsp;ones sold at Wal-Mart, then collapse the flimsy bottom portion of the legs and crank down the upper extension to make it a bit more sturdy. &amp;nbsp;You could even use your camera bag if it's heavy enough. &amp;nbsp;Place it on the ground between the legs, throw the strap over the central support braces, and tighten it down. &amp;nbsp;If it's still kind of flimsy, try spreading the legs with your foot, allowing them to flex outward a bit. &amp;nbsp;Investing in a good solid tripod with a ball head will save you a lot of grief if you can afford it. &amp;nbsp;Use the "Mirror Lock-up" feature on your camera, if it has one, to avoid shake during shorter exposures. &amp;nbsp;Also, use an infrared remote or cable release to control your shutter. &amp;nbsp;This will allow you to shoot without causing vibrations from hitting the shutter button, which can take several seconds to die down.&lt;br /&gt;
&lt;br /&gt;
Using a lens hood will help keep stray photons under control and may help keep moisture off the lens. &amp;nbsp;With most DSLR cameras, light can also leak in from the eyepiece on the rear. &amp;nbsp;On my Cannon 400D, the strap came with a cap attached to it that fits over the viewfinder's eyepiece and blocks out light from the rear. &amp;nbsp;This is important if there are light sources behind the camera, such as laptops for tethered shooting, flashlights, or anything being used to light the scene's foreground. &amp;nbsp;The moon, if it is in the wrong position, will cause lens flares the same way the sun does, a lens hood will help control this.&lt;br /&gt;
&lt;br /&gt;
You should be using RAW images if possible. &amp;nbsp;There are so many reasons for this that I won't attempt to explain them all here, but if your camera supports it, use it. &amp;nbsp;RAW images can be fine tuned much more later, allow corrections for things like chromatic aberration (separation of light near the edges of the frame, causing a star to ghost, among other things), sensor noise, and they contain much more data about the light collected. &amp;nbsp;This is critical if you choose to perform image stacking (which I will explain later) or if you want to filter out certain colors.&lt;br /&gt;
&lt;br /&gt;
Noise is a major factor in low light photography. &amp;nbsp;Noise comes from many sources, including electromagnetic interference in the camera, thermal noise from the sensor heating up, faulty "hot" pixels on the sensor, "dead" pixels which output black dots, and even background radiation. &amp;nbsp;If you are lucky enough to own a low noise, high ISO camera with some fast lenses, this isn't as much of an issue. &amp;nbsp;For us amateurs with less than ideal equipment, there are some things we can to to mitigate the noise problem. &amp;nbsp;If you're shooting in RAW (as you should be... ahem) don't bother with in-camera "noise reduction" options, as they generally only affect JPEG output and will double the time necessary to shoot, while doubling thermal emissions from the sensor. &amp;nbsp;Shoot at the lowest ISO you can. &amp;nbsp;Higher sensitivity is achieved by amplifying the light signal through a gain circuit, which adds noise to the image. &amp;nbsp;Instead, try to get the longest exposures you can without undesired artifacts at the widest aperture you can. &amp;nbsp;We want to collect as many photons as possible in the shortest time possible. &amp;nbsp;If you cannot get a bright enough image, don't worry. &amp;nbsp;I'll discuss options for improving that later on. &amp;nbsp;Noise is not only ugly, but destroys image data. &amp;nbsp;We need all the data we can collect, so I will also show you a method for combining data from many images to remove noise and increase the light data in the image called "stacking".&lt;br /&gt;
&lt;br /&gt;
&lt;span class="Apple-style-span" style="color: #0b5394; font-family: Verdana, sans-serif; font-size: large;"&gt;&lt;b&gt;&lt;i&gt;Post Processing&lt;/i&gt;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
Now that you're home and you have hundreds of bug bites, 3 full memory cards, and your leg is bleeding for no apparent reason, you load up your images in Adobe Lightroom and.... &amp;nbsp;they look like garbage! &amp;nbsp;&lt;i&gt;Don't panic.&lt;/i&gt; &amp;nbsp;There is still work to be done, unlike most terrestrial, normal light photos, you'll need to do a bit of work to get the image data to represent the scene you were shooting. &amp;nbsp;First, if you've been out all night then &lt;i&gt;&lt;b&gt;go to sleep&lt;/b&gt;&lt;/i&gt; and work on them in the morning. &amp;nbsp;Being exhausted and impatient will cause more harm to your images than taking bad ones to begin with. &amp;nbsp;Work on them with a fresh pair of eyes and a fresh brain.&lt;br /&gt;
&lt;br /&gt;
RAW image data needs to be processed into usable images. &amp;nbsp;If you're not stacking them (more on this later) then you can go ahead and start processing them normally using Adobe Camera RAW, Lightroom, etc. &amp;nbsp;You're going to change these images 500 times before you're happy, so make backups. &amp;nbsp;Use your levels and curves tools to adjust contrast so that noise is minimized and the stars pop. &amp;nbsp;Check the entire image at 100-200% zoom and eliminate any bright RGB dead pixels. &amp;nbsp;Also watch for areas heavily noise infested, like one corner of the image being magenta. &amp;nbsp;This is caused by interference from other components in the camera, like a hot image processor, or an improperly shielded RF source like the power supply. &amp;nbsp;The more expensive the camera, the less likely this is to happen. &amp;nbsp;My 400D has a hot spot in the bottom right corner which occasionally causes me grief, and some hot pixels, but I still manage. &amp;nbsp;Here is an example of the noise pattern generated on my sensor over the course of several 9 second ISO 1600 exposures. &amp;nbsp;It has been enhanced to show detail and converted to grayscale.&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://3.bp.blogspot.com/-B9zHqVrpf2A/TrHUAwe54uI/AAAAAAAABLM/DqezEheKnTY/s1600/MasterDark_ISO1600_9s.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="213" src="http://3.bp.blogspot.com/-B9zHqVrpf2A/TrHUAwe54uI/AAAAAAAABLM/DqezEheKnTY/s320/MasterDark_ISO1600_9s.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="" style="clear: both; text-align: left;"&gt;
As you can see, that's a lot of noise! &amp;nbsp;Here's where stacking images can help. &amp;nbsp;If I want to capture an image of something faint like the Andromeda Galaxy, or the Orion Nebula in my image I will need long exposures, and I will generate a lot of noise. This noise, with the exception of hot or dead pixels, changes over time. &amp;nbsp;We can take advantage of this with special software to increase the signal to noise ratio (SNR). &amp;nbsp;Imagine you are recording the sound of a whistle, and there are many people talking in the background. &amp;nbsp;You know the whistle emits a tone at 2600 Hz, but the frequencies of the talking are variable. &amp;nbsp;By isolating the frequency that doesn't change, you can easily remove the ones which do, getting rid of the background noise. &amp;nbsp;Image data is processed in a similar manner. &amp;nbsp;When you have a single, low noise signal, you can simply reduce the amplitude (drop the low end of the dynamic range using the &lt;i&gt;levels &lt;/i&gt;tool) and get rid of much of it. &amp;nbsp;You can also use algorithmic tools like Noise Ninja to remove them, but you will lose some image clarity. &amp;nbsp;If you take many similar exposures, and then combine the data mathematically, while simultaneously generating a map of the noise found in the images, you can remove the noise or increase the SNR. &amp;nbsp;To do this, you will need a program like &lt;a href="http://deepskystacker.free.fr/" target="_blank"&gt;Deep Sky Stacker&lt;/a&gt;, which is free. &amp;nbsp;The website has comprehensive information on how to use it, but I will give you an overview on how this process works for our purposes.&lt;/div&gt;
&lt;div class="separator" style="clear: both; text-align: left;"&gt;
&lt;/div&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://2.bp.blogspot.com/-rRdcQBDw6fg/TrHcEuxtJ8I/AAAAAAAABLU/xdxS_SIQlCE/s1600/Ophiuchus-30-Sec-17.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="400" src="http://2.bp.blogspot.com/-rRdcQBDw6fg/TrHcEuxtJ8I/AAAAAAAABLU/xdxS_SIQlCE/s400/Ophiuchus-30-Sec-17.jpg" width="266" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;ol&gt;
&lt;li&gt;Take a series of "Light Frames", maybe 30 or more pictures of the scene as you would normally shoot it. &amp;nbsp;Concentrate on proper technique here, they won't look spectacular by themselves but they will really pop later. &amp;nbsp;They will probably look kind of rough, like the one above. &amp;nbsp;Note the pronounced noise in the bottom left (which was the bottom right on the sensor before flipping it to vertical orientation.) &amp;nbsp;This is a single frame, 30 seconds at ISO 1600, taken back when I was first learning this stuff.&lt;/li&gt;
&lt;li&gt;Take a series of "Dark Frames" by using the same exact settings but putting the lens cap on. &amp;nbsp;These will allow the software to create a noise map later. &amp;nbsp;This must be done in the same temperature and electromagnetic conditions, so shoot them between the Light Frames ideally, or shoot them after you get the normal images. &amp;nbsp;The more of these you gather, the better. &amp;nbsp;Ensure you have the same ISO, exposure time, etc. &amp;nbsp;These will form the noise map like the one I showed you earlier, which DSS will use to remove noise from the final output.&lt;/li&gt;
&lt;li&gt;(Optional) shoot a few "Flat Frames" where you shoot an evenly lit white surface using the same lens characteristics. &amp;nbsp;Focal length, aperture, etc. &amp;nbsp;Expose normally, like you would any other time. &amp;nbsp;This can be done at home. &amp;nbsp;The software will use these images later to compute vignette corrections, since this will change with each frame as the sky moves. &amp;nbsp;The software will stack the common area in the image, discarding the edges where there is no overlap between frames. &amp;nbsp;Vignette correction will occur before this, so that the star data is preserved.&lt;/li&gt;
&lt;li&gt;Import Light, Dark, and Flat frames into DSS and configure your settings. &amp;nbsp;You will need to read the DSS site and familiarize yourself with the software extensively to understand what all of the settings do, but the defaults are an OK place to start.&lt;/li&gt;
&lt;li&gt;Register (align), and stack the images. You can simply hit "Check All" and hit "Stack Checked Pictures", it will prompt to automatically register them.&lt;/li&gt;
&lt;li&gt;Adjust the output of DSS like you would a RAW image you are preparing to edit. &amp;nbsp;Adjust the Luminance curve to bring it in line with the histogram. &amp;nbsp;If there is a strange color cast, use the RGB/K Levels to fix this. &amp;nbsp;The Saturation might need to be increased if the image looks too gray.&lt;/li&gt;
&lt;/ol&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style="text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/-j8qdOCxnork/TrHgTzgpABI/AAAAAAAABLc/BDT3kPqNdW4/s1600/dss-adjust-screenshot.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"&gt;&lt;img border="0" height="335" src="http://1.bp.blogspot.com/-j8qdOCxnork/TrHgTzgpABI/AAAAAAAABLc/BDT3kPqNdW4/s400/dss-adjust-screenshot.jpg" width="400" /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class="tr-caption" style="text-align: center;"&gt;Screenshot from Deep Sky Stacker, showing the output of the register&lt;br /&gt;
and stack process looks like.&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;br /&gt;&lt;/div&gt;
Now we're talking, right? &amp;nbsp;Ok we can now save a 32 bit per pixel image for editing in Photoshop (Gimp if you're masochistic). &amp;nbsp;In your editor of choice, adjust the Exposure and Gamma to get the image luminance right, or use an HDR workflow to get the image down to a normal 8 bpp. &amp;nbsp;In Adobe Photoshop CS5 you can just switch modes to 8 bpp and use the Exposure/Gamma dialog which comes up to adjust the final output, then do further editing when you're in 8 bit mode. &amp;nbsp;Adjust the image until you're satisfied with the color and contrast represented and show it off!&lt;br /&gt;
&lt;br /&gt;
&lt;table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style="text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/-TrO3lsksO30/TrHjIaL9FPI/AAAAAAAABLk/jntRPDVqqcc/s1600/milkyway-small.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"&gt;&lt;img border="0" height="256" src="http://1.bp.blogspot.com/-TrO3lsksO30/TrHjIaL9FPI/AAAAAAAABLk/jntRPDVqqcc/s400/milkyway-small.jpg" width="400" /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class="tr-caption" style="text-align: center;"&gt;The core of our galaxy, with nebulae and dust lanes from our spiral arms.&lt;br /&gt;
This image has been processed to show maximum detail and much fainter objects.&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style="text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-ynFlfUnsP9s/TrHmAPjsC1I/AAAAAAAABLs/aedhk3c5_As/s1600/milkyway-realistic-small.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"&gt;&lt;img border="0" height="256" src="http://3.bp.blogspot.com/-ynFlfUnsP9s/TrHmAPjsC1I/AAAAAAAABLs/aedhk3c5_As/s400/milkyway-realistic-small.jpg" width="400" /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class="tr-caption" style="text-align: center;"&gt;The same image as above, processed to represent more of what you might see&lt;br /&gt;
with the naked eye. &amp;nbsp;I simply changed the Exposure/Gamma settings&lt;br /&gt;
&amp;nbsp;when converting to 8 bit, adjusted levels, and color balance.&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;br /&gt;
This example was processed from the original images I took back when I was learning, and you can see I failed to control noise in the corner even with the dark frames, and the color is a little off. &amp;nbsp;I'm showing you this example, rather than a perfect image, so you know what to expect when you start trying this. &amp;nbsp;From here, you can do a lot more, such as compositing your stacked sky image with a static landscape exposure, and much more. &lt;br /&gt;
&lt;br /&gt;
&lt;span class="Apple-style-span" style="color: #0b5394; font-family: Verdana, sans-serif; font-size: large;"&gt;&lt;b&gt;&lt;i&gt;A Few Tips&lt;/i&gt;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;b&gt;Undesirable Trails&lt;/b&gt;&lt;br /&gt;
If you have minor trails burring your image, there's a little trick you can use to fix them.&lt;br /&gt;
&lt;br /&gt;
Open the image in your editor, duplicate the background layer. &amp;nbsp;Set the blending mode for the new layer to Darken. &amp;nbsp;Use "offset" to shift the top layer back in the direction of the original objects before they trailed (usually just a couple of pixels). &amp;nbsp;In Photoshop, it's under Filter &amp;gt; Other &amp;gt; Offset. &amp;nbsp;Once everything looks sharp again, you're done.&lt;br /&gt;
&lt;br /&gt;
&lt;table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style="text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-BnQP7Wphi2A/TrHqkwkk0kI/AAAAAAAABL0/xt--oae2CD0/s1600/offset-example.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"&gt;&lt;img border="0" height="230" src="http://3.bp.blogspot.com/-BnQP7Wphi2A/TrHqkwkk0kI/AAAAAAAABL0/xt--oae2CD0/s400/offset-example.jpg" width="400" /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class="tr-caption" style="text-align: center;"&gt;An example where part of the image was fixed using&lt;br /&gt;
&amp;nbsp;the above method, and part of it was left alone.&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Preservation of Night Vision&lt;/b&gt;&lt;br /&gt;
Your ability to see better in low light conditions is controlled by a few factors. &amp;nbsp;First, of course, is pupil dilation which naturally occurs when light levels remain low for a short time. &amp;nbsp;Second, your eyes respond to light which two structures, &lt;i&gt;rods &lt;/i&gt;and &lt;i&gt;cones.&lt;/i&gt;&amp;nbsp; Rod cells react to as little as a single photon of light! &amp;nbsp;These are your high sensitivity night vision cells. &amp;nbsp;Cone cells need tens or hundreds of photons to trigger a reaction. &amp;nbsp;Your rod cells are your friend during night observation and keeping them functioning is important because they take a while to return to maximum sensitivity. &amp;nbsp;When rods are activated, they change the state of a molecule called rhodopsin. &amp;nbsp;Rhodopsin (derived from vitamin A, a&amp;nbsp;deficiency&amp;nbsp;of which will cause night blindness) takes about 30 minutes to regenerate completely; most of the regeneration takes place in the first five to ten minutes however. &amp;nbsp;Every time you get blasted in the face with a flashlight, your camera's LCD, a laptop, cigarette lighter, anything bright and broad spectrum, you reset that counter. &amp;nbsp;To help prevent this, dim your camera's LCD by using its onboard settings or cutting a small piece of automotive window tint film to size and sticking it to the screen. &amp;nbsp;Also, use red LED lights to see while you're out there. &amp;nbsp;Red wavelength light depletes rhodopsin much more gradually, and is absorbed more by the cones than the rods in your eyes.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Focusing&lt;/b&gt;&lt;br /&gt;
You may find it difficult to focus on stars in your viewfinder, and &lt;i&gt;infinity focus&lt;/i&gt; markings on many lenses are inaccurate. &amp;nbsp;Adding to this mess, if your vision isn't perfect and your viewfinder eyepiece is unable to perfectly correct for the discrepancy, what is in focus may appear out of focus in the eyepiece. &amp;nbsp;I find it easiest to focus on a bright, clear object like a planet and then take a few shots, each time checking focus in the magnified LCD view until I get it spot on. &amp;nbsp;Changing focal length on zoom lenses may change your focus, as will moving the camera if your lens isn't manufactured extremely well. &amp;nbsp;Temperature changes over time as your warm camera from the car or house cools down will cause mechanical shrinkage of the optical assembly which changes your focus. &amp;nbsp;Check it from time to time to make sure you didn't just take 40 exposures of blurry garbage.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;span style="color: #0b5394; font-family: Verdana, sans-serif; font-size: large;"&gt;&lt;b&gt;&lt;i&gt;Conclusion&lt;/i&gt;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
There is no one-size-fits-all answer to astrophotography, there are too many variables at work here. &amp;nbsp;Hopefully you now understand what those variables are and you can make your own intelligent decisions on how to achieve the best images. &amp;nbsp;If you found this guide helpful, please share links to this URL using the sharing buttons provided and +1 it on Google Plus. &amp;nbsp;Thanks for reading, please leave comments below. &amp;nbsp;Good luck out there!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/545611806283275210-4306359219479571843?l=www.guiltypixel.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/V_bzVJXstHRBFJ21oLm5y5LVEb0/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/V_bzVJXstHRBFJ21oLm5y5LVEb0/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/V_bzVJXstHRBFJ21oLm5y5LVEb0/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/V_bzVJXstHRBFJ21oLm5y5LVEb0/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/guiltypixel/iHPE/~4/6vB99feXm1c" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.guiltypixel.com/feeds/4306359219479571843/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.guiltypixel.com/2011/11/great-astrophotography-how-to-guide.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/545611806283275210/posts/default/4306359219479571843?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/545611806283275210/posts/default/4306359219479571843?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/guiltypixel/iHPE/~3/6vB99feXm1c/great-astrophotography-how-to-guide.html" title="Great Astrophotography - A How-To Guide" /><author><name>James Dice</name><uri>http://www.blogger.com/profile/06530861365373560215</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://4.bp.blogspot.com/-3sJO7FZIw04/Tkyq0_2GcII/AAAAAAAAApU/E4b3SMtCBb0/s220/me_again_by_demarchand-d31w7n2.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://4.bp.blogspot.com/-lyhCctmt4aw/TrHrqF_tTPI/AAAAAAAABL8/lKvUj-Tp6Pk/s72-c/Silent+Effigy.jpg" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://www.guiltypixel.com/2011/11/great-astrophotography-how-to-guide.html</feedburner:origLink></entry><entry gd:etag="W/&quot;AkUNQHc9fSp7ImA9WhdUGEs.&quot;"><id>tag:blogger.com,1999:blog-545611806283275210.post-5920693177423810048</id><published>2011-10-05T19:04:00.000-05:00</published><updated>2011-10-05T21:31:31.965-05:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-10-05T21:31:31.965-05:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="arduino" /><category scheme="http://www.blogger.com/atom/ns#" term="sun" /><category scheme="http://www.blogger.com/atom/ns#" term="thermal" /><category scheme="http://www.blogger.com/atom/ns#" term="solar" /><category scheme="http://www.blogger.com/atom/ns#" term="spectrography" /><category scheme="http://www.blogger.com/atom/ns#" term="light" /><category scheme="http://www.blogger.com/atom/ns#" term="project" /><category scheme="http://www.blogger.com/atom/ns#" term="open hardware" /><category scheme="http://www.blogger.com/atom/ns#" term="open source" /><category scheme="http://www.blogger.com/atom/ns#" term="uno" /><category scheme="http://www.blogger.com/atom/ns#" term="tutorial" /><category scheme="http://www.blogger.com/atom/ns#" term="sensors" /><category scheme="http://www.blogger.com/atom/ns#" term="diy" /><category scheme="http://www.blogger.com/atom/ns#" term="soil" /><category scheme="http://www.blogger.com/atom/ns#" term="hacking" /><category scheme="http://www.blogger.com/atom/ns#" term="agsensors" /><title>Agricultural Sensors - Part 3: Source Code</title><content type="html">Read &lt;a href="http://www.guiltypixel.com/2011/10/agricultural-sensors-part-2-digital.html"&gt;Agricultural Sensors - Part 2: Digital&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: inherit;"&gt;Blogging generally isn't the best format for distributing code, but here it is. &amp;nbsp;I'll try to find a home for the source code in a downloadable file later. &amp;nbsp;The code comments, as well as the previous two blog posts should explain the concepts here.&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: inherit;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"&gt;/*&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"&gt;&amp;nbsp;* GardenSensor v0.4a&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"&gt;&amp;nbsp;*&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"&gt;&amp;nbsp;* Reads three 10k Ohm thermistors for ambient, soil, and shade temperature&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"&gt;&amp;nbsp;* Reads one 1M Ohm CdS photocell for ambient light between 500-700nM&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"&gt;&amp;nbsp;* Reads one IR LED as a sensor for ~ 950nM infrared radiation levels&lt;/span&gt;&lt;br /&gt;
&lt;a name='more'&gt;&lt;/a&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"&gt;&amp;nbsp;* Reads one UV LED as a sensor for ~ 405nM ultraviolet radiation levels&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"&gt;&amp;nbsp;*&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"&gt;&amp;nbsp;* Outputs either human readable or CSV readings via serial&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"&gt;&amp;nbsp;*&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"&gt;&amp;nbsp;* TODO: Add humidity sensor, soil moisture sensor, rain detector, wireless&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"&gt;&amp;nbsp;* &amp;nbsp; &amp;nbsp; &amp;nbsp; network, and perhaps data logging to micro SD&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"&gt;&amp;nbsp;*&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"&gt;&amp;nbsp;* Thermistor code modified from example by Milan Malesevic and Zoran Stupic 2011&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"&gt;&amp;nbsp;* in Arduino Playground at http://www.arduino.cc/playground/ComponentLib/Thermistor2&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"&gt;&amp;nbsp;*&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"&gt;&amp;nbsp;* GuiltyPixel / James Dice - http://www.guiltypixel.com&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"&gt;&amp;nbsp;*&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"&gt;&amp;nbsp;* Garden Sensors by GuiltyPixel/James Dice is licensed under a Creative Commons&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"&gt;&amp;nbsp;* Attribution-NonCommercial-ShareAlike 3.0 Unported License.&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"&gt;&amp;nbsp;*&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"&gt;&amp;nbsp;*/&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"&gt;#include &amp;lt;math.h&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"&gt;#define DebugPRINT 0 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;// Enter 0 for CSV, any other value for verbose&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"&gt;#define Thermistor0PIN 0 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;// Analog Pin 0 for Direct Sunlight Temp&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"&gt;#define Thermistor1PIN 1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;// Analog Pin 1 for Shade Temp&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"&gt;#define Thermistor2PIN 2 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;// Analog Pin 2 for Soil Temp&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"&gt;#define Thermistor0COMP 0 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // Compensation in deg F for thermistors&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"&gt;#define Thermistor1COMP 7&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"&gt;#define Thermistor2COMP 0&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"&gt;#define IR_N_SIDE 2&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"&gt;#define IR_P_SIDE 3&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"&gt;#define UV_N_SIDE 4&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"&gt;#define UV_P_SIDE 5&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"&gt;#define CdS_PIN 3&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"&gt;float vcc = 4.94; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // only used for display purposes, if used&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // set to the measured Vcc.&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"&gt;float pad = 9910; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // balance/pad resistor value, set this to&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // the measured resistance of your pad resistor&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"&gt;float thermr = 10000; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // thermistor nominal resistance&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"&gt;float Thermistor(int RawADC) {&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"&gt;&amp;nbsp; long Resistance; &amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"&gt;&amp;nbsp; float Temp; &amp;nbsp;// Dual-Purpose variable to save space.&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"&gt;&amp;nbsp; Resistance=((1024 * pad / RawADC) - pad);&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"&gt;&amp;nbsp; Temp = log(Resistance); // Saving the Log(resistance) so not to calculate &amp;nbsp;it 4 times later&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"&gt;&amp;nbsp; Temp = 1 / (0.001129148 + (0.000234125 * Temp) + (0.0000000876741 * Temp * Temp * Temp));&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"&gt;&amp;nbsp; Temp = Temp - 273.15; &amp;nbsp;// Convert Kelvin to Celsius &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"&gt;//Comment out the following line to return Celcius&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"&gt;&amp;nbsp; Temp = (Temp * 9.0)/ 5.0 + 32.0; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;// Convert to Fahrenheit&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"&gt;&amp;nbsp; return Temp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;// Return the Temperature&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"&gt;}&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"&gt;void setup() {&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"&gt;&amp;nbsp; Serial.begin(115200);&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"&gt;}&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"&gt;void loop() {&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"&gt;&amp;nbsp; float temp0;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"&gt;&amp;nbsp; float temp1;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"&gt;&amp;nbsp; float temp2;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"&gt;&amp;nbsp; temp0=Thermistor(analogRead(Thermistor0PIN)) + Thermistor0COMP; &amp;nbsp; &amp;nbsp; &amp;nbsp; // read ADC and &amp;nbsp;convert it to temperature&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"&gt;&amp;nbsp; temp1=Thermistor(analogRead(Thermistor1PIN)) + Thermistor1COMP;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"&gt;&amp;nbsp; temp2=Thermistor(analogRead(Thermistor2PIN)) + Thermistor2COMP;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"&gt;&amp;nbsp; //temp0 = (temp0 * 9.0)/ 5.0 + 32.0; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;// converts to Fahrenheit if Thermistor() conversion&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"&gt;&amp;nbsp; //Serial.print(", Fahrenheit: "); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"&gt;// lines are not uncommented&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"&gt;&amp;nbsp; //Serial.print(temp0,1); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;// display Fahrenheit&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"&gt;&amp;nbsp; Serial.println(""); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"&gt;&amp;nbsp; //------------------------------------------&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"&gt;&amp;nbsp; // Begin code for IR / UV capacitive sensors&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"&gt;&amp;nbsp; unsigned int ir;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"&gt;&amp;nbsp; // Apply reverse voltage, charge up the pin and led capacitance&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"&gt;&amp;nbsp; pinMode(IR_N_SIDE,OUTPUT);&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"&gt;&amp;nbsp; pinMode(IR_P_SIDE,OUTPUT);&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"&gt;&amp;nbsp; digitalWrite(IR_N_SIDE,HIGH);&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"&gt;&amp;nbsp; digitalWrite(IR_P_SIDE,LOW);&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"&gt;&amp;nbsp; // Isolate the pin 2 end of the diode&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"&gt;&amp;nbsp; pinMode(IR_N_SIDE,INPUT);&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"&gt;&amp;nbsp; digitalWrite(IR_N_SIDE,LOW); &amp;nbsp;// turn off internal pull-up resistor&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"&gt;&amp;nbsp; // Measure how long it takes for the IR diode to drain to logical zero&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"&gt;&amp;nbsp; for ( ir = 0; ir &amp;lt; 30000; ir++) {&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"&gt;&amp;nbsp; &amp;nbsp; if ( digitalRead(IR_N_SIDE)==0) break;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"&gt;&amp;nbsp; }&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"&gt;&amp;nbsp; //UV LED sensor section&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"&gt;&amp;nbsp; unsigned int uv;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"&gt;&amp;nbsp; // Apply reverse voltage, charge up the pin and led capacitance&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"&gt;&amp;nbsp; pinMode(UV_N_SIDE,OUTPUT);&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"&gt;&amp;nbsp; pinMode(UV_P_SIDE,OUTPUT);&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"&gt;&amp;nbsp; digitalWrite(UV_N_SIDE,HIGH);&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"&gt;&amp;nbsp; digitalWrite(UV_P_SIDE,LOW);&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"&gt;&amp;nbsp; // Isolate the pin 2 end of the diode&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"&gt;&amp;nbsp; pinMode(UV_N_SIDE,INPUT);&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"&gt;&amp;nbsp; digitalWrite(UV_N_SIDE,LOW); &amp;nbsp;// turn off internal pull-up resistor&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"&gt;&amp;nbsp; // Measure how long it takes for the UV diode to drain to logical zero&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"&gt;&amp;nbsp; for ( uv = 0; uv &amp;lt; 30000; uv++) {&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"&gt;&amp;nbsp; &amp;nbsp; if ( digitalRead(UV_N_SIDE)==0) break;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"&gt;&amp;nbsp; }&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"&gt;&amp;nbsp; //-----------------------------------------------------------&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"&gt;&amp;nbsp; // Begin code for Cadmuim Sulfide broad spectrum light sensor&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"&gt;&amp;nbsp; long light;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"&gt;&amp;nbsp; int pulldown;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"&gt;&amp;nbsp; pulldown=1000000;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"&gt;&amp;nbsp; light=(analogRead(CdS_PIN));&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"&gt;&amp;nbsp; //Convert values for a roughly 0-100 scale output&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"&gt;&amp;nbsp; //Values derived from field testing during peak&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"&gt;&amp;nbsp; //summer conditions in Texas&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"&gt;&amp;nbsp; &amp;nbsp; uv = 100 - (uv / 300);&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"&gt;&amp;nbsp; &amp;nbsp; ir = 100 - (ir / 300);&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"&gt;&amp;nbsp; &amp;nbsp; light = light / 5;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"&gt;&amp;nbsp; //OUTPUT OVER SERIAL&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"&gt;&amp;nbsp; //If DebugPRINT value is 1 then output human&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"&gt;&amp;nbsp; //readable values to simplify things&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"&gt;&amp;nbsp; //If not, then output simple comma separated&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"&gt;&amp;nbsp; //values for spreadsheet applications&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"&gt;&amp;nbsp; if (DebugPRINT != 0)&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"&gt;&amp;nbsp; {&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"&gt;&amp;nbsp; &amp;nbsp; //&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"&gt;&amp;nbsp; &amp;nbsp; Serial.print("Temp0 Fahrenheit: ");&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"&gt;&amp;nbsp; &amp;nbsp; Serial.print(temp0,1);&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"&gt;&amp;nbsp; &amp;nbsp; Serial.println("");&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"&gt;&amp;nbsp; &amp;nbsp; Serial.print("Temp1 Fahrenheit: ");&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"&gt;&amp;nbsp; &amp;nbsp; Serial.print(temp1,1);&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"&gt;&amp;nbsp; &amp;nbsp; Serial.println("");&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"&gt;&amp;nbsp; &amp;nbsp; Serial.print("Temp2 Fahrenheit: ");&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"&gt;&amp;nbsp; &amp;nbsp; Serial.print(temp2,1);&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"&gt;&amp;nbsp; &amp;nbsp; Serial.println("");&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"&gt;&amp;nbsp; &amp;nbsp; Serial.print("IR = ");&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"&gt;&amp;nbsp; &amp;nbsp; Serial.print(ir);&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"&gt;&amp;nbsp; &amp;nbsp; Serial.println("");&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"&gt;&amp;nbsp; &amp;nbsp; Serial.print("UV = ");&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"&gt;&amp;nbsp; &amp;nbsp; Serial.print(uv);&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"&gt;&amp;nbsp; &amp;nbsp; Serial.println("");&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"&gt;&amp;nbsp; &amp;nbsp; Serial.println("");&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"&gt;&amp;nbsp; &amp;nbsp; Serial.print("Light Level = ");&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"&gt;&amp;nbsp; &amp;nbsp; Serial.print(light);&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"&gt;&amp;nbsp; &amp;nbsp; Serial.println("");&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"&gt;&amp;nbsp; &amp;nbsp; Serial.println("");&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"&gt;&amp;nbsp; }&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"&gt;&amp;nbsp; else&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"&gt;&amp;nbsp; {&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"&gt;&amp;nbsp; &amp;nbsp; Serial.print(light);&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"&gt;&amp;nbsp; &amp;nbsp; Serial.print(",");&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"&gt;&amp;nbsp; &amp;nbsp; Serial.print(uv);&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"&gt;&amp;nbsp; &amp;nbsp; Serial.print(",");&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"&gt;&amp;nbsp; &amp;nbsp; Serial.print(ir);&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"&gt;&amp;nbsp; &amp;nbsp; Serial.print(",");&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"&gt;&amp;nbsp; &amp;nbsp; Serial.print(temp0);&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"&gt;&amp;nbsp; &amp;nbsp; Serial.print(",");&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"&gt;&amp;nbsp; &amp;nbsp; Serial.print(temp1);&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"&gt;&amp;nbsp; &amp;nbsp; Serial.print(",");&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"&gt;&amp;nbsp; &amp;nbsp; Serial.print(temp2);&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"&gt;&amp;nbsp; }&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"&gt;&amp;nbsp; delay(4000); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;// Delay in ms until next reading&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: xx-small;"&gt;}&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/545611806283275210-5920693177423810048?l=www.guiltypixel.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/e70gPKQqucG2WXRK-R1URsaDYV0/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/e70gPKQqucG2WXRK-R1URsaDYV0/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/e70gPKQqucG2WXRK-R1URsaDYV0/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/e70gPKQqucG2WXRK-R1URsaDYV0/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/guiltypixel/iHPE/~4/FiGbt1k1DAE" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.guiltypixel.com/feeds/5920693177423810048/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.guiltypixel.com/2011/10/agricultural-sensors-part-3-source-code.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/545611806283275210/posts/default/5920693177423810048?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/545611806283275210/posts/default/5920693177423810048?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/guiltypixel/iHPE/~3/FiGbt1k1DAE/agricultural-sensors-part-3-source-code.html" title="Agricultural Sensors - Part 3: Source Code" /><author><name>James Dice</name><uri>http://www.blogger.com/profile/06530861365373560215</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://4.bp.blogspot.com/-3sJO7FZIw04/Tkyq0_2GcII/AAAAAAAAApU/E4b3SMtCBb0/s220/me_again_by_demarchand-d31w7n2.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://www.guiltypixel.com/2011/10/agricultural-sensors-part-3-source-code.html</feedburner:origLink></entry><entry gd:etag="W/&quot;AkUARXw7cSp7ImA9WhdUGEs.&quot;"><id>tag:blogger.com,1999:blog-545611806283275210.post-5840562273073790257</id><published>2011-10-05T18:56:00.000-05:00</published><updated>2011-10-05T21:30:44.209-05:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-10-05T21:30:44.209-05:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="arduino" /><category scheme="http://www.blogger.com/atom/ns#" term="sun" /><category scheme="http://www.blogger.com/atom/ns#" term="thermal" /><category scheme="http://www.blogger.com/atom/ns#" term="solar" /><category scheme="http://www.blogger.com/atom/ns#" term="spectrography" /><category scheme="http://www.blogger.com/atom/ns#" term="light" /><category scheme="http://www.blogger.com/atom/ns#" term="project" /><category scheme="http://www.blogger.com/atom/ns#" term="open hardware" /><category scheme="http://www.blogger.com/atom/ns#" term="open source" /><category scheme="http://www.blogger.com/atom/ns#" term="uno" /><category scheme="http://www.blogger.com/atom/ns#" term="tutorial" /><category scheme="http://www.blogger.com/atom/ns#" term="sensors" /><category scheme="http://www.blogger.com/atom/ns#" term="diy" /><category scheme="http://www.blogger.com/atom/ns#" term="soil" /><category scheme="http://www.blogger.com/atom/ns#" term="hacking" /><category scheme="http://www.blogger.com/atom/ns#" term="agsensors" /><title>Agricultural Sensors - Part 2: Digital</title><content type="html">Read&amp;nbsp;&lt;a href="http://www.guiltypixel.com/2011/06/agricultural-sensors-part-1-analog.html"&gt;Agricultural Sensors - Part 1: Analog&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
OK, in the last entry I mentioned that we can use LEDs as light &lt;i&gt;sensors. &amp;nbsp;&lt;/i&gt;I will elaborate on this before I continue writing about the rest of the Agricultural Sensors for Arduino device. &amp;nbsp;LEDs are diodes, they only allow current flow in one direction. &amp;nbsp;Normally, you allow current to flow across the LED, and photons are&amp;nbsp;emitted. &amp;nbsp;For our purposes, we will be reversing the polarity of the LED, and measuring its resistance via the Arduino Uno analog input pins. &lt;br /&gt;
&lt;br /&gt;
&lt;a name='more'&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
While in this configuration, the LED will resist current, as well as build a charge due to the inherent capacitance of the components within the LED. &amp;nbsp;If we allow the LED to discharge and measure how long it takes, we can measure the light level because the LED leaks current at a rate proportional to the number of incident photons. &amp;nbsp;To simplify, the time taken to drain the LED's capacitance is proportional to light level. &amp;nbsp;More light, faster discharge rate.&lt;br /&gt;
&lt;br /&gt;
I won't go into electron band gaps and valence bands versus conduction bands... &amp;nbsp;This blog isn't about that but if you're interested then read &lt;a href="http://en.wikipedia.org/wiki/Band_gap"&gt;this wiki article&lt;/a&gt; on band gaps, knowing that incident photons cause electrons to jump the band gap, which is why light stimulates discharge of the LED's capacitance.&lt;br /&gt;
&lt;br /&gt;
LEDs are most sensitive to light wavelengths equal to or less than the wavelength of light they are designed to emit. &amp;nbsp;With the LEDs I tested during the design of this sensor array, I found that infrared and ultraviolet LEDs were most sensitive to light very close to their emission wavelength. &amp;nbsp;This is great, because we want to measure UV and IR light levels, not ambient light. &amp;nbsp;Ambient light is being measured by a CdS photocell through a voltage divider.&lt;br /&gt;
&lt;br /&gt;
This part is very unscientific, but a lot of hacking is. &amp;nbsp;To get baseline readings for rough maximum and minimum IR, UV, and ambient light I took readings during the middle of the summer sun in Texas with the sun directly overhead and also at dusk. &amp;nbsp;I also measured during cloud cover. &amp;nbsp;I took the readings I got from this experiment and used them to calibrate the output of the Arduino so that readings on each type of light sensor would correspond to a 0-100 scale with 100 being the maximum light reading from overhead sun during July in Texas with little ambient humidity. &amp;nbsp;I'm sure there is a mathematical way to calculate how much light to expect but this was simple and effective for the area where the testing is performed. &amp;nbsp;You'll see how this was done later in the source code discussion.&lt;br /&gt;
&lt;br /&gt;
One of the problems I ran into with this method was that the LEDs discharged too fast for the Arduino to measure the time accurately, so I added capacitors in parallel with the LEDs to increase the discharge time. &amp;nbsp;On the IR LED I added a 150nF ceramic capacitor, and on the UV LED I added a .01uF ceramic capacitor to slow things down a bit. &amp;nbsp;Now we have time to get the Arduino to read information but we still have the same resolution, +/- the 3% error on these capacitors which won't really affect our data.&lt;br /&gt;
&lt;br /&gt;
Here is the schematic, so you can see how I wired this up.&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://1.bp.blogspot.com/-Ptc_ku-R3YA/Toztm00HdpI/AAAAAAAAAvo/lhB5Kjj7FNI/s1600/Agricultural-Sensor-v0.9_schem.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="254" src="http://1.bp.blogspot.com/-Ptc_ku-R3YA/Toztm00HdpI/AAAAAAAAAvo/lhB5Kjj7FNI/s320/Agricultural-Sensor-v0.9_schem.png" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class="separator" style="clear: both; text-align: left;"&gt;
Ignore the magical purple wire, Fritzing did that during output, and I don't know why. &amp;nbsp;It is irrelevant though.&lt;/div&gt;
&lt;br /&gt;
Read &lt;a href="http://www.guiltypixel.com/2011/10/agricultural-sensors-part-3-source-code.html"&gt;Agricultural Sensors - Part 3: Source Code&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/545611806283275210-5840562273073790257?l=www.guiltypixel.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/AAr3uPffpV80au5k43idh7nZlLc/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/AAr3uPffpV80au5k43idh7nZlLc/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/AAr3uPffpV80au5k43idh7nZlLc/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/AAr3uPffpV80au5k43idh7nZlLc/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/guiltypixel/iHPE/~4/Bm3BbVv5G0s" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.guiltypixel.com/feeds/5840562273073790257/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.guiltypixel.com/2011/10/agricultural-sensors-part-2-digital.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/545611806283275210/posts/default/5840562273073790257?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/545611806283275210/posts/default/5840562273073790257?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/guiltypixel/iHPE/~3/Bm3BbVv5G0s/agricultural-sensors-part-2-digital.html" title="Agricultural Sensors - Part 2: Digital" /><author><name>James Dice</name><uri>http://www.blogger.com/profile/06530861365373560215</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://4.bp.blogspot.com/-3sJO7FZIw04/Tkyq0_2GcII/AAAAAAAAApU/E4b3SMtCBb0/s220/me_again_by_demarchand-d31w7n2.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://1.bp.blogspot.com/-Ptc_ku-R3YA/Toztm00HdpI/AAAAAAAAAvo/lhB5Kjj7FNI/s72-c/Agricultural-Sensor-v0.9_schem.png" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://www.guiltypixel.com/2011/10/agricultural-sensors-part-2-digital.html</feedburner:origLink></entry><entry gd:etag="W/&quot;AkQBR3w5eip7ImA9WhdUGEs.&quot;"><id>tag:blogger.com,1999:blog-545611806283275210.post-6358745376887313840</id><published>2011-10-05T16:32:00.000-05:00</published><updated>2011-10-05T21:32:36.222-05:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-10-05T21:32:36.222-05:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="arduino" /><category scheme="http://www.blogger.com/atom/ns#" term="sun" /><category scheme="http://www.blogger.com/atom/ns#" term="thermal" /><category scheme="http://www.blogger.com/atom/ns#" term="solar" /><category scheme="http://www.blogger.com/atom/ns#" term="spectrography" /><category scheme="http://www.blogger.com/atom/ns#" term="light" /><category scheme="http://www.blogger.com/atom/ns#" term="project" /><category scheme="http://www.blogger.com/atom/ns#" term="open hardware" /><category scheme="http://www.blogger.com/atom/ns#" term="open source" /><category scheme="http://www.blogger.com/atom/ns#" term="uno" /><category scheme="http://www.blogger.com/atom/ns#" term="tutorial" /><category scheme="http://www.blogger.com/atom/ns#" term="sensors" /><category scheme="http://www.blogger.com/atom/ns#" term="diy" /><category scheme="http://www.blogger.com/atom/ns#" term="soil" /><category scheme="http://www.blogger.com/atom/ns#" term="hacking" /><category scheme="http://www.blogger.com/atom/ns#" term="agsensors" /><title>Agricultural Sensors - Part 1: Analog</title><content type="html">&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://2.bp.blogspot.com/-DaeVi9azWiw/TfE9riv7PoI/AAAAAAAAAdU/w40FaR0Z2yc/s1600/ag-sensors-0.9-500x375.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://2.bp.blogspot.com/-DaeVi9azWiw/TfE9riv7PoI/AAAAAAAAAdU/w40FaR0Z2yc/s1600/ag-sensors-0.9-500x375.jpg" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; AgSensors is an Open Source and Open Hardware project which uses extremely inexpensive equipment to gather reliable and valuable data about solar, thermal, and soil conditions.&amp;nbsp; Novel concepts such as simple spectrography by using LEDs (yes, LEDs as sensors will be explained in detail) and handmade soil probes controlled by an Arduino Uno.&amp;nbsp; In an effort to learn more about wireless sensor networks and programming in general, I've begun work on a project which allows capture of agriculturally significant data.&lt;br /&gt;
&lt;a name='more'&gt;&lt;/a&gt;&amp;nbsp; I don't even have a garden, the reason I chose this was because I will eventually put together a sensor pack for monitoring colony health of honeybees and I need to expand my knowledge.&amp;nbsp; Our little hymenoptera friends could use some help with the crisis they're facing, colony collapse disorder.&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; Learning is good, but sharing knowledge is better, so I've chosen the Arduino Uno as the microprocessor development board in order to make my experiments more accessible to the community.&amp;nbsp; Additionally, since my Java skills are a bit weak, I am using Visual Basic for the back end to make the computer programming tasks simpler to understand and more accessible.&amp;nbsp; None of the code is complicated, and VB is simple to read, so feel free to adapt the application to whatever languages you like.&amp;nbsp; All you need is to be able to read comma delimited values from a serial port and manipulate the data.&amp;nbsp; You can even capture this output directly to Excel or OpenOffice Calc if you like.&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; This project will span several blog entries as I develop the hardware and software further.&amp;nbsp; Please be patient, as I don't like releasing unfinished and buggy work to the public.&amp;nbsp; Early alpha stage software is written and is being tested but I won't post it until its stable and human readable :)&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; Lets begin with a general overview of the concepts used in AgSensors.&amp;nbsp; The data we will capture will include (at this stage) infrared, ultravoilet, and broad spectrum visible light intensity as well as thermal information from direct sunlight, ambient air temperature, and soil temperature.&amp;nbsp; We will also monitor soil moisture levels later using a probe built from dirt cheap and easily obtained parts and we will use the soil temperature to compensate for those conductivity readings.&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; Temperature readings will be the easiest part of this whole project.&amp;nbsp; Utilizing inexpensive and abundant 10k thermistors, we will create voltage dividers which will give temperature values as voltage values to the Arduino's analog inputs, which will then be compared to the analog reference voltage on AREF and converted to Kelvins, Fahrenheit, and Celsius values.&amp;nbsp; If this sounds confusing to you, don't worry, I will explain all of this.&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; A voltage divider is a simple circuit which every hobbyist, hacker, or aspiring engineer should understand.&amp;nbsp; On the Arduino, as well as several other microcontrollers which accept analog values, you will encounter many instances where analog sensors are resistive in nature.&amp;nbsp; Flex sensors vary their resistance when bent, force sensors change resistance with pressure, Cadmium Sulfide (CdS) photo cells like you might find on automatic nightlights change resistance with the number of photons striking them.&amp;nbsp; All of this is very useful, but how do we use this to control our devices?&amp;nbsp; A voltage divider works by having two resistors connected in series, one leading to the source and the other leading to ground.&amp;nbsp; If the two are equal, the voltage measured between them will be half.&amp;nbsp; If they are unequal, the voltage will be higher or lower depending on which one changed.&amp;nbsp; Our analog resistive sensors act as one half of this circuit, changing the voltage in the middle.&amp;nbsp; Please see the excellent description at &lt;a href="http://en.wikipedia.org/wiki/Voltage_divider"&gt;Wikipedia&lt;/a&gt; for diagrams and simple formulas to calculate output voltage.&amp;nbsp; Below is a simple schematic for reading an analog thermistor with Arduino.&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://3.bp.blogspot.com/-rWftf6E7Y9Y/TfFFBh23XdI/AAAAAAAAAdY/IeELvAt2Mdk/s1600/AnalogInputThermistor_schem.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://3.bp.blogspot.com/-rWftf6E7Y9Y/TfFFBh23XdI/AAAAAAAAAdY/IeELvAt2Mdk/s1600/AnalogInputThermistor_schem.jpg" /&gt;&amp;nbsp;&lt;/a&gt;&amp;nbsp;&lt;/div&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;/div&gt;
&lt;div class="separator" style="clear: both; text-align: left;"&gt;
&lt;br /&gt;&lt;/div&gt;
&amp;nbsp; Now if you understand this concept, it should be easy to see how we are going to get our temperature information into the project.&amp;nbsp; We have 3 channels of temperature data, therefore we have 3 thermistors rated at 10k, and matching resistors at 10k.&amp;nbsp; Each channel only needs a single analog pin, since input voltage comes from the power supplied to the device and the other half of the circuit goes to ground, which is common (shared with) our Arduino.&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; Light measurements from a CdS cell will use an identical circuit to measure light, but we will be changing the resistor on the other side of its divider to 100 Ohms.&amp;nbsp; The reason for this is because sunlight is so intense that to measure it accurately we need to measure a small fraction of the photocell's broad sensitivity range at the high end.&amp;nbsp; My photocell reads 300k after 10 seconds of total darkness, and 16k in only 10 lux.&amp;nbsp; Sunlight is far, far brighter than 10 lux, so the changes in resistance will be two orders of magnitude smaller.&amp;nbsp; We will measure changes within a range of 100 Ohms then, limiting the range of measured light to only 1% and increasing our resolution by 1,000 times.&amp;nbsp; The tradeoff is that our sensor will now be unable to measure changes in dim light such as artificial lighting, but we don't want that here anyway.&amp;nbsp; You can apply this concept to many sensors, remember it!&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp; In my next entry, I will cover the digital side of things, and explain how we can use LEDs, which normally &lt;i&gt;emit &lt;/i&gt;light, to measure different wavelengths of light from the sun.&amp;nbsp; Stay tuned for more, you might be surprised just how useful those little things can be!&lt;br /&gt;
&lt;br /&gt;
Read&amp;nbsp;&lt;a href="http://www.guiltypixel.com/2011/10/agricultural-sensors-part-2-digital.html"&gt;Agricultural Sensors - Part 2: Digital&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/545611806283275210-6358745376887313840?l=www.guiltypixel.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/GpxHjeqWkOcjYup-v-BhhkvxGIM/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/GpxHjeqWkOcjYup-v-BhhkvxGIM/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/GpxHjeqWkOcjYup-v-BhhkvxGIM/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/GpxHjeqWkOcjYup-v-BhhkvxGIM/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/guiltypixel/iHPE/~4/Y_4TETh3hCY" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://www.guiltypixel.com/feeds/6358745376887313840/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.guiltypixel.com/2011/06/agricultural-sensors-part-1-analog.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/545611806283275210/posts/default/6358745376887313840?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/545611806283275210/posts/default/6358745376887313840?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/guiltypixel/iHPE/~3/Y_4TETh3hCY/agricultural-sensors-part-1-analog.html" title="Agricultural Sensors - Part 1: Analog" /><author><name>James Dice</name><uri>http://www.blogger.com/profile/06530861365373560215</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://4.bp.blogspot.com/-3sJO7FZIw04/Tkyq0_2GcII/AAAAAAAAApU/E4b3SMtCBb0/s220/me_again_by_demarchand-d31w7n2.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://2.bp.blogspot.com/-DaeVi9azWiw/TfE9riv7PoI/AAAAAAAAAdU/w40FaR0Z2yc/s72-c/ag-sensors-0.9-500x375.jpg" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://www.guiltypixel.com/2011/06/agricultural-sensors-part-1-analog.html</feedburner:origLink></entry></feed>

