monteslu / ble-serial

a node-serialport implementation using BLE for sending and receiving serial data.
17 stars 5 forks source link

Suggested / recommended BLE adapter #5

Closed techniq closed 7 years ago

techniq commented 7 years ago

I'm looking to connect to an Arduino running firmata from React-Native using a combination of this project and https://github.com/jacobrosenthal/react-native-ble but I'm having trouble understanding what type of BLE adapter I'll need.

This project seems to require specific hardware (BleShield / Nordic_nRF8001 chip) and adapter a special version of Firmata. Are the same required for this project? I see a lot of mention of the hm-10 chipset, but it's rather confusing which to get (some discuss the firmware on the hm-10 matters, sometimes you get a CC41a instead of hm-10, etc).

Note: I've successfully connected using a JY-MCU bluetooth serial module from my Mac, but from my understanding Bluetooth and BLE are only related in name (much like Java/Javascript). I'm also struggling to understand how to connect to the JY-MCU module from React Native (I left an issue on another project - https://github.com/rusel1989/react-native-bluetooth-serial/issues/11) and thus thought BLE was the way to go (once I get the proper hardware module).

Thanks.

jacobrosenthal commented 7 years ago

Hey. ble-serial project uses noble under the hood so it draws its requirements from there. The question is really what are you running this on, a pi or a mac or something else?

techniq commented 7 years ago

Thanks @jacobrosenthal. I'm currently using a Mac, but the plan is to connect using React Native from Android and iOS. I decided to pick up Adafruit's Bluefruit LE UART Friend which is based on the MDBT40/nRF51822. I'm going to experiment and will report back any issues I come across.

techniq commented 7 years ago

@jacobrosenthal so far I've been struggling to get the UART Friend to work. Could you by chance tell me which BLE module you are using (and Arduino variant)? I don't know if my issues stem from using a Nano (although it works fine over USB and using a Bluetooth Classic JY-MCU) but I'm sure struggling getting BLE to work. Thanks

jacobrosenthal commented 7 years ago

For a ble central i use the internal mac ble hardware. For ble peripheral I use everything.

You need to break down your problem a bit. See if bluetooth on your mac works to connect to some known good device, see if your mac/phone can see your bluetooth device with an app like like lightblue, then see if noble can scan/connect to your device, then finally when you know the entire stack works you can add the last abstraction layer of something like firmata/ble-serial etc.

techniq commented 7 years ago

@jacobrosenthal Thanks. I'm able to connect successfully to various ble peripherals, including a bb-8 sphero which I've controlled using a node library as well. I'm also able to connect to the Bluefruit LE UART Friend (the connected blue LED lights up, and it shows connected on the Mac). I have a late-2011 MacBook Pro and thus have to use a USB adapter

It appears I'm sending and receiving data over the BLE connection (expand the logs on this issue) but firmata.js/johnny five never emits the ready event.

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

I don't know if the issue is now beyond ble-serial and with firmata.js, although I was trying to get this example from ble-serial to work and so far I've not had any success.

techniq commented 7 years ago

I was successfully after changing the baudrate to 57600 using AT+BAUDRATE=57600 in command mode. Closing this issue as well.