Another PiGRRL "0.3"

Transcription

Another PiGRRL "0.3"
Another PiGRRL "0.3"
Another PiGRRL"0.3" was designed based on “PiGRRL2” & “Raspberry Pi portable case”.
PIGRRL 2
http://www.thingiverse.com/thing:1277483
It's wonderful game console. Many thanks to adafruit.
Raspberry Pi portable case
http://www.thingiverse.com/thing:703638
-Requirement.
Raspberry Pi Zero
micro SD card (for RetroPie).
LCD; adafruit 2.2inch LCD (or compatible device)
adafruit 2.2” LCD https://www.adafruit.com/product/1480
compatible device: aitendo 2.2” LCD (almost compatible)
http://www.aitendo.com/product/7277
PiGRRL 2.0 Custom Gamepad PCB
https://www.adafruit.com/product/3015
Tactile Button switch (6mm) x 12pcs
https://www.adafruit.com/products/367
GPIO Ribbon Cable for Raspberry Pi Model A+/B+/Pi
https://www.adafruit.com/products/1988
Right angle pin header 2x20pin X 2pcs or splittable 2x40pin
http://akizukidenshi.com/catalog/g/gC-00148/
Cylindrical shaped mobile battery
suitable dimensions; 23mm O.D. and 95mm long
ex.) ANKER Astro Mini http://jp.anker.com/products/A1105011
ex.) RAVPOWER Luster http://www.ravpower.com/30200mah-portable-charger-black.html
Resistor; 270 ohm x 2pcs , 150 ohm x 2pcs
Capacitor; 33nF x 2pcs , 10uF x 2pcs
Diode (BAV99 compatible or similar) x 4pcs
M2.6x8mm BOLT x 18pcs
8mm bolt is too long for some part.
In that case, printout spacers by 3D printer and equip with bolt.
Audio amp.board, PAM8302A or similar
https://www.adafruit.com/products/2130
similar product: "AE-PAM8012", class D amp. module
http://akizukidenshi.com/catalog/g/gK-08217/
If the amplifier module which you chose is not equipped with a variable resistor
for gain control, it is necessary.
-Variable resistor
ex.) 10K, 20K or 50K ohm
http://akizukidenshi.com/catalog/g/gP-06110/
http://akizukidenshi.com/catalog/g/gP-06111/
http://akizukidenshi.com/catalog/g/gP-06112/
“PAM8302A” has been equipped with it.
“AE-PAM8012” has not.
Mini metal speaker 8ohm 0.5W
https://www.adafruit.com/product/1890
similar product: "SPK8Ω0.5W-26.5"
http://www.aitendo.com/product/3590
a fragment(21x24mm) of Breadboard PCB
for analog audio circuit.
Breadboard PCB
https://www.adafruit.com/products/1609
a fragment(10x63mm) of universal PCB
for Game Pad L/R button and a variable resistor
(for audio amp gain control)
-About "Audio circuit" for Raspberry pi zero
Since there is no analog audio output on Raspberry Pi Zero, it must be made.
The Audio circuit used in this thing were made with reference
to the adafruit's documentation.
https://learn.adafruit.com/introducing-the-raspberry-pi-zero/audio-outputs
As in the photo , please make up the circuit on a 21x24mm piece of Breadboard PCB.
For audio output, GPIO 12&13 are chosen for this thing.
Of course, +3.3V and GND also need to be wired.
Probably, the diode should choose equivalent or similar of BAV99.
http://www.nxp.com/documents/data_sheet/BAV99_SER.pdf
I chose 1N4148 which appeared from my parts box.
http://www.diodes.com/_files/datasheets/ds12019.pdf
There may be a more suitable choice.
-about noise on the audio line
Probably, audio-out would be noisy.
And impossible to eliminate the noise completely.
But, controling the variable resistor
that is equipped on the input side of the amplifier modules
and RetroPie's audio output, it will be improved.
-Resizing GPIO cable and connecting with LCD
For this thing , you will need a GPIO cable, such as in the photo below.
The length of the GPIO cable is 90mm.
Some of the GPIO signal line must be drawn for 2.2”LCD.
And, a GPIO signal line must be replaced.
Signal lines must be drawn for the LCD are...
[ Adafruit 2.2"LCD uses the following GPIO signals.]
https://www.adafruit.com/product/1480
1.BL(LED)-->gpio18, pin#12
2.SCK-->gpio11, pin#23
3. NC
4.MOSI-->gpio10, pin#19
5.CS-->gpio8, GPIO_pin#24
6. NC
7.RST-->gpio25, pin#22
8.D/C-->gpio24 ,pin#18
9.VCC--> +5V, pin#02
10.GND--> GND, pin#06
[ aitendo 2.2"LCD uses the following GPIO signals. ]
http://www.aitendo.com/product/7277
This LCD, as well as adafruit 2.2"LCD, circuit that allows the 5V power is equipped.
http://aitendo3.sakura.ne.jp/aitendo_data/product_img/lcd/tft2/TM022HDH26/M-TM022-SPI/M-TM022-SPI-sch.gif
However, dealer's web does not have wrote about it.
So, this usage might be outside the scope of the guarantee.
1.VCC_IN --> +5V, GPIO_pin#02
2.GND --> GND, GPIO_pin#06
3.D/CS=GPI0_CS --> gpio8, GPIO_pin#24
4.D_RST=Reset --> gpio25, pin#22
5.D_RS=AO(D/C) --> gpio24 ,pin#18
6.D_SDI=MOSI --> gpio10, pin#19
7.D_SCK=SPIclock --> gpio11, pin#23
8.D_LED=LED-K --> gpio18, pin#12
9. NC
And, signal line must be replaced is GPIO18(pin#12).
GPIO18 will be used for the 2.2” LCD.
However, it is also the button of GAMEPAD is needed.
So to connect the GPIO17 instead of GPIO18 to GAMEPAD.
-about game pad
Use the back of Game Pad PCB as a surface.
For the original "PiGRRL2", buttons and GPIO connections are below.
LEFT--> Pin 7 GPIO 4
UP--> Pin 36 GPIO 16
RIGHT--> Pin 35 GPIO 19
DOWN--> Pin 37 GPIO 26
SELECT--> Pin 29 GPIO 5
START--> Pin 31 GPIO 6
A--> Pin 8 GPIO 14
B--> Pin 10 GPIO 15
X--> Pin 38 GPIO 20
Y--> Pin 12 GPIO 18
L--> Pin 32 GPIO 12
R--> Pin 33 GPIO 13
GPIO18,12 and 13 should be changed the settings for this thing.
LEFT--> Pin 7 GPIO 4
UP--> Pin 36 GPIO 16
RIGHT--> Pin 35 GPIO 19
DOWN--> Pin 37 GPIO 26
SELECT--> Pin 29 GPIO 5
START--> Pin 31 GPIO 6
A--> Pin 8 GPIO 14
B--> Pin 10 GPIO 15
X--> Pin 38 GPIO 20
// Y,L,R must be change
Y--> Pin 11 GPIO 17 // GPIO18...reserved for LCD
L--> Pin 13 GPIO 27 // GPIO12...reserved for audio(PWM)
R--> Pin 40 GPIO 21 // GPIO13...reserved for audio(PWM)
Because it uses the back side of the PCB,
the actual button behavior is different from the original
However, it can be modified immediately in setting of RetroPie,
there is no problem.
-Game Pad L/R buttons and Audio line gain control vol.
For L / R button and the volume , please make a board such as a photograph .
"L" button; wired to GPIO27 (pin#13) and GND (pin#9).
"R" button; wired to GPIO21 (pin#40) and GND (pin#39).
-Audio wiring
If you chose "AE-PAM8012", wiring will be shown in the photograph .
Wiring related to the audio, it might be different depending on your selected amp module.
Please wiring by referring to the manual.
If you chose "PAM8302A", it is basically the same as the PiGRRL2.
How to assemble
1). 3D printing
Please print cases, spacers, and buttons out by 3D printer.
PLA or ABS is recommended for case and spacers.
NinjaFlex-SemiFlex is recommended for buttons.
For more information about modeling , please refer to "anPiGR0p3_327.123dx".
2). L/R buttons
Please stuff L/R buttons after removing the support material which should be removed.
3). assemble gamepad
4). connect GPIO cable
5). assembling arm parts
-Software settings
The setup of this thing requires some knowledge about RetroPie, FBTFT, FBCP, and Adafruit
-RetroGame.
RetroPie
https://retropie.org.uk/
The latest version of RetroPie is 3.7 when this document is written.
FBTFT
https://github.com/notro/fbtft/wiki
FBCP
https://github.com/tasanakorn/rpi-fbcp
Adafruit-RetroGame
https://learn.adafruit.com/retro-gaming-with-raspberry-pi
https://learn.adafruit.com/retro-gaming-with-raspberry-pi/buttons
1). checking FBTFT
If install the retropie 3.7, the checking operations of LCD will also be possible.
Connect to Network, Power On, after a few minutes...(Starting RetroPie 3.7 and reboot)...
login via network by PC and terminal software...and...
Please set up by raspi-config.
> sudo raspi-config
Required setup is the following things.
internationalisation options --> set up your locale/timezone/keyboard/WiFiCountry.
Advanced Options -- enable SPI and kernel loaded by default
Advanced Options -- enable device Tree
and reboot...
login via network again. and...
> sudo modprobe fbtft_device name=adafruit22a rotate=90
> con2fbmap 1 1
Then, a console screen will be made to appear on 2.2" LCD.
2). install FBCP
If 2.2”LCD work well, Please install FBCP.
https://github.com/tasanakorn/rpi-fbcp
If FBCP is installed...
> fbcp &
Then, RetroPie screen will be made to appear on 2.2" LCD.
3). Audio
Sound does not come out only by adding an audio circuit.
It needs to be add some lines in /boot/config.txt
#-----audio setting for Pi0 ; use gpio 12&13 for audio(PWM)
# Enable audio (loads snd_bcm2835)
dtparam=audio=on
#-stereo
dtoverlay=pwm-2chan,pin=12,func=4,pin2=13,func2=4
#-mono
#dtoverlay=pwm,pin=13,func=4
4). screen size
It will be better to rewrite FRAMEBUFFER width and height settings in /boot/config.txt
#--- LCD; 320x240
framebuffer_width=320
framebuffer_height=240
hdmi_cvt=320 240 60 1 0 0 0
hdmi_group=2
hdmi_mode=87
#----5). GamePad
In order to use the tactile switches connected with gpio as gamepad,
you have to set up with reference to Adafruit-RetroGame.
https://learn.adafruit.com/retro-gaming-with-raspberry-pi/buttons
You have to make a configuration file,
after downloading, editing and compiling retrogame.
The key assigning for retrogame.c
// 2.2"TFT + GPIO_GAMEPAD
// --> Joystick (A,B,X,Y,up,down,left,right,L,R,select,start)
{ 19, KEY_RIGHT },
{ 16, KEY_UP },
{ 26, KEY_DOWN },
{ 14, KEY_LEFTCTRL }, // A/Fire/jump/primary/RED
{ 15, KEY_LEFTALT }, // B/Bomb/secondary/YELLOW
{ 20, KEY_Z }, // X/BLUE
//{ 18, KEY_X }, // Y/GREEN
{ 5, KEY_SPACE }, // Select
{ 6, KEY_ENTER }, // Start
//{ 12, KEY_A }, // L Shoulder
//{ 13, KEY_S }, // R Shoulder
// Y,L,R must be change
// Y--> Pin 11 GPIO 17 // GPIO18...reserved for LCD
// L--> Pin 13 GPIO 27 // GPIO12...reserved for audio(PWM)
// R--> Pin 40 GPIO 21 // GPIO13...reserved for audio(PWM)
{ 17, KEY_X }, // Y/GREEN
{ 27, KEY_A }, // L Shoulder
{ 21, KEY_S }, // R Shoulder
//
6). start-up setting
It is necessary to make FBTFT, FBCP, and retrogame work certainly
at the start up.
For example, make the following batch file and
add to end (Just before "exit 0") of /etc/rc.local
(This is a method that does not require the any update or upgrade.)
# batch file "test01.sh"
!/bin/bash
echo "FBTFT"
sudo modprobe fbtft_device name=adafruit22a rotate=90 speed=42000000 fps=20
sleep 1s
echo "FBCP"
sudo fbcp &
echo "GPIO-GAMEPAD"
sudo /home/pi/Adafruit-Retrogame/retrogame &
And, /etc/rc.local will be as follows.
#!/bin/sh -e
# rc.local
#This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
# In order to enable or disable this script just change the execution
# bits.
# By default this script does nothing.
# FBTFT,FBCP and GAMEPAD
sudo bash /home/pi/test01.sh
exit 0
Now, if do reboot, reflection screen of RetroPie is to LCD.
-afterword
Thank you for reading my strange English sentences. Thanks to Google translation.
Perhaps, I might have written some misunderstanding/mistakes in this document.
If you find something, please advice.
Thank you for the wonderful projects,
PiGRRL / PiGRRL2 / Adafuit-RetroGame
FBTFT
FBCP
RetroPie
and thanks to all of developers.
by n602
5/28-29 / 2016
-history of prototypes
12/06/2015...Raspberry pi0+PiTFT2.2 with PWM audio(gpio12&13)
12/12/2015...Raspberry pi0+1.8”LCD with analog AUDIO board(gpio12&13)
3/28/2016...Raspberry pi0+adafruit 2.2”LCD with adafruit GAMEPAD PCB
4/16/2016...Raspberry pi2B+Game_Shield(1.8”LCD&Tactile switches on the universal board)
4/19/2016...Another PiGRRL “0.1”, Raspberry pi0+Game_Shield(2.2”LCD&Tactile switches on
the universal board) + Audio board(gpio12&13)