HardwarePi install

 

Press Ctrl+Enter to quickly submit your post
Quick Reply  
 
 
  
 From:  graphitone   
 To:  Peter (BOUGHTONP)     
42216.41 In reply to 42216.38 
What Ant said, the onboard gives out random pops and hisses when listening to anything.
My DAC is an I2S and sounds great with a decent pair of headphones (on the drawing desk one). I've got that hooked up to a switch that alternates between the headphones and a pair of PC style speakers, so I can put the sound through them too.

The only difference with this setup is that I've got the amp addon (from the same company, so you'd assume they're compatible). I've just found some, admittedly old, builds on IQaudIO's website that are preconfigured. The kodi one was totally out of date and wouldn't run on my Pi3, but there's a Volumio build which I'm downloading now. I'm not tied to Kodi, just that I'm more familiar with it, and Volumio has an option for a Kodi plugin.
0/0
 Reply   Quote More 

 From:  graphitone   
 To:  ALL
42216.42 
The pre-configured builds hosted on IQaudIO's site are either too old for the most recent Pi3, or are corrupted in some way, 'cos they don't run :C

Back to the backup plan of using a backup of Kodi on LibreElec and seeing at what point the sound buggers up.
0/0
 Reply   Quote More 

 From:  graphitone   
 To:  All     
42216.43 In reply to 42216.42 
I found that the issue with the sound not working happens when the shutdown script is invoked.

I'm just running the script manaully and not committing it to the autostart.sh and it turns the sound off.

I'm going with the vanilla script again, and providing I can get this working, I'll go with PB's other suggestions.
 
Code: 

#!/usr/bin/python
import sys
sys.path.append('/storage/.kodi/addons/virtual.rpi-tools/lib')
import RPi.GPIO as GPIO
import time
import subprocess

# we will use the pin numbering to match the pins on the Pi, instead of the
# GPIO pin outs (makes it easier to keep track of things)

GPIO.setmode(GPIO.BOARD)  

# use the same pin that is used for the reset button (one button to rule them all!)
GPIO.setup(5, GPIO.IN, pull_up_down = GPIO.PUD_UP)  

oldButtonState1 = True

while True:
    #grab the current button state
    buttonState1 = GPIO.input(5)

  # check to see if button has been pushed
  if buttonState1 != oldButtonState1 and buttonState1 == False:
    subprocess.call("echo 1 > /sys/class/backlight/rpi_backlight/bl_power && shutdown -h now", shell=True,
            stdout=subprocess.PIPE, stderr=subprocess.PIPE)
    oldButtonState1 = buttonState1

    time.sleep(.1)
Going through the manual again, there's a section of what's passed through the GPIO.
The DAC uses pin 5 for I2C.  I reckon if I'm now scripting that 5 is something else, that's what's kicking the sound out of touch. On that diagram though GPIO5 is pin 29, so as the script mentions it must be using the physical layout as only the first 10 pins are presented on top the Amp card and when the script runs, the power button works, but has the undesirable sound side effect.

So, with the attached diagram(s) in mind I'm guessing I could swap pins 5 (gpio3) and 6 (gnd) to be 9 (gnd) and 10 (gpio15). Would that be feasable?!

UPDATE - I've tried a combination of the other pins and updated the script accordingly. No joy there.

The pin diagram from the manual shows 7, 8 and 10 are available pins and I've tried them all against a pin 9 ground and it's just not doing anything when the shutdown button's pushed. I read that pins 5 and 6 are somehow favoured for the two pins that when shorted will put the Pi into a sleep mode. I haven't yet found whether this can be changed.

 

Attachments:

0/0
 Reply   Quote More 

 From:  Peter (BOUGHTONP)  
 To:  graphitone      
42216.44 In reply to 42216.43 
The GPIO.setmode(GPIO.BOARD) makes it use pin numbers, but you can use GPIO.setmode(GPIO.BCM) to use GPIO numbers instead.

The DAC/AMP might only provide the first 10 pins on top, but it's not clear from photos if they actually prevent you connecting to the other pins underneath?

0/0
 Reply   Quote More 

 From:  graphitone   
 To:  Peter (BOUGHTONP)     
42216.45 In reply to 42216.44 
Yeah, they do. The DAC covers all 40 pins, while the amp takes the first ten and passes them through to the headers on top of the whole stack. I'm pretty sure it's passing  pins 1 - 10 through as shorting 5 and 6 with the script configured to use them did shut it down. I don't get that if /a/ GPIO pin can be utilised to do a thing, then why couldn't /another/ GPIO be used to do the same thing, providing it's (apparently) unused?
0/0
 Reply   Quote More 

 From:  Peter (BOUGHTONP)  
 To:  graphitone      
42216.46 In reply to 42216.45 
Well yeah, if GPIO is supposed to be general purpose then any unused pin should work.

It seems counter to the point of this to take all pins, only use some, and pass through ones that can't be properly used. What about sending a message to IQaudio seeing if they're willing to help?

Failing that, maybe you can de-solder the connector and replace it with several smaller ones, including a right-angle connector for the unused ports? Or I guess cables would be easier at the expense of compactness.

0/0
 Reply   Quote More 

 From:  graphitone   
 To:  Peter (BOUGHTONP)     
42216.47 In reply to 42216.46 
That's a fair idea, I'll send them a message. There must also be some kind of inbuilt shutdown script, as there's a software power button within the Kodi interface. If I can find that, I might be able to add in the backlight commands, which would be half the battle won.
0/0
 Reply   Quote More 

 From:  Peter (BOUGHTONP)  
 To:  graphitone      
42216.48 In reply to 42216.47 
> There must also be some kind of inbuilt shutdown script

Heh, so yeah, that's a really simple solution - that loser Xen would have pointed it out ages ago if he were here.

You can use systemd to hook into system events (like shutdown), so you can create simple service like this one with Before=shutdown.target:

[Unit]
Description=/etc/rc.local.shutdown Compatibility
Before=shutdown.target

[Service]
ExecStart=/bin/true
ExecStop=/etc/rc.local.shutdown
RemainAfterExit=yes

[Install]
WantedBy=multi-user.target

Where /etc/rc.local.shutdown is a script containing the original echo 0 > /sys/class/backlight/rpi_backlight/bl_power (prepended with #!/bin/bash line) and once you've enabled that service, any time the system is shutdown - whether via Kodi or command line or the button - it triggers the script and turns off the backlight.

0/0
 Reply   Quote More 

 From:  graphitone   
 To:  All     Peter (BOUGHTONP)     
42216.49 In reply to 42216.30 
Okaaaaay... I've created a shutdown file here:
 
Code: 
/storage/.config/shutdown.sh

And created this script, putting in the backlight command under the poweroff option.
 
Code: 
case "$1" in
  halt)
    # your commands here
    ;;
  poweroff)
    # your commands here
    ;;
  reboot)
    # your commands here
    ;;
  *)
    # your commands here
    ;;
esac

This works with the software power off, but will mean I need to flick the power switch (which'll be mounted in an under counter cupboard) to get it to turn back on. So, not ideal, but it'll work for now. :)
0/0
 Reply   Quote More 

 From:  ANT_THOMAS  
 To:  graphitone      
42216.50 In reply to 42216.49 
If I'm understanding what you want to do there is a pin available on the RPi to reset the board/power. Connect a button, press it, and it'll act a soft on type button by resetting the RPi from its shutdown state.
0/0
 Reply   Quote More 

 From:  graphitone   
 To:  ANT_THOMAS     
42216.51 In reply to 42216.50 
Ah, that'd be damned useful, providing it's somewhere between 1 & 10 and isn't 5!
0/0
 Reply   Quote More 

 From:  ANT_THOMAS  
 To:  graphitone      
42216.52 In reply to 42216.51 
It's totally separate. It's called "run". Different location on different versions of raspberry pis but the newer ones have it.
0/0
 Reply   Quote More 

 From:  graphitone   
 To:  ANT_THOMAS     
42216.53 In reply to 42216.52 
Found this which seems useful, I'll have a read before bed:

https://www.raspberrypi.org/forums/viewtopic.php?t=218600
 
0/0
 Reply   Quote More 

 From:  ANT_THOMAS  
 To:  graphitone      
42216.54 In reply to 42216.53 
That's the one. When you momentarily connect Run to Ground it resets.
On previous models the pin next to Run was also ground, so you could just use those two pins. But on the latest 3B+ (?) the pin next to Run isn't ground, so you need to use a ground on the GPIO header. Which can be any, even if it's used by something else. Ground is ground.
0/0
 Reply   Quote More 

 From:  graphitone   
 To:  ANT_THOMAS     
42216.55 In reply to 42216.54 
Brilliant. Yeah, the GPIO ground advice is on that site too.

Now I just need a 2 pin header and some soldering skills. :/
0/0
 Reply   Quote More 

 From:  ANT_THOMAS  
 To:  graphitone      
42216.56 In reply to 42216.55 
It's a doddle. But understandably daunting if you don't solder much. You can probably buy a big bag of headers on ebay for 99p.

Watch a few video tutorials on soldering headers. Bluetack is useful.
0/0
 Reply   Quote More 

 From:  graphitone   
 To:  ANT_THOMAS     
42216.57 In reply to 42216.56 
Ok, I dug out an old circuit board from a long unused modem and found a set of headers on there that I could remove. I watched a lot of youtube videos on soldering and unsoldering and have discovered that many americans can't pronounce solder. Preferring to leave the 'l' out and making it 'sodder'. :|


Anywho, after a bit of practicing, I unsoldered them, took two out and soldered them onto the Pi. It's not the neatest or straightest, but they're in.

The circuit does work, I've just got to test it now with the whole thing assembled. :)

Edit - Yay, the software switch powers it off and the push switch powers it back on. It's working, but there's room for improvement, but that can all be done later, for now it's something I can give to the builders and say stick this in the wall for me.

I wonder if you can script anything on that Run pin... If that can be used to shutdown/sleep the Pi, that'd be ideal.

Attachments:

0/0
 Reply   Quote More 

 From:  graphitone   
 To:  ALL
42216.58 
Thanks for your help with getting this far PB and Ant. Tonight's job is getting the momentary switch hooked up. It's got 4 poles and didn't come with a wiring diagram, so a little more experimentation is taking place. :)
0/0
 Reply   Quote More 

 From:  graphitone   
 To:  ALL
42216.59 
The kitchen project is continuing, albeit slowly, which is why I've not updated this for a while. If anyone's interested in seeing what it's like let me know and I'll post a link to a google drive file with pictures of how the whole thing's going, but although the Pi is working it won't be installed for a good few days as yet.
0/0
 Reply   Quote More 

 From:  CHYRON (DSMITHHFX)  
 To:  graphitone      
42216.60 In reply to 42216.59 
I want to see.
“restaurant sues TV chef Gordon Ramsay, claims ‘Kitchen Nightmares’ scenes ‘fabricated’”
0/0
 Reply   Quote More 

Reply to All  
 

1–20  21–40  41–60  61–80  81–92

Rate my interest:

Adjust text size : Smaller 10 Larger

Beehive Forum 1.5.2 |  FAQ |  Docs |  Support |  Donate! ©2002 - 2024 Project Beehive Forum

Forum Stats