Anyway to connect logic circuits to outside world?

Post all other topics which do not belong to any other category.
Post Reply
bennyboy1973
Burner Inserter
Burner Inserter
Posts: 7
Joined: Sun Oct 14, 2018 3:14 am
Contact:

Anyway to connect logic circuits to outside world?

Post by bennyboy1973 »

Forgive me if there's something already about this. I wasn't even sure how to search for it.

I'd like to be able to interact with outside devices-- an Arduino project connect to my computer via USB, or a background Windows app that uses a built-in web browser to accept inputs from online, etc. I can handle all that stuff, I just need an interface to get data in and out of Factorio.

I can think of lots of cool things to do with this if it's available, like have an in-game display of the temperature in my room, flashing red lights and speaker sounds if someone rings my front doorbell, or an arduino-driven robot that dances every time I launch a nuclear missile.

Is it possible?

User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5206
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: Anyway to connect logic circuits to outside world?

Post by eradicator »

You should take a look at Cluster I/O. It's a mod that enables cross-server transfer of items/signals etc. The basic idea is (i think) to use file_write() or print() to output data to a file/the console, and RCON to input data via server commands. It requires a fair bit of code on both sides, so i hope your coding skills are well honed :).

For general LEDs there's the RazorChroma support (output only), but i don't know if you can abuse that for your own hardware (i.e. if some sort of protocoll documentation is available).
Author of: Belt Planner, Hand Crank Generator, Screenshot Maker, /sudo and more.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.

bennyboy1973
Burner Inserter
Burner Inserter
Posts: 7
Joined: Sun Oct 14, 2018 3:14 am
Contact:

Re: Anyway to connect logic circuits to outside world?

Post by bennyboy1973 »

Hmmmm, interesting.

This seems a lot more elaborate than what I want, but it looks like the programmer is able to get his hooks on some of the information I want to use.

Right now, I'm thinking what I want is to write to a custom log file (i.e. to disk) from a mod, and parse that with a standalone program of my own, which will send serial info to my Arduino. It seems likely that won't be possible though-- I suppose the game designers wouldn't want every dude who comes along having the ability to write whatever they want to a customer's drive.

As for input. . . yeah, it looks like running a private server is going to be the most likely way to receive input from outside. I'm not sure I can spare the time and effort to deal with all that, though.

quinor
Filter Inserter
Filter Inserter
Posts: 404
Joined: Thu Mar 07, 2013 3:07 pm
Contact:

Re: Anyway to connect logic circuits to outside world?

Post by quinor »

I'd say just use the Clusterio API and write a mod, you can connect it to something as simple as HTTP on the outside. If you have any trouble, contact the dev. Super nice guy :)

User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5206
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: Anyway to connect logic circuits to outside world?

Post by eradicator »

bennyboy1973 wrote:
Sun Oct 14, 2018 2:45 pm
Right now, I'm thinking what I want is to write to a custom log file (i.e. to disk) from a mod, and parse that with a standalone program of my own, which will send serial info to my Arduino. It seems likely that won't be possible though-- I suppose the game designers wouldn't want every dude who comes along having the ability to write whatever they want to a customer's drive.
That's exactly what write_file() does (see the api doc). The only limitation is that you can not chose an output root directory. The root will always be /script-output in the factorio config directory.
Author of: Belt Planner, Hand Crank Generator, Screenshot Maker, /sudo and more.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.

mrvn
Smart Inserter
Smart Inserter
Posts: 5696
Joined: Mon Sep 05, 2016 9:10 am
Contact:

Re: Anyway to connect logic circuits to outside world?

Post by mrvn »

Here is a project for you that should be loads of fun: Build the train network from a factorio game using Märklin Digital and use the arduino to control the trains so they mirror the trains in the game.

bennyboy1973
Burner Inserter
Burner Inserter
Posts: 7
Joined: Sun Oct 14, 2018 3:14 am
Contact:

Re: Anyway to connect logic circuits to outside world?

Post by bennyboy1973 »

eradicator wrote:
Mon Oct 15, 2018 10:25 am
bennyboy1973 wrote:
Sun Oct 14, 2018 2:45 pm
Right now, I'm thinking what I want is to write to a custom log file (i.e. to disk) from a mod, and parse that with a standalone program of my own, which will send serial info to my Arduino. It seems likely that won't be possible though-- I suppose the game designers wouldn't want every dude who comes along having the ability to write whatever they want to a customer's drive.
That's exactly what write_file() does (see the api doc). The only limitation is that you can not chose an output root directory. The root will always be /script-output in the factorio config directory.
Okay, I just saved a test message from a command line in-game and found it in the script-output folder, and was able to make a simple parser. I'll probably just start with a few custom sounds that trigger on important events and work from there.

I'm currently thinking of finding how to launch a nerf missile with an Arduino.


Okay, now I get the stuff about the need for RCON. That's going to have to be my only way to process input, but it's an order or magnitude more complicated than just dumping text commands to a log from a single-player game, so I'm going to start out with that.

bennyboy1973
Burner Inserter
Burner Inserter
Posts: 7
Joined: Sun Oct 14, 2018 3:14 am
Contact:

Re: Anyway to connect logic circuits to outside world?

Post by bennyboy1973 »

mrvn wrote:
Mon Oct 15, 2018 10:37 am
Here is a project for you that should be loads of fun: Build the train network from a factorio game using Märklin Digital and use the arduino to control the trains so they mirror the trains in the game.
That's a really fantastic idea, but I don't think I have enough hours left for that in my life. How about YOU build the train, and I'll build the interface for you? :D

Post Reply

Return to “General discussion”