Giter Club home page Giter Club logo

cc2540-keyboard's Introduction

CC2540 Keyboard

Video

World's smallest keyboard

Hardware

  • $2.65 CC2540 module (RF-BM-S02) from Aliexpress (11.2 x 15.1 x 1.74 mm, onboard USB support)
  • $1.83 Arduino Nano from Aliexpress (to program the chip)
  • $0.92 Panasonic CR1216 lithium 3v battery (12.5 ร— 1.6 mm), 34 mAh
  • $0.00 Cherry MX Blue keychain (20 x 11 mm) from GeekKeys (actually $3.50 but I got it for free)

Software

Flashing

Build or download precompiled firmware from the repository (HIDEmuKbd.hex), use CCLoader and Arduino Nano to flash it.

Build and upload CCLoader sketch (CCLoader.ino) to Arduino Nano using Arduino IDE.

Hook up CC2540 to Arduino Nano digital pins D4-D6 as shown in the table (don't forget about 3.3V VCC and GND):

Signal CC254x CCLoader
DEBUG_CLOCK P2_1 D6
DEBUG_DATA P2_2 D5
RESET RES D4

Convert firmware.hex to firmware.bin using hex to bin converter.

hex2bin.exe firmware.hex

Run CCLoader client on PC. E.g. for COM6 and Arduino Nano (Device 0) use:

CCLoader.exe 6 firmware.bin 0

That's it, the cc2540 module should accept the new firmware and start working right away (after bluetooth pairing).

The keyboard button is attached to P0_1 (P01) and GND pins. It sends WinKey keycode, you may modify the code to send any key or a key sequence of your choice. The battery (3V) is attached to VCC and GND pins.

Building

This keyboard uses modified HIDEmuKbd sample from the CC2540 SDK.

Copy provided files to the corresponding BLE-CC254x-1.4.0 SDK folders.

Run IAR, open .eww, hit Make. You may also try precompiled firmware from the repository.

Compilation Errors

  • Error[e16]: Segment ISTACK (size: 0xc0 align: 0) is too long for segment definition. At least 0xe more bytes needed. The problem occurred while processing the segment

You got to set number of virtual registers to 8 (in Project - Options - General Options).

Experimental USB mode

This section is pure experimental and it's not related to the keyboard above, you may skip it.

As you know, CC2540 supports USB (CC2541 doesn't), and can be used as USB-HID, USB Serial or USB Mass Storage Device.

  • HIDAdvRemoteDongle sample for the USB HID device.
  • HostTestApp sample for the BTool-compatible serial device.
  • util/UBL sample for the USB Mass Storage device

To run USB firmware and to detect USB on this module, U+ needs to be pulled to +3.3v via 1.5k resistor.

Sadly, USB Mass Storage doesn't work (yet) on this RF-BM-S02 module. It sometimes shows removable drive and even shows DEFAULT.CFG file but never opens it. Not sure if it is software or hardware problem (looks like it opens slightly faster on a low speed USB 2.0). The module uses CC254XF256 so memory should be enough. Probably software problem, because USB HID works just fine.

Official SDK Hardware

You don't really need official CC2540 SDK hardware (Keyfob and USB Dongle) but you could need schematics and defines.

CC2540 buttons and LEDs for Keyfob and Dongle development kits (defined in hal_board_cfg.h):

Define Keyfob Dongle
HAL_KEY_SW_1 P0_0 P1_2
HAL_KEY_SW_2 P0_1 P1_3
HAL_LED_1 P1_0 P0_0
HAL_LED_2 P1_1 P1_1

Note that P0_0 pin is not available on RF-BM-S02

Pictures

Arduino Nano as CCLoader

Arduino Nano as CCLoader

Breadboard rig with attached USB

Breadboard rig with attached USB

RF-BM-S02 Pinout

RF-BM-S02

RF-BM-S02 Dimensions

RF-BM-S02 Dimensions

RF-BM-S02 Schematics

RF-BM-S02 Schematics

Official CC2540 SDK Hardware

CC2540 Keyfob CC2540 Keyfob Schematics

CC2540 USB Dongle CC2540 USB Dongle Schematics

More Pictures

See the full album here: https://imgur.com/a/OkwEb

References

cc2540-keyboard's People

Contributors

joric avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

cc2540-keyboard's Issues

I want to make a DIY footswitch, I have some questions...

Your project is very cool. I want to make a DIY footswitch like this, and a DIY keyboard maybe later.

Firstly, I'm searching for a bluetooth module. I have come across BC417, CC2540, CC2640, ESP32... What's the best module?
For a footswitch, I think the CC2540 is good. But for a keyboard with many keys, do I need other chips to work together with it? Are there anyother modules that can be used for a keyboard? And how to choose, which one is the best?

I also want the keyboard to have a function like the logitech's easy switch https://www.logitech.com/en-us/product/illuminated-keyboard-for-mac-ipad-iphone (using the same keyboard to pair with different computers and switch among them with one click). Can these modules do this?

Also, is it possible to change the key (winkey) easily? It appears I need to compile the firmware everytime if I want to change the key.

Lastly, you have the project for a year. How long the 3V battery last?

Build problem

I know several years has been passed, but maybe you still can help with it...
Using precompiled HidEmuKbd.hex works perfectly, but with own builded firmware I'm getting connection issues for some devices. Also my .hex file has a bit larger size.
Making firmware build I've used same software versions as described:

  • IAR 8.30.2
  • BLE-STACK V1.4.0
  • hidemukbd.c from repository
    Have I missed some step here? Maybe older ble-stack/iar should be used?

Trying to turn on a led without using ble

I want to use the cc2540 but I don't know how to write code for this as the OSAL layers make it way more difficult than anything I have tried before.

Can you help me?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.