# Example ESPHome config for a Samsung 2x20 serial VFD display. # # Copy this file into your ESPHome config folder (and add the keys below to # your secrets.yaml), or use it as a reference for your own device config. # # Wiring (3-pin connector on the display, 9600 8N1): # pin 1 VCC <- 5-24V supply, up to 1.2A at 5V (not the ESP32 regulator) # pin 2 RXD <- MAX3232 T1OUT <- T1IN <- ESP32 GPIO17 (TX) # pin 3 GND <-> supply GND, MAX3232 GND and ESP32 GND # # RXD is an RS-232 input. Without a MAX3232, wire GPIO17 straight to RXD and # set `inverted: true` under uart. esphome: name: samsung-vfd friendly_name: Samsung VFD on_boot: priority: -100 then: - samsung_vfd.clear: id: vfd - samsung_vfd.print: id: vfd text: "Hello World! ~" # "~" is the heart defined below centered: true - delay: 3s # Bring back the last text Home Assistant set for the top line. - samsung_vfd.print: id: vfd line: 0 text: !lambda "return id(vfd_line1).state;" external_components: - source: type: git url: https://mangavalk.com/mangavalk/esphome-samsung-vfd ref: main components: [samsung_vfd] refresh: 1d # While developing the component, use the checkout instead: # - source: # type: local # path: ../components esp32: board: esp32dev framework: type: arduino logger: level: INFO api: encryption: key: !secret api_key ota: - platform: esphome password: !secret ota_password wifi: ssid: !secret wifi_ssid password: !secret wifi_password # Uncomment to pin a fixed address. # manual_ip: # static_ip: 10.1.1.60 # gateway: 10.1.1.1 # subnet: 255.255.255.0 ap: ssid: "Samsung VFD Fallback" password: !secret fallback_password captive_portal: # SNTP so samsung_vfd.printf can show the local time. time: - platform: sntp id: sntp_time timezone: Europe/Amsterdam servers: - 0.pool.ntp.org - 1.pool.ntp.org # Must match the display's jumpers; all open (factory default) = 9600, no parity. uart: id: uart_vfd tx_pin: number: GPIO17 inverted: false # true when wired directly, without a MAX3232 baud_rate: 9600 parity: NONE # The display is output-only for us; no rx_pin needed. samsung_vfd: id: vfd uart_id: uart_vfd cols: 20 rows: 2 brightness: 100% code_table: PC437 # glyphs for é, ü, °, ½, box drawing ... (match jumpers 6-8) international_charset: USA # Up to 4 custom glyphs, replacing a printable ASCII character you don't use. user_characters: - code: "~" pattern: - ".#.#." - "#####" - "#####" - "#####" - ".###." - "..#.." - "....." # Bottom line shows the SNTP clock every second, except while a status banner is up. interval: - interval: 1s then: - if: condition: not: script.is_running: show_status then: - samsung_vfd.printf: id: vfd time_id: sntp_time line: 1 format: "%a %d %b %H:%M:%S" # Full-screen centred banner for a while, then back to line 1 + clock. script: - id: show_status mode: restart parameters: msg: string then: - samsung_vfd.print: id: vfd text: !lambda "return msg;" centered: true - delay: 10s - samsung_vfd.print: id: vfd line: 0 text: !lambda "return id(vfd_line1).state;" - samsung_vfd.printf: id: vfd time_id: sntp_time line: 1 format: "%a %d %b %H:%M:%S" # Two Home Assistant text entities you can type into from HA. text: - platform: template id: vfd_line1 name: "VFD line 1" icon: mdi:text-box-outline mode: text max_length: 20 optimistic: true restore_value: true initial_value: "" on_value: then: - if: condition: not: script.is_running: show_status then: - samsung_vfd.print: id: vfd line: 0 text: !lambda "return x;" - platform: template id: vfd_status name: "VFD status" icon: mdi:information-outline mode: text max_length: 40 optimistic: true initial_value: "" on_value: then: - if: condition: lambda: "return !x.empty();" then: - script.execute: id: show_status msg: !lambda "return x;" # Brightness (4 levels) and power from Home Assistant. select: - platform: template name: "VFD brightness" icon: mdi:brightness-6 optimistic: true restore_value: true options: ["40%", "60%", "80%", "100%"] initial_option: "100%" on_value: then: - samsung_vfd.set_brightness: id: vfd brightness: !lambda "return (i + 2) * 0.2f;" switch: - platform: template name: "VFD display" icon: mdi:monitor optimistic: true restore_mode: RESTORE_DEFAULT_ON turn_on_action: - samsung_vfd.turn_on: id: vfd turn_off_action: - samsung_vfd.turn_off: id: vfd