Code Monkey home page Code Monkey logo

phat-beat's Introduction

pHAT BEAT https://shop.pimoroni.com/products/phat-beat

Stereo amplifier, buttons and dual RGB VU meter for your Pi.

Installing

Full install (recommended):

We've created an easy installation script that will install all pre-requisites and get your pHAT BEAT up and running with minimal efforts. To run it, fire up Terminal which you'll find in Menu -> Accessories -> Terminal on your Raspberry Pi desktop, as illustrated below:

Finding the terminal

In the new terminal window type the command exactly as it appears below (check for typos) and follow the on-screen instructions:

curl https://get.pimoroni.com/phatbeat | bash

Alternatively, on Raspbian, you can download the pimoroni-dashboard and install your product by browsing to the relevant entry:

sudo apt-get install pimoroni

(you will find the Dashboard under 'Accessories' too, in the Pi menu - or just run pimoroni-dashboard at the command line)

If you choose to download examples you'll find them in /home/pi/Pimoroni/phatbeat/.

Manual install:

Library install for Python 3:

on Raspbian:

sudo apt-get install python3-phatbeat

other environments:

sudo pip3 install phatbeat

Library install for Python 2:

on Raspbian:

sudo apt-get install python-phatbeat

other environments:

sudo pip2 install phatbeat

Development:

If you want to contribute, or like living on the edge of your seat by having the latest code, you should clone this repository, cd to the library directory, and run:

sudo python3 setup.py install

(or sudo python setup.py install whichever your primary Python environment may be)

Documentation & Support

Third Party Libraries

phat-beat's People

Contributors

cwjordan avatar dependabot[bot] avatar g6ai avatar gadgetoid avatar lurch avatar mstahel avatar roguem avatar sandyjmacdonald avatar stg7 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

phat-beat's Issues

Integrate MQTT

I'm trying to integrate MQTT messages into the phatbeatd service, so that I can change the station via MQTT messsages.

The MQTT can in general connect to the MQTT server, but only if I manually restart the service after boot. During boot, I always get a socket.error: [Errno 101] Network is unreachable.

I can't figure out how to make the service wait until a proper internet connection is established. I tried changing the service definition to wait for network, named or all, but I still get the same error. I changed the raspi-config settings to wait for network on boot, but still the same error.

Anybody have some advice?

Error in the vlcd script

in line 10, it should be "chown" and not "chmod". You're changing the owner of /home/pi/.config/vlc/ to pi, group pi, not changing permissions.

Build a customised Raspbian image for vlc radio.

Hello,

I use my Pirate Radio to listen to streams with the help of the scripts in the vlc radio project.
Since I use my pirate radio only for that purpose, I don't need to install scripts on an already existing OS. I prefer to flash an image on an SD card for the purpose of the Pirate Radio. I find it more convenient and a common thing to do for embedded devices.

So I have forked the RaspberryPi tool they use to generate Raspbian images and added a step to configure the OS to work as the scripts do in the vlc radio repo. There should be no difference in the results of this build and the modifications done to the OS by the classic install. This will result in a ready to use image to flash on the SD card and enjoy the Pirate Radio.

The repo is here: https://github.com/pirateradiohack/PiRadio
The code I have added on top of official Raspbian is here: RPi-Distro/pi-gen@master...pirateradiohack:master

cheers

Change Port of VLC

I would like to change the port for VLC web interface to 80 but that does not seem possible. I changed the config in /usr/bin/vlc but then it wasn't accessible on 80 or 8080. I switched it back and then it was accessible on 8080. So it seems that it is the correct file to edit but there is something blocking.usage of port 80.

This was installed on a fresh install of Raspbian Buster Lite.

Audio plays too fast on Zero W

To reproduce, play an ogg file with ogg123. I timed it, and a 3:24 song finishes playing in 3:07 and sounds higher pitch than normal. This is consistent with the difference between 44100Hz and 48000Hz.

The VLC Radio installer does not work on this version of Raspbian...

Installing PirateRadio (get.pimoroni.com/vlcradio) on a new Pirate Radio Kit...

Install mostly works, but ends with:
--- Warning ---

The VLC Radio installer

does not work on this version of Raspbian.

Check https://github.com//

Looks like the issue begins with the install of vnc-nox...

Checking for dependencies...

vlc-nox is required

Checking for dependencies...

vlc-nox is required

Installing vlc-nox...

E: Package 'vlc-nox' has no installation candidate

Apt failed to install vlc-nox!

Falling back on pypi...

This is in a new, clean install of raspian lite :

uname -a

Linux raspberrypi 4.19.57+ #1244 Thu Jul 4 18:42:50 BST 2019 armv6l GNU/Linux

cat /etc/os-release

PRETTY_NAME="Raspbian GNU/Linux 10 (buster)"

NAME="Raspbian GNU/Linux"

VERSION_ID="10"

VERSION="10 (buster)"

VERSION_CODENAME=buster

...

Will continue to fiddle...

pulseaudio on Rpi4, bookworm, 64bit

Hello void,

I know that this is completely unmaintained, but maybe someone is still listening in on this and has some ideas. I really like the phat-beat hat and it's still working fine, but I wanted to upgrade the RaspberryPi underneath for different reasons. I started the old install scripts on a brand new bookworm 64bit.

  • OS_NAME could not be determined, so it patched that variable
  • The python package can't be installed via python anymore, but via apt, so I patched that
  • wiringpi is now available from here: https://github.com/WiringPi/WiringPi/releases/download/3.1/wiringpi_3.1_arm64.deb, so I patched that
    • 3.2. didn't work, don't remember the exact log anymore, but it said to use 3.1 instead
  • So the installation seems to run through.

The phatbeat Python library doesn't properly connect to the board, when doing phatbeat.set_all(0,128,0,0.1) it crashes due to

Traceback (most recent call last):
  File "/usr/bin/phatbeatd", line 192, in <module>
    phatbeat.set_all(0,128,0,0.1)
  File "/usr/lib/python3/dist-packages/phatbeat/__init__.py", line 250, in set_all
    setup()
  File "/usr/lib/python3/dist-packages/phatbeat/__init__.py", line 325, in setup
    GPIO.add_event_detect(button, GPIO.FALLING, callback=_handle_button, bouncetime=200)
RuntimeError: Failed to add edge detection
Exception ignored in atexit callback: <function _exit at 0x7faf6e5a80>

I can live without the actual phatbeat LED stuff, I only care about audio output, so I removed the GPIO.add_event_detect call from the python library.

Now my last hurdle seems to be that pulseaudio can't connect to the actual board.

pulseaudio[705]: Using device: phat-beat
pulseaudio[707]: gpio: Unable to open GPIO direction interface for pin 23: No such file or directory
pulseaudio[709]: gpio: Unable to open GPIO direction interface for pin 24: No such file or directory
pulseaudio[705]: [pulseaudio] module-alsa-card.c: Failed to find a working profile.
pulseaudio[705]: [pulseaudio] module.c: Failed to load module "module-alsa-card" (argument: "device_id="1" name="platform-fef00700.hdmi" card_name="alsa_card>
pulseaudio[705]: [pulseaudio] module-alsa-card.c: Failed to find a working profile.
pulseaudio[705]: [pulseaudio] module.c: Failed to load module "module-alsa-card" (argument: "device_id="2" name="platform-fef05700.hdmi" card_name="alsa_card>
pulseaudio[705]: [pulseaudio] server-lookup.c: Unable to contact D-Bus: org.freedesktop.DBus.Error.NotSupported: Unable to autolaunch a dbus-daemon without a>
pulseaudio[705]: [pulseaudio] main.c: Unable to contact D-Bus: org.freedesktop.DBus.Error.NotSupported: Unable to autolaunch a dbus-daemon without a $DISPLAY>

I guess both the Python issue and the pulseaudio issue are due to some GPIO changes, but here I'm a little but clueless. Any further hints would be appreciated.

Maybe @Gadgetoid, I saw you commenting on these things in the past.

vlcradio installation scripty fails on Rasbian Buster

Running "curl https://get.pimoroni.com/vlcradio | bash" gives the following error:

The VLC Radio installer
does not work on this version of Raspbian.
Check https://github.com//
for additional information and support

This is because there is no check for Buster in the
Pimoroni/phatbeat/projects/vlc-radio/setup.sh installation script
The raspbian_check() routine needs to be modified as shown below to support Rasbian Buster


raspbian_check() {
IS_SUPPORTED=false
IS_EXPERIMENTAL=false

if [ -f /etc/os-release ]; then
    if cat /etc/os-release | grep -q "/sid"; then
        IS_SUPPORTED=false && IS_EXPERIMENTAL=true
    elif cat /etc/os-release | grep -q "stretch"; then
        IS_SUPPORTED=false && IS_EXPERIMENTAL=true
    elif cat /etc/os-release | grep -q "jessie"; then
        IS_SUPPORTED=true && IS_EXPERIMENTAL=false
    elif cat /etc/os-release | grep -q "wheezy"; then
        IS_SUPPORTED=true && IS_EXPERIMENTAL=false
     elif cat /etc/os-release | grep -q "buster"; then
        IS_SUPPORTED=true && IS_EXPERIMENTAL=false
    else
        IS_SUPPORTED=false && IS_EXPERIMENTAL=false
    fi
fi

}

I have tested it with the above modification and vlc-radio then installs and runs fine.
Bob Rathbone

latest 2019-04-08-raspbian-stretch issue

My phat beat has been working fine on the prior release of stretch (2018-11-13-raspbian-stretch), but there appears to be an issue with the latest version.

It's a new install, ran 'sudo curl -sS get.pimoroni.com/phatbeat | bash' without issue, and the speaker-test from the command line works great. But in the desktop environment , the audio device is disabled (the task bar speaker icon has a red 'X', and the volume control is disabled). When clicking on the speaker icon, it shows snd_rpi_hifiberry_dac with a green checkmark, but when I attempt to open device settings via the task bar or via Audio Device Settings in Preferences, a popup window appears with the error "No ALSA Devices Found".

Not sure if this is a pulseaudio vs alsa issue, but any suggestions would be welcome.

Add a sleep timer

It would be great to be able to fall asleep to the radio, knowing it's going to shutdown in 20 minutes when holding the power off button for 2 seconds.

Occasional hang when closing a audio device.

To reproduce, play an ogg file with ogg123 while having the vumeter enabled. Press ctrl-c to stop playing. About 50% of the time this result in ogg123 hanging. The VU meter remains lit when this happens.

'Unary operator expected' when running phatbeat install script

I recently tried to use the installation script to set up my phat beat once again but got three 'Unary operator expected' errors at various times during the scripts execution, it doesn't fail and continues with other bits it is doing but quite crucially things didn't work afterwards. I am using Raspbian OS Lite (32-bit)

I was able to get it to work properly again by executing the following commands at the terminal:
extract OS_NAME="Raspbian"
extract USER_HOME="/home/pi"

I also had to install git sudo apt install git and then the script ran perfectly.

I wasn't sure if this was the best way to post this as I have already solved the issue but I wanted to share my findings so I can hopefully save someone else many hours of debugging

wiringpi not available on bullseye

I tried to install this on the latest bullseye release, but there wiringpi is deprecated, thus the installation fails. Is there any hint on how to overcome this?

Thanks!

Update to Raspbian Stretch

It would be very nice if the installer could be updated to Raspbian Stretch. I tried it but it's not working and I switched back to Jessie.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.