Firetruck bed

I’ve made a “firetruck” bed for my son, with blinking lights, sirens, etc.



BOM
8 x 16mm push button momentary reset, custom engravings:

  • White (2), A8 (high beam icon) and M7 (low beam icon),
  • Yellow (2), E9 (arrow icon), M1 (alarm signal)
  • Blue (1), G2 (alarm light icon),
  • Green (1), B1 (engine icon),
  • Red (1), F3 (phone icon),

8 x Socket 16mm push button

1 x T-Relay 5V 8 Channel Relay – LILYGO®

1 x T-U2T – LILYGO®

1 x Relay

1 x PCF8574 IO expansion module

2 x Orange Blinker

2 x Blue strobe light

2 x Strobe light (has been ordered, hasn’t arrived yet, so it’s not on the images)

2 x Headlights

2 x Ikea Kura bed

3 x Ikea Snudda bed (wheels and steeringwheel)

1 x Ewent EW3907 ATX PC Power Supply 500 W

Red, Black and White foil for the panels and wheels (you don’t see the white yet on the images, it’s to create a ladder on the top panel).

1 x White and 1x Blue reflective tape for the lower left panel (has yet to be ordered)

1 x Google Nest

Plenty of electrical wire

Hints and tips for building

  • I’ve used two Ikea beds and combined them, The posts for the top bed are glued with dowels. For the right side of the stairs I’ve used a round slat that goes through the girder.
  • The PSU won’t work unless you short the green wire with one of the black wires, when powered on you’ve got your 12v, 5v and 3.3v so you can power almost anything you would like to connect to the Relay board,
  • Compile your own Tasmota build because you need to include the PCF8574 module,
  • Connect the pushbuttons to the IO expansion module,
  • Connect the additional relay to the Relay board (you’ll need it because the strobe lights have the ability to change pattern)

PCF8574 module setup:
D0: Pushbutton M7
D1: Pushbutton A8
D2: Pushbutton E9 (blinker left)
D3: Pushbutton E9 (blinker right)
D4: Pushbutton G2
D5: Pushbutton B1
D6: Pushbutton F3
D7: Pushbutton M1

Relay board:
Relay1: Headlights (angel eyes) + Pushbutton M7
Relay2: Headlights (low and highbeam) + Pushbutton A8
Relay3: Blinker (left) + Pushbutton E9
Relay4: Blinker (right) + Pushbutton E9
Relay5: Strobe lights + Pushbutton G2
Relay6: Strobe lights (pattern selection)
Relay7: Pushbutton B1
Relay8: Pushbutton F3
Relay9 (added relay): Pushbutton M1

Tasmota settings:
backlog blinkcount 5; blinktime 5

Tasmota Rules:
Rule1 turns on or off the engine light
Rule1 ON PCF8574-1_INP#D5=0 DO Power7 2 ENDON

Rule2 turns on or off Rule3 and turns off all lights when the engine is turned off
Rule2 ON Power7#State=0 DO Backlog Rule3 OFF; Power0 OFF ENDON ON Power7#State=1 DO Rule3 on ENDON

Rule3 turns on or off a relay when a button has been pressed
Rule3 ON PCF8574-1_INP#D0=0 DO Power1 2 ENDON ON PCF8574-1_INP#D1=0 DO Power2 2 ENDON ON PCF8574-1_INP#D2=0 DO Power3 3 ENDON ON PCF8574-1_INP#D3=0 DO Power4 3 ENDON ON PCF8574-1_INP#D4=0 DO Power5 2 ENDON ON PCF8574-1_INP#D6=0 DO Power8 2 ENDON ON PCF8574-1_INP#D7=0 DO Backlog Power9 3; Power3 3;Power4 3 ENDON

HA Automation:

alias: Firetruck
description: ""
trigger:
  - platform: state
    entity_id:
      - switch.tasmota_firetruck_switch_relay_7
    from: "off"
    to: "on"
    id: Dispatch
  - platform: state
    entity_id:
      - switch.tasmota_firetruck_switch_relay_4
    from: "off"
    to: "on"
    id: Lights
  - platform: state
    entity_id:
      - switch.tasmota_firetruck_switch_relay_6
    from: "off"
    id: Engine on
    to: "on"
condition: []
action:
  - choose:
      - conditions:
          - condition: trigger
            id: Dispatch
        sequence:
          - service: tts.cloud_say
            entity_id: media_player.google_nest
            data_template:
              message: >
                {{ ('Line1',
                    'Line2',
                    'Line3',
                    'Line4'
                   )|random }}
              cache: false
          - delay:
              hours: 0
              minutes: 0
              seconds: 10
              milliseconds: 0
          - service: switch.turn_off
            data: {}
            target:
              entity_id: switch.tasmota_firetruck_switch_relay_7
      - conditions:
          - condition: trigger
            id: Lights
        sequence:
          - service: media_player.play_media
            target:
              entity_id: media_player.google_nest
            data:
              media_content_id: /media/local/firetruck_siren.mp3
              media_content_type: audio/mp3
          - delay:
              hours: 0
              minutes: 0
              seconds: 15
              milliseconds: 0
          - service: switch.turn_off
            data: {}
            target:
              entity_id: switch.tasmota_firetruck_switch_relay_4
      - conditions:
          - condition: trigger
            id: Engine on
        sequence:
          - service: media_player.play_media
            target:
              entity_id: media_player.google_nest
            data:
              media_content_id: /media/local/engine_on.mp3
              media_content_type: audio/mp3
mode: single

It’s still a work in progress, but I hope to have given some inspiration to those that are thinking of building a firetruck bed :slight_smile:

3 Likes

And the relevance to HA is? When I posted this there was only the pics, no text in the first post. Looks good now)

Thanks for informing, I had to make a choice between first uploading the images from my phone or first typing the project. The relevance to HA is that it can be controlled by HA, it uses HA to broadcast messages and audio.

Sounds great! Lots of fun for a little person, or is it for you?

I had fun building it and my little one can enjoy being a “real firefighter” or Rider from Paw Patrol :slight_smile:

1 Like

I’ve moved to ESPHome and I’m having a challenge getting the blinkers (links, rechts and waarschuwingslichten) to work properly; left should turn off whenever right is being triggered and vice versa, waarschuwingslichten should turn run both blinkers simultaneously, the blinkers should stop whenever the blinker light that’s blinking is being pressed again (just like a regular car :slight_smile: ).

My idea was to create four scripts, blinker_left, blinker_right, waarschuwingslichten, blinkers_off and three status-switches. Whenever the momentary button on the PCF8574 is being pressed it should toggle the corresponding status-switch and that should end the scripts and run the corresponding script and whenever one of the status-switches toggles off it should run the blinkers_off script.

The following code doesn’t have any of the previous mentioned idea’s; it will blink either the left or right blinker for 5 times, but that could lead to the left and right blinkers blinking at the same moment.

substitutions:
  name: "brandweerbed"
  friendly_name: "Brandweerbed"

esphome:
  name: "${name}"
  friendly_name: "${friendly_name}"
  project:
    name: esphome.lilygo_8relay_brandweerbed
    version: "1.0"
  on_boot:
    priority: 800
    then:
      - switch.turn_off: links
      - switch.turn_off: rechts
      - switch.turn_off: dimlicht
      - switch.turn_off: grootlicht
      - switch.turn_off: waarschuwingslichten
      - switch.turn_off: zwaailampen
      - switch.turn_off: zwaailampen_patroon
      - switch.turn_off: motor
      - switch.turn_off: centrale    

esp32:
  board: esp32dev

preferences:
  flash_write_interval: 0s

logger:
  level: DEBUG

api:
  encryption:
    key: !secret api_encryption_key

ota:
  password: !secret ota_password

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

  ap:
    password: !secret ap_password

captive_portal:

web_server:
  port: 80
  auth:
    username: !secret web_server_username
    password: !secret web_server_password
  version: 2
  local: true

text_sensor:
  - platform: wifi_info
    ip_address:
      name: WiFi - IP-address
    ssid:
      name: WiFi - Connected SSID
    bssid:
      name: WiFi - Connected BSSID
    mac_address:
      name: WiFi - MAC-address
    scan_results:
      name: WiFi - Latest Scan Results
    dns_address:
      name: WiFi - DNS Address
  - platform: homeassistant
    name: Brandweerbedstatus
    entity_id: input_boolean.brandweerbed

sensor:
  - platform: wifi_signal
    name: "WiFi - Signal"
    update_interval: 60s
    entity_category: "diagnostic"

i2c:
  sda: GPIO22
  scl: GPIO23
  scan: true

pcf8574:
  - id: "pcf8574_hub"
    address: 0x39
    pcf8575: false

switch:
  - platform: restart
    name: "Device - Restart"

# Default LilyGo T-Relay 5V 8 Channel Relay
  - platform: gpio
    pin: GPIO33
    name: Dimlicht
    id: dimlicht
    # relay 1

  - platform: gpio
    pin: GPIO32
    name: Grootlicht
    id: grootlicht
    # relay 2

  - platform: gpio
    pin: GPIO13
    name: Knipperlicht links
    id: links
    # relay 3

  - platform: gpio
    pin: GPIO12
    name: Knipperlicht rechts
    id: rechts
    # relay 4

  - platform: gpio
    pin: GPIO21
    name: Zwaailampen
    id: zwaailampen
    # relay 5

  - platform: gpio
    pin: GPIO19
    name: Zwaailampen (patroon)
    id: zwaailampen_patroon
    # relay 6

  - platform: gpio
    pin: GPIO18
    name: Motor
    id: motor
    # relay 7

  - platform: gpio
    pin: GPIO05
    name: Centrale
    id: centrale
    # relay 8

# Additional relay
  - platform: gpio
    pin: GPIO27
    inverted: true
    name: Waarschuwingslichten
    id: waarschuwingslichten

# PCF8574
binary_sensor:
  - platform: homeassistant
    name: Brandweerbed
    entity_id: input_boolean.brandweerbed
    id: brandweerbed
    internal: true

  - platform: gpio
    name: "Drukknop dimlicht"
    id: pcf8574_0
    pin:
      pcf8574: pcf8574_hub
      # Use pin number 0
      number: 0
      # One of INPUT or OUTPUT
      mode:
        input: true
      inverted: true
    on_press:
      if:
        condition:
          - binary_sensor.is_on: brandweerbed
          - switch.is_on: motor
        then:
          - switch.toggle: dimlicht
        else:
          - switch.turn_off: motor
          - switch.turn_off: links
          - switch.turn_off: rechts
          - switch.turn_off: waarschuwingslichten
          - switch.turn_off: zwaailampen
          - switch.turn_off: dimlicht
          - switch.turn_off: grootlicht

  - platform: gpio
    name: "Drukknop grootlicht"
    id: pcf8574_1
    pin:
      pcf8574: pcf8574_hub
      # Use pin number 0
      number: 1
      # One of INPUT or OUTPUT
      mode:
        input: true
      inverted: true
    on_press:
      if:
        condition:
          - binary_sensor.is_on: brandweerbed
          - switch.is_on: motor
        then:
          - switch.toggle: grootlicht

  - platform: gpio
    name: "Drukknop links"
    id: pcf8574_2
    pin:
      pcf8574: pcf8574_hub
      # Use pin number 0
      number: 2
      # One of INPUT or OUTPUT
      mode:
        input: true
      inverted: true
    on_press:
      if:
        condition:
          - binary_sensor.is_on: brandweerbed
          - switch.is_on: motor
        then:
          - switch.turn_off: links
          - switch.turn_off: rechts
          - switch.turn_off: waarschuwingslichten
          - repeat:
              count: 5
              then:
                - switch.turn_on: links
                - delay: 500ms
                - switch.turn_off: links
                - delay: 500ms    

  - platform: gpio
    name: "Drukknop rechts"
    id: pcf8574_3
    pin:
      pcf8574: pcf8574_hub
      # Use pin number 0
      number: 3
      # One of INPUT or OUTPUT
      mode:
        input: true
      inverted: true
    on_press:
      if:
        condition:
          - binary_sensor.is_on: brandweerbed
          - switch.is_on: motor
        then:
          - switch.turn_off: links
          - switch.turn_off: rechts
          - switch.turn_off: waarschuwingslichten
          - repeat:
              count: 5
              then:
                - switch.turn_on: rechts
                - delay: 500ms
                - switch.turn_off: rechts
                - delay: 500ms

  - platform: gpio
    name: "Drukknop zwaailampen"
    id: pcf8574_4
    pin:
      pcf8574: pcf8574_hub
      # Use pin number 0
      number: 4
      # One of INPUT or OUTPUT
      mode:
        input: true
      inverted: true
    on_press:
      if:
        condition:
          - binary_sensor.is_on: brandweerbed
          - switch.is_on: motor
        then:
          - switch.toggle: zwaailampen

  - platform: gpio
    name: "Drukknop motor"
    id: pcf8574_5
    pin:
      pcf8574: pcf8574_hub
      # Use pin number 0
      number: 5
      # One of INPUT or OUTPUT
      mode:
        input: true
      inverted: true
    on_press:
      if:
        condition:
          - binary_sensor.is_on: brandweerbed
          - switch.is_off: motor
        then:
          - switch.turn_on: motor
        else:
          - switch.turn_off: motor
          - switch.turn_off: links
          - switch.turn_off: rechts
          - switch.turn_off: waarschuwingslichten
          - switch.turn_off: zwaailampen
          - switch.turn_off: dimlicht
          - switch.turn_off: grootlicht

  - platform: gpio
    name: "Drukknop centrale"
    id: pcf8574_6
    pin:
      pcf8574: pcf8574_hub
      # Use pin number 0
      number: 6
      # One of INPUT or OUTPUT
      mode:
        input: true
      inverted: true
    on_press:
      if:
        condition:
          - binary_sensor.is_on: brandweerbed
          - switch.is_on: motor
        then:
          - switch.toggle: centrale

  - platform: gpio
    name: "Waarschuwingslichten"
    id: pcf8574_7
    pin:
      pcf8574: pcf8574_hub
      # Use pin number 0
      number: 7
      # One of INPUT or OUTPUT
      mode:
        input: true
      inverted: true
    on_press:
      if:
        condition:
          - binary_sensor.is_on: brandweerbed
          - switch.is_on: motor
        then:
          - switch.turn_off: links
          - switch.turn_off: rechts
          - switch.turn_off: waarschuwingslichten
          - repeat:
              count: 5
              then:
                - switch.turn_on: links
                - switch.turn_on: rechts
                - switch.turn_on: waarschuwingslichten
                - delay: 500ms
                - switch.turn_off: links
                - switch.turn_off: rechts
                - switch.turn_off: waarschuwingslichten
                - delay: 500ms

time:
  - platform: homeassistant
    id: homeassistant_time