Light Pollution Solution - Artemis

Introduction: Light Pollution Solution - Artemis

About: The Adler Planetarium engages teens, undergraduates, volunteers, around the Chicago land area on real-world research. We hope you enjoy our project developed Instructables!

Light pollution is something that affects all of us around the world. Ever since the lightbulb was invented, light has become much more popularized and has specifically been used in big cities like New York City and Chicago. All this light can affect so many different types of animals; for example, baby turtles who need to find their way to the ocean using the moon for guidance mistake a dangerous streetlight for a moon and head to the highway. Light also affects the migration of birds and their mating seasons. On top of all the animals that light pollution affects, it also affects us. Whenever we walk outside at night and see these blinding blue lights, our minds are triggered to think it is daytime. Therefore, our brain does not produce melatonin; the chemical needed for us to go to sleep. Since this chemical isn’t produced as much, our sleep schedule gets thrown off, which causes a multitude of other problems.

However, with our Light Pollution Solution, Artemis, we make it easy to create a better tomorrow in terms of light pollution. Our light has a warm color temperature so as not to emit blue light to make us think we should be awake late into the night. With the help of Arduino Uno, multiple different sensors, and Snap Circuits, our light turns on or off based on the activity in the area, the darkness, and more. With our solution, less light will be emitted into the atmosphere so we, along with all animals, can enjoy the beauty of the night sky that helps to keep our environment blissful.

Step 1: Gather Your Materials

The first step of making Artemis is to gather materials.

As seen in the first picture above, here's a list of the physical materials you will need:

  • The Super Starter Kit Uno R3 Project - this will have your microcontroller, breadboard, and all the sensors you will need in it so you can use these to code your light. Specifically, you will need:
    • A USB-Arduino cable (and an adapter if you do not have a USB port in your laptop)
    • Male-male wires
    • Male-female wires
    • Extra-long wires (to cut if needed)
    • Jumper cables (to connect the Snap Circuits photoresistor to the breadboard)
    • A micro SD card and reader
    • An OLED screen
    • An Arduino Uno microcontroller
    • A PIR sensor
    • A DHT (humidity/temperature) sensor
    • 220k Om resistors
    • A breadboard
    • RGB LEDs (4x) or Regular LEDs (4x)
    • A photoresistor
  • A Snap Circuits Classic set (as shown by the manual above). Specifically, you will need a Snap Circuits photoresistor.
  • Scissors
  • Wooden sticks
  • An Exacto-knife
  • A wire stripper
  • A screwdriver
  • Black foam core
  • Construction paper
  • As shown in the second picture, you will need the Arduino Genuino application on your desktop/laptop computer to code the sensors.
  • As shown in the third picture, you will need some friends to do this with!

Step 2: PIR / Photo-resistor - Code

The first code you create is for the PIR (motion sensor) and the photoresistor. By combining these two sensors into one code, we can make the light react to both the level of darkness and the activity (or lack thereof) in the area. Here is what each main function in the code does:

setup(): this function activates the serial monitor and establishes the LED pin as an output and the PIR pin as an input

loop(): this function runs the photo_value() function and the checkPIRStatus() function

NBhere(): this function writes in the LEDs as off if the motion sensor is not on

SBhere(): this function writes the LEDs as on so they show brightly if the motion sensor is on

checkPIRStatus(): this function gets data from the sensor, then checks if the value reported is higher than 451. IF it is and the sensor is off, it is turned on and SBhere() runs. However, if the number reported is low and the sensor is on, then the sensor is turned off and NBhere() runs.

photo_value(): this function checks to see if the number is high, medium, or low and changes the intensity of the light accordingly.

Step 3: PIR / Photo-resistor - Electrical Schematics

After your code has compiled successfully, hook up your breadboard in the same way as in the Fritzing diagram above. After you're done, make sure everything is plugged in properly and that nothing is out of place. In addition to the 4 regular LEDs or RGB LEDs, you will need:

  • A PIR sensor
  • A photoresistor
  • Three male-female wires
  • Male-male wires
  • 4 220k Om resistors

After your code successfully uploads to the board, wave your hand over the PIR sensor. The lights should turn on and brighten and if you open your serial monitor, it should read "Motion detected!". Once you take your hand away from the PIR, the serial monitor should read "Motion ended!", and the LED (or RGB LED as shown in the fritzing diagram) should dim and turn off :).

As for the photoresistor, if you cover it, the LED should brighten and/or turn on, and once you lift your hand, the LED should dim. If you turn on all the lights in your area, the LED should be close to turning off.

Step 4: OLED / DHT - Code

Once you're done with the PIR/photoresistor segment of the code, you're ready to move on to the OLED/DHT code! Running correctly, this code should take in humidity/temperature data from the surrounding environment and, after displaying that information onto the serial monitor, it should display that information, as well as the status of any other sensors, on the OLED screen.

Here is what each function in the code does:

setup(): this function activates the serial monitor and initializes the libraries

loop(): this function creates variables for temp/humidity, then displays the information for humidity/temp onto the OLED screen and serial monitor

Here are the specific libraries you need to be downloaded to run this code:

  • U8g2 Library

Sidenote: the code above is both for the DHT/OLED and for the SD card, and the functions listed are the ones that solely control the DHT/OLED sensors.

Step 5: OLED / DHT - Electrical Schematics

After your code has compiled successfully, hook up your breadboard in the same way as in the Fritzing diagram above. After you're done, make sure everything is plugged in properly and that nothing is out of place. In addition to the 4 regular LEDs or RGB LEDs, you will need:

  • An OLED screen
  • A DHT sensor
  • Male-male wires
  • 4 220k Om resistors

After the code is successfully uploaded to the board, the humidity/temp information should appear on the serial monitor, and after the OLED screen shows its Adafruit screen, the humidity temperature data should appear on the top, with the status of each of the sensors saying 'ON' or 'OFF' below it :).

Step 6: Gather Data From OLED

By using the serial monitor, we were able to convert the humidity/temperature data into a graph. When your code works successfully and you see correct humidity/temp information on the serial monitor, click on 'Tools', then 'Serial Plotter'. Once you press that, you should get a graph of the data. In order to collect data, attach the DHT sensor to the breadboard, run the final code, and then set the DHT sensor near your window or outside from sunset to sunrise to get the data.

In the graph on the right of Celsius Temperature vs. Time, the temperature gradually decreases as the sun sets. This data was collected during sunset from 7:00 pm to 10:00 pm. Nighttime often yields lower temperatures compared to the day because the sun is no longer directly warming the area. These measurements were collected using a DHT sensor, which collects both temperature and humidity data.

The graph on the left is a measurement of the percentage of humidity in the air vs. time. The data was collected from 7:00 pm to 10:00 pm using the DHT sensor. As time passed, the humidity began to increase, which could possibly indicate precipitation in the near future. Precipitation is an important factor to take into consideration when designing light fixtures because weather events such as rain, snow, and fog can reduce visibility and affect light scatter.

Step 7: SD Card - Code

Now that you've successfully coded the OLED/DHT segment and the PIR/photoresistor segment, you're ready for the final segment: the SD card code. Working correctly, the purpose of this code is to have the SD card read the photoresistor data and show any lighting trends throughout the day.

Here is what each function in the code does:

setup(): this function activates the serial monitor and logs any data onto the serial monitor

loop(): this function establishes the timer

writeHeader(): this function prints the headers for the data into the SD card file

logData(): this function logs the time, humidity, and temperature into the SD card file

Additional libraries you will need:

  • SD.FAT library
  • Simple DHT library

Step 8: SD Card - Electrical Schematics

After your code has compiled successfully, hook up your breadboard in the same way as in the Fritzing diagram above. After you're done, make sure everything is plugged in properly and that nothing is out of place. You will need:

  • An SD card reader
  • A photoresistor
  • Male-male wires
  • 1 220k Om resistor

After the code is successfully uploaded, leave the photoresistor by your window or take it outside into your yard. Leave it there sunset through sunrise, and when you get back, take the micro SD card out. Then, using an SD card reader, have your laptop read in the information and create a graph with it!

Step 9: Gathering Data From the SD Card

Above is a picture of the data we collected from the photoresistor values from the SD card. The purpose of collecting this data is to see the lighting trends throughout the night so we can see if there's any very intrusive source of artificial light that disrupts the life of all animals on earth.

In order to gather data, connect the photoresistor to your breadboard using the Fritzing diagram, and run the final code that's in the zip file at the end of the Instructable. Plug your micro SD card into the reader and set the photoresistor by your window or outside from sunset to sunrise to collect your data.

This data was collected by a photoresistor, which measures light intensity. The data was collected from 12:00 am to 6:45 am and includes the sunrise. As the sun rose, the intensity of the light increased, causing the values obtained by the photoresistor to increase. This data can be used to determine when artificial lighting is necessary because the photoresistor determines the intensity of natural light in its surroundings and can tell when it is bright enough to create a visible landscape without artificial light.

Step 10: Combining All the Code

After you are done coding the three separate components of the code, it's time to put them all together! Taking the three components of your code, make sure nothing is the same in between all the programs, and then put them into a different program. After that, make sure everything is hooked up on your breadboard the way it is in the Fritzing diagram and run the program!
For us, there were a couple of times when the code didn't work when we combined all the components, so take a look at the troubleshooting part of this Instructable if things don't seem to work at first.

Step 11: Suggestions/Troubleshooting

Below are some suggestions for problems you might be having while working on your code. We know from experience that code can sometimes be very annoying and stressful so hopefully these tips help you replicate our *light pollution solution* :).

General:

  • Make sure all your wires are connected to the right pins, which are told to you in the program when defining variables.
  • Make sure all your wires are connected properly (for example, maybe your LED's negative side and positive side should be switched)
  • Make sure you don't have RGBs in your breadboard when coding for LEDs and vice versa

If the programmer isn't responding:

  • Restart Arduino and your microcontroller
  • Unplug and re-plug your USB
  • Check to make sure your port is the Arduino Uno (go to 'Tools' then 'Port')
  • Open a new, blank file and try running that and then running your original code

Can't find a solution here?

Try going to https://www.arduino.cc/en/Guide/Troubleshooting2 (the official Arduino Troubleshooting site) and look for your problem.

Step 12: Designing the Model

Use the diagrams in the zip file to design and 3d print the lights (however, a 3d printer is not necessary). To begin designing the model, cut out a piece of foam core or posterboard with measurements around 56cm x 37 cm. To make wiring easier, elevate the board by hot gluing wood blocks to the corners. Create your road and grass by gluing strips of black construction paper to the board and cut out holes where the lamps should be. Space them equally apart by dividing the length of the board into 4 and cutting out spaces in the base. determine the location of your sensors (photoresistor and PIR) and the OLED screen as well so you can cut out parts of the base to feed the wires through to the arduino. After all the holes have been cut, begin feeding the wires through so they pass under the model and attach to the arduino. Once everything is finalized, hot glue the sensors and lights in place!

Step 13: Test Everything Together

Now, since the design, electrical, and coding components are all finished, it's time to test your work! Go ahead and upload your program to the board, and if it works, congratulations!! If not, go back to the troubleshooting portion of this Instructable to see if you can figure out the issue.

Light Pollution Solutions like Artemis are essential to bringing the night sky back to everyone. For centuries, people have become scared of the night sky and have perceived light as a savior, though many animals suffer from the abundance of light near their natural habitats. By using this Light Pollution Solution, we can take a step towards having a better environment so that we and all the other animals on Earth are not disrupted by their natural schedules so we can all live happy and healthy!

Step 14: Acknowledgements

Thanks so much for reading our Instructable! :) This project could not have been possible without the following groups, so here are some people we would like to thank:

  • Jesus Garcia (our instructor at the Adler ASW program) for teaching us about how to use these sensors and helping us troubleshoot!
  • Ken, Geza, Chris, Kelly, and the rest of the Adler Teen Programs team for helping us out with this project
  • Guest speakers LaShelle Spencer, Carlos Roa, and Li-Wei Hung for giving fascinating talks which inspired us to keep being creative with our projects
  • Snap Circuits for sending us a very interesting kit that helped us learn more about circuits and helped us with our final project
  • the Adler donors for watching our final presentation and giving us feedback :)

Also, above is a zip file with all the fritzing diagrams, models, libraries, and code we used to make this Light Pollution Solution. We encourage you to download this if you want to make this at home!

Download our entire repository for this Light Pollution Solution here!

Be the First to Share

    Recommendations

    • Make it Fly Challenge

      Make it Fly Challenge
    • Fruit and Veggies Speed Challenge

      Fruit and Veggies Speed Challenge
    • Maps Challenge

      Maps Challenge

    Comments