Introduction: Rainbow Predictor - Projected
Everyone loves seeing rainbows. While there is nothing quite like stumbling across a rainbow, it is possible to maximize your probability of seeing a rainbow. Rainbows require very certain conditions - the sun has to be below 42 degrees above the horizon (i.e. during the morning and late afternoon), you need the sun behind you (and not hidden by clouds), and to have rain in front of you. You can hear me talk more about it here. Due to the wonders of the internet and a little math, we can work out when the probability of seeing a rainbow is high. We can also calculate if a rainbow does appear, in which direction it needs to be.
This was a demonstration project I build for a Google developer day event in Sydney. An android app (running on a phone or tablet) calculates the probability of seeing a rainbow at regular intervals. When the probability of seeing a rainbow is high - it turns on a slide projector, and rotates it to project a rainbow on the wall in the direction you should look to see the rainbow.
- Android phone or tablet - any relatively recent model should do, it needs to be able to get location data (to calculate where the sun is), and internet (to get the weather forecast)
- A slide projector - I picked up an one up from ebay
- Arduino Mega ADK - this is an Arduino device that can act as a slave to an Android phone
- Slides with a picture of a rainbow and other icons (see details later on how to make these)
- Lazy Susan (to rotate the slide projector), e.g. from Ikea
- An arduino-friendly motor controller (many are available, e.g. on ebay)
- Stepper motor
- Relays (to control the buttons on the slide projector)
- 120 V / 240V relay (to turn the slide projector on or off)
Step 1: The Slide Projector
A key feature of this device is to project a rainbow on the wall when there is a high probability of seeing a rainbow. I chose to do this using a slide projector for two reasons - it seemed like a cool idea, and slide projectors can be found second-hand cheaply (as opposed to data projectors).
Perseverance is usually necessary in these things, and I eventually did win one auction for AU$20 for a Kodak Carousel S-AU 28 slide projector. The auction included the slide projector, several carousels, and a spare globe. The generous seller also gave me a projection screen to go along with it.
It was made in Germany, weighs a tonne but seems very solid (and works fine). I could not find a date of manufacture, however the Kodak slide projector history website says it was "supplied" from 1971-1974 and the list price was 240 pounds in 1971! Kodak still have a manual for it up on their web site. The same site announces also that Kodak stopped making slide projectors in 2004.
There is a 6 pin round DIN plug for the remote, as well as a weird 12 pin (2 parallel lines of 6 pins, never seen something like it) on the side which according to the manual allows "projector change-over and other control units to be linked to the projector". I'm guessing this could be a good way of switching the projector on and off (rather than using a relay on the 240V power in), whereas the 6 pin DIN will do the forward / back (this is what the supplied remote plugged in there does).
Step 2: The Slides
When I had the idea to use a slide projector for this project, I assumed that getting slides made was a similar process to getting digital prints made. I wanted to get digital photos made into standard 35mm slides. I soon realised that this is not a trivial thing to do. After going through many google searches and sending out a few emails, I could not find any shops in Australia that offer this service. Most of my searches ended up with places that will convert slides to digital, in my emails although (I think) I clearly stated what I wanted, most of them offered me the reverse service (slides -> digital). There are still places in Australia that will take special slide film and develop it into slides. So one option would have been to buy some of this film, borrow / buy a film camera (I don't have one!), take photos of a printout or the screen and get them developed. It didn't sound like a great idea.Eventually, I found some online services in the USA that will do this and ship to Australia for a reasonable price. After comparing many options on this web site, I went with Gammatech. They arrive quickly and they look great! Shown is one of the slides (using the computer monitor as the back-light), as well as the designs we sent off to be produced (thanks to my wife Anatt for making the designs)
Step 3: The Construction of the Device
The Android software to run the device is included here. The arduino software is the demo app from the ADK 2011 software.
This app will perform the rainbow probability calculations. This program obtains the current longitude and latitude (using the GPS or coarse location signals), and from this calculates the height of the sun in the sky (using standard astronomical algorithms). If the sun is in a suitable position (i.e. has not yet set, and is less than 42 degrees above the horizon), then it obtains the current weather conditions (using the free World Weather Online API). Based on this combination of sun location and weather information, a prediction is made about the chance of seeing a rainbow (either no chance, medium chance, or high chance). The app also provides an explanation for the result (e.g. the sun is too high in the sky to see a rainbow). The appropriate slide will be projected.
The Android device connects to the Arduino using a standard USB cable. If you get this far, please contact me for more details about how to wire up the arduino ADK to the slide projector.
A version of the app (without a projector!) is available in the Google play store