Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to connect with johnny-five / firmata.js #10

Closed
techniq opened this issue Nov 22, 2016 · 6 comments
Closed

Unable to connect with johnny-five / firmata.js #10

techniq opened this issue Nov 22, 2016 · 6 comments

Comments

@techniq
Copy link

techniq commented Nov 22, 2016

I've been having a lot of difficulty trying to get my new Bluefruit LE UART Friend to work with johnny-five/firmata.js. I've followed the instructions outline here and here to wire up and flash the special version of firmata to work with the module.

It appears to be able to connect using Node/johnny-five/firmata.js I need to use something like ble-serial or ble-serialport for the BLE virtualport, but thus far I've not had any success (it just hangs / times out). I have left a similar issue on ble-serial's issues, although I thought it was worth asking here.

I am able to connect to the device successfully using the Android Bluefruit LE app and can control the onboard LED (pin 13) of my Arduino Nano using the app under Pin I/O. I can also connect using the Bluefruit LE Desktop app (which uses javascript / noble library, but does not appear to use firmata / control I/O pins)

I've also seen a lot of discussion about merging the custom firmata for the nrf51822 in this repo into [StandardFirmataBLE](- https://github.com/firmata/arduino/tree/master/examples/StandardFirmataBLE), although it doesn't look like any progress has been made.

Any tips on how I can get this to work? My end goal is to connect via React-Native, but first steps is being able to connect using firmata.js from my Mac. Thanks.

@ladyada
Copy link
Member

ladyada commented Nov 22, 2016

hiya, we did the firmata port for arduino but have never worked with j5. the uart friend is just a pass thru uart. if you can get j5 working with firmata then the uart friend can just go in between.

last we tried it, the custom firmata doesn't work very well on uno or 32u4, so we dont recommend using it

only tips is lots of debugging, comparing uart traces between j5 and arduino, etc :)

@ladyada ladyada closed this as completed Nov 22, 2016
@techniq
Copy link
Author

techniq commented Nov 25, 2016

@ladyada I think my confusion stems from what version of Firmata is needed to be flashed on the Nano (or any Arduino) to work with the UART Friend. Is BluefruitLE_nrf51822.ino not required? Can StandardFirmata be used as long as TX1/RX0 are wired to the TX0/RX1 on the UART Friend? I have no issues connecting to the Nano over USB order Bluetooth Classic using a JY-MCU adapter.

@ladyada
Copy link
Member

ladyada commented Nov 25, 2016

BluefruitLE_nrf51822.ino is optimized but has only been tested in SPI mode. for plain UART mode, you can probably use regular Firmata since its 'transparent' - just make sure you're in data not command mode

@techniq
Copy link
Author

techniq commented Nov 25, 2016

If I leave the MODE pin not attached, and set the flip switch to UART, this should suffice, correct?

Thus far I haven't had any success trying this (with various Firmata versions). I've also set the MODE pin to ground.

Based on this:


screen shot 2016-11-25 at 1 34 29 am


it seems like the MODE pin is required and thus the "custom firmata" be used.

Sorry for all the trouble. I was really hoping switch from Bluetooth Classic to BLE was going to be fairly seamless, and choose the UART friend for this very reason:


screen shot 2016-11-25 at 1 40 49 am


Should I have chosen the SPI version instead?

@techniq
Copy link
Author

techniq commented Nov 25, 2016

Based on the following data read, it appears I'm getting a response (0xf9 0x02 0x03) from the Arduino over BLE:

 ble-serial writing <Buffer f9> +4s
 ble-serial writing <Buffer f0 79 f7> +1ms
 ble-serial read <Buffer f9 02 03> true +86ms

Although I'm still not able to receive a "ready" event. At this point I think i need to work with firmata.js / johnny-five to try and see if the issue resides there.


One thing worth pointing out before I close the issue, I seem to be having a lot of odd issues with the UART Friend initializing / factory resetting. It seems 9 out of 10 times I have to close and reopen serial monitoring for the factory resetting of the UART Friend to succeed:


screen shot 2016-11-25 at 2 15 54 am


screen shot 2016-11-25 at 2 16 16 am

@techniq
Copy link
Author

techniq commented Nov 29, 2016

@ladyada Thanks for your help earlier. I wanted to report back I was able to successfully connect using fimata.js/johnny-five after changing the baudrate to 57600. I didn't know this was possible based on the description on the production page (I thought it was hard set to 9600) but after changing to CMD mode and running AT+BAUDRATE=57600 I am now in business (well, after also realizing I forgot to ground CTS since I was using hardware uart pins 0/1.

Thanks again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants