Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    Bryan Hughes
    @nebrius

    I finally managed to get a bit of time to update dependencies. I’m looking at i2c-bus, but I’m struggling to figure out precisely what the breaking changes in v2 and v3 are (raspi-i2c is still on 1.x)

    For v2 it looks like error handling changed a bit, but I can’t tell specifically what it changed to and how I need to modify my code to handle this. Can you go into some depth on that?

    For v3, it looks like the only breaking change is dropping support for older versions of Node.js, correct?

    @fivdi similar thing for pigpio. Is v1.0.0 a breaking change, or was this just getting it into proper semver range?
    Brian Cooke
    @fivdi
    As you already noticed, with i2c-bus v2 error handling changed. The properties of the Error object that are thrown are different to v1. Errors are now thrown from JavaScript rather than from C++. This is probably of no relevance for raspi-i2c. Correct, with v3 dropping support for Node.js < v4 is the breaking change.
    With pigpio is was just getting into proper semver range. There was no breaking change.
    Bryan Hughes
    @nebrius
    Thanks @fivdi! I’m going to try and get the updated version published this week sometime (I’m pretty swamped, so probably not today)
    Bryan Hughes
    @nebrius
    I just published v9.0.0 of raspi-io! It updates pigpio, i2c-bus, and serialport to the latest versions and drops support for Node 4 across the board
    Bryan Hughes
    @nebrius
    I just tested in Node 10 as well and everything looks good!
    Brian Cooke
    @fivdi
    Excellent :+1:
    Jérôme Loï
    @gorhgorh
    :+1: cool i just got a 3 and planned to play with it this weekend :)
    Bryan Hughes
    @nebrius
    Nice @gorhgorh! :D
    Brandon
    @bmf
    Does anyone have any tutorials / tips on getting Raspi-io working in a docker container?
    Bryan Hughes
    @nebrius
    @bmf sorry, been away at Burning Man this last week. Check out https://github.com/nebrius/johnny-five-iot-edge, it has some rudimentary documentation for getting Raspi IO working in Azure IoT Edge, which uses Docker.
    Brandon
    @bmf
    @nebrius Thank you for the pointer. Hope you had a good time out in the desert.
    Bryan Hughes
    @nebrius
    Thanks, it was fantastic!
    kTweaks
    @EricLegend
    Hey everyone, really new to this. Using an LED strip (WS2812) with https://github.com/beyondscreen/node-rpi-ws281x-native and it says to init use const board = new five.Board({ io: new Raspi({ excludePins: 'GPIO18'}) // Exclude GPIO18 from raspi-io }); but why would I do that if my LED's are on GPIO18?
    Bryan Hughes
    @nebrius
    @EricLegend. We exclude this pin because Raspi IO doesn't support talking to WS2812's. To talk to WS2812's, you'll need to use an independent library. By default, Raspi IO controlls all pins on the Raspberry Pi in such a way that it prevents other libraries from using the pins too. To allow the node-rpi-ws281x-native module to access GPIO18, you need to tell Raspi IO to not control that one pin so the other library can.
    Bryan Hughes
    @nebrius
    Cross-posting from the johnny-five gitter: Hey everyone, I just released v10.0.0 of Raspi IO!!! This release is a major rewrite of Raspi IO. It's now all written in TypeScript , has a more moduler and maintainable architecture, and greatly improves performance! CPU Usage had a regression somewhere in the old codebase, and would spike to 100% even with the LED hello world. CPU usage is now at 6-7% on an RPi 3 for LED hello world.
    Be aware that there are a number of breaking changes to be aware of. Check out the details at https://github.com/nebrius/raspi-io/blob/master/CHANGELOG.md
    Tiago Alves
    @tralves
    :+1:
    Prateek Chachra
    @prateekchachra
    Hello
    Anyone active here? Wanted to ask a question
    Bryan Hughes
    @nebrius
    Hi @prateekchachra, what's up?
    Prateek Chachra
    @prateekchachra
    Hey! So I wanted to do some digital audio processing through raspberry pi, I successfully have the digital input for the audio file. Wanted to ask how to use python to store and manipulate the file
    Its hard to do with a file that's already in byte form
    I'm using a MCP3204 IC to get the digital input signal
    Bryan Hughes
    @nebrius
    @prateekchachra This project is JavaScript only and it doesn't interface with audio either. You'd be better off asking in some Python forums
    Travis Martin
    @marti2221
    @nebrius im having trouble connecting buttons to the raspi-io plugin. When i instantiate a new button instance in the raspi board's "ready" event, I get an error saying I cannot set property 'mode' of undefined. console.log confirms event callback is running.
    Bryan Hughes
    @nebrius
    @marti2221 can you post your code here?
    Bryan Hughes
    @nebrius
    @marti2221 oh also, can you paste the full stack trace here?
    Travis Martin
    @marti2221
    (node:12999) UnhandledPromiseRejectionWarning: TypeError: Cannot set property 'mode' of undefined
    at Firmata.pinMode (/home/pi/node_modules/firmata-io/lib/firmata.js:936:25)
    at Button.value (/home/pi/node_modules/johnny-five/lib/button.js:30:17)
    at new Button (/home/pi/node_modules/johnny-five/lib/button.js:296:10)
    at Board.<anonymous> (/home/pi/Documents/Projects/smartGarden/index.js:18:14)
    at Board.emit (events.js:215:7)
    at Board.EventEmitter.emit (domain.js:476:20)
    at Board.finalizeAndBroadcast (/home/pi/node_modules/johnny-five/lib/board.js:475:12)
    at Board.<anonymous> (/home/pi/node_modules/johnny-five/lib/board.js:145:18)
    at Firmata.ready (/home/pi/node_modules/firmata-io/lib/firmata.js:736:9)
    at Object.onceWrapper (events.js:299:28)
    @nebrius
    const Raspi = require("raspi-io").RaspiIO;
    const five = require("johnny-five");
    console.log("Program is running");
    
    const ports = [
            { id: "A", port: "/dev/ttyACM0" },
            { id: "rpi", io: new Raspi() }
    ]
    
    const boards = new five.Boards(ports);
    
    const raspi = boards[0];
    const arduino = boards[1];
    
    raspi.on("ready", () => {
            console.log("heyey");
            const btn = new five.Button("GPIO27");  
            console.log("hello");
    });
    Travis Martin
    @marti2221
    @nebrius i should also mention that i soldered the wires to the bottom of the header pins as a last resort hack, since i ordered the wrong gender wires.
    Bryan Hughes
    @nebrius
    @marti2221 Ah, so what's happening here is the new five.Button() call doesn't specify a board, so it's defaulting to the Arduino. The Arduino doesn't know what GPIO17 is, so that's why it's crashing
    Instead, you'll need to instantiate your button as such:
    const btn = new five.Button({ pin: 'GPIO27', board: raspi });
    Travis Martin
    @marti2221
    man. im pretty sure i had tried that before i switched to that setup. What i had before was:
    
    var five = require("johnny-five");
    var Raspi = require("raspi-io").RaspiIO;
    
    var ports = [
        { id: "A", port: "/dev/ttyACM0" },
        { id: "rpi", io: new Raspi() }
    ];
    
    var boards = new five.Boards(ports).on("ready", function(){
        A = boards[0];
        rpi = boards[1];
    
    var btn = new five.Button({
            pin: "GPIO",
    })
    Bryan Hughes
    @nebrius
    @marti2221 The board: raspi is the magic sauce you need, which is still missing in this example
    Travis Martin
    @marti2221
    yes sorry accidentally hit enter, heres the rest
    @nebrius
    var btn = new five.Button({
            pin: "GPIO27",
            board: rpi
    })
    btn.on("up", ()  => {
            console.log("button pressed");
    })
    i believe that was giving me the same error, but im not home right now so im unable to recreate the issue
    @nebrius ill let you know how it goes when i get home either sun/mon
    @nebrius i was able to connect the button to the board. but when i ran the .on("ready") listener, i was getting that error. Like i said ill have to try it again when im back home to be sure.
    Travis Martin
    @marti2221
    @nebrius hey i found out i was using the wrong model pin diagram so my GPIO pins were off. I've got it all working now tho. Mux expander (via nano backpack) that reads analog sensors, a 74hc595 shift register used to expand digital outputs that will connect to relay boards. The relay boards will control solenoid valves and a water pump. The raspi reads digital inputs from buttons to turn on those relays. Then i plan to connect to a blynk app for mobile control. Thanks for your help, ill continue to keep you posted on my progress.
    Bryan Hughes
    @nebrius
    @marti2221 Thats awesome, I'm glad you figured that out!
    Travis Martin
    @marti2221
    @nebrius now with i2c, if i want to use 2 of the same sensors (BH1750 Light), i need two different addresses. from what ive read, ill need a pull up resistor (or can i just connect the address pin to HIGH voltage?). how will i know what to set the address properties to on the sensors?
    i guess that should prob go in the other convo, sorry.
    Cory Fail
    @fyroc
    @nebrius I'm trying to connect a Adafruit Ultimate GPS with USB to my Raspberry Pi Zero W and be able to use it with Johnny-Five. How would I do this since it's USB? It has built-in USB to Serial, so would I just need to enable serial in rasp-io and it'll find the GPS module automatically?
    Bryan Hughes
    @nebrius

    @nebrius I'm trying to connect a Adafruit Ultimate GPS with USB to my Raspberry Pi Zero W and be able to use it with Johnny-Five. How would I do this since it's USB? It has built-in USB to Serial, so would I just need to enable serial in rasp-io and it'll find the GPS module automatically?

    @fyroc In theory that should be the case, but a quick glance at the code seems to indicate that Raspi IO only supports the default, built in serial-port I'm afraid.

    Cory Fail
    @fyroc
    @nebrius so does that mean it will not work at all?
    Bryan Hughes
    @nebrius
    @fyroc I’m afraid so
    Cory Fail
    @fyroc

    @nebrius now I'm curious to whether I can just use another GPS NPM package. For example, https://www.npmjs.com/package/gps.

    Then just use it with Johnny-Five.

    Bryan Hughes
    @nebrius
    @fyroc yep, you can totally do that