DrinkTimer: Smart LED Timer for Your Party – DIY Project With NeoPixel, Raspberry Pi Pico, and MicroPython [Guide + Code]

by ulmerju in Circuits > Electronics

424 Views, 4 Favorites, 0 Comments

DrinkTimer: Smart LED Timer for Your Party – DIY Project With NeoPixel, Raspberry Pi Pico, and MicroPython [Guide + Code]

IMG_1134-ezgif.com-video-to-gif-converter.gif
F0NW8WDM290YYZN.jpg

The DrinkTimer is a DIY project designed specifically for parties. Powered by a Raspberry Pi Pico and programmed in MicroPython, the DrinkTimer measures the time a glass is lifted and, ideally, emptied. The duration is displayed on an OLED screen, which also shows the current time, fastest, and average drinking times.

The experience is enhanced with NeoPixel LED rings, creating vibrant light shows that amplify the party atmosphere. Additionally, a plotter and 3D printer were used to craft the enclosure and other components. This project not only adds a fun element to your next party but also offers a fantastic opportunity to delve into the world of microcontrollers and creative electronics.

Supplies

  1. Raspberry Pi Pico
  2. NeoPixel LED Ring(s) (e.g., 1/8/16/24/35/4 ... Leds LEDs per ring)
  3. OLED Display (e.g., 128x64 pixels, I2C)
  4. Round acrylic glass (for protective or aesthetic covers)
  5. Diffuser film (to soften and spread the light from the LEDs)
  6. 2x Touch Sensor
  7. 3D-printed enclosure
  8. Jumper wires
  9. Resistor (330 Ohm)
  10. Capacitor (1000µF, 6.3V or higher)
  11. USB cable for Raspberry Pi Pico
  12. Breadboard or soldering materials

Set Up the Hardware

Schematic.PNG

Connect the LED Ring:

  1. Connect the DIN pin of the NeoPixel ring to one of the GPIO pins of the Raspberry Pi Pico (e.g., PIN32 (GP27)).
  2. Connect VCC to 5V and GND to GND on the Pico.
  3. Add a 330-ohm resistor between the GPIO pin and the DIN pin of the LEDs.
  4. Place a 1000µF capacitor between VCC and GND to minimize voltage fluctuations.

Connect the OLED Display:

  1. Connect the SDA and SCL pins of the OLED display to the corresponding I2C pins on the Pico (e.g., PIN4 (GP2) for SDA, PIN5 (GP3) for SCL).
  2. Connect VCC and GND to the respective pins on the Pico.

Touch Sensor for Start and Object Detection:

  1. Connect the output of Sensor1 to (e.g., PIN34 (GP28)), and VCC and GND to the corresponding pins on the Pico.
  2. Connect the output of Sensor2 to (e.g., PIN24 (GP18)), and VCC and GND to the corresponding pins on the Pico.

Optional:

  1. Use a breadboard for temporary connections before soldering everything together.

Prepare the Software

Install MicroPython on the Pico:

  1. Connect the Pico to your computer via a USB cable.
  2. Install the MicroPython firmware on the Pico by dragging the firmware file onto the Pico "drive."

Develop the Code:

  1. Open a MicroPython IDE (e.g., Thonny) and begin writing the code for the DrinkTimer.
  2. Utilize libraries like neopixel for controlling the LEDs and ssd1306 for the OLED display.
  3. Implement the functionality for time tracking, LED light shows, and display output.

Upload the Code to the Pico:

  1. Test the code within the IDE to ensure it works properly.
  2. Once finalized, upload the code to the Pico.


_________________________________________________________________


Alternative:

  1. Use the provided files and save them directly to the Pico.

Special Considerations:

  1. The LED ring animations are stored in an external class, allowing for easy expansion and customization.
  2. The OLED display typically only supports small fonts. Therefore, the writer.py function and freesans20.py are used to generate custom writer files and fonts that allow for larger text display.

3D-Print the Case

3D-Modell.PNG

Design a custom enclosure or use a pre-made template that provides space for the Raspberry Pi Pico, the LED ring, and the OLED display. Use a 3D printer to create the case and ensure it accommodates all components securely.

For my project, I cut a 140mm diameter disc from acrylic glass and printed a matching case using a 3D printer. The case consists of two main components:

  1. Lid Element: The acrylic glass disc is glued into the lid, which creates a sleek and modern appearance.
  2. Base Element: This part houses all the electronics, including the Raspberry Pi Pico, the LED ring, and the OLED display.

The lid fits precisely onto the base and can be secured with slight pressure, ensuring a snug fit without the need for screws or additional fasteners.

To enhance the visual effect, I used a plotter to cut a 140mm ring from translucent, diffuse film with a window for the OLED display. The film was applied to the acrylic glass, diffusing the light from the LEDs and giving the animations a much smoother, more attractive appearance. This added touch makes the LED effects look even more impressive and professional.

Optionally, you can use a plotter to create custom decorations or labels for the case, giving it a personalized touch.

Assembly and Testing

Now that all components are prepared, it’s time to assemble your DrinkTimer and bring it to life.

  1. Place the Electronics: Carefully position the Raspberry Pi Pico, the OLED display, and the NeoPixel ring inside the 3D-printed case. Ensure each component fits snugly in its designated area to avoid unnecessary movement or strain on the connections.
  2. Secure the Components: Once everything is in place, secure the components to the housing. You can use small screws for a more permanent installation or hot glue for a quicker, adjustable setup. Make sure that the LED ring is aligned correctly, and the OLED display is visible through the window in the acrylic disc.
  3. Connect and Power On: With the components secured, it’s time to connect the wiring according to your setup. Attach the power supply and double-check that all connections are correct, ensuring that both the LEDs and the OLED display are properly linked to the Raspberry Pi Pico.
  4. Test the DrinkTimer: Power on the device and watch as it springs to life. Verify that the NeoPixel LEDs light up as expected and display your programmed animations smoothly. Ensure that the OLED display shows the desired information, such as timers or notifications.
  5. Final Adjustments: During testing, check for any potential issues. Are the LEDs displaying the correct colors and sequences? Is the OLED screen clear and legible? If everything works as intended, your DrinkTimer is now fully functional and ready for use!

With the assembly complete, you’ve transformed your design into a working device that combines functionality and style.

Final Adjustments and Enjoying Your Project

F32BITBM290YYZB.jpg
IMG_1152.jpeg
IMG_1130.jpeg
IMG_1141.jpeg

With your DrinkTimer assembled, it’s time for the final touches and customizations to make your project truly unique.

  1. Customize LED Light Shows and Effects:
  2. Experiment with different light patterns and animations for the NeoPixel rings. Play with colors, brightness, and timing to create unique and exciting effects. You can even design personalized LED animations to add a special touch or create celebratory animations for when a player wins the game.
  3. Optimize the Display:
  4. Fine-tune how the information is displayed on the OLED screen. Adjust the readability of the timer, or customize messages that appear based on game progress. Add celebratory messages or animations to highlight key moments, such as announcing the winner or reaching game milestones.
  5. Enhance the Design:
  6. Add decorative elements or labels to polish the design of your DrinkTimer. Using custom engravings, stickers, or other creative decorations, you can give the project a personal, finished look. Consider adding extra features like sound effects or vibrations for more interactive fun.

Enjoy Your DrinkTimer

Now it’s time to show off your DrinkTimer at your next party! Use it to track game progress, impress your friends with the cool LED effects, and dynamic display animations.

Don’t stop here—continue to experiment with new features and improvements. Whether it’s more complex light shows, integrating sound, or expanding the display functionality, your DrinkTimer can evolve with your creativity. The possibilities for fun and personalization are endless!