Hacked Gadgets Forum

September 14, 2011

Karate Chop – Avnet Dog Days of Summer Contest using a PIC 16F1827

at 11:12 pm. Filed under Cool Gadgets, Electronic Hacks, Game Hacks

karate-chop-avnet-dog-days-of-summer-contest-using-a-pic-16f1827_30


My daughter Alexis and I worked on this Karate Chop project as an entry into the Avnet Dog Days Summer Contest. She had the idea to make a game to enter in the entertainment section of the contest. The game she came up with was a reaction game where you have to quickly move to the correct indicated position. Four infrared detection circuits was the resulting method used to detect hand movements. She also wanted to have a memory type game similar to the classic game called Simon but using the IR beams instead of buttons.

As a hacker and maker I will be giving Avnet a good look when purchasing parts, in the What’s New section of the Avnet home page it says that they offer free 2 day FedEx shipping on orders over $10 to Canada and the USA as long as it is under 10 pounds! The offer code is AVNETEXPRESS, I don’t know if this is a permanent thing so get it while you can. Not sure about you but free shipping is always something that I am looking for when it comes to parts orders.

There are 4 games in total, one game is the Simon like pattern game where you need to match the random patterns 5 times in a row to win and one where you need to match the patterns 10 times in a row. The other 2 games are reaction games, one is normal speed and the other you need to be very quick. With the reaction games you need to break the indicated random beam locations 10 times in a row without breaking the wrong beam or breaking the correct beam too slowly.

On power up and after each game the system waits for the user to choose the game to be played.
1 (top left beam): Pattern match 5 to win.
2 (top right beam): Pattern match 10 to win.
3 (bottom left): Normal reaction game. Get 10 normal speed beam break reactions to win.
3 (bottom right): Fast reaction game. Get 10 fast speed beam break reactions to win.

The circuit is quite simple and makes for an ideal microcontroller solution. A 16F1827 is the PIC microcontroller which has been selected for this project, the 16F1827 is available from Avnet here. Four pairs of IR LED and IR Transistors are used to detect the person waving their hand in the four chop zones. The user feedback is done in a number of ways. Four colored LEDs which are being driven directly from the PIC output pins. A very bright surface mount LED panel is mounted behind the breadboard and is shining through to the Avnet name on the front, this is being switched by a transistor since it requires about 200mA of current. A piezo buzzer is being driven directly from the PIC and provides audible feedback during game play.

Power is coming from a 12 volt plug in wall transformer and there is an board mounted LM7805 which is providing the 5 volt regulation for the low voltage circuitry.

The physical game is made from MDF and plywood. The main 1/2 inch section was made from MDF, a thin 3mm plywood front was added which had the laser engraved lettering and laser cut Avnet name. The IR LED and IR transistor holders were also cut from MDF to allow the beams to be mounted securely. The initial idea was to have two more pieces of 1/2 inch MDF stacked to the rear of this. The center section would hold the IR beams and allow for wires to be run. The rear section would cover everything up nice and neat. To keep things simple an open design that showcases the spaghetti of wires on the breadboard was eventually what we went with. 🙂

Sample code will be made available once it has been cleaned up and commented a bit more.

Thanks to John Schuch from the Hacker’s Bench for the tip.



karate-chop-avnet-dog-days-of-summer-contest-using-a-pic-16f1827_32


karate-chop-avnet-dog-days-of-summer-contest-using-a-pic-16f1827_48