Raspberry Pi powered pinball machine – lights and sound

Adding light and sound effects is a huge difference when building a pinball machine. Even if I have currently only 3 triggers and two lights its quite fun to play around with the current state. I added a small effect class to the project to play any sounds one after another and to define simple light effects. This means blinking all around and because of a small random routine there is always some blink-blink action. Yeah, major improvement in terms of atmosphere.

The right flipper finger is not as strong as the left one and I’ve no idea why. Same resistors, resistance and pieces all around but noticeably weaker. Maybe something mechanically, will go ahead and ignore it for now. The next step is to define the places for more elements and the visual interface.

The source code is available if you are interested. I really enjoy Python as it makes stuff so much easier. I should add a video as just text or static images can’t express how cool this is. Stay tuned ‚till the next milestone and have fun.

Building a Raspberry Pi powered pinball machine

Beginning of the year we replaced the bed of my daughter. First we wanted to give it away but nobody picked it up. In the same time I wanted to start a Raspberry Pi 2 project. One aim was to use the GPIO capabilities. After having the bed standing around several weeks the idea grow to build my own pinball machine where all logic is done by the Raspberry Pi 2. I don’t think that such a project would be possible several years ago but today you get the parts and pieces together without leaving the house. Great times,right. Here is a picture of the foundation:

The foundation: a princess bed

With your power of imagination you see a pinball machine within this bed. No? Ok, let’s fast forward some days and have another look.

rough_draft

Yeah, there it is. A rough draft. You can see the already mounted shooter assembly and the shooter alley. The slingshot and the flipper finger placement was defined in this stage mostly intuitive. The board is a „multiplex board“ or in German: „Siebdruckplatte“. The most important attribute of these boards for this project is that they don’t bend. My board is 230mm thick if you are curious. At this time I read a lot about flipper coils, power supplies and pinball machines in general as this field was completely new for me. One of the most confusion topics was the wiring of the flipper coils and more specific: the EOS switch. You can find many information around a normally closed (NC) EOS switch or a normal open (NO) one. As I’m tend to test stuff out I ordered all pieces of a flipper assembly and started to play around with it. Here are the pieces for my testing. Test bed becomes a complete new meaning in this project.

flipper_components

As you see, the EOS switch I got is an normally open (NO) one. After more research the picture was clear. Around the early ’90 was a technology switch from NC to NO EOS switches. The good news for me was that the technology switch was because control boards were introduced. As I want the logic within the Raspberry Pi this was exactly the stuff I needed. This means the EOS switch is connected to a GPIO input pin and the logic triggers a GPIO out pin which switches a relay to control the flipper coils. So we have already three different circuits and voltages. GPIO runs on 3,3 volt, the relay needs 5 volt and the flipper coil need high voltage. High voltage in my case means 36 volts and up to 5 amps. Some words to the flipper coils: A flipper coil has two different turns which have a different purpose. The first coil (HIGH) has just a few turns and almost no resistance. This coil kicks the flipper finger and the ball hard. The other coil (HOLD) has far more turns and a higher resistance. Purpose is to hold the flipper finger up when the flipper button is pressed a longer period of time. The issue with the HIGH coil is that it is nearly a short-circuit and draws a huge amount of current. I burned a relay in the process because my relays can only handle 5 amps and I started with 0.5 seconds HIGH. At the moment the HIGH coil is only energized 0.04 seconds and works just great. This said playing with flipper coils is serious business and we need resistors for protection ;). Here a picture of my first wiring prototype and processing the input with the Raspberry Pi:

wiring_prototype

Today was a good day as I finished the basic flipper logic, have a quite amount of wiring done and can control two different lights with the Raspberry Pi. Neat!

first_milestone

Now comes the part to place more components like bumpers and targets and to develop the first counter/light logic. Whenever I hit the next milestone I will post again. The code will be published on GitHub within the next days. Have fun!

Raspberry Pi USB Device Reset

I have to reset an USB device on my Pi and found this extremely helpful little program. It is a bit ugly to find the relation between the device and the bus/device number. There are some hints on the internet like this one:

udevadm info --name=/dev/ttyUSB0 --attribute-walk

I found an easier solution and as I run a cron job to reset the device I wrote a little script that gets the bus/device number and calls usbreset:

#!/bin/bash

result=`lsusb | grep "Prolific Technology, Inc. PL2303 Serial Port"`
#echo $result
tokens=( $result )
busnum=${tokens[1]}
devnum_colon=${tokens[3]}
devnum=${devnum_colon%":"}
command="sudo /home/pi/usbreset /dev/bus/usb/$busnum/$devnum"
eval $command

Status of my smart home project

I can’t really say that I’ve finished the project but it’s pretty far. The new UI is responsive, completely developed from a mobile first approach and looks nice on a smartphone, a tablet and with a normal desktop browser.

In addition I spent a lot of time to make everything flexible. This includes not only i18n (most of the UI is available in German, English and Spanish) but also 90% of the information and options are based on config files.

The system is actually a visualization/control system for a home automation bus system. Spent quite some time on points like security, ease of use and simplicity. And a bit on modularization but I guess this area needs some more refinement.

smarthomeconnect_homecontrol

Some labels will be renamed in the near future. The section „Switches“ for example includes currently „Levels“. What it really does is to create and visualize/control any kind/amount of areas, such as floors, garden or single rooms. And then everything which is related to this area can be viewed and controlled, such as lights, sockets, thermostats, valves, … It’s technically possible to add the shutters to the „Levels“, but currently it feels more natural to put them in an own section. Time will tell if this should be changed.

The only completely custom module is the „Device“ section. In this section the system is able to show any kind of device that is currently „on“  – means, the system can ping it. This section includes smartphones, tablets, notebooks, PCs, TVs and stuff like a Wii (not my XBox as the Xbox prevents a ping). This means that the system is somehow context aware. I have some hopes that the system can become really smart. Because it is most likely that somebody is at home if the TV is on. Or a laptop. Or a smartphone. Let’s see how this can be used. Best is that this information are available nearly for free and without beacons or any kind of unnatural manual registration.

So what’s next? I still want a always on speech control. And more sensors. But I think first comes some fine tuning and enhancements all around 🙂

Holiday smart home upgrade

My holiday project is an upgrade of my smart home project. New hardware from Raspberry Pi B to Raspberry Pi B+. In addition the software and the services will become a complete overhaul.

Raspberry Pi B+

My Raspberry Pi B with my DIY home control worked nearly one year 24/7 and gave us a tremendous user experience and fun from any device even remotely. Features so far:

  • Lightning control
  • Shutter control
  • Access to security cams
  • Environment information
  • Voice control

This said, the new system will be customizable and administrable. The UI gets a responsive design for better tablet support. On top of this I have some nifty ideas for a even better user experience. Will post results and screenshots when I’m satisfied.

Happy holidays everybody!

Raspberry Pi and the Wifi power management

One real annoying issue working with a Raspberry Pi over Wifi is that the Wifi dongle goes into power saving mode. Thus the ssh connections lags or a connect isn’t even possible. But we can solve that. First we have to check that you have a specific USB dongle by executing the following command:

dmesg | grep rtl8192cu

If you see something like „usbcore: registered new interface driver rtl8192cu“ as result, we can solve the issue. Edit the following file:

sudo nano /etc/modprobe.d/8192cu.conf

and add the following:

# Disable power saving
options 8192cu rtw_power_mgnt=0

Now reboot and enjoy your stable Wifi connection without interrupts.

Solar charger test phase

Since quite a few weeks I only charge my smartphone powered by solar power. I’m a bit skeptical that it works for the 51° latitude in the middle of Europe across autumn and winter. Until now it all worked fine even if the charge process took a while.

solar_charger

I’m using a power pack that can power and simultaneously charge. To start the charging process you have to push a button. As soon as the device is fully charged the power pack shuts down automatically. My real goal is to power a Raspberry Pi independent from the power grid outside 24/7/365. At the current stage I just analyze the output from the solar panel under different conditions. The test phase will continue over the winter month until the second quarter of 2015. With the current knowledge, I can’t use any of the components as the solar panel is not powerful enough and the power pack requires manual interaction. The good news is there are there are plenty of solutions available, like the one from Adafruit.

Banana Pi and Open-Xchange

Here it is. A Banana Pi running an Open-Xchange AppSuite on a 8 GB SD card.

Banana pi

As the Raspberry Pi does not support ARMv7 I had to use the Banana Pi instead. Not too bad as this device is more powerful and better to run a Java backend, a MySQL database and the Apache web server. For mail I’m using an existing mail account in the cloud.

Installation was pretty much straight forward using the existing Open-Xchange quickinstall script. The only thing to mention is that the script is available with git and not with svn:

git clone https://git.open-xchange.com/git/wd/testing/quickinstall -b master

You have to make a few modifications as officially only 32-bit systems are supported. This means the OS architecture check and all office related repositories must be commented out.

Android offline speech recognition

Released today the OXAndroidDemo app on GitHub. As this app uses Android speech recognition features, it’s worth to mention that with Android >= 4.3 the speech recognition no longer requires the Google online service. Simple install the language files.

Goto „Settings“ → „My device“ → „Language & input“

Make sure to select „Google“ and click the gear. Next step is to select „Offline Speech Recognition“ and download your favorite languages.

Enjoy the faster and more anonymous speech recognition.

Smart home and voice recognition

When I was younger I really liked the computer of the Enterprise in Star Trek TNG. Always on, always listening. „He“ understands all languages, accents and background sound is easily filtered out. Even with red alert in the background and explosions all around. Oh, and I still like it. Today I have my own „smart home“ and can control stuff with my voice with an application written for Android. Easy as eating cake, right. Have done this in a few ours in my spare time. But wait. There is something missing. It’s not always on. I can’t just run around and say „Computer, locate [PUT ANY NAME HERE]“ or „Computer, it’s to hot. Please reduce temperature by 2°“. You ask why?

Current issues:

– Maturity of voice recognition (I’m talking Linux here, more concrete Raspberry Pi!) and the overall approach (I don’t want to send every word to a Google service!)
– The environment itself. On the Enterprise you could say something in the endmost edge of any floor. This does currently not work for me at all 🙂
– Security. Don’t want to allow any stranger to control stuff just by saying something at the front door

My goal is to solve the issues as far as I can and build something which is not only cool but also useful. I’ll keep posting my results and approaches here.