“I’m scared of the dark” Robot
For this week’s assignment, I created an Arduino “robot” that is scared of the dark. The idea is that it will print out its current emotions based on the light measure and will get “scared” and light up when it’s too dark. It did cross my mind that I was giving a robot “emotions”, but that thought went out of my brain pretty quickly.
Ambient Light Sensor Using Photo Resistor and LED Lights!
I've been using Arduino for a little while now and I've decided it's past time to design my own project from scratch. I…
To get started, I read through the tutorial below for an idea of how the schematic and what the code might look like.
Next, I started by giving the new light variable so I had more control over the value that was coming in and simplifying the code a little bit more.
Using if statements, I had the Arduino print out statements based on the measurement of the photoresistor.
- If there’s lots of light, it would say “I’m not scared, it’s bright out!”.
- If it’s somewhere in the middle, it would say “I’m fine, I can still see”
- If it’s dark, it would say “AWWW, IT’S SO DARK! I’m scared!”
Next, I wired up my breadboard with an LED and added the output value into my code. Then inside the if statements, I had the LED values be off in the bright and medium brightness values. Once it goes into the dark threshold, the LED will be turned.
First attempt, nothing. So I changed the wiring a little bit.
Second attempt, nothing again. Some profanity.
After, the third and fourth attempts, I looked at my code. But it was definitely working because it was printing out correct, so I slacked Professor Benedetta for help. With one look, she diagnosed that the resistor I chose was too high.
BOOM. Once I changed the resistor, it worked like a dream. Here is a video below that shows my robot in action. Lessons learned, use a resistor with a smaller value for LEDs and you can make a robot that’s scared of the dark.