Comments on: Talking to a Bluetooth Serial Module with a Raspberry Pi http://blog.dawnrobotics.co.uk/2013/11/talking-to-a-bluetooth-serial-module-with-a-raspberry-pi/ Tutorials and updates from Dawn Robotics Tue, 30 Dec 2014 22:58:08 +0000 hourly 1 http://wordpress.org/?v=3.7.5 By: yash http://blog.dawnrobotics.co.uk/2013/11/talking-to-a-bluetooth-serial-module-with-a-raspberry-pi/#comment-581 Sat, 06 Dec 2014 15:35:44 +0000 http://blog.dawnrobotics.co.uk/?p=375#comment-581 dude,
you are awesome!

This worked like a blast!
I am just testing my thermal printer which is connected via bluetooth,
It just simply worked and I got a print of what I wrote!

Many many thanks man!
Keep posting such articles..

]]>
By: Alan http://blog.dawnrobotics.co.uk/2013/11/talking-to-a-bluetooth-serial-module-with-a-raspberry-pi/#comment-534 Wed, 22 Oct 2014 10:18:52 +0000 http://blog.dawnrobotics.co.uk/?p=375#comment-534 Hi there,

It could be that the serial port hasn’t appeared properly for some reason. What do you get when you run

ls -alh /dev/rfcomm1

and

lsusb

Regards

Alan

]]>
By: Javier http://blog.dawnrobotics.co.uk/2013/11/talking-to-a-bluetooth-serial-module-with-a-raspberry-pi/#comment-530 Tue, 21 Oct 2014 07:34:54 +0000 http://blog.dawnrobotics.co.uk/?p=375#comment-530 Thanks for the tut!
When I do this line: bluetoothSerial = serial.Serial(“/dev/rfcomm1″,baudrate=9600)
I get this error:
Process Process-3:
Traceback (most recent call last):
File “/usr/lib/python2.7/multiprocessing/process.py”, line 258, in _bootstrap
self.run()
File “/usr/lib/python2.7/multiprocessing/process.py”, line 114, in run
self._target(*self._args, **self._kwargs)
File “/home/pi/Desktop/Car/RPiCar/BluetoothServer.py”, line 7, in startBluetoothServer
bluetoothSerial = serial.Serial(“/dev/rfcomm1″,baudrate=9600)
File “/usr/lib/python2.7/dist-packages/serial/serialutil.py”, line 260, in __init__
self.open()
File “/usr/lib/python2.7/dist-packages/serial/serialposix.py”, line 280, in open
self._reconfigurePort()
File “/usr/lib/python2.7/dist-packages/serial/serialposix.py”, line 409, in _reconfigurePort
termios.tcsetattr(self.fd, TERMIOS.TCSANOW, [iflag, oflag, cflag, lflag, ispeed, ospeed, cc])
error: (5, ‘Input/output error’)

Do you have any thoughts?

]]>
By: Alan http://blog.dawnrobotics.co.uk/2013/11/talking-to-a-bluetooth-serial-module-with-a-raspberry-pi/#comment-511 Thu, 02 Oct 2014 14:49:58 +0000 http://blog.dawnrobotics.co.uk/?p=375#comment-511 Hi Kim,

That error is sometimes caused if you have another program using the serial port, have you got another program such as cutecom running?

If that’s not the problem then I’d actually recommend using a separate serial program like cutecom to test that the serial port works, before you try to use it with Python.

On the Raspberry Pi you can install cutecom with

sudo apt-get install cutecom

When you run cutecom (needs to be run from the desktop) you type the name of your serial port in, select the baud rate and then open the connection. At that point you should should be able to send a message with 2 numbers to the Arduino.

Best of luck.

Regards

Alan

]]>
By: kim http://blog.dawnrobotics.co.uk/2013/11/talking-to-a-bluetooth-serial-module-with-a-raspberry-pi/#comment-507 Wed, 01 Oct 2014 13:36:45 +0000 http://blog.dawnrobotics.co.uk/?p=375#comment-507 i have a error

Traceback (most recent call last):
File “bluetooth_serial_example.py” , line 21, in
buetoothSerial.write( “{0} {1}”.format(a,b ))
file “/usr/lib/python2.7/dist-packages/serial/serialposix.py”, line 485, inwrite
raise SerialException(‘write failed: %s’ % (v,))
serial.serialutil.SerialException: write failed: [Errno 5] Input/output error

…. what i shoud do…. help me…

]]>
By: Alan http://blog.dawnrobotics.co.uk/2013/11/talking-to-a-bluetooth-serial-module-with-a-raspberry-pi/#comment-418 Thu, 17 Jul 2014 18:36:40 +0000 http://blog.dawnrobotics.co.uk/?p=375#comment-418 Hi Theo, It’s tough to know what to suggest here. It’s odd that the test script fails on the write command, as by that point, it looks like it’s opened the /dev/rfcomm1 serial port. Also odd that it didn’t ask for the password (perhaps time to go back to DisplayKeyboard?). At this point I would test to see if reading from the serial port works. You can modify the Arduino test program to write data using Serial.println and then listen for it using a serial monitor such as cutecom.

Sorry I can’t be more help, but it’s tough without having the specific devices to hand.

Regards

Alan

]]>
By: theo http://blog.dawnrobotics.co.uk/2013/11/talking-to-a-bluetooth-serial-module-with-a-raspberry-pi/#comment-416 Wed, 16 Jul 2014 16:03:37 +0000 http://blog.dawnrobotics.co.uk/?p=375#comment-416 Thanks for the quick reply ;)

My bluetooth module is this one https://www.adafruit.com/products/1588 and my bluetooth dongle is this one https://www.adafruit.com/product/1327. I am able to pair my bluetooth module with my laptop so i guess it work properly :)

After few test, i finally manage to pair my raspberry to my bluetooth module using the command “sudo bluez-simple-agent hci# xx:xx:xx:xx:xx:xx” but we did not ask me any password ( yet i have to use one to pait it with my laptop ) and when i’ve tried to run a test code, there is an error :

Traceback (most recent call last):
File "test.py", line 6, in
bluetoothSerial.write("test")
File "/usr/lib/python2.7/dist-packages/serial/serialposix.py", line 485, in write
raise SerialException('write failed: %s' % (v,))
serial.serialutil.SerialException: write failed: [Errno 107] Transport endpoint is not connected

And here is the test code that i use :

#! /usr/bin/python

import serial
import time

bluetoothSerial = serial.Serial( "/dev/rfcomm1", baudrate=9600 )
time.sleep(5)
bluetoothSerial.write( "test")

Thanks :)

]]>
By: Alan http://blog.dawnrobotics.co.uk/2013/11/talking-to-a-bluetooth-serial-module-with-a-raspberry-pi/#comment-413 Tue, 15 Jul 2014 10:54:49 +0000 http://blog.dawnrobotics.co.uk/?p=375#comment-413 Hi Theo,

I’m not sure I’m afraid. I haven’t seen that particular error before and I haven’t had to try the KeyboardDisplay to DisplayYesNo change. Which 2 bluetooth devices are you trying to pair exactly? I.e. which dongle, and can you post a link to the Adafruit device? Also, are you able to pair a bluetooth enabled smartphone to the target bluetooth device? It’s usually easier to pair phones with devices and you can see if the passcode is as you expect etc.

Regards

Alan

]]>
By: theo http://blog.dawnrobotics.co.uk/2013/11/talking-to-a-bluetooth-serial-module-with-a-raspberry-pi/#comment-410 Mon, 14 Jul 2014 18:13:41 +0000 http://blog.dawnrobotics.co.uk/?p=375#comment-410 Hi,

I follow your guide to connect my Adafruit bluetooth module to my pi but i have cannot pair these two devices together. In fact, when i run this command “sudo bluez-simple-agent hci# xx:xx:xx:xx:xx:xx” ( with my module adresse and number of course ) i get an error “Creating device failed: org.bluez.Error.AuthenticationRejected: Authentication Rejected”

How can i solve that ? ( i already try to change the word ‘KeyboardDisplay’ with ‘DisplayYesNo’ of the file in the “/usr/bin/bluez-simple-agent” directory )

]]>
By: Alan http://blog.dawnrobotics.co.uk/2013/11/talking-to-a-bluetooth-serial-module-with-a-raspberry-pi/#comment-394 Thu, 03 Jul 2014 09:05:28 +0000 http://blog.dawnrobotics.co.uk/?p=375#comment-394 Hi Guilherme,

Practically anything is possible with computers and robotics, provided that you’ve got enough time. ;) One way to do what you want would be to write a server program that ran on the Pi. Your virtual machine could then talk to this server program over the network, and send commands to the bluetooth device. You can write the server program in whichever language you’re most comfortable with, but personally I’d try to use Python and XML-RPC.

Regards

Alan

]]>