Snaplights is project that uses face recognition and clap detection to play the game of tic-tac-toe. It is a two-player game. In this project, 9 Adafruit Neopixel LEDs are arranged in 3-by-3 patterns in a wooden frame with a camera and a microphone attached to the frame. The Open MV H7 camera is used for the face recognition, KY-037 Microphone sensor for the clap detection, and the neopixels to display the output. Players choose their spot with their face and double clap to confirm. The first to claim three spots in a row wins!
2.0 Sketch of SnaplightsMSP430 is a mixed-signal microcontroller family from Texas Instruments. MSP430 is the control system of snaplight because it is responsible for the communication between all major components i.e. camera, microphone, and neopixels. It receives the input from the camera and microphone, processes the input in the microcontroller, and gives command to the neopixels to perform specific operations.
P1.1 and P1.2 pins creates a UART connection between the camera and MSP430. P1.7 pin is responsible for MOSI which stands for Master Output and Slave Input in which data is sent from the master to the slave on each clock edge. For snaplight, the master is the microcontroller and the the neopixels are the slave.
KY-037 Microphone sensor is used for clap detection. The microphone detects the clap, and sends an analog signal to the amplifier. The amplifier amplifies the signal according to the resistance value of the potentiometer and sends the signal to analog output of the module which is connected to P1.4 in MSP430
OpenMV Cam H7 is used for face detection. The OpenMV Cam H7 has a microcontroller embedded in the board which can be programmed in high level python scripts. For Snaplights, the program splits the camera lens into 9 different sections in terms of coordinates. Depending on where the player has their face, the corresponding neopixel will show X or O. This is made possible by the UART connection between camera and MSP430.
The Adafruit NeoPixel is used to display the X and O sign in the tic-tac-toe game. The neoPixel cannot be programmed, but receives commands to display different patterns and colors in the 8x8 matrix. The colors displayed in the neopixel are unlimited because it only depends on the ratio of RGB colors; we can achieve different colors by changing the ratio of RGB colors. One microcontroller pin is required to control all the LEDs. In the case of Snaplights, it is the MOSI pin in MSP430 shown in Fig. 5.
The back of the neopixel consist of 6 pins. There are 3 pins for input called GND, 5V, and DIN. There are 3 pins for output called GND, 5V, and DOUT. DIN is the pin that receives the command to operate the neopixel, and DOUT is used to transfer the same command to another neopixels if necessary.
4.0 How does the game of Tic-Tac-Toe work?Two software platforms provide functionality to SnapLights. TI Cloud Composer Studio programs the MSP 430, allowing it to interface connections between the camera, NeoPixels, and microphone. OpenMV IDE is the Python platform that programs the camera, and built into it are a variety of Haar cascade models for object detection, including one for face detection.
In the camera's field of view, we divide what it sees into 9 regions. Depending on at which region a face is located, the corresponding NeoPixel on the tic-tac-toe grid lights up red. When the microphone hears a double clap, it turns the selected NeoPixel from red to blue, marking a confirmation of the spot. Now it is the next player's turn to mark his or her territory.
Achieving accuracy is the main challenge of this project. The system is highly sensitive to the environment where the game is being played. The game requires a dark background to minimize background reflection for an accurate face detection. The clap detection is sensitive to background sounds. (We did double clap to solve that)
Therefore, a clear vicinity should also be provided for the players because of the limitation in the range of detection for both camera and the microphone. Hence, taking in account all of these limitations is crucial for the accuracy of the game.
6.0 Hardware Assembly and Final Product“KY-037 Microphone Sensor Module (High Sensitivity).”KY-037 Microphone Sensor Module (High Sensitivity) - SensorKit X40 Wiki, sensorkit.en.joy-it.net/index.php?title=KY-037_Microphone_sensor_module_(high_sensitivity).
Adafruit Industries. “Adafruit NeoPixel NeoMatrix 8x8 - 64 RGB LED Pixel Matrix.” Adafruit Industries Blog RSS, www.adafruit.com/product/1487.
“OpenMV Cam H7.” OpenMV, openmv.io/products/openmv-cam-h7.
“MSP430G2 LaunchPad Development Kit MSP-EXP430G2 This Product Is No Longer in Production.” MSP-EXP430G2 MSP430G2 LaunchPad Development Kit | TI.com, www.ti.com/tool/MSP-EXP430G2.
Comments