Skip to content

asterics/BleenyButton

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Bleeny: an nRF52840-based low cost BLE Button

The Bleeny Button is an assistive switch for creating a key press or other HID activities using Bluetooth Low Energy (BLE). It can be used to control SmartPhones, Tablets, Computers or AAC Software like our free and open source Asterics AAC. The Bleeny Button utilizes the affordable Tenstar Robot devboard (aka nice!nano) or a XIAO nRF52840 board with the Nordic nrf52840 microcontroller. A good summary of the features of this SoC/board is provided at the Zephyr documentation page. The source code builds with PlatformIO, using the Adafruit nRF52 and Bluefruit libraries. The code is based upon the BLE keyboard example

Requirements

  • install VSCode/PlatformIO and build a project for the Adafruit Feather nRF52840 Express (or a similar Adafruit nRF board, to install the nRF platform packages)
  • add the files for the nice nano board as described here: Nicenano-NRF52-Supermini-PlatformIO-Support (not necessary for the XIAO board)

Usage

  • build and upload the demo code (note that the Serial USB CDC interface must be enabled in the code in order to use the auto-upload via DFU in PlatformIO)
  • pair the BLE device (e.g. Bleeny-214D, the unique number is composed from the mac address of your device)
  • attach a pushbuttons to GPIO pin 017 and GND (optionally, more buttons can be connected to pins 020, 022, 024 and 100)
  • when pressed, the buttons shall trigger keys (default settings are: SPACE , ENTER, 1, 2 and 3)
  • changing settings can be done with the simple config UI (or a serial terminal): ui/config.html or online

Notes regarding low power operation / current consumption

In paired active mode, current consumption is about 1.2mA @ 3,3V (which can reduced to ~1mA if the activity LED is not used).
After an adjustable time of user inactivity (constant SLEEP_TIMEOUT_MS), the nRF enters hibernation / deep sleep where current consumption drops to ~1,4uA @ 3,7V. (For this, the LDO for providing external VCC must be disabled, else around 40uA are consumed). This could be further improved by supplying power directly to the VDD pin on the backside of the PCB, see this post in the Arduino forum A wakeup can be triggered by pressing any of the configured buttons. This will cause a system reset. BLE connection to a paired host is usually re-established in 1-3 seconds.

Suggested hardware setup

3D printed parts

You need to print following files from the hw folder:

  • 0-1-ProMicro_Basic.stl (Tenstar Board, one button) OR 0-2-ProMicro_Output.stl (Tenstar Board, button + output jack plug with a relay OR 0-3-XIAO_Basic.stl (XIAO nRF52840 Board, one button) OR 0-3-XIAO_Output.stl + 0-3-XIAO_Output_Clip.stl (XIAO nRF52840 board, button + output jack plug with a relay)
  • 1-Ring.stl
  • 2-Topper.stl

Electronic / mechanical parts

Optional (if using the BleenyButton with the output enabled):

  • FTR-B3GB003Z mini relay, latching, 3V
  • FC68125 3.5mm jack
  • 6x6mm Button, 8.35mm length (mode switching)

Assembly

Please have a look at the pictures named wiring*_ in the folder img, select the correct picture for your setup (Tenstar or XIAO board, button only or with output)

  1. Glue the parts into the case, either use hotglue or mounting adhesive (recommended!)

    Note 1: avoid glue in the USB-C connector and the jack plug (if mounted)

    Note 2: do not glue any contacts, soldering will result in hazardous fumes

  2. Solder the button and optional relay/jackplug

    Note: avoid short circuits if using bare wire

    Note: also solder the shown bridges if using relay/jackplug

  3. Solder the battery

    Note: avoid any short circuits with the battery! Especially when removing the plug or the insulation.

    Note: on the XIAO board, the LEDs will blink if the battery is connected correctly

  4. Place the topper on the base, add the ring. Hold the ring & base and screw them together (M2x8 screws, 3x)

Programming

  • Open this folder with VSCodium (or VSCode if prefer M$ tracking)
  • Select the correct target in PlatformIO:
    • XIAO nRF52840: [env:xiao_nrf52840]
    • Tenstar: Follow the installation guide , build an example and the build with [env:nicenano]
  • With relay/jackplug: enable //#define OUTPUT_ACTIVE
  • Upload

parts and size comparison parts mounted in base assembled Bleeny Button

Configuration (UI)

The BleenyButton can be configured via the USB-CDC (USB-Serial) interface. An unknown/empty command or ?\n prints out the help with possible commands. This is used for UI as well, which shows the possible options based on the help output.

Open the UI either by opening the file /ui/config.html with a browser (not in GitHub!) locally OR open it at https://assistronik.info/config.html.

Press connect and select the BleenyButton serial interface (shown as something with nRF52840).

The UI will show you the possible options.

Important: The settings are not saved automatically, you need to execute Store new settings on the device!

Currently implemented settings

Command Shortcode (serial command) Type & Value Range Notes
Store new settings on the device s Action Always trigger this action to save changes
Inactivity time [ms] i Integer, 30000-600000 [ms] (30s - 10min) Time before the BleenyButton enters the power-down mode. Will be reset by pressing the button or an established BLE connection
Connected device d Info This information heavily depends on the BLE stack of the host device, it is not always available, even if a device is connected!
Reset paired devices r Action Reset the BLE pairings
Key 1 1 Selection: Space, Enter, 1, 2, Tab, F1, F2, F13, F14 Select the keyboard key to be send when pressing the main button
Key 2 2 Selection: Space, Enter, 1, 2, Tab, F1, F2, F13, F14 If a second button is connected, this key will be sent.
Print out supported commands and build date ? Action Print out possible commands

The following commands are available when building with output enabled:

Command Shortcode (serial command) Type & Value Range Notes
Trigger output c Action Trigger the output, either click or toggle (see Output mode)
Output mode o Selection: click, toggle Either click the output for 0.1s or toggle when the button is pressed (or command "Trigger output" is sent)
Mode 1 - Tremor timeout t Integer, 300-5000 [ms] (0.3-5s) Defines the delay before another output trigger can happen, used in Mode 1
Mode 3 - Auto click delay p Integer, 2-600 [s] After the output is triggered, this time will pass until the output is triggered again.
Startup Mode m Integer, 1-3 Select the output mode on startup. The mode can be changed with the second button on the bottom (PIN_MODE)

Output mode description

Mode 1 - tremor timeout

When pressing the button, it is locked for a given timeout until another press on the button is triggering the output.

Mode 2 - straight

Button presses are directly mapped to the output. Note: each edge (press / release) triggers the output (either click or toggle).

Mode 3 - auto click

A button press triggers the output. Afterwards, the button is locked for a given timeout, then another automatic trigger of the output happens.

Acknowledgement

This work has been accomplished at the UAS Technikum Wien in course of the R&D-project InDiKo (MA23 project 38-09), which is supported by the City of Vienna.

FreeCAD project, output addition, XIAO board adaption and software bugfixes are done by Benjamin Aigner, Assistronik

About

A low-cost BLE button to control devices (switch access / scanning)

Resources

License

Stars

1 star

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors