Close
0%
0%

BLE Keyboard Mouse Dongle

A CC2540 dongle firmware to control Raspberry Pi/HTPC with Smartphone via BLE

Similar projects worth following
This is a small Keyboard/Mouse USB dongle with BLE control. It is designed for headless systems such as Raspberry Pi, HTPC, etc; to provide handy control with your smartphone.

Due to latency of Bluetooth low energy, this project is not a replacement of mouse or keyboard for daily usage. However, it will be quite convenient to add a small dongle to a Raspberry Pi to setup account and SSH server before you have set up network.

This is a small Keyboard/Mouse USB dongle with BLE control. It is designed for headless systems such as Raspberry Pi, HTPC, etc; to provide handy control with your smartphone.

Due to latency of Bluetooth low energy, this project is not a replacement of mouse or keyboard for daily usage. However, it will be quite convenient to add a small dongle to a Raspberry Pi to setup account and SSH server before you have set up network.

Link to controller's webpage

https://deqingsun.github.io/BLE-Keyboard-Mouse-Dongle/kbd_access.html

How it works

I chose CC2540 for this project. It has full speed USB port and Bluetooth low energy capability. There are already a lot of CC2540 USB dongle on market for Packet Sniffer or Btool with TI's reference design, so I don't need to build hardware, I can buy the small form-factor dongles and reprogram them.

On USB side, there are 3 interfaces, one keyboard, one mouse and one consumer control. This is a pretty standard configuration.

On BLE side, I created a service with 6 characters. Keyboard can be triggered in 3 different characters, one character sends back keyboard led status, one character is used for mouse report, and last one for consumer report.

I also put Eddystone-URL formatted data in advertisement packages. So smartphone can pop-up URL directly with Physical Web. I can just pull down notification bar and click instead of typing URL in browser.


On web there is one page hosted on Github. It connects to BLE dongle with Web Bluetooth API. You can drag cursor with joystick or type with virtual keyboard.

Graphics Interchange Format - 346.24 kB - 07/09/2017 at 05:17

Preview
Download

  • 1 × Off-shelf CC2540 dongle
  • 1 × CC-Debugger or Arduino

  • 1
    Get proper hardware

    This firmware can be programmed to any CC2540 board with USB support as it doesn’t require any external peripheral. However if your development board don't have USB already, make sure there is a 1.5K pull-up resistor on D+ line.

    I used a development board to write firmware, then I bought a few small-factor dongles and all of them have programming pads.


    They can be got from Ebay or Aliexpress around $10~$15

  • 2
    Flash firmware

    In order to program them, I had to solder 3 wires, DC, DD and RST. Since there was already a USB port, I supplied power with a USB connector breakout board directly to save 2 wires.

    Finally I used CC Debugger to re-flash all chips. I tried to use an Arduino as programmer but I didn't get setup correct. But it is worth trying if you don't have CC Debugger. Here are links:

    https://github.com/RedBearLab/CCLoader

    https://github.com/wavesoft/CCLib

    http://magictale.com/2884/flashing-ble112-with-arduino-based-cc-debugger/

    Once those dongle is re-flashed with new firmware, plug them to your Raspberry Pi and enjoy ~.

View all instructions

Enjoy this project?

Share

Discussions

Andrii Myronchuk wrote 12/01/2020 at 12:15 point

Hi.

I tried to upload your compiled hex file to  

Bluegiga DKBLE Bluetooth Development Kit which has CC2540 bluetooth module and CC debugger on it), but I didn't do it successfully.

I also have BLED112 usb dongle(CC2540 in it).

Could you guide me how I can compile your firmware and upload to my kit or dongle?

Andrii

  Are you sure? yes | no

Peter Burkimsher wrote 07/19/2017 at 01:15 point

Nice work! I built a setup using my laptop & Arduino Pro Micro as a keyboard for the Raspberry Pi. 

http://peterburk.github.io/programs/#keyMouSerial

I don't have Android, so I can't use yours unfortunately. I've long wanted to make a WiFi version. [cnlohr] built a beautiful WiFi-USB HID dongle, but only manufactured his own prototype and never sold any. He told me to order my own, but I don't know how to do that. 

http://hackaday.com/2016/09/03/software-usb-on-the-esp8266/

  Are you sure? yes | no

deqing wrote 07/19/2017 at 02:22 point

According to https://github.com/WebBluetoothCG/web-bluetooth/blob/master/implementation-status.md

You can buy WebBLE app. My ipod is too old to install this app so I didn't test. But it should work. 

  Are you sure? yes | no

Peter Burkimsher wrote 07/19/2017 at 02:33 point

"iOS: ... no implementation planned"

I'm still on iOS 6, so I think I can't install it either. 

  Are you sure? yes | no

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates