Looking for a node package to use to integrate the 4-mic hat. I haven’t found anything so far - do you know of anything?
Hi, Sorry we do not have the node package for respeaker 4-mic hat. thanks.
Seeed techsupport team
Bill
Thanks for the response. Is there any reason that the Respeaker would not work with node packages for Raspberry Pi? I’m assuming that this is essentially GPIO control (which I’m new at). I’m trying some node.js code that uses a package for APA102 LEDs, but no luck so far.
Any tips on control of the LEDs and mics would be appreciated.
Hi I tested the LED with nodejs successfully. the LED uses the SPI and audio uses the I2S. we have to enable te spi first by following https://www.w3schools.com/nodejs/nodejs_raspberrypi.asp.
- install dependiences
sudo apt-get update
sudo apt-get dist-upgrade
curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
node -v
npm install apa102-spi
- please create a led.js file with below code.
var Apa102spi = require(‘apa102-spi’)
// Apa102spi(number of leds, clock divider)
var LedDriver = new Apa102spi(9, 100)
// setLedColor(n, brightness 0-31, red 0-255, green 0-255, blue 0-255) , n=0 led1; n=1, led2; n=2, led3;
LedDriver.setLedColor(0, 1, 255, 0, 0)
// send data to led string
LedDriver.sendLeds()
- run node led.js and see the led turned on.
For the I2S, i do not test it. thanks.
Seeed techsupport team
Bill
Thanks - got the LEDs working. Now on to figuring out the mics!
I found the code for ReSpeaker 6-Mic Circular Array kit for Raspberry Pi as well:
[code]
var onoff = require(‘onoff’);
var Gpio = onoff.Gpio;
led = new Gpio(5, ‘out’);
// turn on (required for ReSpeaker 6-Mic Circular Array)
led.write(1, function() { console.log(“Changed LED state to: 1”); });
// npm install apa102-spi --save
var Apa102spi = require(‘apa102-spi’); // requires to run the node in as root (sudo node index.js)
// Apa102spi(number of leds, clock divider)
var LedDriver = new Apa102spi(12, 100);
function ledPower(power) {
if (power != 1) power = 0;
led.write(power, function() { console.log("Changed LED state to: " + power); });
LedDriver.setLedColor(0, 0, 255, 0, 0);
LedDriver.sendLeds();
}
function ledPowerOn() { ledPower(1); }
function ledPowerOff() { ledPower(0); }
ledPowerOn();
[/code]
@piparmer I’m trying this now with the 6 mic array and no LEDs are turning on. I managed to install all dependencies & run it as sudo. Am I missing anything?
I confirmed that LEDs work, because I managed to get them all working with the python demo. I also tried using hooloovoo with the ReSpeaker, but was only able to get 10/12 LEDs lighting up.