1

First timer here. I'm new to RPi and Python in general. I am making an RC car with my Pi, an Adafruit PCA9685, and an old OUYA bluetooth controller.

Everything works on my desk. But, I want it to move around on the floor. My next objective is to get the Pi running with no display or keyboard/mouse, and have the script run at boot. I'm okay with figuring out all of that.

Where I'm stuck? After boot, my Ouya controller won't connect unless I turn off the bluetooth, then turn it back on. After which, I hit the "OUYA" button on the controller, it connects, all works as expected.

I've spent the better part of the past day or two searching the 'bluez' documentation, but I can't find a thing.

I have been reluctant to request from the forums, as I like to try to solve the problem myself, I have to ask, need to move on.

Thanks,

-Parsko

  • Can you expand on what you mean by "I turn off the bluetooth, then turn it back on"? That might help prospective answerers to see where you are stuck a bit more clearly. Thanks! – MrChips Dec 27 '17 at 15:42
  • I'm using stock Raspbian on a Pi3. I have loaded the Bluetooth manager, and I turn the bluetooth off then back on via that interface. I have found if I go through 'bluetoothctl', and can get the same result. My solution below seems to be working pretty well, resetting the bluetooth via the {hciconfig} commands. – parsko Dec 28 '17 at 17:17
2

I think I found a solution. Bluetooth runs at startup, so it's there. But, it needs to be reset before I can find it. Once it's reset, I can connect easily. Now, I'm sure there is a more elegant way to do this, but this is the Python command that solved this issue:

os.popen('sudo hciconfig hci0 reset')

If I run this after a reboot, I can just connect my OUYA controller as expected.

-Parsko

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.