Bluetooth

Discussion in 'UDOO NEO' started by Nico, Jan 19, 2016.

  1. Frederick Blais

    Frederick Blais New Member

    Joined:
    Mar 10, 2016
    Messages:
    5
    Likes Received:
    3
    @Bairon

    You need to create a permanent serial port on your Udoo.
    Follow the second part of this tutorial to see how it's made : https://myraspberryandme.wordpress.com/2013/11/20/bluetooth-serial-communication-with-hc-05/
    This will create a device called "rfcomm0" in your /dev directory that you will be able to open like a file.

    The second part is to connect to that with your Android phone. You can use either an already made Serial Port app (Search for "Bluetooth SPP") or create your own.
    http://developer.android.com/reference/android/bluetooth/BluetoothSocket.html
    https://github.com/akexorcist/Android-BluetoothSPPLibrary
    http://digitalhacksblog.blogspot.ca/2012/05/android-example-bluetooth-simple-spp.html
     
    Bairon likes this.
  2. Bairon

    Bairon New Member

    Joined:
    Feb 1, 2016
    Messages:
    14
    Likes Received:
    2
    Thanks @Frederick Blais !
     
  3. Bairon

    Bairon New Member

    Joined:
    Feb 1, 2016
    Messages:
    14
    Likes Received:
    2
    dear @Frederick Blais i have stabilished a serial comm over bluetooth (trought /dev/rfcomm40), but how read this from arduino?? i see characters send by app on android and vice versa on serial monitor (/dev/rfcomm40), I tried modify /usr/share/arduino/lib/preferences.txt replacing serial.port=COM1 to serial.port=/dev/rfcomm40 but no solution, sorry for my bad english i´m a newbie on udoo/arduino.

    thanks a lot.
     
  4. waltervl

    waltervl UDOOer

    Joined:
    Dec 12, 2015
    Messages:
    2,314
    Likes Received:
    580
  5. Bairon

    Bairon New Member

    Joined:
    Feb 1, 2016
    Messages:
    14
    Likes Received:
    2
  6. Frederick Blais

    Frederick Blais New Member

    Joined:
    Mar 10, 2016
    Messages:
    5
    Likes Received:
    3
  7. Bairon

    Bairon New Member

    Joined:
    Feb 1, 2016
    Messages:
    14
    Likes Received:
    2
    Yes i have read this and i apply the follow comand:
    Console 1:
    rfcomm listen 12:34:56:78:90:ab //android phone MAC
    arter phone is connected run in another console
    console2:
    socat /dev/rfcomm40,raw,echo=0,crnl /dev/ttyMCC,raw,echo=0,crnl

    it's work!!

    i have added to rc.local this script
    hciconfig hci0 piscan <- to make discoverable bluetooth
    sdptool add sp <- to add serial port
    rfcomm listen 12:34:56:78:90:ab <- to listen a smartphone

    but i`ll find a way to use socat when smartphone is connected automatically...
     
  8. Frederick Blais

    Frederick Blais New Member

    Joined:
    Mar 10, 2016
    Messages:
    5
    Likes Received:
    3
    Looks like you are making a lot of progress. Congrats!
     
    Andrea Rovai and Bairon like this.
  9. Bairon

    Bairon New Member

    Joined:
    Feb 1, 2016
    Messages:
    14
    Likes Received:
    2
    yes!, Thanks! I will document when completed
     
    Andrea Rovai and waltervl like this.
  10. Bairon

    Bairon New Member

    Joined:
    Feb 1, 2016
    Messages:
    14
    Likes Received:
    2
    as mentioned it works with the socat comand, but this only starts when the device is created, as I can run socat automatically when rfcomm40 be created?

    maybe can use udev rule?
     
  11. Juan Sebastian Guerrero

    Juan Sebastian Guerrero UDOOer

    Joined:
    Dec 24, 2015
    Messages:
    9
    Likes Received:
    3
    Hi!!
    Two years later... @Bairon you could document this process??

    @Andrea Rovai the bluethoot use documentation exists?
     

Share This Page