Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
Travis Martin
@marti2221
oh sweet! you wouldn't happen to have any experience working with the expander board would you?
having trouble understanding what ill need to do to connect my arduino uno to a "CD74HC4067" multiplexer. it appears ill need to use an arduino nano as a "backpack", however im not sure if that just gets installed with StandardFirmata or something else (i noticed a cd74hc4067 nano backpack in the j5 github).
Travis Martin
@marti2221
@nebrius also, do you know of a more active j5 community? I've noticed many of the nodebot groups seem to be dwindling as well.
Bryan Hughes
@nebrius
@marti2221 yeah, there isn’t as much activity in general around J5 these days.
I haven’t used backpacks myself, so I can’t help much. I seem to recall that they use non-firmata custom firmware, but I could be mistaken. @dtex can you add some insight?
Travis Martin
@marti2221
@nebrius @dtex Ok from what I've read, I'll have to install StandardFirmata to Uno. Connect the Uno to nano via i2c. Install custom firmware found in j5 github @ directory "johnny-five/firmwares/". Then just make sure wired as shown in docs, and should be good to go?
Bryan Hughes
@nebrius

@marti2221 I did a little more digging, and figured out what you'll need to do:

  1. Flash the backpack firmware to your Nano using the Arduino IDE (this part is not well documented).
    1. Installed the Arduino IDE on your computer, if you don't already have it: https://www.arduino.cc/en/Main/Software
    2. Download the backpack firmware to your computer: https://github.com/rwaldron/johnny-five/blob/master/firmwares/cd74hc4067_i2c_backpack.ino
    3. Connect your Arduino Nano
    4. Configure the Arduino IDE for use with your Nano: https://www.arduino.cc/en/Guide/ArduinoNano
    5. Upload the firmware to your Nano
  2. Wire up your project the same as shown in http://johnny-five.io/examples/expander-CD74HC4067_NANO_BACKPACK/
  3. Run the example code at http://johnny-five.io/examples/expander-CD74HC4067_NANO_BACKPACK/ and everything should work

Let us know how it goes!

Travis Martin
@marti2221
@nebrius Thanks a lot! i will let you know how it turns out when i get some time. Ill obviously still have to install the StandardFirmata(Plus) on the Arduino Uno as well, yes?
Bryan Hughes
@nebrius
Yes that is correct, you'll also need StandardFirmata(Plus) on the Uno, which you can install using more or less the same instructions as the first step above
Travis Martin
@marti2221
yep i gotcha. thanks again
Travis Martin
@marti2221
@nebrius hey i meant to ask whether i need to install another firmata if i want some more functionality with the Ardi Nano? So will I have to install the standardFirmata AND the backpack firmware for the cd74hc4067? If i want to wire up a dht sensor to that same board, will i have to install the backpack firmware pertaining to that as well?
Travis Martin
@marti2221
I would still like to be able to use the other pins on the nano, is my main concern
Travis Martin
@marti2221
also one more question. Would I be able to hook up any other i2c sensors (seeing as how the SDA/SCL pins will be used on the Uno -> Nano Backpack connection)?
Travis Martin
@marti2221
@dtex might you be able to answer my questions regarding multiple firmware packages on the nano backpack and multiple i2c devices?
Bryan Hughes
@nebrius
@marti2221 unfortunately you can only install one firmware at a time on any given Arduino, so you'll have to pick one or the other
I2C is a bus protocol, which means you can chain together multiple I2C devices on a single I2C port. http://www.goodliffe.org.uk/arduino/i2c_devices.php has some photos of how to do this
Are you not able to use the pins on your Arduino Uno that the Nano is connected to?
Travis Martin
@marti2221
gotcha so that nano can only be used for one thing at a time(installing cd74hc4067 firmware in this case). Yes i am able to use the Uno. I will just be using a lot of sensors, so if i couldve migrated a few over to the nano board that wouldve been nice, but thats ok. Seems like ill just have to connected to a shift register for some outputs. Then i can connect more i2c sensors via the Uno a4/a5 or the two other sda/scl pins on the Uno (behind the icsp header) as long as the devices have unique addresses. Sound correct?
@nebrius sorry didnt tag you in that
Bryan Hughes
@nebrius
Yes, that sounds correct @marti222
Travis Martin
@marti2221
Awesome! i receive the nano in the mail today. i will let you know how it goes once i get everything set up. Thanks again, huge help
Bryan Hughes
@nebrius
You’re welcome 😊
Travis Martin
@marti2221
I followed those instructions and im getting a "Device or Firmware Error" in the terminal. I downloaded the firmware from github, opened it with Arduino IDE and uploaded it to the Nano successfully. I then wired my boards as shown in the docs, no luck. Keep getting the same error. Doesnt even show the console.log() in my "ready" event handler. My nano does appear to be getting power, as the red pwr led is on.
Travis Martin
@marti2221
ok seems to be an issue with raspi-io. i have commented out my require() and instantiation of the raspi board and the error is gone. Weird cuz i had this setup without the nano (just raspi-io board and an Uno board), and everything was working fine. ill eventually have to work out why thats happening, as i will need to use the raspi board for some extra digital inputs (buttons). However now the value is being logged as 0.
Travis Martin
@marti2221
@nebrius i have now tried a couple different ports and results are the same (0 val). I did notice that the MODE is changing from 1 -> 2(Analog) on the pins that i have connected to a potentiometer.
Bryan Hughes
@nebrius
@marti2221 regarding raspi-io and an Arduino, that’s an advanced use case. In this scenario, you’ll need to instantiate two board instances, not one. One is for the Raspberry Pi,’the other for the Arduino Uno. Without using raspi-io, what you’re effectively doing is using the Raspberry Pi in place of your laptop (and in fact could just use your laptop instead of the RPi).
See http://johnny-five.io/api/boards/ for info on using multiple boards
As for getting no value, can you post your code and a photo of your wiring setup? I suspect there’s some mismatch somewhere
Travis Martin
@marti2221
@nebrius i got it! just tried a new breadboard and everything worked great!
Travis Martin
@marti2221
@nebrius and yes, thats exactly what i did. I had it running with two boards (Uno and Raspi) before attempting my hookup of the nano. Im gonna give that a go again tomorrow now that i have everything working on the Nano <- Expander <- Analog input setup.
Travis Martin
@marti2221
@nebrius Also, you had mentioned that there was no way to do multiple firmware backpacks on the nano. But in a previously closed github issue (rwaldron/johnny-five#1476), @dtex seems to indicate otherwise.
Bryan Hughes
@nebrius

@marti2221 so there's a couple things going on here. First, let's step back and define a few things, because it's easy to get things mixed up with each other:

  1. On any Arduino, you can only load one program at a time (often referred to as "firmware." In the case of an Arduino, "program" and "firmware" are interchangeable terms). A program is a set of C++ or assembly source code, compiled into a single executable file (usually a .bin file) that gets loaded into the Arduino's flas memory.
  2. You cannot load more than one program on an Arduino. Indeed, it's not possible to run more than one program on any computing device. In most cases, we load a program we call an operating system, which is really just a program that allows us to run other programs that appear to run at the same time. It's not possible to run an operating system on an Arduino though, because it's too underpowered.
  3. Firmata.js is a set of programs (e.g. StandardFirmata, StandardFirmataPlus, etc.), one of which can be loaded onto any given Arduino at a time. Each of these programs more or less does the same thing, with only slight variances between them. Firmata is a general purpose server that listens for and sends commands over a serial port that allows a remote client to perform standard operations (writing/reading from GPIO, writing/reading from I2C, etc).
  4. A backpack is a special purpose program written for an Arduino that behaves similarly to Firmata, except that it provides higher level commands for a specific use case that often perform multiple general purpose commands under the hood. Instead of providing commands to access to all GPIO/I2C/PWM/etc., it provides commands for a specific sensor or other external device connected in a specific way to the backpack device (often just referred to as a "backpack"). The reason this is useful is because we can coordinate timing-sensitive operations that otherwise wouldn't be possible with Firmata due to latency.
  5. Backpack programs are not Firmata. Although they may seem similar from a functional perspective, they are distinctly difference codebases.

Ok, so with this in mind, when we talk about combining multiple backpacks together, what that means in practice is finding a way to combine multiple backpack programs into a single program. Just like with any JavaScript application, combining two programs into one requires special coding (you can't just run Express.js and Mongoose together and have a working application...it requires writing code to wire them together).

In the case of the issue you linked to, this is a difference scenario, and I get that this is confusing due to terminology. In that issue, when they say "multiple backpacks," they don't mean "multiple backpack programs on a single backpack device," they mean "multiple backpack devices, each with a single backpack program per device."

Hope this helps.

Travis Martin
@marti2221
@nebrius This helps immensely, thank you for such a thorough response. So as i understand it, installing both a firmata and a backpack will not be possible without combining the two C++ codebases somehow(both are uploaded to arduino). Is this correct?
Bryan Hughes
@nebrius
@marti2221 correct, and it’s likely that J5 would need to be modified as well to support these new multiple backpacks, although I can’t say for sure
Travis Martin
@marti2221
ok so i was successful in reading analog signals from my [Uno <-- Nano backpack <-- expander <-- potentiometer] setup. However I've encountered an issue with trying to daisy chain 2 74hc595 shift registers together in series. I didn't understand the "daisy-chain" example in the docs, as there is no bit shifting or sending of bits to the register. I also wont be using a seven segment display, so much of the code wouldn't apply to my use case. I tried wiring it up as shown on that same doc page, and tried just sending different integer literals to the register, lighting the leds one at a time. All but a few light up with my 8 bit binary literals (128, 64, 32, 16, 8, 4, 2, 1). Im sure the few that aren't lighting are just connection issues. However when I send my binary to the register, it is turning on two leds at a time (pins: 0,8 / 1,9 / 2,10 / 3,11 / etc.). How can i control the pins individually? I tried using 16 bit binary integers, but that didn't work. I also changed the size prop on the register to 2.
I also tried using the 74hc595 expander class. I keep getting an error saying I need to use a valid controller. Has this feature been deprecated?
Travis Martin
@marti2221
@nebrius Shooot! keep forgetting to tag you in my questions. lol
Travis Martin
@marti2221
@nebrius Here is the doc page i was referring to. It says we can control both with one instance of ShiftRegister, but does not show how the bits will be shifted or sent to the register like the non daisy-chain docs do.
Travis Martin
@marti2221
@nebrius Also if i instantiate the register but do not call any methods on it, all the leds stay on. So looks like connections are good.
Carltoso
@Carltoso
hello
I have built a smart robot elegoo v3 - and I want to connect to a rest api. Should I go nodebots way and attach a wifi-module somehow or should I go the bluetooth hc-06 way..
My node script for get request are already written
Carltoso
@Carltoso
something tells me, that running my script through my computer and sending to serial port would be the easiest way
Bryan Hughes
@nebrius
@marti2221 when you instantiate the expander class, what code are you using to instantiate it?
As for your first issue, the ShiftRegister class was specifically designed for seven segment displays. It might be possible to do what you want to do, but you'll have to do some reverse engineering to figure out the right sequencing

@carltoso

something tells me, that running my script through my computer and sending to serial port would be the easiest way

I think this would be easiest, yes

Travis Martin
@marti2221
@nebrius ok i see. I have instantiated the expander via the Expander class, then setting the io prop of the virtual board. However i did get a single 74hc595 expander to work, and it looks like i have enough IO to just use that. thanks again.
Travis Martin
@marti2221
@nebrius I have no idea why i cannot get the bh1750 (I2C light) sensor working. I have wired vcc --> 5v/ GND --> GND/ A4 --> SDA/A4 --> SCL/ ADDR left open, as stated in docs. I am getting a reading of { level: 0, lux: 0 } with the following code:
var five = require("johnny-five");
var Raspi = require("raspi-io").RaspiIO;

var ports = [
    { id: "A", port: "/dev/ttyACM0" },
    { id: "rpi", io: new Raspi() }
];

const boards = new five.Boards(ports).on("ready", () => {
    const ardi = boards[0]
    const raspi = boards[1]
    const lux = new five.Light({
        controller: "BH1750",
        address: 0x23
    });
    lux.on("data", (lux) => {
        console.log(lux)
    });
})
Bryan Hughes
@nebrius
@marti2221 following up from the other channel, do you currently have two sensors connected? If so, did you set the address bit high on one and low on the other (a pull-up/pull-down resistor is preferred, but you can also connect it directly to vcc/gnd respectively)?
Cory Fail
@fyroc
Hello, 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?