Closed awong1900 closed 1 year ago
For me i could not make J5 work for any arduino or arduino compatible board. I dont know why im using perl-firmata and it works fine, i suggest you give it a try.
https://github.com/ntruchsess/perl-firmata/tree/master/examples
@ale-novo It seems some change in the latest version has broken the js library. See https://github.com/rwaldron/johnny-five/issues/1817
I used UNO board install ConfigurableFirmata 3.0, still not working. It looks like ConfigurableFirmata has issues with j5 or Firmata.js. I will check perl-firmata follow @ale-novo 's advise.
@awong1900 Check the baudrate that is used. The default baudrate for ConfigurableFirmata 3.0 is now 115200.
Yes, I carefully checked the baud rate. I think i found true reason on UNO.
Make initFirmata();
before initTransport()
, it work on UNO.
initFirmata(); // Change the initialization order.
initTransport();
Becase we need firstly set the firmware version, then begin(115200)
. If not, the printFirmwareVersion()
can not sends the firmware name and version to the Firmata host application.
But still not work on ESP32, it stop on queryAnalogMapping
with Firmata.js.
ive tested J5 like 1 year ago and i was running ConfigurableFirmata v2.10, and like i said i had no luck for it to connect with several boards. Dont know why and i ditched it. i had great success with perl-firmata with several boards with V2.10 and the new V3.0 so i suggest you try it out first to determine the problem is software and not hardware or maybe OS
ive tested J5 like 1 year ago and i was running ConfigurableFirmata v2.10, and like i said i had no luck for it to connect with several boards. Dont know why and i ditched it. i had great success with perl-firmata with several boards with V2.10 and the new V3.0 so i suggest you try it out first to determine the problem is software and not hardware or maybe OS
Thank you for your advise. I'm looking inside the code, trying to print some debug info. I have solved the connection problem between UNO ConfigurableFirmata v3.0.0 and J5. Now looking at why this didn't work on ESP32.
AnalogInputFirmata.cpp
I use line 92 instead of line 91. The firmata.js/example/blink.ino work fine on esp32. So i think the code line 91 not work on esp32 board. @pgrawehr
Like the last comment modified AnalogInputFirmata.cpp
, The J5 test code also work well.
var SerialPort = require("serialport");
var five = require("johnny-five");
const port = new SerialPort("/dev/tty.wchusbserial14310", {
baudRate: 115200,
});
var board = new five.Board({ port: port });
board.on("ready", () => {
// Create an Led on pin 13
const led = new five.Led(2);
// Blink every half second
led.blink(500);
});
You should not be modifying the Analog input cpp
i can connect successfully to ESP32 and run the capability query with perl-firmata w/o any mods and works fine.
i believe J5 is not compatible with ConfigurableFirmata, but only with StandardFirmata, and that may be the reason why it was not connecting for me and/or failing for you.
There is a Difference between ConfigurableFirmata and StandardFirmata. You cant run ESP32 with StandardFirmata as its not defined on boards.h
For ConfigurableFirmata: you need to flash your arduino board with this sketch, that is the one provided with the ConfigurableFirmata project. https://github.com/firmata/ConfigurableFirmata/blob/master/examples/ConfigurableFirmata/ConfigurableFirmata.ino You need to make sure you have the latest ConfigurableFirmata library installed (v3.0.0) and ESP32 board definition
and then launch the j5 example, for instance https://github.com/firmata/firmata.js/blob/master/packages/firmata.js/examples/blink.js
if it does not work try perl-firmata https://github.com/ntruchsess/perl-firmata/blob/master/examples/example-blink.pl
for me with perl-firmata and ESP32 , the capability query works fine and report analog pins, however i noticed a problem only for ESP32 where it reports initially the analog value but then freezes, ie it does not update again despite being in a loop.
OK, I'm sure you can use perl-firmata to complete the connection. You have do great test.
however i noticed a problem only for ESP32 where it reports initially the analog value but then freezes, ie it does not update again despite being in a loop.
Now, it is our biggest problem.
let me know if you fix it
@awong1900 Can you describe exactly what steps you're executing to freeze the ESP32? I'm not sure I'm following the scenario you have a problem with.
for me i can describe what ive seen. i was thinking on creating a new issue since its not related with this 'connection' issue.
For me ESP32 analog input works, however the analog value freezes with the initial value.
lets say you connect your esp32 using firmata to a client, and query your analog pin. the pin maybe reports a value of 255 (0-1024), then if you move pot the analog pin still reports 255
other boards when you move your pot they report the right value for the new pot position. for ESP32 there is a bug where the analog value does not get updated after the initial value is reported.
hope its clear
@ale-novo Yes, please open a separate issue on this. I noticed that I never tested analog input on ESP32, and I can reproduce that it isn't working as expected. I'm investigating.
I will make a new issue . #145
I use esp32 with ConfigurableFirmata 3.0.0. The firmware use
ConfigurableFirmata.ino
. Success flash to esp32, and outputThen i test it with J5 and Firmata.js, like this
Output:
Firmata.js code:
Output:
The esp32 chip info:
It looks like the ready communication is not complete. Any suggestions would be appreciated.