Rubik's Cube Alarm Clock banner

Rubik's Cube Alarm Clock

9 devlogs
15h 10m 15s

Essentially, an alarm clock that forces you to solve a scrambled rubiks cube to turn it off.
Please read the readme file for instructions!

This project uses AI

Claude for debugging quadrilateral detection

Demo Repository

Loading README...

AVD

Tagged your project as well cooked!

🔥 AVD marked your project as well cooked! As a prize for your nicely cooked project, look out for a bonus prize in the mail :)

Sebastian Wu

Shipped this project!

Hours: 18.89
Cookies: 🍪 417
Multiplier: 22.08 cookies/hr

I built an alarm clock that stops only when you present it with a solved rubik’s cube. I did have trouble figuring out how to actually get it to verify that it was a solved cue, but by letting it find 3 solved sides from an angle, I was able to let it finally work. The details are in the readme and demo video.

I wasn’t exactly sure if the demo was supposed to be a video or something else, (also beware of headphone volume idk what happened) but if there are any issues, pls lmk!

Sebastian Wu

Debugging and running the code on the pi continuously to TRY AND GET THE COLOUR DETECTION TO WORK WITH MY CRAPPY WEBCAM AHGDHSFHHHH (idk if this is the correct hackatime workspace or wtv that i added but the time looks abt right) but it does work now hahehahehaha….

0
Sebastian Wu

I fixed the edge detection & corner detection for scanning and applying masks. Now it actually says that there are four corners found, but before, it was saying there were six, or five, or three, which meant it wasn’t a quadrilateral. This was fixed by stronger morphological operations which took me quite a while to figure out…

Attachment
Attachment
Attachment
0
Sebastian Wu

it now kinda works on the pi but the colour detection isnt fully working for some reason..
it does stop though

0
Sebastian Wu

woo it works! almost ready to ship! (havent tested on raspberry pi YET), HOWEVErRRRRRR the code now can detect if the cube is a quadrilateral , and correclty identifies all colours, and it somehow actually works on a mildly saturated background!

Attachment
0
Sebastian Wu

More robust testing to check if it’s solved. If there are opposite sides on the cube that are detected (e.g. blue & green at the same time), and are both over 5000 pixels in area (the threshold value), it will not detect it as solved, since there are impossible colours.

2

Comments

Sebastian Wu
Sebastian Wu 2 months ago

guys why is the video sideways

toderodavi
toderodavi 2 months ago

why is the video sideways

Sebastian Wu

Figured out the logic for detecting sides! And also integrated it into the alarm. Now all that’s left is to further add some more verification for detecting if it’s solved or not, and then migrating it to raspberry pi :)

output is attached below when i run the detection:

  • cube sensed: true
  • sides solved are listed
  • number of faces solved = 3; hence cube is solved
Attachment
Attachment
Attachment
Attachment
0
Sebastian Wu

First ~2h30m is mostly finishing the freecodecamp tutorial (https://www.youtube.com/watch?v=oXlwWbU8l2o).
Next ~1h was spent making the detection file, where it creates masks and detects if there are three or more colours shown in the picture. If there are, it returns True. trying to find the right upper and lower bounds killed me :(

Attachment
Attachment
Attachment
0
Sebastian Wu

Today (and the following ones) will probably be largely just learning the basics of OpenCV.
The code can currently detect edges & contours, but will probably need to be modified VERY heavily cuz… well… you can see the image… but progress is progress!
Today’s progress - I can now:

  • Read images & Video
  • Resize images & video
  • Draw shapes & add text
  • Manage essential functions (grayscale, blur, edge cascading)
  • Contour Detection
Attachment
1

Comments

kashsuks
kashsuks 2 months ago

It’s so peak