Page 1 of 1

Interface minetest to a real world device

PostPosted: Tue Oct 22, 2013 08:32
by Gorilla
I have been thinking about physical computing, namely do something in the virtual world and a real world device changes state and similar for the other way around. See http://en.wikipedia.org/wiki/Physical_computing for more explanation.

As an example, I'd like to use an Arduino to illuminate a LED (light) when a player punches a particular door at which point the Minetest server sends a signal via a serial port to the external advice, eg Arduino. The Arduino then toggles a light. In the real world, User may then toggle a switch which sends a signal back to the minetest server which could unlock/open the door.

Reading online, Lua can support access to peripherals such as serial ports but not sure how to "hook" into Minetest. I'd like to avoid having to recompile minetest-server if possible.

Typical Architecture could be as follows

Minetest Server -> Custom Lua Mod code -> Serial Port data -> Arduino

Server: Debian Linux "Jessie" (Currently in testing) running in a virtual machine on Windows8. I can't change this atm.

PostPosted: Tue Oct 22, 2013 11:41
by Evergreen
Gorilla wrote:I have been thinking about physical computing, namely do something in the virtual world and a real world device changes state and similar for the other way around. See http://en.wikipedia.org/wiki/Physical_computing for more explanation.

As an example, I'd like to use an Arduino to illuminate a LED (light) when a player punches a particular door at which point the Minetest server sends a signal via a serial port to the external advice, eg Arduino. The Arduino then toggles a light. In the real world, User may then toggle a switch which sends a signal back to the minetest server which could unlock/open the door.

Reading online, Lua can support access to peripherals such as serial ports but not sure how to "hook" into Minetest. I'd like to avoid having to recompile minetest-server if possible.

Typical Architecture could be as follows

Minetest Server -> Custom Lua Mod code -> Serial Port data -> Arduino

Server: Debian Linux "Jessie" (Currently in testing) running in a virtual machine on Windows8. I can't change this atm.
Actually, Jeija himself made a light turn on and off (In real life) via a lever in minetest.

PostPosted: Tue Oct 22, 2013 21:45
by kaeza

PostPosted: Tue Oct 22, 2013 23:43
by Menche
I had my arduino blink lights corresponding to actions in Minetest by just using Lua's normal file access functions to write data to the serial interface. Interfaces can be written to and read from like any other file.