GithubHelp home page GithubHelp logo

tibordp / cube-timer Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 0.0 3.3 MB

Bluetooth-enabled Arduino/ESP32 Twisty Puzzle Timer

License: MIT License

C++ 57.32% HTML 2.01% CSS 3.90% TypeScript 36.76%
cube-timer esp32-arduino esp32 bluetooth-low-energy platformio

cube-timer's Introduction

Cube Timer

Cube Timer is a Bluetooth-enabled hardware twisty puzzle timer, based on the ESP32 MCU (using the Arduino core)

Features:

  • Capacitive touch panel for starting and stopping the timer.
  • 128x64 monochrome OLED display, so it can be used as a standalone device
  • Bluetooth Low Energy interface for integration with results logging software
  • Inspection mode with adjustable time
  • Dedicated push buttons for +2/DNF
  • I don't have any data to back it up, but it should be quite accurate, margin of error is ~2ms if the touch panel is properly calibrated.

Even though the software is Arduino-based, it is not very portable, as it makes use of some cool features of the ESP32 (e.g. capacitive sensor inputs, interrupts on all GPIO pins, Bluetooth radio). It might work with slight modifications on ESP8266, but it will definitely not work on AVR-based Arduino boards.

Schematic and build

Schematic

The dev board I used is ESP32 DevKitC V2. I used this OLED module, but any 128x64 SH1106 module should probably work just fine.

Touch panel can be wired to pretty much anything conductive, such as a square of aluminium foil. I used a resealable tab from a bag of coffee beans soldered to a jumper wire. Different panels will produce different readings, so Cube Timer has a built in calibration feature (long hold of button 4). Calibration values are persisted in flash across restarts.

Here's how it looks on a breadboard. The ESP32 dev board I used is too wide to fit on a regular-sized breadboard and leave holes on both sides, so I had to route half of the jumpers under the board.

Bluetooth LE interface

Cube Timer exposes a BLE GATT service with the UUID of EB0E77C3-AF14-4B7F-AC80-D3631DC386AC and a single characteristic with UUID EB0E77C3-AF14-4B7F-AC80-D3631DC386AD (Read, Notify and Indicate).

It notifies on every internal state transition and the format corresponds to this packed struct:

struct __attribute__ ((packed)) CharacteristicValue {
  // Internal state of the device 
  // (e.g. 0 = default, 10-19 = inspection, 20-29 = timer running)
  uint32_t state;    
  
  // Number that increments on every new solve
  uint32_t epoch;
  
  // Duration of the solve in milliseconds (DNF is represented as -1)
  int32_t duration;  
};

Demo app

A simple demo app Web Bluetooth API is available on https://tibordp.github.io/cube-timer (see source under demo_app)

Ideas for further work

  • Integrate it with cstimer or some other popular timer
  • Add rechargeable battery and make use of ESP32's ULP coprocessor
  • Some sort of persistence and statistics calculation, so it can function better as a standalone device
  • Actually design a PCB for it (I have no idea yet how to do it, this is my first real electronics project)
  • Ditch Arduino and rewrite it in Rust?

cube-timer's People

Contributors

tibordp avatar

Watchers

 avatar  avatar

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.