Voting resources, early voting, and poll worker information - VOTE. ... Adafruit is open and shipping.
0

Pigrrl zero and Adafruit MAX98357 I2S Class-D Mono Amp
Moderators: adafruit_support_bill, adafruit

Forum rules
Talk about Adafruit Raspberry Pi® accessories! Please do not ask for Linux support, this is for Adafruit products only! For Raspberry Pi help please visit: http://www.raspberrypi.org/phpBB3/
Please be positive and constructive with your questions and comments.

Re: Pigrrl zero and Adafruit MAX98357 I2S Class-D Mono Amp

by jpete24 on Fri Jun 17, 2016 9:43 pm

Here is the case mod. Should work well with all the parts you have. I'm working out the bugs right now with some dimensions and printing, but I'll be putting it on thingiverse soon.

https://www.dropbox.com/s/rey54epwh2zbt ... .jpeg?dl=0

jpete24
 
Posts: 71
Joined: Tue May 17, 2016 2:58 pm

Re: Pigrrl zero and Adafruit MAX98357 I2S Class-D Mono Amp

by tronicgr on Fri Jun 17, 2016 11:37 pm

jpete24 wrote:Do you have a few more photos of your connections? Did you change any settings in retropie?

I can't quite figure out how your SD port is working with that latch system and why I can't get mine to output any audio....

I did hook up the amp wrong at first (wasn't paying attention to two wires same color...DOH) so I wonder if I didn't torch the I2S amp...

[EDIT] I re-read your first post, and it seems like you had to remap some of the buttons on the GPIO? Care to explain how you remapped everything to work properly?



I'm not sure what do you mean for the SD card. It's a non latching one pi zero v1.2.

I have a photo of the key map I made to fit all keys but it still mentions wrong pins for those two I2S pins, I had to swap 19 and 21 to work.

Image

Hope that helps

I did the same for a real Gameboy Zero mod I was making, still working on the post details but I have photos of it here:
http://sudomod.com/forum/viewtopic.php?f=9&t=623


Thanks
Thanos

tronicgr
 
Posts: 76
Joined: Wed Feb 03, 2016 1:48 pm

Re: Pigrrl zero and Adafruit MAX98357 I2S Class-D Mono Amp

by jpete24 on Sat Jun 18, 2016 12:04 am

Sorry, I don't know what I was saying about the SD card....

I think you are the only guy who has this working right now on a PiGRRL Zero, bravo! Regarding your image for the button configuration, couple questions:

1. Did you just attach those wires from the gamepads directly to the actual Pi Zero? I know on the Adafruit tutorial they attached them to the 2.2" PiTFT, which then was connecting to the Pi Zero. I have mine all setup, so I'd have to tear apart my Pi Zero from my PiTFT if I went that route, otherwise direct connect to the Pi Zero on the bottom of it.

2. Did you have to do anything software side to reconfigure those buttons? Was it in Retropie? If so, how did you do it or can you point me to another tutorial that was helpful in showing you how? Maybe you can provide a clone of your Retropie image?

3. When you run Retropie did you have to select which audio source you wanted to use? Can you still use the USB adapter and headset?

I appreciate your help here, I'm excited to get external audio setup, I just can't find any decent information anywhere on how to do it.

jpete24
 
Posts: 71
Joined: Tue May 17, 2016 2:58 pm

Re: Pigrrl zero and Adafruit MAX98357 I2S Class-D Mono Amp

by jpete24 on Sat Jun 18, 2016 9:54 am

Anyone who may be interested in this thread, I have posted my changes to the case to accommodate the Adafruit I2S amp and speaker.

http://www.thingiverse.com/thing:1621907

jpete24
 
Posts: 71
Joined: Tue May 17, 2016 2:58 pm

Re: Pigrrl zero and Adafruit MAX98357 I2S Class-D Mono Amp

by tronicgr on Sat Jun 18, 2016 11:00 am

jpete24 wrote:Sorry, I don't know what I was saying about the SD card....

I think you are the only guy who has this working right now on a PiGRRL Zero, bravo! Regarding your image for the button configuration, couple questions:

1. Did you just attach those wires from the gamepads directly to the actual Pi Zero? I know on the Adafruit tutorial they attached them to the 2.2" PiTFT, which then was connecting to the Pi Zero. I have mine all setup, so I'd have to tear apart my Pi Zero from my PiTFT if I went that route, otherwise direct connect to the Pi Zero on the bottom of it.

2. Did you have to do anything software side to reconfigure those buttons? Was it in Retropie? If so, how did you do it or can you point me to another tutorial that was helpful in showing you how? Maybe you can provide a clone of your Retropie image?

3. When you run Retropie did you have to select which audio source you wanted to use? Can you still use the USB adapter and headset?

I appreciate your help here, I'm excited to get external audio setup, I just can't find any decent information anywhere on how to do it.


Thanks for the compliment, I was just planning it ahead as I also wanted sound from the Raspberry Zero while all fits in the same Pigrrl Zero enclosure. Thanks for the updated 3D printed part. I may use it in I can fit the battery in it.

to your questions:
1. I connected the wires on the PiTFT between the two boards, as the Pigrrl zero guide shows, just used a little different wiring as on my Key map on the photo on my previous post. I only soldered the +5v and Ground from the I2S directly on the RPi Zero to minimize any noise from the PowerBoost switching (I fixed the noise Issue I had on my older Pigrrl2 build this way too!).

2. I used the guides from the following links to setup the controls like in Pigrrl2 so I also have ESC and Enter for DOS games like Doom.
https://learn.adafruit.com/running-open ... g-controls
https://learn.adafruit.com/pigrrl-zero/usage-and-extras
https://learn.adafruit.com/pigrrl-2/software

And used this piece is software to shutdown the Pigrrl zero using the TFT button "27":
https://github.com/adafruit/Adafruit-GPIO-Halt
https://learn.adafruit.com/1500-neopixe ... y-pi-setup

3. I just followed the guide here to disable all other sound sources and enable the I2S sound:
https://learn.adafruit.com/adafruit-max ... y-pi-usage
Of course you lose the ability to set the volume, so I added a switch between the SD pin on the I2S board and the Ground to Shutdown the amplifier if I don't need sound.

Thanks
Thanos

tronicgr
 
Posts: 76
Joined: Wed Feb 03, 2016 1:48 pm

Re: Pigrrl zero and Adafruit MAX98357 I2S Class-D Mono Amp

by jpete24 on Sat Jun 18, 2016 11:07 am

Rather than doing all the software setup, do you think you could clone your retropie img and share it? That would be much appreciated.

If your battery is too large, get me the dimensions and I could add some girth or modify to incorporate it.

jpete24
 
Posts: 71
Joined: Tue May 17, 2016 2:58 pm

Re: Pigrrl zero and Adafruit MAX98357 I2S Class-D Mono Amp

by tronicgr on Sat Jun 18, 2016 11:45 am

jpete24 wrote:Rather than doing all the software setup, do you think you could clone your retropie img and share it? That would be much appreciated.

If your battery is too large, get me the dimensions and I could add some girth or modify to incorporate it.



I'll make a copy of the SD card (without the roms of course for reasons widely known) but not sooner than Monday, as I have all the tools at my work computer. I'll PM you a link to get it as soon I have it uploaded in a sharing site.

The Battery is a 2000mA flat one as you can see in the photos I shared, its not thick, but If I'm right, your mod has some extra mount for the I2S board right where I place the battery. Perhaps move this near the speaker area if it fits somewhere. I currently rest the I2S board on the battery with some insulation double tape to keep it in place.

Thanks
Thanos

tronicgr
 
Posts: 76
Joined: Wed Feb 03, 2016 1:48 pm

Re: Pigrrl zero and Adafruit MAX98357 I2S Class-D Mono Amp

by jpete24 on Sat Jun 18, 2016 12:43 pm

You're the best. I'll take a look at the case mod based upon the pictures you posted.

Can you still use USB audio with this setup or does the I2S shut that down? I assume there would be a way you can switch back and forth between external and USB adapter audio.

jpete24
 
Posts: 71
Joined: Tue May 17, 2016 2:58 pm

Re: Pigrrl zero and Adafruit MAX98357 I2S Class-D Mono Amp

by tronicgr on Sat Jun 18, 2016 1:04 pm

jpete24 wrote:You're the best. I'll take a look at the case mod based upon the pictures you posted.

Can you still use USB audio with this setup or does the I2S shut that down? I assume there would be a way you can switch back and forth between external and USB adapter audio.


Not sure if that is still possible, as according to the guide you disable all other audio interfaces.

I have been using the USB for hub for keyboard and WiFi access.

Thanks
Thanos

tronicgr
 
Posts: 76
Joined: Wed Feb 03, 2016 1:48 pm

Re: Pigrrl zero and Adafruit MAX98357 I2S Class-D Mono Amp

by jpete24 on Mon Jun 20, 2016 12:11 pm

I don't think we can direct message on these forums. I just tried. Could you send me the link to your SD card IMG to my email? jpete24 at gmail.com

I also have some modified cases for you based upon the photos you showed. This should fit the speaker, standoff for amp and your large battery. Let me know if you need me to make some tweaks.

https://www.dropbox.com/s/v4grio4wjalp9 ... e.stl?dl=0
https://www.dropbox.com/s/3l0htbsge1ft9 ... e.stl?dl=0

jpete24
 
Posts: 71
Joined: Tue May 17, 2016 2:58 pm

Re: Pigrrl zero and Adafruit MAX98357 I2S Class-D Mono Amp

by tronicgr on Mon Jun 20, 2016 12:16 pm

jpete24 wrote:I don't think we can direct message on these forums. I just tried. Could you send me the link to your SD card IMG to my email? jpete24 at gmail.com

I also have some modified cases for you based upon the photos you showed. This should fit the speaker, standoff for amp and your large battery. Let me know if you need me to make some tweaks.

https://www.dropbox.com/s/v4grio4wjalp9 ... e.stl?dl=0
https://www.dropbox.com/s/3l0htbsge1ft9 ... e.stl?dl=0



I think I can just place the link here, as its a quick modification of adafruit pigrrl zero image. No other rom or bios was whatsoever added. I'll place the link as soon its uploaded to the file sharing server.


If you still want to have the instructions and all details how this is done I'll give some more information below.

First you can use the Pigrrl Zero image from here:
https://learn.adafruit.com/pigrrl-zero/software

And then apply the following commands (capture from terminal with commands and settings):

Code: Select all | TOGGLE FULL SIZE

login as: pi
pi@10.120.179.78's password:

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Tue May  3 19:59:39 2016

   .~~.   .~~.    Monday, 20 June 2016,  3:46:44 pm UTC
  '. \ ' ' / .'   Linux 4.1.14+ armv6l GNU/Linux
   .~ .~~~..~.
  : .~.'~'.~. :   Filesystem      Size  Used Avail Use% Mounted on
 ~ (   ) (   ) ~  /dev/root       7.2G  2.2G  4.7G  32% /
( : '~'.~.'~' : ) Uptime.............: 0 days, 00h04m28s
 ~ .~       ~. ~  Memory.............: 101440kB (Free) / 250376kB (Total)
  (   |   |   )   Running Processes..: 79
  '~         ~'   IP Address.........: 10.120.179.78
    *--~-~--*     Temperature........: CPU: 42°C/107°F GPU: 42°C/107°F
                  The RetroPie Project, http://www.petrockblock.com


pi@retropie:~ $ git clone git://github.com/adafruit/Adafruit-GPIO-Halt
Cloning into 'Adafruit-GPIO-Halt'...
remote: Counting objects: 14, done.
remote: Total 14 (delta 0), reused 0 (delta 0), pack-reused 14
Receiving objects: 100% (14/14), 6.66 KiB | 0 bytes/s, done.
Resolving deltas: 100% (5/5), done.
Checking connectivity... done.
pi@retropie:~ $ cd Adafruit-GPIO-Halt
pi@retropie:~/Adafruit-GPIO-Halt $ make
gcc  -Wall -O3 -fomit-frame-pointer -funroll-loops -s gpio-halt.c -o gpio-halt
strip gpio-halt
pi@retropie:~/Adafruit-GPIO-Halt $ sudo make install
mv gpio-halt /usr/local/bin
pi@retropie:~/Adafruit-GPIO-Halt $ sudo nano /etc/rc.local

        Insert this one line before the final 'exit 0':
       /usr/local/bin/gpio-halt 27 &


pi@retropie:~/Adafruit-GPIO-Halt $ cd ..
pi@retropie:~ $ cd Adafruit-Retrogame
pi@retropie:~/Adafruit-Retrogame $ sudo nano retrogame.c
 
 
  GNU nano 2.2.6             File: retrogame.c                        Modified

        // GPIO options are 'maxed out' with PiTFT + above table.
        // If additional buttons are desired, will need to disable
        // serial console and/or use P5 header.  Or use keyboard.
   ioStandard[] = {
        // This pin/key table is used when the PiTFT isn't found
        // (using HDMI or composite instead), as with our original
        // retro gaming guide.
        // Input   Output (from /usr/include/linux/input.h)
        {   4,    KEY_LEFT     },   // Left
        {  24,    KEY_RIGHT    },   // Right
        {   5,    KEY_DOWN     },   // Down
        {   6,    KEY_UP       },   // Up
        {  12,    KEY_Z        },   // A
        {  13,    KEY_X        },   // B
        {  16,    KEY_A        },   // X
        {  26,    KEY_S        },   // Y
        {  15,    KEY_Q        },   // L
        {  20,    KEY_W        },   // R
        {  17,    KEY_ESC      },   // TFT 17 ESCAPE
        {  22,    KEY_LEFTCTRL },   // TFT 22 SELECT
        {  23,    KEY_ENTER    },   // TFT 23 START
        // For credit/start/etc., use USB keyboard or add more buttons.
        {  -1,     -1           } }; // END OF LIST, DO NOT CHANGE




pi@retropie:~/Adafruit-Retrogame $ make retrogame
gcc  -Wall -O3 -fomit-frame-pointer -funroll-loops -s retrogame.c -o retrogame
strip retrogame
pi@retropie:~/Adafruit-Retrogame $ sudo mv retrogame /usr/local/bin
pi@retropie:~/Adafruit-Retrogame $ sudo reboot





login as: pi
pi@10.120.179.78's password:

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Mon Jun 20 16:01:35 2016

   .~~.   .~~.    Monday, 20 June 2016,  4:04:24 pm UTC
  '. \ ' ' / .'   Linux 4.1.14+ armv6l GNU/Linux
   .~ .~~~..~.
  : .~.'~'.~. :   Filesystem      Size  Used Avail Use% Mounted on
 ~ (   ) (   ) ~  /dev/root       7.2G  2.2G  4.7G  32% /
( : '~'.~.'~' : ) Uptime.............: 0 days, 00h03m16s
 ~ .~       ~. ~  Memory.............: 116104kB (Free) / 250376kB (Total)
  (   |   |   )   Running Processes..: 75
  '~         ~'   IP Address.........: 10.120.179.78
    *--~-~--*     Temperature........: CPU: 51°C/123°F GPU: 51°C/123°F
                  The RetroPie Project, http://www.petrockblock.com


pi@retropie:~ $ curl -sS get.pimoroni.com/phatdac | bash

This script will install everything needed to use
pHAT DAC

--- Warning ---

Always be careful when running scripts and commands
copied from the internet. Ensure they are from a
trusted source.

If you want to see what this script does before
running it, you should run:
    \curl -sS get.pimoroni.com/phatdac

Do you wish to continue? [y/N] y

Checking hardware requirements...

Adding Device Tree Entry to /boot/config.txt
dtoverlay=hifiberry-dac

Commenting out Blacklist entry in
/etc/modprobe.d/raspi-blacklist.conf

Disabling default sound module
Configuring sound output

All done!

Enjoy your new pHAT DAC!

Some changes made to your system require
your computer to reboot to take effect.

Would you like to reboot now? [y/N]
Y


tronicgr
 
Posts: 76
Joined: Wed Feb 03, 2016 1:48 pm

Re: Pigrrl zero and Adafruit MAX98357 I2S Class-D Mono Amp

by jpete24 on Mon Jun 20, 2016 12:21 pm

Perfect. I'm going to get this going tonight or tomorrow. One more quick clarification, you didn't have to change the Pinout on the PiTFT buttons or shoulder buttons from what the tutorial had right? It was only the D-pad and four buttons?

I'd rather just detach my current button wires, and just rewire directly to the back of the Pi/PiTFT and see if it works that way without making this thing too much of a Frankenstein.

jpete24
 
Posts: 71
Joined: Tue May 17, 2016 2:58 pm

Re: Pigrrl zero and Adafruit MAX98357 I2S Class-D Mono Amp

by tronicgr on Mon Jun 20, 2016 1:51 pm

jpete24 wrote:Perfect. I'm going to get this going tonight or tomorrow. One more quick clarification, you didn't have to change the Pinout on the PiTFT buttons or shoulder buttons from what the tutorial had right? It was only the D-pad and four buttons?

I'd rather just detach my current button wires, and just rewire directly to the back of the Pi/PiTFT and see if it works that way without making this thing too much of a Frankenstein.



That is right, I substituted just three buttons that their pins were used by the I2S amplifier:

{ 18, KEY_LEFT }, // Left
{ 19, KEY_S }, // Y
{ 21, KEY_W }, // R (shoulder button)

Their new location is:

{ 4, KEY_LEFT }, // Left
{ 26, KEY_S }, // Y
{ 20, KEY_W }, // R (shoulder button)

This leaves free the 18,19 and 21 to be used by the I2S.

Thanks
Thanos

tronicgr
 
Posts: 76
Joined: Wed Feb 03, 2016 1:48 pm

Re: Pigrrl zero and Adafruit MAX98357 I2S Class-D Mono Amp

by jpete24 on Mon Jun 20, 2016 2:03 pm

Thanks! Let me know when you have that image up. I'd love to take a crack at this.

I may look into headphone usage after I get the I2S up and see if that's even feasible.

jpete24
 
Posts: 71
Joined: Tue May 17, 2016 2:58 pm

Re: Pigrrl zero and Adafruit MAX98357 I2S Class-D Mono Amp

by tronicgr on Tue Jun 21, 2016 7:17 am

I never had such trouble sharing file, but this size (3.8gb) it takes for ever... I hope it does upload today.

Thanks
Thanos

tronicgr
 
Posts: 76
Joined: Wed Feb 03, 2016 1:48 pm

Please be positive and constructive with your questions and comments.