Reputation:
I'm creating a project where I'm attempting to send analog data recorded from an FSR to a computer to generate a real-time graph. I understand the basics of Arduino, Python, Bluetooth, and serial communication, but I want to establish the connection as easily as possible, which means that I don't want to select the serial port via the Arduino IDE.
Is it possible to establish the serial port outside of the IDE? I would like for a serial communication to be established after simply pairing the Bluetooth dongle to the Bluetooth shield.
I am using an Arduino Uno with the Bluefruit EZ-Link Shield: http://www.adafruit.com/product/1628
Thank you!
Upvotes: 2
Views: 2011
Reputation: 59
we've written two tutorials some time ago that will surely help you:
The communication server we use is in Python, so I think it will apply to your problem.
Tip: The bluetooth serial device (/dev/rfcomm0 or /dev/rfcomm1) will appear only after you've chosen to connect to the arduino as a Dev-B (see the tutorial) using the blueman-manager.
Tip 2: Do not use the serial.tools.list_ports.comports() function from serial.tools. It does not detect rf devices (it's a problem with the basenames it uses to collect the devices: rf* is not in the list someone imagined, but you won't be debugging standard python libraries). If you want to automatically look if the correct device was created, use the following code:
import glob
rfports = list(glob.glob("/dev/rfcomm*"))
Important: Remember the following:
You can connect the Bluetooth module directly to the Arduino connecting the RXD/TXD ports of the Bluetooth to the TX/RX ports (RXD<->TX & TXD<->RX !) of the Arduino or
you can connect the Bluetooth module to any digital ports of the Arduino using the SoftwareSerial lib.
IF you use the first option, it is important that the Arduino is not connected to the computer via USB, because the USB connection uses the same RX/TX ports of the Arduino and the Bluetooth communication won't work. Power the Arduino using batteries or a cellphone charger.
Upvotes: 1