Categories
Raspberry Pi

Super Capacitor testing

THIS IS FOR AN ODROID XU4 which has 1.8V max on GPIO logic, should also work in a Raspberry Pi but untested.

Working with Super Capacitors is super dangerous, they may burn you or weld your skin to something else, or give you a very nasty shock. Be very careful not to short the capacitor + and -, or feed them at a higher rating than is suitable. Please google super capacitors and understand how they work before playing with them.

  • 2 x 1.5 Ohm 5W resistor (R1, R2)
  • 2 x 5A Schottky diode (D1,D2)
  • 2 x 10F 2.7V capacitor (C1,C2)
  • 2 x 100R resistor (R3,R4)
  • 3 x 1K resistor (R5, R6, R7)
  • 1 x XL6009 Step up & down convertor module

5.2V input from 5A PSU, up and down convertor is set to output 5.1V output.

       +---R1---D1------+
in     |        >|      |
+5--+--+                +-----+---+-\
    |  |        >|      |    +|   |  -\         out
   R5  +---R2---D2------+    C1   |    -+----+- +5
   R6                        -|  R3     |step|
    +----<1.8V to GPIO        +---+     |up &|
    |                        +|   |     |down|
   R7                        C2  R4    -+---+-- -0
in  |                        -|   |  -/          out
-0--+-------------------------+---+-/

The voltage to a GPIO pin on the XU4 will be <1.8V (1.6V ish) whilst the input is 5.2V. A shell script should check the state of this pin and trigger a shutdown when the voltage drops below .5V.

Step Up Step down to provide 5.1V output no matter what the input is. Input min for this XL6009 module is 3.8V and it can be fed at 3A max.

Work in progress, this circuit is currently not working correctly.

Categories
Linux Raspberry Pi

Raspberry PI 2 / 3 with 5″ touchscreen LCD

I managed to get a cheap 5″ LCD HDMI touchscreen from Ebay for my 80’s game emulator. This is an 800×480 panel using an XPT2046 to provide the resistive touch screen, a similar one can be bought here: Raspberry Pi 2 HDMI LCD Screen

A lot of the information on the Internet made it look like getting this screen working with the RPi was going to be a bit of a chore, but I found that out of the box Raspbian Jessie seems to work well with only a few configuration changes.

This screen attaches to the RPi2/3 via a clever 180 degree HDMI connector, and also via the GPIO so it is quite a secure fit. Metal standoffs are also included to keep the LCD and Raspberry Pi safe from harm. You can plug the power either into the power socket on the panel, or the RPI. Powering both screen and RPi from a 2a charger, and a battery pack meant for phone recharging rated at 5200 mAh, 3.7v with 2.1a output worked well.

The RPi is probably set to output video at 640×480, so setting the following in /boot/config.txt forces the 800×480 output:
# Force 800×480 for 5″ lcd display
hdmi_group=2
hdmi_mode=1
hdmi_mode=87
hdmi_cvt=800 480 60 6 0 0 0

The touchscreen didn’t work out of the box either, but adding the following to /boot/config.txt did the trick:
dtparam=spi=on
dtoverlay=ads7846,penirq=25,speed=10000,penirq_pull=2,xohms=150

That got the touchscreen working, but it wasn’t calibrated and there is no right click. The following fixed this:
wget http://github.com/downloads/tias/xinput_calibrator/xinput_calibrator-0.7.5.tar.gz
tar -xvf xinput_calibrator-0.7.5.tar.gz
cd xinput_calibrator-0.7.5.tar.gz
sudo apt-get install libx11-dev libxext-dev libxi-dev x11proto-input-dev
./configure
make
sudo make install

Run the calibration from the Application | System menu, locate all 4 corners and it will output some data, copy the data (starting Section) into the file below. This also includes code to emulate right click with a long press:
su
cat >/usr/share/X11/xorg.conf.d/01-input.conf
Section “InputClass”
Identifier “calibration”
MatchProduct “ADS7846 Touchscreen”
Option “Calibration” “141 4009 196 3966”
Option “EmulateThirdButton” “1”
Option “EmulateThirdButtonTimeout” “750”
Option “EmulateThirdButtonMoveThreshold” “30”
EndSection

Categories
DIY Raspberry Pi Retro gaming

DIY Raspberry PI portable arcade box with included screen and arcade controls

Since about 1997 when I first found Mame I’ve wanted a decent arcade gaming platform to play games like Street Fighter, Asteroids, Outrun, Pacman, Space Invaders, Bubble Bobble and the like.. I’ve thought about upright cabinets, cocktail cabinets but with no space and 3 kids these are still a pipe dream. Over the years I’ve tried putting arcade emulators on various machines running Windows and Linux, with with USB controllers and dedicated arcade controllers, none of which is quite what I’m looking for.

For a while I considered using a tablet / phone but with the advent of the Single Board Computer (SBC) like the Raspberry Pi I’ve designed and built a standalone counter top arcade gaming system, with built-in arcade controls, display, processing unit, battery, speakers and power on / off, etc.

I used the following:

£10 Square wooden box external 340mm x 250mm x 50mm
£20 Arcade Controls (joystick, buttons, Zero Delay USB encoder)
£ 3 USB travel speaker
£31 Raspberry Pi 3
£11 Power bar
£ 9 5″ 800×480 XPT2046 HDMI LCD
£ 4 A4 Perspex sheet I chose purple, the choice is yours
£ 2 Power switch
£ 4 Pack of 3 Male USB A to Micro B
£ 6 Spray on Lacquer
Some thin electrical wire
Undercoat / primer
Left over sparkly paint

Tools-wise I used:
Electric drill, Li-Ion battery is the best
Hole saw kit for 22mm, 24mm and 30mm holes
Jigsaw
Jigsaw blades specially for cutting Acrylic
Rasps

I started with the unpainted wooden box.

Arcade box before modifications

I gave it a sand and a clean, and then marked out the holes for the screen and arcade controls. I used some paper on which I’d drawn some grid lines, and then marked out where I wanted the screen, the joystick and the buttons to go. 22mm for the joystick, 24mm for the 2 smaller side buttons and 30mm for the larger top mounted buttons. I then laid that onto the box and pushed through with a pencil to mark out the hole centres, and the corners of the screen.

Arcade box with joystick Arcade controls

To cut the wooden box for the LCD panel I drilled some small pilot holes in the corners I’d marked out. I made this the size of the front of the LCD panel so that it fit snugly, the perspex goes on top and overlaps the LCD slightly making everything look neat. I used a small drill bit, wider than the jigsaw blade width. I started drilling inside the line so that the edge of the drill bit was on the line. I drilled about 5 or 6 holes next to each other along the line until it was long enough to fit the jigsaw blade. Once I’d done each corner I use the jigsaw. I finished with the wide rasp with square corners.

Cutting the holes for the joystick and top mounted buttons I placed a block under the top because it is a little flexible without the perspex.

Once I had cut all the holes I needed in the box, I put on a couple of coats of undercoat / primer, inside and out, sanding the outside between each coat with a very fine sandpaper. Then after cleaning I used a roller to give it 3 coats of paint on the outside only, sanding between each coat with a very fine sandpaper. Once the last coat was on I left it to dry for 24 hours. Then used a clear lacquer spray to finish the box, the trick here is lots of very light coats, otherwise the lacquer pools and runs. I did around 4 coats on the bottom / sides first leaving 5 minutes between each coat. I think I ended up doing 8 coats on the top / sides, I didn’t intentionally spray lacquer where the perspex was going to cover. I left this to dry for 24 hours.

To cut the perspex for the LCD panel I used the same technique as for the wooden box except the following. I put the perspex on a wooden block so that any exit marks on the bottom of the perspex were minimised. I set the jigsaw set to its fastest setting. I clamped a metal rule to the perspex with some cloth to ensure it didn’t scratch the surface to help keep the line straight. The hole in the perspex should be smaller than the hole in the wooden box, to overlap the edges of the LCD you don’t want to see.

IMG_20160808_070554

To cut the perspex for the buttons and joystick is similar. Using the correct sized hole saw – I used 22mm for the joystick and 30mm for the larger buttons. I’d already marked on the perspex where the buttons were located. I put the perspex onto a wooden block and drilled into that to ensure the underside of the perspex was not damaged.

IMG_20160808_070258
In the above picture I’m running Mame, though now its running RetroPie so its also emulating NES, SNES, Mame, PS2, N64 as well as running Duke Nukem 3D, Doom, Quake, and of course, an Atari VCS…