www.NewsDownload.co.uk Page 16

Raspberry Pi Portable Hand Held MAME

2013-01-20 17:48 By Jason Birch

Using a Raspberry Pi to play MAME games powered from batteries with a 3.5" LCD display. The controller is encapsulated with the Raspberry Pi computer in a small hand held case. The display and batteries are encapsulated in a small hand held case. The two cases can be plugged together or unplugged freely.

The video here demonstrates the project which this article describes how to build.

The article breaks the project down into several stages:

  • Hardware
  • Project Costing

This project is relatively simple, but can be taken in a variety of directions depending on the builders requirements. The project builds on several previous projects and there are projects currently queued waiting to extend this project in new directions.

Voltage Regulator Circuit
The system runs off of a battery pack of 6 x AA Ni-MH rechargeable batteries @ 2400mAh. This will produce 6 x 1V2 = 7V2. This is enough to power the LCD display and audio amplifier directly.

The Raspberry Pi however must have a regulated 5V supply, this is critical. So a 5V regulator is used to provide a regulated 5V +/- 4% from the 7V2 supplied by the batteries.

The regulator circuit is one of the simplest electronic circuits. It uses only a 5V regulator IC and two capacitors to prevent electrical oscillation occurring in the circuit.

5V is passed back to the Raspberry Pi via a plug and socket placed in the case next to the audio plug and socket. The power is then applied to the 5V and 0V pins on the Raspberry Pi GPIO header.
A very basic audio amplifier circuit has been added to boost the audio signal up to the voltage supplied by the battery pack. This amplifier is as simple as it gets and won't provide very good quality sound. But for an on-board amplifier it should be good enough.

There is very little space in the case, so the left and right audio channels have been combined into a mono audio channel. This means only a single audio speaker is required in the case.

A piezoelectric device has been used as a speaker as these are very compact. However piezoelectric transducers are only really good for producing tones which resonate within the device itself. Reproduction of sound is not very good and the 7V2 from the battery pack isn't really good enough to drive the piezoelectric device. Some time will be spent later on to find a decent audio device for the system.
Audio Amplifier Circuit
LCD Interface Circuit
The LCD module is easy to wire up. The module was sourced from a car reversing camera display. It should be powered from 12V, but it will operate on a voltage as low as 5V. This is not the case for all LCD displays sourced in this way, some will only operate from 12V.

In this case I wire the 12V wire directly to the 7V2 on the battery pack. 0V to 0V on the battery pack. There are two AV inputs on the LCD, I wire AV1 directly to the Raspberry Pi RCA connector. It is important to remember the 0V line is common to all parts of the system.
The Raspberry Pi enclosure and software is taken from a previous project, full details of the project and how it is built can be found by clicking this link:

Raspberry Pi MAME GPIO Joystick
The components are placed on a board which just sits in the case. There is very little room in the case as the display has a PCB behind it which also has to fit. So care has to be taken when placing tall components to ensure they do not interfere with the taller components on the LCD board.

Luckily there are not many components and they can generally be fitted close to the edge of the board.

The battery pack is connected to the strip board using a connector which needs to be cut short in order to fit. Disconnecting the battery pack allows the strip board to be removed from the case.
The battery pack connector has a hole blocked and pin removed to enforce polarizing and prevent the connector being connected the wrong way around.

At the front edge of the strip board, a smaller piece of strip board is placed at a right angle and fixed using a right angle header strip. Connectors are soldered directly onto the smaller board at a pitch which will allow this case to plug directly into the Raspberry Pi case. This is done to ensure good mechanical stability when connecting, disconnecting and when in use.

Note that the connectors all sit at different heights and to achieve this well the Raspberry Pi needs to be offered up to the strip-board at the time of mounting the connectors.
There are several good features with this design.

The Raspberry Pi can still be disconnected from the display at any time and used for an alternate purpose or project.

The project does not need to be used as a gaming device, it can be used in other projects with different requirements.

The battery pack has an integrated switch built in, this is very useful and I recommend these battery holders.
There are currently some aspects of this project which are undesirable, this is because the project has evolved and lessens have been learned which will be applied in future projects.

The original project was designed to be used with the HDMI project, which means the keys are arranged upside down for this project. A workaround has been made in this project by getting MAME to rotate the display by 180 degrees.

For the same reason the battery pack has been mounted on the display for this project. In future projects the battery pack will be mounted on the Raspberry Pi case.

At this time the Raspberry Pi Model A is not available. The Model A should be used in battery applications because of it's much lower power consumption compared to the Model B.

Project Cost
Item Reference Qty Each Cost
1K Resistor Carbon film 1/4W 5% BitsBox 1 £0.04 £0.04
0.1uF Metalised Polyester Capacitors BitsBox 3 £0.08 £0.24
0.33uF Polyester Film Capacitor BitsBox 1 £0.22 £0.22
1N4148 Diode BitsBox 2 £0.04 £0.08
BC337 NPN Transistor BitsBox 2 £0.09 £0.18
7805 5V 1.5A Voltage Regulator BitsBox 1 £0.28 £0.28
Piezo Transducer BitsBox 1 £0.75 £0.75
Stereo 3.5mm Jack Plug BitsBox 1 £0.63 £0.63
Phono Plug BitsBox 1 £0.22 £0.22
2.5mm Power Plug BitsBox 1 £0.39 £0.39
2.5mm Panel-mount Power Socket BitsBox 1 £0.76 £0.76
Kynar Wire - 5m length BitsBox 1 £1.55 £1.55
Header Strip Right Angle 0.1" Pitch (36-way) BitsBox 1 £0.40 £0.40
Header Strip Straight 0.1" pitch (4-way) BitsBox 1 £0.08 £0.08
Single Row Sockets 0.1" Pitch (4-way) BitsBox 1 £0.26 £0.26
Stripboard 127 x 95mm 50 holes x 36 holes BitsBox 1 £1.59 £1.59
BitsBox Shipping BitsBox 1 £1.75 £1.75
Playing Card Case eBay 1 £0.99 £0.99
6AA Battery Case eBay 1 £3.00 £3.00
3.5" Car Reversing LCD Display eBay 1 £15.00 £15.00
Plastic Snap Rivets 10 Pack Maplin 1 £1.29 £1.29
SUB TOTAL £29.70
Raspberry Pi MAME GPIO Joystick Project NewsDownload.co.uk 1 £10.52 £10.52
Raspberry Pi Model A Farnell (element 14) 1 £28.50 £28.50
TOTAL £68.72

UPDATE 2013-02-02

Using a switch mode regulator to improve battery life.

There is a switched mode regulator available which is pin compatible with the 7805 regulator and a similar size. The 7805 regulator is supposed to be roughly 55% efficient where as the switch mode regulator TSR 1-2450 is supposed to be roughly 95% efficient. In testing, running this project from a fully charged set of batteries the switched mode regulator lasted 26% longer.

Cost Comparison
Part No. Reference Cost Duration
7805 RS £0.47 2.5 Hours
TSR 1-2450 RS £6.85 3.17 Hours

UPDATE 2013-02-05

Raspberry Pi Model A Released Yesterday - improved battery life.

The purpose of the Model A Raspberry Pi has always been to provide a low power option at a lower cost. In testing, running this project from a fully charged set of batteries the Model A lasted 50% longer.
Cost Comparison
Part No. Reference Cost Duration
Raspberry Pi Model B Farnell £29.85 3.17 Hours
Raspberry Pi Model A Farnell £22.36 4.75 Hours