{"id":28858128,"url":"https://github.com/gloworm72/interactive-wand-gesture-recognition","last_synced_at":"2026-04-20T09:33:50.311Z","repository":{"id":293579117,"uuid":"984486404","full_name":"Gloworm72/Interactive-Wand-Gesture-Recognition","owner":"Gloworm72","description":"Raspberry Pi wand system using OpenCV \u0026 machine learning to cast spells via real-time motion tracking, servo control, LEDs, and sound.","archived":false,"fork":false,"pushed_at":"2025-05-31T19:25:11.000Z","size":15775,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-06-20T02:05:10.309Z","etag":null,"topics":["computer-vision","gesture-recognition","gesture-tracking","harry-potter","harrypotter","machine-learning","maker-project","opencv","raspberry-pi","raspberry-pi-5","raspberrypi","themepark"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Gloworm72.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-05-16T02:36:07.000Z","updated_at":"2025-06-04T22:01:18.000Z","dependencies_parsed_at":"2025-05-20T19:06:02.005Z","dependency_job_id":"0fb01003-2ffc-4935-b2c5-4301293218fd","html_url":"https://github.com/Gloworm72/Interactive-Wand-Gesture-Recognition","commit_stats":null,"previous_names":["gloworm72/interactivewand","gloworm72/interactive-wand-gesture-recognition"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Gloworm72/Interactive-Wand-Gesture-Recognition","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Gloworm72%2FInteractive-Wand-Gesture-Recognition","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Gloworm72%2FInteractive-Wand-Gesture-Recognition/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Gloworm72%2FInteractive-Wand-Gesture-Recognition/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Gloworm72%2FInteractive-Wand-Gesture-Recognition/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Gloworm72","download_url":"https://codeload.github.com/Gloworm72/Interactive-Wand-Gesture-Recognition/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Gloworm72%2FInteractive-Wand-Gesture-Recognition/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260862914,"owners_count":23074182,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["computer-vision","gesture-recognition","gesture-tracking","harry-potter","harrypotter","machine-learning","maker-project","opencv","raspberry-pi","raspberry-pi-5","raspberrypi","themepark"],"created_at":"2025-06-20T02:05:02.445Z","updated_at":"2026-04-20T09:33:50.274Z","avatar_url":"https://github.com/Gloworm72.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Interactive Wand\n\nA personal passion project recreating the magic of spellcasting through computer vision, machine learning, and themed show control — all powered by a Raspberry Pi 5 and written entirely in Python.\n\n**Webpage Link:** https://andrewcongdon14.wixsite.com/andrew-congdon/interactive-wand\n\n---\n\n## Project Summary\n\nThis wand system detects spellcasting gestures in real-time using OpenCV and an infrared-lit wand. It recognizes and responds to two specific spells:\n\n- **\"Alohamora\"** — opens the magical box with warm purple fire  \n- **\"Colloportus\"** — closes it with a cool burst of blue flame  \n\nThe system features:\n\n- Real-time IR blob tracking and wand path tracing\n- Spell recognition using a trained SVM classifier\n- Servo-based box movement\n- Custom LED animations tied to spell type\n- Themed sound effects with seamless background music\n- Filtering to prevent false or accidental spell detection\n\nAll code runs on-device using multithreaded Python and a Pi Camera.\n\n---\n\n## Technologies Used\n\n- `OpenCV` for video input and motion tracking  \n- `scikit-learn` SVM with `GridSearchCV` for spell classification  \n- `Pi5Neo` to control RGB LED strip over SPI  \n- `pygame` for real-time sound effects and music  \n- `pigpio` and `gpiozero` for hardware PWM and servo control  \n- Custom wand trace dataset of 400+ samples, labeled and trained manually  \n- Threading to keep vision, servo, LED, and audio systems responsive  \n\n---\n\n## Spellcasting Flow\n\n![Wand (1)](https://github.com/user-attachments/assets/949b9146-4611-4c83-a0c0-e3fd67cafff5)\n\n---\n\n## File Overview\n\n**HarryPotterWandcv.py**\n\n↳ Main runtime script: blob detection, trace drawing, spell prediction, and show control.\n\n**HarryPotterWandsklearn.py**\n\n↳ Used to run the pre-trained SVM classifier concurrently.\n\n**new_custom_classifier.pkl**\n\n↳ Pre-trained model for classifying spells based on trace shape.\n\n**lastframe.jpg**\n\n↳ Latest wand trace visualization, saved for debugging or training.\n\n**Sounds/**\n\n↳ Sound effects and background music used in spellcasting.\n\n**DatasetCreation/**\n\n↳ Python for drawing custom training data, converting that training data into the correct format, training the SVM classifier to produce the .pkl file\n\n---\n\n## ML \u0026 Classification\n\nI created a custom dataset by collecting over 400 wand path traces drawn in-air. These were:\n\n- Centered and normalized\n- Smoothed and resampled\n- Converted to vector features\n\nI used `GridSearchCV` to tune a Support Vector Machine (SVM) classifier that could distinguish between gestures with over 99% accuracy.\n\nThe classifier runs on-device in real time with minimal latency.\n\n---\n\n## Show Control Highlights\n\n- **Servo Logic** – Smooth actuation of box lid using hardware PWM and `pigpio`  \n- **LED FX** – Custom “fire” animations with randomized color flickers using `Pi5Neo`  \n- **Audio Layers** – Spell SFX mixed over looping background music via `pygame`  \n- **Gesture Filtering** – Start and stop conditions prevent noisy traces from triggering spells  \n\n---\n\n## 🎥 Demo Video\n\n[![Watch the video](https://img.youtube.com/vi/IFpQFHPK7W4/0.jpg)](https://www.youtube.com/watch?v=IFpQFHPK7W4)\n\n*Click the image to watch the full demo.*\n\n---\n\n## Final Thoughts\n\nThis was one of the most technically rewarding projects I've created — combining embedded hardware, computer vision, machine learning, and interactive storytelling. It’s a small glimpse into how software and show control can bring magic to life.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgloworm72%2Finteractive-wand-gesture-recognition","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgloworm72%2Finteractive-wand-gesture-recognition","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgloworm72%2Finteractive-wand-gesture-recognition/lists"}