Light Chaser Game

by yui_maker in Circuits > Arduino

275 Views, 0 Favorites, 0 Comments

Light Chaser Game

1.jpg
2.jpg
3.jpg

This is a very simple but super fun light-chaser game. Random LEDs will light up and the player has to press the button associated with that LED. There is a time limit for pressing the buttons so if you press the button too late or press the wrong button the game will end. I have used arcade game micro switches in which the LEDs and micro switches come together. But you can make this game with some simple push buttons and LEDs as well.

Arduino Uno was used for this project but any Arduino should work. The code was also tested with Arduino Nano.

I have tried to comment on the code to the best of my ability but if you have any questions please feel free to leave a comment.

Supplies

parts.jpg

Arduino Uno or nano (It should work with other Arduinos/microcontrollers as well. We need 8 digital pins and I2C communication capabilities)


Micro Switch or push button (I have attached some links for arcade switches similar to the ones I have used but any micro switch or push button will work)

I have used 4 microswitches in red, green, blue, and yellow colors.

https://www.aliexpress.com/item/1005002878944016.html?spm=a2g0o.productlist.0.0.55895297va0P3L&algo_pvid=5c2787b4-df23-43f3-ac7f-e0609078fdec&algo_exp_id=5c2787b4-df23-43f3-ac7f-e0609078fdec-28&pdp_ext_f=%7B%22sku_id%22%3A%2212000022593255561%22%7D&pdp_npi=2%40dis%21EUR%210.71%210.59%21%21%21%21%21%40210318bb16670562709018208ed7a4%2112000022593255561%21sea&curPageLogUid=KzYvEycKNCE7


https://www.aliexpress.com/item/32812342892.html?spm=a2g0o.detail.1000060.1.52a7b755VuuC0v&gps-id=pcDetailBottomMoreThisSeller&scm=1007.13339.291025.0&scm_id=1007.13339.291025.0&scm-url=1007.13339.291025.0&pvid=9ed9daec-1fac-4859-bfdd-9577314c3b51&_t=gps-id:pcDetailBottomMoreThisSeller,scm-url:1007.13339.291025.0,pvid:9ed9daec-1fac-4859-bfdd-9577314c3b51,tpp_buckets:668%232846%238113%231998&pdp_ext_f=%7B%22sku_id%22%3A%2264606053736%22%2C%22sceneId%22%3A%223339%22%7D&pdp_npi=2%40dis%21EUR%212.39%212.24%21%21%21%21%21%4021032f9f16670563680512562e7579%2164606053736%21rec


https://www.aliexpress.com/item/1005003222705548.html?spm=a2g0o.detail.1000014.28.2b51262chYCwQo&gps-id=pcDetailBottomMoreOtherSeller&scm=1007.40050.281175.0&scm_id=1007.40050.281175.0&scm-url=1007.40050.281175.0&pvid=bd05e040-eb25-48e1-8807-9a4239c2c284&_t=gps-id:pcDetailBottomMoreOtherSeller,scm-url:1007.40050.281175.0,pvid:bd05e040-eb25-48e1-8807-9a4239c2c284,tpp_buckets:668%232846%238113%231998&pdp_ext_f=%7B%22sku_id%22%3A%2212000024728727965%22%2C%22sceneId%22%3A%2230050%22%7D&pdp_npi=2%40dis%21EUR%212.15%212.02%21%21%21%21%21%4021032f9f16670563301671835e7579%2112000024728727965%21rec


OLED display (Any display will work, the code is written for I2C OLED display. The following link is just an example for something similar)

https://www.aliexpress.com/item/32896971385.html?spm=a2g0o.productlist.0.0.34bc5dd8f1ufAO&algo_pvid=cb675cfd-cac8-4054-8f78-4369c330cb3e&algo_exp_id=cb675cfd-cac8-4054-8f78-4369c330cb3e-0&pdp_ext_f=%7B%22sku_id%22%3A%2210000001875162581%22%7D&pdp_npi=2%40dis%21EUR%212.22%211.92%21%21%210.35%21%21%402101e9cf16670564347542727e02a8%2110000001875162581%21sea&curPageLogUid=m7lGcJhhVQei


A proto shield for Arduino UNO but it is not necessary.

https://www.aliexpress.com/item/32860010936.html?spm=a2g0o.order_list.0.0.63b91802eEwM7x


Easy electrical wire connector

https://www.aliexpress.com/item/4001004729267.html?spm=a2g0o.productlist.0.0.3c34fb2dqaNCzt&algo_pvid=564e11c6-2ca8-4ec3-bb78-a6964d3f782d&algo_exp_id=564e11c6-2ca8-4ec3-bb78-a6964d3f782d-7&pdp_ext_f=%7B%22sku_id%22%3A%2210000013415640174%22%7D&pdp_npi=2%40dis%21EUR%215.75%214.6%214.26%21%21%21%21%402101d8b516670575158405558ed98a%2110000013415640174%21sea&curPageLogUid=qeDSHN5bWOq7


All the links provided are just for reference. This game can be made with many different kinds of components. Please feel free to tweak and modify.

Wire the Switches and Display

LightChaserGameWiring_bb.png
MicroSwitchWiring2.jpg
MicroSwitchWiring.jpg
wiring2.jpg

Wire the micro switches or push buttons according to the wiring diagram

Micro switches:-

NO (Normally open) of the micro switches are attached to the digital pins of Arduino UNO.

(switch for green-led to pin 9, switch for yellow-led to pin 8, switch for red-led to pin 7 and switch for blue-led to pin 6)

COM of the micro switches will be connected to the ground.

LEDs:-

The positive legs of LEDs will be connected to the digital pins of the Arduino UNO. (green-led to pin 5, yellow-led to pin 4, red-led to pin 3 and blue-led to pin 2)

The negative pins of LEDs will also be connected to the ground.

OLED display:-

SDA will be connected to A4

SCL to A5

Vin to 5V

And ground to ground


I have used an Arduino Uno proto shield and wire connectors to attach the wires without soldering.

3D Printing and Laser Cutting the Case

For display installation:-

Print the attached files for installing the display to the case. I used some hot glue for joining the display holder to the holder shaft.

The display will be locked to the case with the displayButtonLocker.


For game box:-

Laser cut the game installation box. (The dxf file.) I used some wood glue to join the laser-cut box. Based on the tolerance of your laser cutter, the finger joints might come out too loose or too tight.


These are some very simple case designs. You can also make/design/print/laser cut something way cooler.

Uploading the Code

Here is a very simple code for this game. If you decide to change the wiring for the switches, LEDs or display remember to change their respective pins in the code.