• New version, new project

    Kjetil11/21/2017 at 21:15 0 comments

    After I have experienced a little with the Arduino for the ESP i did make a new standalone version of this project.


    as it is a totally new take on the task, I made a new project to document it.

    As it is standalone it is easier to use.  Not using a script on the server and not relying on an http server anymore.

  • Software on ESP8266

    Kjetil07/27/2015 at 21:06 0 comments

    The software on the ESP8266 module is simple too. It is an short script in LUA.

    tmr.alarm(0, 5000, 1, function()
        sk=net.createConnection(net.TCP, 0)
        sk:on("receive", function(sck, c)
          st,en= string.find (c, "Online: ")
          if (en ~= nil) then
            onl=string.sub (c,en+1,en+3)
            st,en= string.find (c, "Max: ")
            maon=string.sub (c,en+1,en+3)
    	if (pl < 1000) then pl = 1000 end
    	if (pl == 1800) then pl = 1900 end
            if (pl < 2000) then print ("Offline") end
          if (pl ~= po) then
    	print(onl,maon, pl)
        end )
        sk:send("GET /ESPing.php HTTP/1.1\r\nHost:\r\nConnection: keep-alive\r\nAccept: */*\r\n\r\n")
    tmr.alarm(1, 1000, 1, function()  

    This script is uploaded as init.lua.

    It consist of two main timers.

    the first one is geting a webpage from my webserver every 5sek an calculates the server position in the variable "pl". There is also some if statements for spesial cases "pl <1000" makes everything abowe 10 players show as 10 players. "pl==1800" is if there is none players online to make this stand out. And if the search for the field "Online:" fails the pl is set to 2000 and pointing to offline.

    the other timer send a pulse to the servo to set its position. A new pulse is sent every 1sek.

    The calculations is ment to scale to the "Max:" player field, but is not testet with anything else than 20 players. And would probably fail, at least on the spesial cases the if statements is handeling. This is something to fix later.

    I also want the ESP module to chec directly with the minecraft server, but when pinging the server from the module I always missed the first part of the response (the part with the number of players) With a network sniffer i did check an it was sent from the server. Tis is also somthing to fix later.

    Tools used:

    LUA Loader (to upload script to the ESP)

    esp8266_flasher (to upload NodeMCU firmware)

    And of course NodeMCU. I did use 0.9.6 version

  • Hardware

    Kjetil07/27/2015 at 20:50 0 comments

    The hardware for this project is mainly a servo and a esp module.

    There is two resistors between the esp and the servo. One to keep the gpio pin on the esp high when booting an one to protect the esp if anything goes wrong with the servo.

    The rest of the circuit is an simple 3.3v regulator made of some resistor, capacitor and a npn transistor. I don't even know the type transistor I used, I did only use my multimeter to check if it was a npn. My parts bin was empty of npn transistor, and I did not have a 3.3v regulator either....

    The 5V for the servo and input to the regulator is from a old phone charger with a broken plug.

    There is an photo of my hand drawn schematics in the project description.

  • Software on server

    Kjetil07/27/2015 at 20:29 0 comments

    For the webserver I use this php scripts to ping my minecraft server:


    and this code for the actual webpage:

            include_once 'MinecraftStatus/status.class.php';
            $status = new MinecraftServerStatus();
            $response = $status->getStatus('trondsen.name', 25565, '1.6.0');
            if(!$response) {
                    echo"The Server is offline!";
            } else {
                    echo"Online: ".$response['players']."  \nMax: ".$response['maxplayers']."  ";

    This give a simple webpage with the max limmit of players an how many that is online at the moment.

    If the server is down the message "The server is offline" is displayed.

    (I do know my servername is in the script, but the server is not open...)

  • Up and running

    Kjetil07/27/2015 at 20:09 0 comments

    I have the display up running. I did get some problems with lost packets when pinging the server directly from the ESP.

    As for now I have a PHP script running on my webserver to ping the minecraft server.

    Then the ESP downloads this page and set the server position from what the page returns.

    In the spesifications for the servo it should have a pulse from 1 to 2 ms that sets the position of the servo arm. This pulse should be repeated every 20ms. When i tried that I got a lot of jitter and noise from the servo. I have an update rate of 1 second now and it is nice and silent.