Skip to content

Clock with flexible second time driven by rotary encoder

Notifications You must be signed in to change notification settings

The-Coobaz/crazyclock

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

crazyclock

Continuous Integration

The main idea of this project is arduino clock with flexible second time. This would allow to speed up or slow down the time.

Hardware

You are going to need:

Schema

Fritzing Wemos D1 Mini schema

Development

Formatting

VS Code

For VS Code install Clang-Format extension.

To format currently edited file use [ctlr] + [shift] + [i] keyboard shortcut.

Console

To format all files at once (with clang-format installed on your system):

clang-format -style=llvm -i crazyclock.ino
find src -iname "*.h" -o -iname "*.cpp" -o -iname "*.ino" | xargs clang-format -style=llvm -i

Working with Arduino IDE

We keep components in src folder.

Working with arduino-cli

Arduino CLI setup

  1. Install arduino-cli

  2. Create configuration file: arduino-cli config init

  3. Add esp8266 URL for board manager:

    arduino-cli config add board_manager.additional_urls https://arduino.esp8266.com/stable/package_esp8266com_index.json
    
  4. Configure the autocompletion for command-line (optional step)

  5. Install Wemos D1 Mini board:

    arduino-cli core update-index
    arduino-cli core install esp8266:esp8266
    arduino-cli core list
    arduino-cli board listall esp8266:d1

Connecting esp-8266 (or Wemos)

  1. Watch for logs with: sudo dmesg -w | grep USB
  2. Connect your device via USB
  3. Write down the ID for the USB device (i.e. ttyUSB0)
  4. Show permissions for the device: ls -lah /dev/ttyUSB0
  5. Write down the group of the device (i.e. uucp)
  6. Add your user to the above group: sudo usermod -a -G uucp $USER
  7. logout and login again to apply changes

Compile and Upload

In root directory:

  1. Install required libraries (i.e. hd44780):

    arduino-cli lib install "hd44780" "NTPClient" "RotaryEncoder" "Time" "Timezone" "DS3231"
  2. Compile: arduino-cli --verbose compile --fqbn esp8266:esp8266:d1

  3. Upload: arduino-cli --verbose upload --fqbn esp8266:esp8266:d1 --port /dev/ttyUSB0

Fritzing Parts

  1. KY-040 Rotary Encoder
  2. Wemos D1 Mini

Automated tests

Requirements

  1. AUnit library: arduino-cli lib install AUnit
  2. EpoxyDuino v1.3.0 in crazyclock libraries folder
  3. Set environment variable ARDUINO_CLI_DIR for arduino-cli libraries:
    export ARDUINO_CLI_DIR=${HOME}/Arduino

About

Clock with flexible second time driven by rotary encoder

Resources

Stars

Watchers

Forks

Packages

No packages published