RaspberryPySlotsBanner.jpg

 

Enter e14's 2016 Costume Contest Here!

 

There are only a few holidays here in the US that I actually participate in, with Halloween being my favorite by far. Many of you reading this might remember my two projects from last year, Foginator2000 and Trick or Trivia. They were both fun projects to build, and I learned a lot over the two months it took to build them. This year Element14 has asked me to build another project for Halloween, specifically a costume. Over the past week I have spent a lot of time trying to come up with concepts that I can easily complete in three weeks, and I will be the first to admit that this was actually a lot tougher than it sounds, but I finally settled on something that I think will be pretty fun.

 

When Element14 first contacted me about doing this project, I actually tried to talk them into letting me build another Halloween prop this year instead of a costume. Building Halloween props is well within my comfort zone, and I even once co-owned a business that did just that, but this year they were firmly set on the idea of a costume based around the Raspberry Pi 3. I wanted to build this crazy spooky demon costume, but there was just not enough time or budget to pull it off, so I settled on something more comical: a walking, talking, digital slot machine.

 

I know what you are thinking, “This guy has to be the lamest costume builder ever,” and I would tend to agree with you, but before you break out the pitchforks and torches take a moment to hear me out. The purpose of this project is to showcase the Raspberry Pi 3, and its capabilities even in a mobile environment. I chose this idea because it will allow me to not only show off the Pi 3, but would give me the chance to use a Raspberry Pi 7-inch Touch Screen in another project. Finally, the major deciding factor was the fact that I basically have two weeks to get everything finished as shipping the hardware to me would take a full week. Additionally, I was able to find an open source slot machine game that was written in Python that would be easy to modify.

 

IMG_9123.jpg

 

Before we dive deeper into the concept of the project, let's take a few minutes and talk about the hardware that I have selected for this project. Below you will find the full bill of materials broken down into two sections. The first section is all of the hardware that can be purchased from Element14 / Newark.com, and the second list is all of the materials that I had to purchase separately. I will provide links to any items on the second list that can be purchased from Amazon.

 

Newark Part No.

Notes

Qty

Description

77Y652077Y6520

Raspberry Pi 3

1

RASPBERRY PI 3

77Y653477Y6534

SD Card

1

16GB NOOBS MICRO SD CARD

49Y171249Y1712

Touch Screen

1

Raspberry Pi 7-Inch Touchscreen

26Y844626Y8446

NeoPixel Strip

1

NeoPixel Strip 60 LED/meter 4 Meters

13T927513T9275

Arduino Nano

1

Arduino Nano 3.0

66W7510

Arcade Button

1

ADAFRUIT  Massive Arcade Button with LED - 100mm Blue

27T269227T2692

Tilt Switch

1

COMUS  CW1300-1  TILT/MOTION SENSOR

 

 

Amazon Product No.

Notes

Qty

Description

B00MBAZJUI

Bluetooth Speaker

1

Neon BTS220-37 Ultra-Portable Bluetooth Wireless Speaker

B007ZFXDLG

Felt Topper Hat
1Black Felt Top Magician Costume Hat

B00JP8MZGK

Power Bank
1KMASHI 15000mAh External Battery Power Bank

B015RLUAV0

Hookup Wire

1TronicsPros 4 Pin 4 Color 20m RGB Extension Cable

B005GYHQL6

Fabric

1Silver Metallic Stretch Spandex Fabric
B01KZFLSBOUSB Cables16-foot Amoner Micro USB Cable 3-pack

 

 

The Raspberry Pi 3 will serve as the brains of the costume, and will control all of the slot machine functions, the sound, and some of the lighting effects. However, the majority of the lighting effects will be controlled by an Arduino Nano. I made the decision to control the majority of the lighting effects with an Arduino simply because it is actually rather difficult (in my experience) to control more than one string of neopixel LEDs at a time with the Raspberry Pi, and as I wanted both an always on lighting scheme and an event triggered on a win in the slots, this was the best decision.

 

pyslotneo.jpg

 

Audio will be handled via a cheap Bluetooth speaker that I will cannibalize to make it fit somewhere on the costume. I am not yet sure if the speaker will be visible or hidden just yet. The speaker I picked up to cannibalize also features an auxiliary port, so if for some reason I can not get the Bluetooth connection to work, I can just plug in a 3.5mm audio cable and the audio will still be available.

 

IMG_9125.jpg

 

My left arm will serve as the pull handle that triggers the slot machine’s “spin,” and will utilize either a simple tilt switch, or a more complex accelerometer. I am not sure which I will use just yet, as it all comes down to reliability and repeatability. To sort of dress the costume up a little more, I have selected a shiny silver fabric to sew into a sleeve, which will conceal my arm, hand, and the tilt switch. (You can see a close up of this fabric below.) When someone wants to spin the slots, they simply have to pull my arm down. I am still toying with the idea on how to dress this up a little more to make it look more like a traditional pull lever, but I am not sure yet. Does anyone have any thoughts? The tophat is a sort of bonus project, that I will build if time allows. I plan on brightening it up with several strips of NeoPixels.

 

IMG_9126.jpg

 

As you can see, the fabric is about as shiny as fabric can get, and to top it off, it’s quite stretchy. I actually searched two hobby stores before visiting a fabric store where I found this. The most shocking thing I learned in that adventure is that fabric, especially specialty fabric, can be quite expensive. I got lucky and found this shiny fabric on sale for $15.00/yard, down from its regular price of $25/yard, and I had a 20% off my purchase coupon. So I think I paid about $12 for the yard I needed. I purchased this specific fabric at Joann Fabrics and it's SKU is 400106656512 if you would like to use the same fabric. Alternatively, I have linked to a similar spandex fabric in the Amazon list above, and it is actually a bit cheaper per yard.

 

IMG_9124.jpg

 

The rest of the costume will be built out of foam core project board that I picked up at the local dollar store for $0.89 per sheet. I am not sure how many sheets it will take right now, but I have 15 on hand. The plan is to build something similar to the mockup you see above this paragraph. I will be recessing the LED strips into the foam core’s first layer, then covering everything with custom designed artwork that I will have printed at staples. My thoughts behind this is that the light will diffuse into the paper some, and will make the bright 5050 LED modules less harsh. As of right now, I am still deciding on the best way to mount this facade to my body, but a friend who cosplays semi-professionally said that a shoulder rig made from PVC pipe will be my best bet, so if I go that route, I will update the BOM to reflect the additional parts.

 

pIsCREEN.jpg

 

The screen where all the action takes place will be an official Raspberry Pi 7-inch Touch Screen, which will be flush mounted with the surface of the foam board facade. I am not sure if I will have time to build any touch screen functionality into the slots program, but it may still be possible if time allows. Since the Pi Touch Screens feature a very thin bezel, and are quite wide, this makes mounting the screen with some 3M VHB tape very quick and easy. I wish the foundation would release a 10-inch or 12-inch screen, as a larger screen would have been ideal for this project, but I think the 7-inch will work out ok. I do have plans to continue this project in the coming months, but in a different direction, so I may pick up a cheap 19" HDMI TV or Monitor for that. The one thing I do like about this screen is that it is so easy to work with. I have used a few on several different projects both personally, and in my past haunted attraction automation business, and for projects like this, it is perfect as far as ease of use goes.

 

pyslots_Bfruit.jpg

 

 

As far as the software side of things goes, I will be building the slot-machine almost completely in Python. As I mentioned earlier, I am under a time crunch to get this completed before Halloween, and I knew that there would not be enough time to develop a slot-machine program from scratch, and luckily I found an open source slots program written in Python on Source Forge called BFruit. While it is not the most glamorous, or efficient slot-machine program out there, it will be very easy for me to modify to add lighting even triggers, and such. The best part is that since it is licensed under the GPL V2 licence, I am able to modify the code, and upload my own version as long as I credit the original creator. This means that once finished, you, the community, will be able to continue where I left off, and code in new and exciting features. Since the program is written in Python and not a compiled language, I am able to easily swap out the images too. I already have most of the new images figured out, but I wanted to let the community pick the last image. So leave me a comment below, and I will pick a few of the best, and then create a poll that you can vote on and place it in the next update.

 

 

PYSLOT_POWERBANK.jpg

 

Now you have to be asking yourself how in the world am I going to be able to power a Raspberry Pi 3, 7-inch Touchscreen, and all of these power hungry Neopixels? The answer is actually quite simple. I will be using a high-capacity USB power banks that is capable of 2A of output at 5V each on at least one port. I will also create a USB pigtail to add power to the Neopixels, but if this single power bank is not enough, I have two more on hand to help out. I plan on wearing a backpack when taking the costume to a party, and that is why I ordered the 6-foot long USB cables. I should have about two feet to spare, giving me enough room to twist some without the cable getting tight. All in all, by my estimate, the project will consume about three amps, which is what this power bank is capable of producing. If this proved to be true, this single power bank should have enough power for two or more hours of use. This is plenty of time to show the costume off at a Halloween Party, or for trick or treating. If that turns out not to be the case, I have two more that I can utilize.

 

Thanks for taking the time to read this post. I will have two more posts with updates on this project, with things wrapping up before Halloween. At the time of this article's publication I am still awaiting on several components to the project, and I expect some to not arrive until late next week, so I would estimate my next update to go live sometime around the 14th of October, with the final update coming a week later. So stay tuned for the hardware portion of the build next! Until then, I will continue to post my weekly Design Challenge summaries (just project summaries until the next Design Challenge kicks off). As always, remember to Hack The World, and Make Awesome!

 

Check Out The Full Project!

  1. Raspberry PySlots: The Costume - Introduction
  2. Raspberry PySlots: The Costume - Hardware, Software, and Pretty Lights!
  3. Raspberry PySlots: The Costume - The Slot Machine, NeoPixels, Pull Arm, And Finishing Things Up