I'm trying to set a Bluetooth dongle as the default Bluetooth controller on my raspberry pi (rather the the internal controller on the board it self).
bluetoothctl is able to display both devices with:
sudo bluetoothctl list
and even change the default with select. This change however is only applied in the bluetoothctl session and is not permanent.
I would like to change the default system wide. So all Bluetooth activity runs over the dongle.
Related
I am trying to pair device using bash script. I want to do it automatically without prompting user to enter PIN.
I tried this over stdin:
echo 1234 |bluetoothctl pair XX:XX:XX:XX:XX:XX
And this as parameter:
bluetoothctl pair XX:XX:XX:XX:XX:XX 1234
But nothing worked.
I need to provide pin because i am trying to pair with HC-05 module.
Or is there some alternative to bluetoothctl on raspberry pi OS, that can do what I want?
You can try to overcome this by changing the IO capability on your device so that you don't even get a prompt in the first place. You have two options when launching bluetoothctl:-
bluetoothctl --agent DisplayOnly
bluetoothctl --agent NoInputNoOutput
This will make it so that when pairing, the remote device will know that you don't even have the capability to do any inputting on your device, and therefore the prompt will switch to the remote device or to JustWorks pairing if the other device has no input capability as well.
Have a look at the links below for more information:-
Raspberry BLE encryption/pairing
Linux command line how to accept pairing without pin
BLE pairing the Raspberry Pi 3B model
Bluetoothctl set passkey
Automatically accept Bluetooth pairings
A method to Connect / Disconnect a USB device "softly".
Hey, Assume I have a USB device connected to my PC, I want to enable/disable the port it is connected via computer so that I don't have to unplug/plug my device each time.
P.S : Device is a Microcontroller Board ( powered by USB port ) , so I don't want it to be active all the time. I want to deactivate it when appyling changes to code etc. and then activate that port so I can load my code into it again.
Is there a method to do so ?
Thanks in advance.
Device is a Microcontroller Board ( powered by USB port )
Most USB enabled µC types can "unplug" themself.
The idea is to put the USB data pins (usually called D+ and D-) into "output low" state for about one second at startup. This forces USB to be recognized as "disconnected".
After that is done, re-configure the pins to for their USB function and initialze the USB as usual.
Note that this method is not possible on old style boards that still use USB2UART chips instead of hardware USB inside the µC itself.
In my current project, I am working with iBeacon in the area of IoT. Basically iBeacon works on Bluetooth wireless technology. I am using Raspberry Pi 3 (which is available with in-built wifi and bluetooth). Pi 3 Bluetooth display and detect the iBeacon but not able to do pairing with it and display the following error:
GDBus.Error:org.bluez.Error.AuthenticationFailed
I also tried with bluetoothctl command also but again display the Failed to pair: org.bluez.Error.AuthenticationFailed
error.
Am I missing something? I am able to pair iBeacon with my mobile and windows based lapotop.
Understand that iBeacon is a transmit only Bluetooth LE device. It is Bluetooth LE manufacturer advertisements to send a unique identifier, something you have seen if you have detected it with the Raspberry Pi 3.
But a basic iBeacon device is not designed to be connectable over Bluetooth LE. Some beacon manufacturers may expose a secondary configuration service that is connectable, but this is not universal and if it exists it is entirely outside the beacon spec.
Bottom line: you are not supposed to be able to connect.
If you have a specific model of beacon that does have a config interface, and you want to connect to that, you may want to put that in your question.
Ass everyone saying in their first posts "I'm new one" and trying to figure out one complexity.
I want to scan and create list of available wifi networks in Raspberry area and send the list to the phone via bluetooth.
Next - select one of the networks in the list on the phone, enter a password to selected network and send back via bluetooth to Raspberry
I'm using Raspberry pi3 with bluetooth on board, Raspbian OS and nodejs v7.4.0
I choose wifi-control to work with wifi network and it works greate. One thing - I should run npm run with sudo to get all networks, not just current one;
Then I'm trying to work with bluetooth via bluetooth-serial-port lib.
First of all I did all preparations that was written in documentation.
var btSerial = new (require('bluetooth-serial-port')).BluetoothSerialPort();
btSerial.inquire();
And it does nothing. At least I don't see any effect - my phone doesn't "see" Raspberry in available bluetooth devices list;
I thought that my Raspberry has porblems with bluetooth, but then I run
bluetoothctl -> power on -> discoverable on
And Raspberry appeared on phone.
What should I do to "turn on" Bluetooth control and add my Raspberry to list of available bluetooth devices?
Peace!
Got the exact same problem. My solution (which might or might not be fitting for your needs) was to pair the phone via bluetoothctl beforehand. (this already is you why this solution kinda sucks: you can't come and use a different phone/pi the next day, stuff got completely screwed when changing to a different pi :D)
Oh and the main script should run as root, else all of this wont work.
1) Pairing your device
$ bluetoothctl
[bluetoothctl] agent on
[bluetoothctl] discoverable on
[bluetoothctl] pairable on
[bluetoothctl] scan on
(now you turn on your bluetooth on your phone and search for devices, in bluetoothctl you should see your device and mac to be shown)
[bluetoothctl] pair XX:XX...(MAC of your phone)
(phone is going to show the "yo this device wants to pair"-dialog and bluetoothctl wants you to confirm the pairing too)
Now you can always connect to the pi via bluetooth, if it is discoverable or not. (I'm using Serial Bluetooth Terminal)
2) Actual talking between devices
NONE of the npm packages supposed to work with bluetooth worked for me. Not a single one. So in the end I used rfcomm and it's ability to start a program on connection. Together with serialport I let rfcomm run node myscript.js, which establishes the actual serial connection like so:
2.1) rfcomm waiting for connections
const rfcommProc = spawn(
'rfcomm',
['watch', 'hci0', '1', 'node', `${__dirname}/myscript.js`]
);
2.2) myscript.js opening the port
const port = new SerialPort('/dev/rfcomm0', spError => {
if (spError) {
process.send(spError);
}
})
Look up on the npmjs-page how to receive and send stuff now.(:
Hope this gives you some ideas and/or helped.
3) Note
The bluetooth service starts quite late. Making a service requiring it didn't do the job for me, but adding it to rc.local seems to be "late enough" to have it running and listening on startup.
I am trying to send/receive data over serial connection (GPIO UART pins) between a Raspberry Pi (B model, raspian wheezy) and any pc (tried a netbook and desktop, both running with win 7).
I followed all the stepts found in several tutorials like: http://codeandlife.com/2012/07/01/raspberry-pi-serial-console-with-max3232cpe/
to build a 5V to 3.3V converter. (unfortunately i can't post a pic yet)
The settings for ttyAMA0 in files 'cmdline' and 'inittab' are ok. (like described in many tutorials)
Connecting RX/TX on rpi direct works fine, so i can send text over GPIO pins and receive it. But as i connect it to a pc there is no way to read or write any data. Baudrate 9600 or 115200 doens't matter. (Hardware connection: rpi GPIO -> voltage converter -> serial USB adapter -> pc)
On pc i used Putty. On the rpi:
'echo text >> /dev/ttyAMA0' on the terminal
Putty and
minicom
but no one had success
Is there anything i missed? Could you give me some advice i could look for please.
some ideas:
Whereever i plug the usb into one of 3 available netbook USB ports the win device manager always say it's on COM3... shouldn't it change?
is there a possibility to make some measurements inside the voltage converter wiring to insure that it's not a broken component in the hardware circuit? (i have no knowlegde of it's function)