Plant Light Level Detector

by AMG17 in Circuits > Arduino

43 Views, 0 Favorites, 0 Comments

Plant Light Level Detector

20241124_230340085_iOS.jpg

In our engineering class, our group was given a project to develop a robot. In our discussion on what to do for our project, we landed on the idea of a plant light level detector. We chose this idea because we felt that it was unique and may be useful in finding the best spot in a window to place a houseplant. To achieve this, we decided on some goals the project should meet.


The robot should be able to:

  1. Detect the light levels in four different positions on a windowsill
  2. Indicate which position on the windowsill receives the greatest amount of sunlight
  3. Autonomously move to each of the four positions


It took a bit of trial and error, but we eventually came up with a robot that uses a motor with wheels to move it, a servo to move the light sensor to multiple heights, and LEDs to indicate the best position. The code was developed to achieve these functions in the correct sequence and display the results correctly and reliably.

You can find both videos of the function device and these instructions in video form at

https://drive.google.com/file/d/16xrwOsA0EiyRzw89cJDnbocXGMaa7rpf/view?usp=sharing

Supplies

Sparkfun Inventor's Kit for Arduino Uno - v4.1

  1. Arduino Board
  2. Breadboard
  3. 1 Gear Motor (With Gear attachment)
  4. 2 Rubber wheels
  5. 1 Servo Motor
  6. 1 Photoresistor
  7. 4 LEDs (Preferable of different colors)
  8. 1 Motor Driver
  9. 1 Pushbutton
  10. 1 4 AA Battery Batter Pack

Cardboard/Poster Board

Popsicle Sticks

Electrical Tape/Wire Connectors (Can be replaced with Solder)

Hot glue gun/hot glue

Duct Tape

Scissors or knife

Marker, pen, or pencil

Ruler or measuring tape

Wire the Circuit

T9A Project v1.png
20241121_000603350_iOS.jpg
20241120_234222284_iOS.jpg

Following the circuit diagram above, wire your Arduino kit and included electrical components.

For the servo, LEDs, Photoresistor, and button, use either end to end wire connectors, electrical tape, or solder, to extend the components off of the board. (Demonstrated with LED above)

Trace each component back to its labeled input or output pin and ensure it is the same as the circuit diagram.

Then, run the code on the completed circuit before assembling the rest of the design.

After pushing the button, the servo should rotate between 10 different positions and then spin the gear motor. After 4 of these cycles, one or all of the LEDs should turn on.

Prepare Body

20241121_000203852_iOS.jpg
20241121_000211516_iOS.jpg
20241121_000243372_iOS.jpg
20241121_000303128_iOS.jpg
3.5 Inches.png

First, cut your cardboard, or whatever body material you chose, into six pieces: two 5.5" x 3.5" (front and back), two 8" x 3.5" (top and bottom), two 8" x 5.5" (left and right), and one 1" x 3.5" (Tail).

Label each piece as its designated position and mark the front and back side of each for easier assembly.

Near the upper front corner of the left side wall, mark and cut a 2.2 mm x 1.1 mm rectangular hole to fit the servo motor; exact location does not matter. (Use servo motor to ensure the back fits snugly without going all the way through.)

Near the front of the top piece, create four evenly spaced holes to fit your LEDs. (Use the LEDs to help make the holes the correct size.)

In the center of the top piece, trace the edges of your button and cut a hole that you can put the button in.

Cut out a piece of body material that is one inch in width, with a length that matches the distance you would like the robot to travel. This will serve as the track.

Mount Arduino

20241121_003040872_iOS.jpg
20241121_000548837_iOS.jpg

For this step you have multiple options.

In order to reuse our Arduino, our prototype has a rail mount made out of popsicle sticks. To avoid this, you can use duct tape or glue to directly adhere the back of your Arduino to the left side wall (the same wall as the servo mount).

To recreate our mount, do the following:

  1. Place your Arduino and breadboard on the wall, then trace a small shallow groove around the bottom and side edges.
  2. Place 6 small pieces of popsicle sticks (5-6mm long) standing directly up in the grooves, use hot glue to adhere.
  3. Use hot glue to attach 3 more popsicle sticks lying horizontally across the vertical sticks.

When the Arduino slides in, it should be held sturdily while also being removable.

Motor Assembly

20241120_234233177_iOS.jpg
20241120_234342468_iOS.jpg
20241120_235414556_iOS.jpg
20241120_235418766_iOS.jpg
20241120_235527073_iOS.jpg
20241120_235846361_iOS.jpg
20241120_235849297_iOS.jpg
  1. Attach wheels to gear motor by fitting half circle key into matching holes in the wheels.
  2. Create two identical rafts out of popsicle sticks and hot glue (5/8in x 4in)
  3. We found that using two layers separated by a stick on both ends worked the best.
  4. Using hot glue, attach the rafts to either side of the gear motor pointing away from the wheels.
  5. Use tape to run the wires through the inside of the rafts.
  6. Grab the foam piece marked for the bottom of the device, inset by about a half inch, and measure and cut two holes spaced so that both motor rafts can fit snug through them.
  7. Push the rafts halfway up these holes, ensuring that the motors can spin freely and the wires run up through the holes.
  8. Use hot glue to secure the assembly in place.

Servo Assembly

20241124_223724574_iOS.jpg
20241124_224901801_iOS.jpg
20241124_224906034_iOS.jpg
20241124_224917289_iOS.jpg
  1. Mount the servo through its designated hole on the left side with the wires pointed in toward the Arduino.
  2. Run the photoresistor through the same hole so that it stays attached to the Arduino.
  3. Cut down a popsicle stick to a desired length (Based on the allowed length of your wires).
  4. Attach one end of the popsicle stick to the servo spindle and the other to the photoresistor.

Prepare Pieces for Attachment

20241124_224906034_iOS.jpg
20241124_225514431_iOS.jpg
20241124_230054541_iOS.jpg

In this step before the final assembly, run each component into its intended hole and secure.

This includes:

  1. LEDs
  2. Servo Motor
  3. Button

If holes are too big, place a piece of tape behind the components to lock them in place. During this process, avoid unplugging components from the Arduino and breadboard.

Connect motor wires to designated place on circuit diagram.

Using a piece of tape attach the battery pack to the outside of the left wall, then cut a small hole to run the wire in and plug in the battery pack (method of doing so varies on battery pack used).

Power the device and run the code one last time before full assembly.

Assemble Body

IMG_7047.jpeg
IMG_7051.jpeg
IMG_7050.jpeg
IMG_7049.jpeg
IMG_7052.jpeg

Now that you have all the pieces outfitted with their respective parts, it’s time to put them all together. Start by orienting each piece in the direction that they will face on the robot.

Use hot glue to connect the front 5.5” x 3.5” piece at the bottom to the front end (side with the wheels). Next, do the same with the back piece on the back side.

Then, use hot glue to attach the 8” x 5.5” piece holding the circuit to the floor and wall pieces on the left side. Ensure that the circuit is facing inward, with the Arduino board closer to the front and the breadboard closer to the back.

Cut a hole out of the top piece directly above the Arduino port to allow for troubleshooting.

After that, use duct tape to attach the other 8” x 5.5” piece (the door) to the front wall piece. The door should be able to swing open at the back and close using either another piece of tape or a more complex latch.

Next, hot glue the top 3.5” x 8” piece to the top of each wall, with the button and LEDs facing outward, the LEDs nearer to the front.

Lastly, use hot glue to secure the tail piece to the bottom of the back end of the body. It should sit on the corner so that it drags while the robot is in motion. Once connected securely, cut out a piece in the center of the tail to fit the track.

Testing

Now it’s time to test your robot.

First, place the robot on the track with the wheels facing forward, ensuring that the track is situated neatly between the wheels and tail pieces.

Press the button to run the circuit.

Observe how the robot operates and note any errors you see.

Brainstorm and test ideas on how to fix any malfunctions.

Troubleshooting

This is a difficult step because everyone’s obstacles that they encounter are unique. This is the time when your engineering skills are put to the test. That being said, here are some errors we encountered, and how to fix them.

Error #1: Veering to the left

One of the first problems that we encountered was that our robot would turn left while driving, which could have disastrous results in applied use. We implemented two ideas to fix this issue: the track, which you have already created, and a counterweight. For our counterweight, we used duct tape to stick four 9V batteries onto the inside wall of the front left side of the vehicle. For your counterweight, you can use anything you find that can even out the weight distribution. However, we recommend that whatever you choose be secured to the body in some way so that it doesn’t move around while the robot is in motion.

Error #2: LEDs not working

The next problem we faced was that the LED lights were not functioning properly. The solution to this was to check over the connections and ensure that each is wired correctly.[

Error #3: Motor not spinning

While two was as far as our group’s errors went, we would like to present some possible solutions to potential obstacles. One likely issue is that the gearmotor won’t rotate as intended. The way to fix this, like the LEDs, would be to check its connections and that it’s wired to the correct pins.

Error #4: Servo getting stuck

Another obstacle you may encounter is that the servo motor is not able to go through all of its positions; that it gets stuck at some point. This could be because the wires are too tight and they restrict the motor from cycling through its full range of motion. To fix this, you should adjust the wire lengths to allow enough slack for the popsicle stick to reach its peak position. 

It is likely that you will run into problems that aren’t mentioned on this page. For this reason, we encourage you to get creative, think outside the box, use your resources, and think critically to solve your own unique problems. Be the engineer you are capable of becoming. We believe in you!