slexy
Posts: 2
Joined: Thu Sep 26, 2019 12:44 pm

Using bluetooth from raspberry pi to send commands to PC

Mon Sep 30, 2019 11:23 am

Hello!

Model: Raspberry Pi 3B+

We have a school project going, where we have to use raspberry pi to send joystick movement over bluetooth to PC to control a game. We've gotten the raspberry pi to read the joystick movement and button clicks.

I have zero experience with raspberry pi's bluetooth. Is there a possibility to send these commands through bluetooth and make PC read those commands.

The idea is to make a game with Unity 3D, which would be controlled with raspberry pi via bluetooth? I'm in a corner with this.

Another possibility is to use Wifi, but I'll let you more experienced guys to throw out ideas.

User avatar
Douglas6
Posts: 4778
Joined: Sat Mar 16, 2013 5:34 am
Location: Chicago, IL

Re: Using bluetooth from raspberry pi to send commands to PC

Mon Sep 30, 2019 1:45 pm

Yes, a couple of ways to go.
1. If it's not a Macintosh PC, you can connect from the Pi using Bluetooth's Serial Port Profile (SSP). Then read and write to a program running on the Pi using serial communications.
2. You could make the Pi emulate a Bluetooth HID device that would send actual joystick movements to the PC. I did that once emulating a keyboard, but I can't be of much help with a joystick or game controller.

slexy
Posts: 2
Joined: Thu Sep 26, 2019 12:44 pm

Re: Using bluetooth from raspberry pi to send commands to PC

Mon Sep 30, 2019 1:53 pm

Douglas6 wrote:
Mon Sep 30, 2019 1:45 pm
Yes, a couple of ways to go.
1. If it's not a Macintosh PC, you can connect from the Pi using Bluetooth's Serial Port Profile (SSP). Then read and write to a program running on the Pi using serial communications.
2. You could make the Pi emulate a Bluetooth HID device that would send actual joystick movements to the PC. I did that once emulating a keyboard, but I can't be of much help with a joystick or game controller.
Thank you for your answer! This will help us to proceed further with the project.

Any recommended tutorials to use the SSP profile?

User avatar
Douglas6
Posts: 4778
Joined: Sat Mar 16, 2013 5:34 am
Location: Chicago, IL

Re: Using bluetooth from raspberry pi to send commands to PC

Mon Sep 30, 2019 2:29 pm

This post may help: https://www.raspberrypi.org/forums/view ... 85#p947185
After that, simply connect the devices using PySerial (with Python) or another programming language. You'll need to research how to do that on the PC.

Return to “Interfacing (DSI, CSI, I2C, etc.)”