I’m trying to control the gpio 12 and 13 pins on the respeaker 2 hat from within node-red (installed in a docker-container).
If I could use these pins it would open a possibility to add infrared transmitter possibilities to the rhasspy-raspberry system.
I tried two ways to do it, but none of them works
Here’s my node-red flow: https://www.dropbox.com/s/oxcr5c3bzbmrb5k/gpioflow.json?dl=1
any idea how to do it using node-red (without making a modified node-red image)?
Yes, I did this last year successfully to control a button and a LED with Node-RED. I don’t have the configuration or flow at hand here, but what I remember is this:
I let this node communicate to the GPIOs with pigpiod, which I installed in a Docker container (I think it was the corbosman/pigpiod image). But running pigpiod directly on Raspberry Pi OS should be fine too.
Another little question:
Is it safe to perform the following manoeuvre (to be able to directly enter npm-commands )?
Won’t that interfere with the node-red gui entered stuff?
found 1 low severity vulnerability in 347 scanned packages
However even though it seemed to install, it was not visible/available in the node-red webinterface. And didn’t want to install there. So I removed it: npm uninstall node-red-node-pi-gpiod
Yes, I did this last year successfully to control a button and a LED with Node-RED. I don’t have the configuration or flow at hand here, but what I remember is this:
I let this node communicate to the GPIOs with pigpiod , which I installed in a Docker container (I think it was the corbosman/pigpiod image). But running pigpiod directly on Raspberry Pi OS should be fine too.
I installed pigpiod in node-red (using manage palette), this time it installed without problems.
I made the following docker-compose.yml
docker-compose up -d doesn’t give any error messages
However the node-red-flow I made to test it, doesn’t make my led at pin 12 light up.
I am puzzled by this text in the documentation of pigpiod:
If using with Docker on Pi then the default Host IP should be 172.17.0.1 . You will also need to run sudo pigpiod on the host.
However the host ip on my system is:
172.18.0.3
Should/Can I change that? How?
And does the ‘sudo pigdiod’-passage mean I should add a user-line to the pigpiod-part of the docker-compose.yml?
I have no experience with pigpiod but to use gpios in docker you need to at least add a device to your docker compose. To get access to WiringPi via docker I needed to add those lines to my docker-compose, pigpiod might need something similar:
You might only need some of those but my research to using gpio pins via docker told me at least one of them is needed, which depends on the library used and I only experimented with WiringPi
I noticed that my respeaker-2 started acting strange after installing the corbosman/pigpiod
Suddenly the respeaker-2 started speaking slowly and with a very low bass voice. Music also played too slowly and frequencies were shifted to the low frequency range.
I reinstalled the drivers for the respeaker-2 but that didn’t help. Finally I removed the pigpiod container and restarted the raspberry. Now the respeaker-2 is acting normally again.
I think your pigpiod might be configured to use PCM as its clock peripheral, and that is also needed for the sound output of the respeaker. There is a option to choose either PWM or PCM. If you choose PWM instead the onboard headphone output will not work. http://abyz.me.uk/rpi/pigpio/pigpiod.html
Try to run pigpiod with -t 0 option to choose PWM instead of PCM and the audio of your respeaker-2 should work again.
If i understand it right you can somehow pass those options to your container.
Try to add command: -t 0 to your pigpiod container…
It works, thanks for the help fastjack and moqart
This is what I have now in my docker-compose.yml for pigpiod:
pigpiod:
image: corbosman/pigpiod
container_name: pigpiod
restart: always
privileged: true
command: -t 0