SlideShare a Scribd company logo
1 of 17
Download to read offline
@proffalken | github.com/modelrailwaysascode | github.com/proffalken
The imitation Game
Model Railways and Open Data
@proffalken | github.com/modelrailwaysascode | github.com/proffalken
What’s the dream?
A completely autonomous model railway, utilising the
Network Rail Open Data feeds to move trains around
the layout in real-time.
“
”
@proffalken | github.com/modelrailwaysascode | github.com/proffalken
What do we need?
Data Feeds
Command and
Control Software
Data Converter
Model Railway
Hardware
Interface
@proffalken | github.com/modelrailwaysascode | github.com/proffalken
What do we need?
Data Feeds
Command and
Control Software
Data Converter
Model Railway
Hardware
Interface
@proffalken | github.com/modelrailwaysascode | github.com/proffalken
Network Rail data feeds and the Open Rail Data community
●
https://wiki.openraildata.com/
●
Amazing source of information on the various data formats that Network Rail make available via their
API’s
●
https://datafeeds.networkrail.co.uk/ ← Sign up here to get access to the data!
●
Be careful, data comes in multiple formats, and not all formats contain all the data…
@proffalken | github.com/modelrailwaysascode | github.com/proffalken
STOMPing around in Python
@proffalken | github.com/modelrailwaysascode | github.com/proffalken
JMRI – The brains of the operation!
●
Java-based
●
Multiple applications depending on what you want to do
●
It uses Jython!
●
Jython is really old…
●
It supports MQTT!
●
MQTT requires yet more “stuff” to be setup
●
It has a TCP-based API called WiThrottle for control via mobile devices!
●
The WiThrottle API is… unique
@proffalken | github.com/modelrailwaysascode | github.com/proffalken
WiThrottle – RL2][RGS 41}|{41}|{L][Test Loco}|{1234}|{L
●
It uses [
[ and ]
] to differentiate between locomotives
●
It uses {
{ and }
} to show the values for settings
●
The settings are always in the same order…
●
… but never as key=value
key=value pairs
●
Commands use three characters in a row to delimit: <;>
<;>
●
All feedback is sent as new lines, but you don’t know when it’s finished sending feedback
@proffalken | github.com/modelrailwaysascode | github.com/proffalken
WiThrottle – Setting a function
M0AS3<;>F110
M0 = Throttle ID
A = Send an “action” to a locomotive
S = Make sure we’re using DCC “short” mode
3 = The DCC channel we need to target
<;> = That weird choice of delimiter
F = Set a Function
1 = Either 0 (Off) or 1 (On)
10 = The function to act against (from 00 to 99)
@proffalken | github.com/modelrailwaysascode | github.com/proffalken
WiThrottle – Moving the loco
M0AS3<;>V50
M0 = Throttle ID
A = Send an “action” to a locomotive
S = Make sure we’re using DCC “short” mode
3 = The DCC channel we need to target
<;> = That weird choice of delimiter
V = Set the speed (v == Velocity?)
50 = A value between 0 and 126
@proffalken | github.com/modelrailwaysascode | github.com/proffalken
WiThrottle – Switching Direction
M0AS3<;>R0
M0 = Throttle ID
A = Send an “action” to a locomotive
S = Make sure we’re using DCC “short” mode
3 = The DCC channel we need to target
<;> = That weird choice of delimiter
R = Set the direction
0 = Either 0 (Reverse) or 1 (Forward)
@proffalken | github.com/modelrailwaysascode | github.com/proffalken
Let’s make this a bit easier…
PyWiThrottle
https://github.com/modelrailwaysascode/pywithrottle
@proffalken | github.com/modelrailwaysascode | github.com/proffalken
Connecting to the track using
●
www.merg.org.uk
●
Numerous circuit boards to connect to model
railways and accessories via all kinds of
protocols and methods
●
Large online community who are incredibly
helpful
●
Cheap to join
●
Kits are not expensive
●
Full computer control of a layout, including block
detection and point control for under £90!
(Commercial equivalents are well over £250 for
a “decent” setup)
Photo © MERG
@proffalken | github.com/modelrailwaysascode | github.com/proffalken
Putting it all together!
@proffalken | github.com/modelrailwaysascode | github.com/proffalken
The output
@proffalken | github.com/modelrailwaysascode | github.com/proffalken
What next?
●
Build a proper layout rather than the test track
– Find a suitable location (St. Ives Branch line?)
– Model it
– Work out the TIPLOC/STANOX codes for each section
– Write the integration based on PyWiThrottle
●
Continue to update PyWiThrottle to add more functionality (Contributors welcome!)
●
Create more fun distractions timewasters projects under the “Model Railways as Code” banner
@proffalken | github.com/modelrailwaysascode | github.com/proffalken
Thank you!
https://github.com/modelrailwaysascode/
https://twitter.com/proffalken

More Related Content

Similar to The imitation Game - EMFCamp 2022.pdf

Scaling application with RabbitMQ
Scaling application with RabbitMQScaling application with RabbitMQ
Scaling application with RabbitMQNahidul Kibria
 
Graph web superpath-2015 - SVG Extension
Graph web superpath-2015 - SVG ExtensionGraph web superpath-2015 - SVG Extension
Graph web superpath-2015 - SVG ExtensionJean-Claude Moissinac
 
Combitronic: Multi-axis Control with Animatics SmartMotors
Combitronic: Multi-axis Control with Animatics SmartMotorsCombitronic: Multi-axis Control with Animatics SmartMotors
Combitronic: Multi-axis Control with Animatics SmartMotorsDesign World
 
Operationalizing Machine Learning: Serving ML Models
Operationalizing Machine Learning: Serving ML ModelsOperationalizing Machine Learning: Serving ML Models
Operationalizing Machine Learning: Serving ML ModelsLightbend
 
Deep Dive into Futures and the Parallel Programming Library
Deep Dive into Futures and the Parallel Programming LibraryDeep Dive into Futures and the Parallel Programming Library
Deep Dive into Futures and the Parallel Programming LibraryJim McKeeth
 
Angular 2 overview in 60 minutes
Angular 2 overview in 60 minutesAngular 2 overview in 60 minutes
Angular 2 overview in 60 minutesLoiane Groner
 
What is Socket Programming in Python | Edureka
What is Socket Programming in Python | EdurekaWhat is Socket Programming in Python | Edureka
What is Socket Programming in Python | EdurekaEdureka!
 
Proxy deep-dive java-one_20151027_001
Proxy deep-dive java-one_20151027_001Proxy deep-dive java-one_20151027_001
Proxy deep-dive java-one_20151027_001Sven Ruppert
 
Developing Microservices with Apache Camel
Developing Microservices with Apache CamelDeveloping Microservices with Apache Camel
Developing Microservices with Apache CamelClaus Ibsen
 
Building Kafka Connectors with Kotlin: A Step-by-Step Guide to Creation and D...
Building Kafka Connectors with Kotlin: A Step-by-Step Guide to Creation and D...Building Kafka Connectors with Kotlin: A Step-by-Step Guide to Creation and D...
Building Kafka Connectors with Kotlin: A Step-by-Step Guide to Creation and D...HostedbyConfluent
 
A Brief Conceptual Introduction to Functional Java 8 and its API
A Brief Conceptual Introduction to Functional Java 8 and its APIA Brief Conceptual Introduction to Functional Java 8 and its API
A Brief Conceptual Introduction to Functional Java 8 and its APIJörn Guy Süß JGS
 
The Graphical Web Conferernce 2015 - Superpath SVG Extension
The Graphical Web Conferernce 2015 - Superpath SVG ExtensionThe Graphical Web Conferernce 2015 - Superpath SVG Extension
The Graphical Web Conferernce 2015 - Superpath SVG ExtensionJirasri Deslis
 
Python Streaming Pipelines with Beam on Flink
Python Streaming Pipelines with Beam on FlinkPython Streaming Pipelines with Beam on Flink
Python Streaming Pipelines with Beam on FlinkAljoscha Krettek
 
Gearpump akka streams
Gearpump akka streamsGearpump akka streams
Gearpump akka streamsKam Kasravi
 
Flink Forward Berlin 2018: Thomas Weise & Aljoscha Krettek - "Python Streamin...
Flink Forward Berlin 2018: Thomas Weise & Aljoscha Krettek - "Python Streamin...Flink Forward Berlin 2018: Thomas Weise & Aljoscha Krettek - "Python Streamin...
Flink Forward Berlin 2018: Thomas Weise & Aljoscha Krettek - "Python Streamin...Flink Forward
 
Iot gateway dream team - Eclipse Kura and Apache Camel
Iot gateway dream team - Eclipse Kura and Apache CamelIot gateway dream team - Eclipse Kura and Apache Camel
Iot gateway dream team - Eclipse Kura and Apache CamelHenryk Konsek
 

Similar to The imitation Game - EMFCamp 2022.pdf (20)

Scaling application with RabbitMQ
Scaling application with RabbitMQScaling application with RabbitMQ
Scaling application with RabbitMQ
 
Xilinx training in mohali
Xilinx training in mohaliXilinx training in mohali
Xilinx training in mohali
 
Graph web superpath-2015 - SVG Extension
Graph web superpath-2015 - SVG ExtensionGraph web superpath-2015 - SVG Extension
Graph web superpath-2015 - SVG Extension
 
Combitronic: Multi-axis Control with Animatics SmartMotors
Combitronic: Multi-axis Control with Animatics SmartMotorsCombitronic: Multi-axis Control with Animatics SmartMotors
Combitronic: Multi-axis Control with Animatics SmartMotors
 
Google cloud Dataflow & Apache Flink
Google cloud Dataflow & Apache FlinkGoogle cloud Dataflow & Apache Flink
Google cloud Dataflow & Apache Flink
 
Operationalizing Machine Learning: Serving ML Models
Operationalizing Machine Learning: Serving ML ModelsOperationalizing Machine Learning: Serving ML Models
Operationalizing Machine Learning: Serving ML Models
 
Deep Dive into Futures and the Parallel Programming Library
Deep Dive into Futures and the Parallel Programming LibraryDeep Dive into Futures and the Parallel Programming Library
Deep Dive into Futures and the Parallel Programming Library
 
Angular 2 overview in 60 minutes
Angular 2 overview in 60 minutesAngular 2 overview in 60 minutes
Angular 2 overview in 60 minutes
 
What is Socket Programming in Python | Edureka
What is Socket Programming in Python | EdurekaWhat is Socket Programming in Python | Edureka
What is Socket Programming in Python | Edureka
 
Proxy deep-dive java-one_20151027_001
Proxy deep-dive java-one_20151027_001Proxy deep-dive java-one_20151027_001
Proxy deep-dive java-one_20151027_001
 
Developing Microservices with Apache Camel
Developing Microservices with Apache CamelDeveloping Microservices with Apache Camel
Developing Microservices with Apache Camel
 
Building Kafka Connectors with Kotlin: A Step-by-Step Guide to Creation and D...
Building Kafka Connectors with Kotlin: A Step-by-Step Guide to Creation and D...Building Kafka Connectors with Kotlin: A Step-by-Step Guide to Creation and D...
Building Kafka Connectors with Kotlin: A Step-by-Step Guide to Creation and D...
 
A Brief Conceptual Introduction to Functional Java 8 and its API
A Brief Conceptual Introduction to Functional Java 8 and its APIA Brief Conceptual Introduction to Functional Java 8 and its API
A Brief Conceptual Introduction to Functional Java 8 and its API
 
The Graphical Web Conferernce 2015 - Superpath SVG Extension
The Graphical Web Conferernce 2015 - Superpath SVG ExtensionThe Graphical Web Conferernce 2015 - Superpath SVG Extension
The Graphical Web Conferernce 2015 - Superpath SVG Extension
 
Python Streaming Pipelines with Beam on Flink
Python Streaming Pipelines with Beam on FlinkPython Streaming Pipelines with Beam on Flink
Python Streaming Pipelines with Beam on Flink
 
Microservices in Clojure
Microservices in ClojureMicroservices in Clojure
Microservices in Clojure
 
Gearpump akka streams
Gearpump akka streamsGearpump akka streams
Gearpump akka streams
 
What is your money doing?
What is your money doing?What is your money doing?
What is your money doing?
 
Flink Forward Berlin 2018: Thomas Weise & Aljoscha Krettek - "Python Streamin...
Flink Forward Berlin 2018: Thomas Weise & Aljoscha Krettek - "Python Streamin...Flink Forward Berlin 2018: Thomas Weise & Aljoscha Krettek - "Python Streamin...
Flink Forward Berlin 2018: Thomas Weise & Aljoscha Krettek - "Python Streamin...
 
Iot gateway dream team - Eclipse Kura and Apache Camel
Iot gateway dream team - Eclipse Kura and Apache CamelIot gateway dream team - Eclipse Kura and Apache Camel
Iot gateway dream team - Eclipse Kura and Apache Camel
 

Recently uploaded

SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphNeo4j
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxOnBoard
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptxLBM Solutions
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 

Recently uploaded (20)

SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food Manufacturing
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptx
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 

The imitation Game - EMFCamp 2022.pdf

  • 1. @proffalken | github.com/modelrailwaysascode | github.com/proffalken The imitation Game Model Railways and Open Data
  • 2. @proffalken | github.com/modelrailwaysascode | github.com/proffalken What’s the dream? A completely autonomous model railway, utilising the Network Rail Open Data feeds to move trains around the layout in real-time. “ ”
  • 3. @proffalken | github.com/modelrailwaysascode | github.com/proffalken What do we need? Data Feeds Command and Control Software Data Converter Model Railway Hardware Interface
  • 4. @proffalken | github.com/modelrailwaysascode | github.com/proffalken What do we need? Data Feeds Command and Control Software Data Converter Model Railway Hardware Interface
  • 5. @proffalken | github.com/modelrailwaysascode | github.com/proffalken Network Rail data feeds and the Open Rail Data community ● https://wiki.openraildata.com/ ● Amazing source of information on the various data formats that Network Rail make available via their API’s ● https://datafeeds.networkrail.co.uk/ ← Sign up here to get access to the data! ● Be careful, data comes in multiple formats, and not all formats contain all the data…
  • 6. @proffalken | github.com/modelrailwaysascode | github.com/proffalken STOMPing around in Python
  • 7. @proffalken | github.com/modelrailwaysascode | github.com/proffalken JMRI – The brains of the operation! ● Java-based ● Multiple applications depending on what you want to do ● It uses Jython! ● Jython is really old… ● It supports MQTT! ● MQTT requires yet more “stuff” to be setup ● It has a TCP-based API called WiThrottle for control via mobile devices! ● The WiThrottle API is… unique
  • 8. @proffalken | github.com/modelrailwaysascode | github.com/proffalken WiThrottle – RL2][RGS 41}|{41}|{L][Test Loco}|{1234}|{L ● It uses [ [ and ] ] to differentiate between locomotives ● It uses { { and } } to show the values for settings ● The settings are always in the same order… ● … but never as key=value key=value pairs ● Commands use three characters in a row to delimit: <;> <;> ● All feedback is sent as new lines, but you don’t know when it’s finished sending feedback
  • 9. @proffalken | github.com/modelrailwaysascode | github.com/proffalken WiThrottle – Setting a function M0AS3<;>F110 M0 = Throttle ID A = Send an “action” to a locomotive S = Make sure we’re using DCC “short” mode 3 = The DCC channel we need to target <;> = That weird choice of delimiter F = Set a Function 1 = Either 0 (Off) or 1 (On) 10 = The function to act against (from 00 to 99)
  • 10. @proffalken | github.com/modelrailwaysascode | github.com/proffalken WiThrottle – Moving the loco M0AS3<;>V50 M0 = Throttle ID A = Send an “action” to a locomotive S = Make sure we’re using DCC “short” mode 3 = The DCC channel we need to target <;> = That weird choice of delimiter V = Set the speed (v == Velocity?) 50 = A value between 0 and 126
  • 11. @proffalken | github.com/modelrailwaysascode | github.com/proffalken WiThrottle – Switching Direction M0AS3<;>R0 M0 = Throttle ID A = Send an “action” to a locomotive S = Make sure we’re using DCC “short” mode 3 = The DCC channel we need to target <;> = That weird choice of delimiter R = Set the direction 0 = Either 0 (Reverse) or 1 (Forward)
  • 12. @proffalken | github.com/modelrailwaysascode | github.com/proffalken Let’s make this a bit easier… PyWiThrottle https://github.com/modelrailwaysascode/pywithrottle
  • 13. @proffalken | github.com/modelrailwaysascode | github.com/proffalken Connecting to the track using ● www.merg.org.uk ● Numerous circuit boards to connect to model railways and accessories via all kinds of protocols and methods ● Large online community who are incredibly helpful ● Cheap to join ● Kits are not expensive ● Full computer control of a layout, including block detection and point control for under £90! (Commercial equivalents are well over £250 for a “decent” setup) Photo © MERG
  • 14. @proffalken | github.com/modelrailwaysascode | github.com/proffalken Putting it all together!
  • 15. @proffalken | github.com/modelrailwaysascode | github.com/proffalken The output
  • 16. @proffalken | github.com/modelrailwaysascode | github.com/proffalken What next? ● Build a proper layout rather than the test track – Find a suitable location (St. Ives Branch line?) – Model it – Work out the TIPLOC/STANOX codes for each section – Write the integration based on PyWiThrottle ● Continue to update PyWiThrottle to add more functionality (Contributors welcome!) ● Create more fun distractions timewasters projects under the “Model Railways as Code” banner
  • 17. @proffalken | github.com/modelrailwaysascode | github.com/proffalken Thank you! https://github.com/modelrailwaysascode/ https://twitter.com/proffalken