/OMJK

Here I try to gather information about how I build control for OMJK model railway, with Home Assistant & ESPHome

Primary LanguageHTML

Home Assistant as Railway Controler

Why

  • Home Assistant can control many parts of my house, it can make sure the lights turn on when needed, it can control my lawnmower, it can check if someone is in the house, send an alarm if there is an unwanted visitor, so why don't use it to control our model railway, it's just some lights and some switches and a bit of logic.
  • And not least, it is easy to program for non-programmers, and there is plenty of good documentation.
  • To interface our model railway, Home Assistant has built in ESPHome which is an Arduino-like platform that allows us to use ESP & Raspberry Microcontroller to interface with the model railway

Step to get there

  • to get a stable block detection to work, we must use block detection to feed our logic system.
  • will be to be able to control our signals, since they will be our output from our logic system.
  • will be to control our switches, as their position must be included in our logic system.
  • other not know for now.

Electronics building blocks

  • I have spent half a year developing a set of building blocks like Lego bricks so we can use some standard components for the installation, all based on the ESP MCU and ESPHome.
  • The first module is a Binary Input/Output with PCF8574, connected to ESP32 via I2C interface, with it we will connect Block Detection modules to Home Assistant.
  • To control our LEDs in signals and desks, I have been a long way around control via optocouplers, in order to be able to connect to already set up equipment, but found a small smart print with a PCA9685 chip which has PWM output and I2C interface for ESP MCU.
  • Driver for LED Strip RGBWW V-TAC VT-505-60, a desire has arisen to be able to control the lighting in the room when we drive according to the timetable, a strip of LED Strip has been purchased for this, so the next m´building block for our electronics is a drive that can interface with our Binary Input/Output module.

Test and show progress

  • I find the best way to see if something works is to show it in Home Assistant Views.
  • it gives a quick overview of whether Block Detection works as desired, we can with the Home Assistant Companion App on our phone, follow our model train around the facility and get a visual information.
  • In the same way, we can use another view to find and switch off Led in desks and signals, and thus get confirmation that the installation is in order.

Network with OPNsense

  • OPNsense is an open source, easy-to-use and easy-to-build FreeBSD based firewall and routing platform. OPNsense includes most of the features available in expensive commercial firewalls, and more in many cases. It brings the rich feature set of commercial offerings with the benefits of open and verifiable sources.
  • By using OPNsense, we can separate our network, so that the model railway network is not accessible to everyone, but only to those who have to maintain it.
    We can have a public network where all members can use their laptop or phones to access the internet, use our printers
    and we can have a network where everyone has access to Internettet.


Stationer på anlæget med Home Assistant

  • Stationer
    • Nyborg-FGH
    • Nyborg-H (Ng)
    • Hjulby (Ju)
    • Tommerup (Tp)
    • Odense (Od)
      • Øst
      • Vest
    • Fruens Bøge (Frs)
    • Svendborg (Svg)
    • Holmstrup (Hp)
    • Middelfart (Md)
    • Frederica (Fa)


Graphic Stations Layout

Network

  • Network with OPNsense
    • DHCP Server
    • Net seperation
      • Train Network
      • Private Network
      • Public Network
    • Network switch

Database projects is an exercise in moving our maintenance documentation from, spreadsheets and word documents to a database environment.
Here we use LibreOffice-Base as frontend, and MariaDB as backend.