Skip navigation
2016

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

Introduction

This blog post is about powering a new security camera (HAL-CAM 9001) using network cables. These could be cables already installed in an office or home environment, saving costs, or they could be new cables installed indoors or outdoors (using weather resistant cable).

 

This sub-project is part of the HAL-CAM 9001 project but it is generic enough to suit other scenarios too. It could be used to power a Raspberry Pi remotely for other tasks. Other single board computers (SBCs) can benefit from this project too.

 

HAL-CAM 9001 doesn’t have a lot of free space inside so this project was made to be ultra-compact; 2cm high and 6x5cm footprint. This project supplies 5V at up to 2.5A.

The schematic and PCB files are attached, ready to be sent to a board manufacturer.

poe-annotated.jpg

 

What is PoE?

Power over Ethernet is one of these technologies that when you use it, you find you really need it. Over the years it has saved costs, copper, and provided a reliable and safe solution to providing energy to many diverse devices over Ethernet based local area network (LAN) connections.

 

At its debut, it was said that standards-compliant PoE was effectively one of the few worldwide standards for power so one could take a device and be assured it would work anywhere in the world, in contrast with the mains supply voltages and plug shapes which vary from country to country. And it doesn’t require an electrician to install!

 

Part of the safety of PoE comes from the ability to automatically and electronically control the delivery of power. By default, the network connection has no substantial power capability enabled and is finger-safe. When the connected device requests power the far end will switch on the supply. Note: the equipment that can supply power is known as the Power Sourcing Equipment (PSE), and the device to be powered is the Powered Device (PD).

 

With the earlier standard (IEEE 802.3af) the request was as simple as having a 25k resistor across a couple of pins. If the resistor was present, then the far end would turn on the power. This solution provided about 13W of power to the PD. The later standard IEEE 802.3at nearly doubled this capability, to just over 25W of power. This later standard had a more complicated method of enabling power; the PD would provide a varying load over time in a special combination that would allow the PSE to detect that the PD was an 802.3at capable device and then supply up to one of four particular levels of power. Once this was achieved it was possible to signal information in Ethernet packets to further refine the power requirements.

 

Today Universal PoE (UPOE) has more than doubled the power capability to 60W – equivalent to an incandescent light bulb!

cam-project-overview.png

 

This project provides IEEE 802.3af and 802.3at standards based power capability. The output is at 5V, capable of up to 2.5A (i.e. up to 12.5W). This level of output is ideal for remotely powering HAL-CAM 9001, or other Raspberry Pi projects, BeagleBone Black (BBB) or other single board computers (SBCs).

poe-bbb-annotated.jpg

 

Note that the powered device doesn’t actually need to have an Ethernet connection at all. It is possible to use PoE to charge your mobile phone.

poe-phone-charge.jpg

 

How do I get PoE?

Assuming standards-based PoE is required then the best way is to pick up a switch with 802.3af or 802.3at capability. In the UK for consumer use the 802.3af compliant 8-port TP-LINK TL-SG1008P costs about £50 from Amazon and provides 4 devices with up to 13W of power each, simultaneously (I have not tried this switch so it isn’t a recommendation, just a pointer to what is out there).

 

There are also so-called ‘PoE Injector’ adapters, also misleadingly called 2-port PoE switches sometimes. These are not great because often they are not IEEE 802.3af or 802.3at compliant and may supply power all the time; they are therefore not very green because their power cannot be shut down electronically. A true standards compliant PoE capable switch is the far better choice and doesn’t cost much as mentioned earlier, considering it can power up to four devices.

 

At the device end, it needs to support the same standard. If the device doesn’t support PoE then an off-the-shelf external PoE adapter can be used; it is standards compliant and taps off the supply to be used to power the device.

 

Building It

poe-maxrefdes.jpg

The schematic is shown below; it is really simple because most of the functionality is contained in Maxim’s MAXREFDES98MAXREFDES98 board which contains a DC-DC converter and the circuitry to handle the standards negotiation. The rest of the board mainly consists of the Ethernet transformers and connectors. Note that it would be wise to add some suppression circuitry as detailed in the original HAL-CAM blog page; I forgot to add it to this revision 1 PCB but the same method (TVS diodes) can be used as in the original blog post. At some stage I will update this blog post with revision 2 files which will correct this omission.

poe-schematic.png

 

To construct this project, solder up the smallest parts first (the resistors and capacitors), ending with the largest parts. The fuse is optionally available in a socket which will fit the board but I chose to save some cost and directly solder the fuse.

 

Network cables are available in short lengths but I wanted an extremely short length (a few cm) for fitting inside HAL-CAM 9001 so I used an RJ45 tool to do that. The back of the PCB has a reference indicating which color wire goes where.

poe-complete-underside.jpg

 

Testing It

There is not much chance of error during assembly since there are so few parts in this project (the part values are in the schematic but a list of components will be published in the next few days). I connected this project via the longest length of network cable that I had (5m long) to a switch, enabled PoE on it (some switches require configuration for this) and then used a multimeter to confirm 5V was present on the output supply connector. The on-board LED was lit too, confirming that the board was receiving power. The multimeter confirmed the correct output so I proceeded to plug it into the Pi and verified that the Ethernet link came up and I had network connectivity. I can now issue a shutdown command to the Pi remotely using SSH, and then configure the switch to disable power. Whenever I want to turn the Pi on, I can configure the switch to turn on the PoE capability.

 

There are additional tests that should be done (such as confirm the voltage output under changing loads, verify the ‘eye diagram’ for the signals over the network cable, check for RF interference and checking throughput to see if there are any packet errors occurring). These will be done later at some stage; for now the board is functioning well enough to continue HAL-CAM 9001 development.

 

Summary

PoE is easy to use and it can be useful to be able to retro-fit non-PoE devices with the capability. The Maxim module makes this really easy. The PCB files are attached ready to send to a manufacturer. Note that the PCB also has some additional “features” (see photo below) which can be hack-sawed off and put aside for now (they are for unrelated mini-projects which will be documented at some later stage; feel free to guess what they are! It is not too difficult).

poe-extras.jpg

 

See also:

 

HAL-CAM 9001 – Building a New Security Camera

A recent project was delivered to me with a problem with its LCD screen. In the process of testing it I wanted to generate a composite video signal. After looking at some ideas involving Arduino and resistor dividers I came across some examples of raspberry Pi testcards, specifically RPI - ATV

 

I had an original Pi model B which has an RCA socket with composite out so that was ideal for my task.

sony-rasp-pi.jpg

To get the testcard to work I downloaded a suitable picture and added my text to it. I then installed the python script into the /home/pi/atv folder and added my image and a dummy sound file into the /home/pi/atv/images and /home/pi/atv/sounds folders.

I tweaked the python script not to use the internal generator and also to load the first image.

 

#don't always start with internal picture
internalPicture = false
loadimage("1")

 

To get the generator to start up automatically, I had tried using rc.local but that did not seem to work. I had a bit of help from fvan who suggested cron would work.

 

To add the cron job I ran the following which prompted me to pick and editor to edit the file.

 

sudo crontab -e

 

I added in my task to run on reboot.

 

@reboot python /home/pi/atv/atv3.py

 

For testing I plugged in a phono cable from the pi to my TV and booted it up using a USB battery box.

TestingTheTestCard.jpg

See Part 1 of the project here.

See Part 2 of the project here.

 

I received the 3D printed parts. I used good'old Shapeways to handle that!.

 

However, I had to drill and tap the mount holes for the Pi. It all fit together perfectly.

 

pi top orange.jpg

 

In the effort of portability, I am using one of the Pi TFT touchscreens

 

I used 2.5mm caphead bolts for mounting all parts. They fit perfectly into the mount positions.

 

Next update should be the final product!

 

Cabe

Filter Blog

By date: By tag: