The yaml below provides the basic functionality for the Nixie Clock, along with the basic peripherals: RGB Leds, Nixie Vb voltage sensor, and Dallas temp sensor.
esphome:
name: nixie-clock
friendly_name: Nixie Clock
on_boot:
priority: -100
then:
- number.set:
id: mcp4018_num
value: 170
- number.set:
id: nixie_1
value: 0
- number.set:
id: nixie_2
value: 0
- number.set:
id: nixie_3
value: 0
- number.set:
id: nixie_4
value: 0
- number.set:
id: nixie_5
value: 0
- number.set:
id: nixie_6
value: 0
- lambda: |
auto call = id(rgb_leds).turn_on();
call.set_rgb(0.5, 0.25, 1.0);
call.set_brightness(0.5);
call.perform();
- switch.turn_on: hv_enable
external_components:
- source: github://lylavoie/esphome@MCP401x
components: [ mcp401x ]
- source: github://lylavoie/esphome@HV5522
components: [ hv5522 ]
esp32:
board: esp32dev
framework:
type: arduino
# Enable logging
logger:
level: DEBUG
# Enable Home Assistant API
api:
encryption:
key: xxxx
reboot_timeout: 0s
ota:
password: xxxx
wifi:
ssid: xxxxxxxx
password: xxxxxxxx
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Nixie-Clock"
password: "Nixie-Clock"
captive_portal:
web_server:
port: 80
log: False
auth:
username: xxxx
password: xxxx
status_led:
pin:
number: GPIO12
time:
- platform: sntp
id: sntp_time
timezone: America/New_York
on_time_sync:
then:
lambda: |
auto time = id(sntp_time).now();
auto call1 = id(nixie_1).make_call();
call1.set_value(time.second % 10);
call1.perform();
auto call2 = id(nixie_2).make_call();
call2.set_value(time.second / 10);
call2.perform();
auto call3 = id(nixie_3).make_call();
call3.set_value(time.minute % 10);
call3.perform();
auto call4 = id(nixie_4).make_call();
call4.set_value(time.minute / 10);
call4.perform();
auto call5 = id(nixie_5).make_call();
call5.set_value(time.hour % 10);
call5.perform();
auto call6 = id(nixie_6).make_call();
call6.set_value(time.hour / 10);
call6.perform();
on_time:
# Seconds
- cron: "* * * * * *"
then:
lambda: |
auto time = id(sntp_time).now();
auto call1 = id(nixie_1).make_call();
call1.set_value(time.second % 10);
call1.perform();
auto call2 = id(nixie_2).make_call();
call2.set_value(time.second / 10);
call2.perform();
# Minutes
- cron: "0 * * * * *"
then:
lambda: |
auto time = id(sntp_time).now();
auto call3 = id(nixie_3).make_call();
call3.set_value(time.minute % 10);
call3.perform();
auto call4 = id(nixie_4).make_call();
call4.set_value(time.minute / 10);
call4.perform();
# Hours
- cron: "0 0 * * * *"
then:
lambda: |
auto time = id(sntp_time).now();
auto call5 = id(nixie_5).make_call();
call5.set_value(time.hour % 10);
call5.perform();
auto call6 = id(nixie_6).make_call();
call6.set_value(time.hour / 10);
call6.perform();
light:
- platform: neopixelbus
name: RGB-LEDs
id: rgb_leds
pin: GPIO13
num_leds: 6
variant: WS2812
type: RGB
- platform: monochromatic
name: "Nixie Brightness"
output: nixie_bl
restore_mode: RESTORE_AND_ON
i2c:
- id: bus_a
sda: GPIO16
scl: GPIO4
scan: True
output:
- platform: mcp401x
id: myPot
address: 0x2F
min_power: 0
max_power: 1
- platform: ledc
pin:
number: GPIO32
inverted: true
id: nixie_bl
dallas:
- pin: GPIO14
sensor:
- platform: adc
id: nixie_voltage
name: Nixie Voltage
pin: GPIO35
attenuation: 11dB
update_interval: 1s
filters:
- sliding_window_moving_average:
window_size: 15
send_every: 15
- calibrate_linear:
method: least_squares
datapoints:
- 1.43 -> 147.8
- 1.47753 -> 153.3
- 1.5116 -> 158.5
- 1.55487 -> 165.3
- 1.60327 -> 172.5
- 1.63367 -> 177.9
- 1.6646 -> 182.9
- 1.6942 -> 187.8
- 1.72827 -> 194.8
- 1.749 -> 200.2
- 1.782 -> 206.2
- 1.81293 -> 212.5
- platform: dallas
index: 0
name: "Temperature"
spi:
id: spi_bus0
clk_pin: GPIO18
mosi_pin: GPIO33
hv5522:
id: myHV5522
latch_pin: GPIO17
spi_id: spi_bus0
data_rate: 200kHz
count: 2
switch:
- platform: gpio
pin: GPIO23
name: HV Enable
restore_mode: ALWAYS_OFF
inverted: true
id: hv_enable
- platform: gpio
id: sep_1a
name: Seperator 1A
restore_mode: ALWAYS_ON
pin:
hv5522: myHV5522
number: 30
- platform: gpio
id: sep_1b
name: Seperator 1B
restore_mode: ALWAYS_ON
pin:
hv5522: myHV5522
number: 31
- platform: gpio
id: sep_2a
name: Seperator 2A
restore_mode: ALWAYS_ON
pin:
hv5522: myHV5522
number: 62
- platform: gpio
id: sep_2b
name: Seperator 2B
restore_mode: ALWAYS_ON
pin:
hv5522: myHV5522
number: 63
number:
- platform: template
name: Nixie Voltage
id: mcp4018_num
min_value: 140
max_value: 200
optimistic: true
step: 0.1
set_action:
- lambda: |
float newPotValue=x*-0.00489589+1.62733;
ESP_LOGV("number", "Setting digipot to %f", newPotValue);
id(myPot).set_level(newPotValue);
- platform: hv5522
name: Nixie-1
id: nixie_1
count_back: True
count_back_speed: 50
hv5522: myHV5522
pins: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
- platform: hv5522
name: Nixie-2
id: nixie_2
count_back: True
count_back_speed: 50
hv5522: myHV5522
pins: [10, 11, 12, 13, 14, 15, 16, 17, 18, 19]
- platform: hv5522
name: Nixie-3
id: nixie_3
count_back: True
count_back_speed: 50
hv5522: myHV5522
pins: [20, 21, 22, 23, 24, 25, 26, 27, 28, 29]
- platform: hv5522
name: Nixie-4
id: nixie_4
count_back: True
count_back_speed: 50
hv5522: myHV5522
pins: [32, 33, 34, 35, 36, 37, 38, 39, 40, 41]
- platform: hv5522
name: Nixie-5
id: nixie_5
count_back: True
count_back_speed: 50
hv5522: myHV5522
pins: [42, 43, 44, 45, 46, 47, 48, 49, 50, 51]
- platform: hv5522
name: Nixie-6
id: nixie_6
count_back: True
count_back_speed: 50
hv5522: myHV5522
pins: [52, 53, 54, 55, 56, 57, 58, 59, 60, 61]```