Digital Ruler and Unit Converter

by mattdks4 in Circuits > Raspberry Pi

76 Views, 0 Favorites, 0 Comments

Digital Ruler and Unit Converter

Digital Ruler and Unit Converter

This project uses an LED strip to resemble a ruler. The number of LEDs that are on can be adjusted, and a button will send the length of the lit up LEDs to the serial console. The units can be changed by another button, indicated by the color. For this project, I wanted to take an everyday item and add tech to it, and I decided to choose a ruler.

Supplies

Electrics Materials:

  • Raspberry Pi Pico W
  • LED Strip (30 LEDs)
  • Potentiometer
  • 2 External Buttons
  • Alligator Clip to Male Jumper Wire
  • Male to Male Jumper Wire

Woodworking Materials:

  • Laser Cutter
  • 1/8'' Baltic Birch Plywood
  • Wood Glue
  • Hot Glue
  • Clear Tape
  • Markers

Other:

  • Mu Serial Console
  • Adafruit IO

Design and Code

ruler-1.png
ruler-2.png
ruler-3.png
ruler-4.png
IMG_5002.jpg

I began with a loose visual idea for the project and wrote the majority of the code. I tested this with my electrics before building anything. (Note: sketch should say 32 in)

Downloads

Laser Cut

70424604782__FB075287-621C-4E02-AC91-5577A7746357.jpg
BE1182C0-8C9A-4E28-B742-9D629B7B9138.jpg

I did not end up using the original dimensions and instead scaled down to 20 inches long. I designed the wood box using a "Console" preset on festi.info/boxes.py/. I added a hole in the back for parts access and holes in the front for buttons and a potentiometer. I also engraved the color key on the front of the box. I printed each piece, but I needed to attempt to unwarp some of the pieces, which delayed my assembly.

Wood Assembly

70431467807__FBDB3E18-D95D-4276-A134-28753CB511A1.jpg
IMG_5011.jpg

I used wood glue to put the general box together. After each piece was on, I added some tape to remove some of the issues with the warped wood. I also colored the color code.

Electronics Assembly

image_123927839 (1).JPG
image_6487327 (2).JPG

I attached the potentiometer to the box using hot glue, and the LED strip using tape. For the buttons, I made small square wooden cutouts and hot glued the button in the middle. I then wood-glued the square to the back of the circle hole. The wiring for this project is very simple, only needing two or three wires for each part.

Connecting to Adafruit IO

ruler-5.png

I created a dashboard in Adafruit IO to allow the ruler to work the other way around. Rather than visually choosing a length and getting the numerical equivalent, the dashboard allows the user to enter a number and see the length on the ruler. I use two separate feeds, one for centimeters and one for inches, that work the exact same, receiving a numerical value and lighting up the appropriate number of LEDs. The code does not check for nonnumerical values but does catch numbers that are out of bounds.