Pachinko Bubble Gumball Machine

24

So where did this idea come from?  Well my wife loved playing pachinko when she was a child at her grandparent’s house.  So when we found a old pachinko machine at a garage sale, it was bought.  Well it sat for a few years and Christmas was coming; I decided it was time to do something with it besides tripping over it. 

So the plan was always to build a case around it, but doing just that seemed kind of  lame.  I then started to think of other things she liked and bubble gumball machines came to mind, now to build it.  Of course, I try to use some kind of CPU in my projects and a computer was overkill (ok so was a microprocessor) so I went with an Arduino type board.  You have to love these little devices, they are cheap and have a great deal of possible uses.  Plus there is a great community of developers for help or code snippets. 

The first step was to build the case and not tip my wife off, so I told her I was building something for work, that worked as she was surprised at Christmas(of course I kept the pachinko out of the case until Christmas).  The next step was to figure out what type of wood to use.  I went with Oak plywood, it would be easy to work with and give me the look I wanted once it was stained and finished.  I purchased a 4 x 8 sheet from Home Depot and drew a pattern on it with a pencil in the shapes I wanted.  I did not want it perfectly straight and made it with a little angle on the sides.   I also knew I would need a compartment where both the gumball mechanics and any electronics would need to be placed.  In addition I wanted it to be locked and covered.  So all of these parts would also need to be also cut from the Oak plywood.  In building the compartment, it also would serve as a shelf for the pachinko machine to rest on so the weight of it would not rest solely on any screws from the sides or top.  After cutting, gluing and measuring for the proper spacing for the pachinko machine I had a case I was starting to like.

1 35

 

With the case starting to come together I turned my attention to the mechanics of the bubble gum machine.  It needed to first work, second be refillable fairly easily and finally prevent the candy from just falling on the floor.  To meet all of these requirements, PVC pipe came to mind.  The reason is you can get it in different sizes, it is easy to put together, you can clean it and it is pretty cheap.  I decided to go with the four inch pipe.  This would hold a great deal of candy between refills, there were also plenty of reducers so I could “funnel” the candy down the chute. First I made a little dock to hold the reservoir straight up, next I cut a circle of wood and fashioned a thin piece of metal to act as the dispenser.  The challenge here was to make the slot in the side to line up with the board.  The best process was cut the slot in the pipe, put the circle board in the pipe, slide in the metal plate and then screw the wood circle in place from outside the pipe.  I cut a one inch hole in both the wood circle and the metal plate this allowed for everything that I tested to work great. (Hot Tamales candy, Skittles, Gumballs).  Screws on both sides of the metal plate acted as guides when the plate moved back and forth.

131621

Now with the candy ready to go we needed a way to dispense the “reward”.  For this I used a cheap hobby servo.  The concept, when the switch is triggered, the servo will move to the left for two seconds (open, holes in wood and metal plate lined up) and then move back to the right(closed, holes in wood and metal plate do not line up).  I happened to have a BoArduino from another project I was doing so I used it, however any Arduino would work.  If you can not soldier then do not use the BoArduino as it is a kit you have to put together.   The code was very simple since all I was doing was looking for a “contact” from a switch that would trigger the servo to move back and forth.  To power everything, my first thought was I had a 6 volt gel battery around and was going to use that, however after a month it would die and not run anything.  So I modified the power setup and just used a 6 volt wall wart and have not had a single problem since then except reloading the balls for the game and refilling the payout…

Probably the single biggest challenge was the “switch”.  My first thought was to use a simple contact switch.  I needed to fabricate a mount for the switch, however what I found out was the mechanics of the levers were too good.  Anything, no matter how light of a touch that interfered with the levers seemed to jam them and either always left it on or never paid out.

99b9a

After much trial and error, I remembered I had bought some conductive ribbon (for some future project Smile ) .  With this I connected one wire to the pachinko machine with a screw and gave it a little loop.  The other wire to the switch, I wrapped it around a length of the conductive ribbon and looped the other end of the ribbon  to one of the levers that moved on a pay out.  When the pay out happened, the ribbon touched the other looped wire and we have “contact”.  The arduino was happy and so was I.  I did however apply a little bit of electric tape looped around the other end of the lever to counter balance the touching of the ribbon to the wire this worked perfectly. 

On the pachinko machine itself.  I did have to take it completely apart and clean out the wasp nest, and other gunk that was gumming up the tracks that the balls followed.  The Glass had been replaced with Plexiglas and that needed to be replaced as I was trying to keep the Pachinko experience as close to original as I could and the balls hitting glass sound much better than Plexiglas.  The brass nails were tarnished, but luckily or not the Marine Corps taught us over and over how to use this stuff called “brasso” it is a pain, but it does work.   In fact it worked like a champ and really cleaned up the brass nails that the balls would bounce on.  I also had to change the locks as the keys for the pachinko machine’s lock were lost.  Not a big deal as I wanted matching keys for locking the dispenser and the pachinko machine, these were easily found on the internet.

A short video of photos taken while making the project

 

And there you have it a Pachinko Gum Ball dispenser.  I had to cheat a great deal to test it; I found out I evidently am not a very good Pachinko player as I lost way more than I would ever win.  Christmas came and my wife loved it, we have now gone through a huge bag of Skittles, Hot Tamales and a few bags of Gum Balls.  So I would have to consider it a successful project…

Posted in DIY | Tagged , , | 4 Comments

TN Games Vest Get Shot in C#

 thumb_3rd_space_vest

I attended the Game Developers Conference (GDC)back in 2008 and saw this vest and fell in love with it.   It has the ability to let you “Feel” when you get shot or fragged in a game.  I quickly noticed how you change the way you play when you wear it because you know the “pain” is coming when you get shot.  Ok not really pain, but an air pocket inflates where you are shot.   I was even more lucky when my wife decided to get me one for my birthday that year.  I played it with many different game but of course in the Waterhobo fashion I wanted more.   

I had hoped to have the vest connected and usable with the WiFi Warthogs at the PDC, but it was not meant to be.  There is a SDK, but it is a C++ unmanaged code.  On top of that it did not have any dlls but only the header and library file.  Of course I am not a C++ person, my C skills are dated and I could not really get any help from TN Games or for that matter the internet.  So it meant C++ here I come, so if you know C++ and see something that could be better please comment on a better way.  I can say that what I put together did work. 

First I needed to turn the C++ unmanaged code into a dll that could be imported into a C# managed dll.  I happened to find a code snipped that kind of met my needs, not perfect, but  it did put me on the right path.   Below is the code that allowed me to make the unmanaged dll that I would need in order make the managed one.  I got it to work fine, but I am not the most qualified to explain it.  The parts to note are the linking of the tngaming.lib and the header file that explain the sdk from TN Games.

   1: // vest.cpp : Defines the exported functions for the DLL application.

   2: //

   3:  

   4: #include "stdafx.h"

   5: #include "vest.h"

   6:  

   7: #include "tngaming.h"

   8:  

   9: /* --- link library */

  10: #pragma comment(lib,"tngaming.lib")

  11:  

  12:  

  13: // This is an example of an exported variable

  14: VEST_API int nvest=0;

  15:  

  16:  

  17: // This is an example of an exported function.

  18: VEST_API int setupvest(void)

  19: {

  20:     

  21:     return SetUpJacket();

  22: }

  23:  

  24: VEST_API void shutdownvest(void)

  25: {

  26:      TearDownJacket();

  27:     

  28: }

  29:  

  30: VEST_API int vestseteffect(int nEffect)

  31: {

  32:     

  33:     return SetEffect(nEffect);

  34: }

  35:  

  36: VEST_API int vestseteffect2(int speed, int actuator)

  37: {

  38:     

  39:     return SetEffect2(speed,actuator);

  40: }

  41:  

  42: VEST_API int vestgeterrorcode(void)

  43: {

  44:     

  45:     return GetErrorCode();

  46: }

  47: VEST_API int vestgeterrortext(void)

  48: {

  49:     if (SetUpJacket()  != GLIB_OK)

  50:     {

  51:         //printf("Error: %s", GetErrorText());

  52:         return 2;

  53:     }

  54:     return 42;

  55: }

  56:  

  57: VEST_API void vestflushbuffer(int actuator)

  58: {

  59:     FlushBuffer(actuator);

  60:     

  61: }

  62:  

  63: // This is the constructor of a class that has been exported.

  64: // see vest.h for the class definition

  65: Cvest::Cvest()

  66: {

  67:     return;

  68: }

 

Now with the unmanaged code library built it is a simple matter of importing it into a C# wrapper.  Then another simple process of  creating a test harness to call our new dll and test all of the functionality.

A few notes on the dll building process, I put everything together as best as I could based my limited C++ knowledge and the included SDK documentation.  The test harness works fine, but a few things I did notice.  It is possible I did something wrong with the C++; so if you know C++ please let me know, but it seems as if the TN Games sdk does not match the documentation.  The return codes did not come back as stated, enum did not work as stated, you do not get error statuses if you do not set the vest up first as stated in the documentation.  Again I do not know if it is me, the documentation, the TN Games lib file or a combination of all that I did not get everything to match the documentation; so this is my only disclaimer.  So on with the show…

In the code below I am importing the unmanaged code into my C# dll, I am also defining all the functions that will be called.  They are a match to the C++ dll functions, so this is just a pass through from C# to C++.

   1: public class TNGamesVest

   2: {

   3:  

   4:     //need to import all of the functions from TNGames.lib vest.dll is the C++ wrapper around the TNGames lib

   5:     [DllImport("vest.dll", EntryPoint = "?setupvest@@YAHXZ")] public static extern int setupvest();

   6:     [DllImport("vest.dll", EntryPoint="?shutdownvest@@YAXXZ")] static extern  void shutdownvest();

   7:     [DllImport("vest.dll", EntryPoint="?vestseteffect@@YAHH@Z")] static extern int vestseteffect(int nEffect);

   8:     [DllImport("vest.dll",EntryPoint="?vestseteffect2@@YAHHH@Z")] static extern int vestseteffect2(int speed, int actuator);

   9:     [DllImport("vest.dll",EntryPoint="?vestgeterrorcode@@YAHXZ")] static extern int vestgeterrorcode();

  10:     [DllImport("vest.dll",EntryPoint="?vestgeterrortext@@YAHXZ")] static extern int vestgeterrortext();

  11:     [DllImport("vest.dll",EntryPoint="?vestflushbuffer@@YAXH@Z")] static extern void vestflushbuffer(int actuator);

  12:  

  13:  

  14:     public int SetupVest()

  15:     {

  16:         return setupvest();

  17:     }

  18:  

  19:     public void ShutDownVest()

  20:     {

  21:         shutdownvest();

  22:     }

  23:  

  24:     public int SetEffect(int myEffect)

  25:     {

  26:         return vestseteffect(myEffect);

  27:     }

  28:  

  29:     public int SetEffect2(int speed, int actuator)

  30:     {

  31:         return vestseteffect2(speed, actuator);

  32:     }

  33:  

  34:     public void FlushVestBuffer(int actuator)

  35:     {

  36:         vestflushbuffer(actuator);

  37:     }

  38: }

  39: }

 

Now that we have the dll made it is a simple process of importing the dll into our project and building a test harness.

This is a screen shot of our test harness.

testharness

At this point you can test the functionality of the vest.  you will first plug the vest  into the USB port  and have everything setup like you would if you were playing a game.  You are ready to now just step through each of the steps.  First  initialize the vest, you do this via the setup vest button.  Next if you read the documentation from TN Games that comes with their SDK you will be able to select the different effects to see exactly what each means (machine gun, grenade, etc.).  You will also be able to test each of the bellows to simulate being shot in different areas.

In summary, I really wished I was able to have gotten this ready for the PDC, I think it would have added a cool twist to the Wi-Fi Warthogs.  So what is next?  ARE YOU KIDDING… now that we have a C# dll the sky is the limited.  How about getting shot from a web page?  Or How about  every time you get an email you also get a grenade effect.  Maybe put a service in the cloud that allows me to play a SilverLight MMO game and when someone shoots me or hits me I know it.  Of course XNA with XBox live would be fun, but TN Games appears to have beat me there, oh well there is SilverLight/XNA for Windows Phone 7, Bluetooth to pc and a service to the vest, yes that might work…

This is the source code that I  made.  I do ask if you decide to use this that you at least give me credit for figuring out this much.  TN Games now if you are looking for a tester or someone to maybe take this in another direction drop me a line at tbh726@gmail.com i would love to play some more…

Posted in DIY | Tagged , | Leave a comment