Whac-a-Veggie using PIC18F4550 microcontroller
For this year’s Trunk ‘O’ Treat game I wanted to make a something fun and exciting for kids to play so I choose a Whac- a-Mole type game called Whac-a-Veggie using the Veggie Tales characters.
The Whac-a-Veggie game is played with a foam hammer in your hand and the veggie characters randomly popping-up quickly and you have to hit them on the head before they go back in there holes to score a hit, the one with the most hits wins. The PIC microcontroller controls the game action with air cylinders that push the veggies up and down by the use of an air solenoid. A timer keeps the game time to 35 seconds long and the score board counts the number of veggies you hit in the game.
Design and Operation
The Whac a Veggie game has to maintain the following list of game requirements for reliability and game operation. The game starts off by clearing the score for a new game and keeping score during the game with every hit. Start a timer for a preset game time and the timer stop the game when the time is expired. The veggies need to pop-up randomly during the game. The veggies must not rotate when hit so we have to design the hardware to keep the veggies looking forward at all times. The game must me made strong enough to take the many hard hits with the hammer. The relay, air cylinders, and solenoids need to move the veggies up and down quickly to have good game to player response for game fun.
PIC 18F4550 PIC
40 Pin PIC Development Board # DEV-00021 (Spark Fun)
ATX breaker board #BOB-09558 and ATX connector #PRT-09498 (spark fun)
Bimba Air cylinder 6” travel #BF-096-D
MettleAir pneumatic valves 5/2 way 4A210-08 12VDC (Pneumatic Products)
Brass air Silencer for exhaust air 1/8” (Pneumatic Products)
Tubes thread fittings 1/4” #S1/4-N02 (poweraire.com)
Tube male elbow fittings 1/4” #E1/4-N02 (poweraire.com)
Union straight speed controller #USC1/4 (Qty-6) (poweraire.com)
Triple branch union #TUBU1/4(Qty-2) (poweraire.com)
20MHZ crystal oscillator
Timer MX024 Digital Timer (Bakatronics)
Relay module board, eight channels, for PIC, songle electronics (eBay)
ATX breakout board and connector # BOB-09558 and PRT-09498.
Resistors: 1K, 100, 10K, 470 ohm,
Capacitors 4.7uf, .1uF
Counter Display #G16774 (goldmine electronics)
ATX power supply connector 12v, 5v power for control and lights.
Blank PCB proto boards
74LS08 AND gate
Mechanical hardware springs, 6-32 bolts, 1/4”-20 bolts, 8-32 bolts,
The cabinet base is 30”L X 30”W x 27-1/2”H by and the display board is 30”L x 5-1/2”W x 73”H. The cabinet base is constructed out of 2×4 boards at the corners and 1×2 with the main deck with 3/4” particleboard on top. The veggie bases are attached to the underside of the main deck of the cabinet by mounting bolts. The veggie basses and the main deck holes must all line up for the machine to function correctly. To maintain perfect alignment of all the holes. I temporally screwed the top and bottom veggie base plate boards to the underside of the main deck. Follow the dimensions shown on the layout drawing for drilling. Label and mark all boards for top, bottom, number, location, front, and back for maintaining perfect hole alignment for assembly. Once all the 1/4”-20 holes are drilled on the main deck you can remove the labeled wood veggie bases. Now you can drill with a hole saw the 4-1/2″ diameter pop-up holes on the top of the main deck.
Construction-Veggie Bases and Characters
The veggie base needs to be securely built to take the abuse of being hit. The veggie bases provide support for the air cylinders and veggie characters. The veggie bases consist of a top plate and bottom plate of that are held together with the 1/4”-20 all thread. The top and bottom base are constructed from 3/4” thick particleboard and are 7”w x 10”L in size. The veggie bases are mounted to the underside of the main deck of the cabinet base via the mounting bolts.
The metal support bracket that are attached to the air cylinder which provides the support for the switches, rotation guides, and springs for keeping the veggie characters looking forward. The rotation guides are located on the bottom of the veggies, by the switches, rotation rod. All this was added to prevent the veggies from rotation when hit and going up and down. An additional metal guide was attached to the front of each veggie to prevent characters from rotating. The blots (6-32) by the metal springs keep the spring form rotating.
The veggies characters are standard stuffed plush toys. I removed the most of the stuffing so I could insert the 1-1/2” square hardwood table leg. The hardwood was cut to lengths and then drilled in drill press for the plastic bushing that was glued with epoxy inside so it will slide easily on the 5/16” all thread shaft support shaft. The plastic bushing with the spring was glued with epoxy together in place.
The main deck is where the all the veggie bases mount to by the 1/4”-20 mounting bolts. When the heights are set on all the veggies you use your Dremel tool to cut the all-thread flush with the nuts. Use the Dremel tool to grind the cut metal smooth with no sharp edges. Put lock tight or nail polish to keep the nuts from loosing. Put Duct tape over the nuts so they will not cause a electrical short when the hole lights are installed.
LED Hole Lights:
Paint around the veggie holes with black paint on the inside edge and one inch around the hole. To make the LED hole lights you take a qty12- 5mm white LED’s and solder them to make two wire rails in a circle with 470 ohm resister on the anode lead of the LED. I put clear packing tape to keep the positive and negative wires from touching and shorting out. The LED hole lights are glued down to the main deck with silicone glue. The LED power supply wires are going through a hole drilled in the main deck and connected to 5VDC. The lights make it easier/better to see the veggies at night during Trunk ‘O’ Treat.
The green carpet is placed on the main deck and with a sharp knife you cut the holes out without moving the green carpet from the main deck. When ready you glue down the green carpet with silicone glue put some heave height on the carpet so it will glue down flat and smooth. The green carpet wraps around the top edges 2” down and is glued down this silicon glue and stapled to keep in position.
For more detail: Whac-a-Veggie using PIC18F4550 microcontroller
Current Project / Post can also be found using:
- mole pic 12f675