Active Topics

 


Reply
Thread Tools
Posts: 88 | Thanked: 63 times | Joined on Feb 2008 @ Solingen; Germany
#1
hi mæmo users^^

As the thread is called I would know from you, where to get the
package "python-serial" for diablo, which is important for my future
project to work with serial ports...


I registred a project at garage today:
b60 ( just waiting for the feedback)

The goal of this project is to offer a special module to get connected with the pyS60'S bluetooth console and keep it easy and quickly.

I look foreward to see programms of these:
http://de.youtube.com/watch?v=JPf5-r7dl5U
using the motion-sensor (here of the n95).

greeez


__________________________________________________ _____________________
| Thread "Python: Serial" renamed as "BlueSixty: Get Connected with PyS60" |

Last edited by thopiekar; 2008-10-09 at 11:58.
 
Guest | Posts: n/a | Thanked: 0 times | Joined on
#2
Originally Posted by thopiekar View Post
The goal of this project is to offer a special module to get connected with the pyS60'S bluetooth console and keep it easy and quickly.
You don't need python-serial to create an RFCOMM Bluetooth socket. Package python2.5-bluez enables you to do that. It gets installed automatically when you install Python (python2.5-runtime) on your tablet. RFCOMM sockets act like serial port sockets: example.

You need python-serial to connect a real serial port adapter to the tablet in USB host mode. There's no ready-made package that I know of, but python-serial is a pure Python module and can easily copied around. See my earlier post about the subject.
 
Posts: 134 | Thanked: 57 times | Joined on Mar 2008 @ South Bend IN
#3
python-serial is indeed pure python and works on OS2008. I have used it, and dbus, to connect to my roomba and other projects over bluetooth without much issue. You may want to incorporate turning the bluetooth on and off as well into your project, which can be done over dbus.

download python-serial from the source forge page listed above, use an archive program to unpack the contents, and then just copy the folder from the archive's ./usr/lib/python2.5/site-packages/serial to the same path in your file structure.
 
frethop's Avatar
Posts: 283 | Thanked: 60 times | Joined on Nov 2005 @ It's dark in here. I hear laughing.
#4
hvacengi: Do you have the Roomba access code available? I've been wanting to access my Roomba, but was waiting for some time to dig into the BlueZ access.

Thanks.
 
Posts: 134 | Thanked: 57 times | Joined on Mar 2008 @ South Bend IN
#5
Below is the code I used. You have to know the address of the device you want to connect to, or offer an option to select it. You can have bluez do a search, and/or list the saved paired devices I think. I didn't do it when I wrote this section cause I was just messing around with the concept. I think that if you want to use a pass code you have to have the n8x0 paired with your receiver.

Once you connect, "self.port" acts just like a regular serial port. Reading stream data doesn't work so well (automated every 15ms is a bunch of data and at least in python things seemed to get bogged down some where). But I could send commands and read responses fine. I've used this same trick to talk to my arduino board, my laptop, and a gps receiver, all without any problems (other than remembering to change the bluesmirf's data rate). You might notice that I check to see if the bluetooth adapter is on (trying to use it when it's off throws an exception), and if not I set a bool to true when I turn on the adapter so that I can turn it off again at application close.

Good luck with your program, I'd be interested to see anything you come up with.

-Brad

Code:
self.bus = dbus.SystemBus();
self.bmgr = dbus.Interface(self.bus.get_object('org.bluez', '/org/bluez'), 'org.bluez.Manager')
self.bus_id = self.bmgr.ActivateService('serial')
self.adapter_add = self.bmgr.DefaultAdapter()
print self.adapter_add
self.adapter = dbus.Interface(self.bus.get_object('org.bluez', self.adapter_add), 'org.bluez.Adapter')
mode = self.adapter.GetMode()
print mode
self.disable_bt = False
if mode == "off":
    print "setting adapter on"
    self.adapter.SetMode("connectable")
    self.disable_bt = True
self.ser_int = dbus.Interface(self.bus.get_object(self.bus_id, '/org/bluez/serial'), 'org.bluez.serial.Manager')
self.device = self.ser_int.ConnectService("00:06:66:00:D4:0C", "spp")
print self.device;
self.port = serial.Serial(str(self.device), 115200, timeout=1)
 

The Following User Says Thank You to hvacengi For This Useful Post:
Posts: 88 | Thanked: 63 times | Joined on Feb 2008 @ Solingen; Germany
#6
thanks for your posts

I just have asked for this module because a project (niime.com)
used this module too..

a module, which uses rfcomm, for python is the main thing for my new project: BlueSixty

greeez
 
frethop's Avatar
Posts: 283 | Thanked: 60 times | Joined on Nov 2005 @ It's dark in here. I hear laughing.
#7
Very cool! Many thanks.
 
Posts: 88 | Thanked: 63 times | Joined on Feb 2008 @ Solingen; Germany
#8
I thried the rfcomm-server of code.google.com and removed the lines 29 to 35, insert

Code:
client_sock.send("import audio)
client_sock.send("audio.say('Hallo World!')")
, because in this case the bluetooth console of pyS60 acts like a client.

But my N95 doesn't react.

Do you have some solutions?
It seems that I'm a little bit helpless in bluetooth-things..

EDIT: Fixed

Last edited by thopiekar; 2008-10-11 at 14:06.
 
Reply

Tags
b60, bluesixty, python, rfcomm, serial


 
Forum Jump


All times are GMT. The time now is 02:40.