Rainbow Roulette
Building and coding an electro-mechanical color wheel game
Building and coding an electro-mechanical color wheel game
TIMELINE
October 2023 (2 weeks)
ROLE
A solo project for Electronics & Controls course.
SKILLS & TOOLS
Electronics & Circuit Design
Python
Pulse Width Modulation
DELIVERABLES
+ An electromechanical game that incorporates a 12V DC gearmotor and an element of user interaction
OVERVIEW
The goal of this project was to design a simple game that used a 12V DC gearmotor and incorporated user interaction. I chose to design and build an electromechanical color wheel game using a KB2040, DC gearmotor, switches, potentiometer, and PWM. For user interaction, the user would click the start button to begin the game, adjust the speed of the color wheel for varying degrees of difficulty, and click the stop button when the target color will land on the arrow.
Video Demonstration & Explanation of the Final Version of the Game
STAGE 1: IMPLEMENTATION
To begin this project, I started out working on getting all the components of the game to work together. This included developing the breadboard circuitry, writing the python code, and finetuning the user interaction to have switches that start the game, adjust the motor speed, and stop the game.
The key aspect of this game is to start and stop the motor. To do this, I used an electrical switch, the N-Channel Mosfet, to allow 12V to either flow through the motor or not. The Mosfet is controlled by the KB2040.
When I first implemented the motor, wheel, start, and stop buttons, the color wheel spun so fast that it was almost impossible to stop it on the correct color. So, I implemented a potentiometer in the circuit between the 12V power supply and the motor to vary the voltage going to the motor, changing the rate the motor turned at.
However, there was not enough fine-tuning possible because the potentiometer was too high of a resistor (10k). To improve the fine-tuning, I implemented Pulse Width Modulation with one of the analog pins on the KB2040. As the potentiometer was turned, it would let through between 3.3V and 0V to ground and the analog pin would read in the value in this range and use it to control the pulse width modulation on the digital pin connected to the mosfet.
STAGE 2: INTEGRATION
After the code and breadboard design was fully developed, I went through the process of integrating the components into a box to give a polished look. This was challenging because when I first put the switches, motor, and breadboard into the box and closed the lid, the game did not function correctly and it was difficult to open the box to troubleshoot the issue without pulling wires out of the breadboard. To solve this, I attached all the components to the lid of the box so that when the box opens, all the components move together in a module.
Layout Planning
Internal component construction
Exterior integrated design
FINAL PRODUCT
Breadboard Circuit
Python Code
TAKEAWAYS & FUTURE IMPROVEMENTS
There are multiple elements to building a physical game. While getting the electronics and overall interactions to work is the first step, there are a lot of challenges that lie in the process of mounting the elements and encasing the game in a clean box.
I learned how to use pulse width modulation to control the speed of a DC gearmotor.
In the future, I would like to implement the target color in a more visible location on the game instead of it being read on the serial monitor of the computer.
Developing a method for the game to know whether you won or not using a color sensor would be another direction I would love to take this project.
Arcadia Ohnemus arcadia.ohnemus@gmail.com LinkedIn