7-Segment-Digital-Clock_Analog-Patch
This is the source and schema for a homemade analog clock I've made. The code is based on this.
In daylight it's not very bright.
To control the clock you can use a bluetooth terminal of your choice or my app.
Feel free to modify my app like you want to. Source code
If the app asks you to enable bluetooth, the devices wont display after you allowed it, first you need to reload the current site.
Press on the Devices button to reload the site (works on other sites too).
The App needs following permissions:
- <uses-permission android:name="android.permission.BLUETOOTH" />
- <uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
- <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
- <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
Bluetooth should be logical. The app will ask befor enabling Bluetooth or access the storage. The storage is used to save some values (see site advanced). You can save and load color values.
The values will be stored in most cases to /storage/emulated/0/AnalogClockV1/config.json
, just open a file explorer and navigate to internal storage. anywhere there you should find the folder AnalogClockV1.
The resistor R1.1 need to be a pull UP resistor!
I'll fix the plans (wiring, pcb, perfboard (AnalogClockV1.fzz)) later (with the ext. EEPROM update I'm working on)
(Btw, the cirquit worked with even no resistors...)
See wiring folder for sketches
Hardware | Additional hardware for wireless clock | Software |
---|---|---|
Arduino Nano (ATmega328!) | Li-Ion 18650 Battery | Arduino IDE |
LED strip WS2812B 1m 30 RGB LEDs (24 needed) | 5V 1A Step Up Power Module | Library: Adafruit_Sensor |
Real time clock: DS3231 | A battery holder wouldn't be bad... | Library: DHT |
(and a battery if not included) | 2x Generic female header - 15 pins | Library: FastLED |
Bluetooth module: HC-05 | 4x Generic female header - 4 pins | Library: RTCLib |
Temperature & Humidity Sensor: DHT11 or DHT22 | 1x Generic female header - 3 pins | Library: Timer |
LED 4 Digits 7 Segment Display: TM1637 | Library: TM1637 | |
5V / 2A Power Supply | ||
PCB, Breadboard, ... | ||
Wires, Glue and a lot of patience :) |
To send a command to the clock, you need to wrap it into this characters: ||
Synthax:
| Command,arg0,argN|
Command | Arguments | Description |
---|---|---|
PING | none | Returns |STATUS,(some parameters\*)| . Its for the app (to check if right device, for different versions, ...) |
RESET | none | Restarts the Arduino (like pushing the reset button or put the reset pin high) |
CLOCK | none | Set mode to 0 (Display time) |
TEMPERATURE | none | Set mode to 1 (Display time and temperature)** |
HUMIDITY | none | Set mode to 2 (Display time and humidity)** |
SCOREBOARD | L, R | Set mode to 3 and Set score of L and R (both type integer, 0 ≤ n ≤ 99) |
TIMER | none | Set mode to 4 and start/ stop timer (Returns |TIMER,(timerRunning as int)| ) |
MODETOGGLE | none | Define, if the clock toggles every 5 seconds between mode 1 and 2 (Returns |MODETOGGLE,(modeToggle as int)| ) |
RTC | Y, M, D, h, m, s | Set time. No leading zeros required (Year, Month, Day, Hour, Minute, Second) |
COLOR | target, r, g, b | Set rgb color of target (B, P, S)*** |
BRIGHTNESS | target, value | Set brightness of target(B, H, 0, 1, 2, L)**** |
*For parameters see AnalogClockV4 » processBtBuffer() » if PING [#L218]
**If modeToggle is true, the clock toggles between temperature and humidity.
***List of color targets:
- B: Background
- P: Hour dot (pointer) & Score left
- S: Minute dot(s) (pointer) & Score right
****List of brightness targets:
- B: Background
- H: Hour dot (pointer)
- 0: Minutes dot (offset 0)
- 1: Minutes dot (offset 1)
- 2: Minutes dot (offset 2)
- L: Set background lighting:
- 0: Off
- 1: Quarters
- 2: All
Clock displaying humidity
Clock displaying scoreboard
Clock displaying temperature
Clock displaying 18:55