Sensor Combination (Week 5)

  • Goal of this project : I made a circuit enables RGB LED to be on/off and change the light color corresponding to both sensor – ultrasonic sensor and photoresistor. I used RGB LED to change its color according to the distance detected by ultrasonic sensor, and also it will be on/off according to the light of space detected by photoresistor.
  • Circuit and components : Arduino, RGB LED, Ultrasonic sensor, photoresistor, 3 x 220ohm resistors(for RGB LED), 1 x 1K ohm resistor(for photoresistor), jumper wires          * RGB LED has 4 legs – three legs are for red, green, blue output color, and one long leg is for ground.

  • How it works : RGB LED is changing its color output. When the distance is farther than 14cm, it turns blue, when the distance is closer than 7cm, it turns red, and in between, green. I also used photoresistor to detect the light of the space, if photoresistor’s value is below than 200, LED will be off, if it is above 200, LED will be on. The distance in cm and light value from photoresistor are uploading on serial monitor so you can see their value in real time.
  • Any problems encountered / solved : I had a trouble to get a value of photoresistor because when I connect it with 10K ohm resistor, the value was wandering around only in between 0~3. And values were not stable. I checked all connections were right and test with different codes, the problem was still same. But the fact that I am using RGB LED which has 4 legs with 3 x 220 Ohm resistors came up on my mind, so I thought that should influence the current of whole circuit. So I lowered the ohm of photoresistor’s resistor 10K to 1K. After that, the value was detected in reasonable range, and it provides stable input.
  • code

Leave a Reply

Your email address will not be published. Required fields are marked *