The LED Glasses Case allows you to locate your glasses in the morning when the room is usually dark with the LED stripes. You can also use it as a night lamp since after you put your glasses inside, triggering the ultrasonic sensor. This project incorporates a RGB stripe, ultrasonic sensor, L2N98 driver and most importantly, a 12v power supply.
I use a Arduino Leonardo board, but I think other kinds of arduino board can achieve the same result. Enjoy this tutorial!
2. Ultrasonic Sensor CH-SR04
3. L298N a dual H-Bridge motor driver which allows speed and direction control of two DC motors at the same time.
4. Arduino Leonardo
5. Bread board
6. 12v RGB LED stripe
7. 12v adaptor
8. A box (the glass case)
Step 1: Connect RGB Strip With L298N
You don't need any extra resistors, just connect the D-Pins and the 12v RGB as the diagrams depicts above. It seems like it's very complicated in the first picture, but it'll be easier if you follow the illustration. Remember for the D-pins, you have to connect to those pins with "~" like Pin 3, 5, 6. That is for analogwrite. Use a screwdriver to loosen up the screws so you can stick the jumpers in.
Step 2: Connect Ultrasonic Sensor to Arduino Board
I connect Trig to Pin 13 and Echo to Pin 11. It offers excellent non-contact range detection with high accuracy and stable readings in an easy-to-use package from 2 cm to 400 cm or 1” to 13 feet. The ultrasonic sensor measures in cm, so make sure the unit is cm when you're modifying the code.
Step 3: Coding
The link for the code is right here
Step 4: Create the Glasses Case
1. Find a box that fit the arduino board
2. Drill a hole for the LED strip
3. Then drill another hole for the 12v power
4. Cut out a hole on a cardboard for the ultrasonic sensor
5. Put the board on top to cover up the jumpers and board
remember the sensor has to be 2cm away from your glasses or anything you want to use to trigger the sensor
be careful with the utility knife!
Plug in the 12v power and the input of the arduino board then it's done.
Step 5: Done!
This is the final result. Note that you can adjust to any color you want by changing the code. Enjoy your night lamp/glassed case if you are a person like me who cannot find your glasses when waking up.
The Youtube link is down below