Back to Home

IoMT - the Internet of things from Minecraft: we manage real objects in the virtual world

iot · wifi light bulb · minecraft

IoMT - the Internet of things from Minecraft: we manage real objects in the virtual world


    The virtual computer that controls the light switch in the virtual

    Minecraft world is already more than a game. This is the lifestyle and habitat of many, many gamers. Minecraft can also be used for engineering purposes. For example, why not learn how to turn on and off your light bulb in a room by placing a switch in the game?

    So did one of the players whose nickname is giannoug . He worked with his friend, creating a system that controls a noname WiFi light bulb. Now it is not uncommon, and you can buy them at a relatively low price. Giannoug worked with a friend who reverse engineered the lightbulb protocol. The author of the idea himself built a switch based on the OpenComputers mod .

    After some time, the computer was ready, and the author was able to open it to the whole world through TCP / IP.

    The protocol used by the bulb is quite simple. The header byte, three additional bytes for determining the RGB color, a byte for determining the brightness, a byte for switching the operating mode, and a final byte. There is also a mineral in the game - an analogue of electricity in our world. By default, blocks can be used as elements of an electrical circuit. With the help of such blocks even analogues of real processors were created.

    0x56 RED GREEN BLUE WHITE MODE 0xAA




    The script for the light bulb:
    local event = require ('event')
    local net = require ('internet')

    local myEventHandlers = {}
    local running = true

    local con = net.open ('192.168.1.110', 5577)

    function myEventHandlers.key_up (address, char , code, playerName)

    if (char == 'q') then
    running = false
    print ('Goodbye' ... playerName ... '!')
    end

    end

    function myEventHandlers.redstone_changed (_, address, side)

    local brightness = 0xff;

    if side> 0 then
    brightness = 0xff
    else
    brightness = 0x00
    end

    print ('Sending' ... brightness ... 'to lamp ...')

    con: write (string.char (0x56))
    con: write (string.
    con: write (string.char (0x00))
    con: write (string.char (0x00))
    con: write (string.char (brightness))
    con: write (string.char (0x0f))
    con: write (string. char (0xaa))

    con: flush ()

    end

    function handleEvent (eventID, ...)

    local event = myEventHandlers [eventID]

    if (event) then
    event (...)
    end

    end

    if con then
    print ('Connected to the bulb ! ')
    end

    while running do
    handleEvent (event.pull ())
    end

    And a demonstration of the work of the whole scheme:



    In Minecraft, many gamers still recreate models of real places. For example, Antarctica.
    Martin O'Leary, a glaciologist at Swansea University, recreated Antarctica in Minecraft. Now the model, with a size of 1: 1000 from the real continent, contains more than 3 billion blocks. Martin decided to do such a large-scale work after scientists began to appear in Minecraft who created various models, including 19th-century Manhattan .

    Additional information on the “turn on the light from Minecraft” project is on the author’s website .

    Read Next