The OreServer - a Raspberry Pi Dedicated Minecraft Server With LED Player Indicator

10,237

92

43

Published

Introduction: The OreServer - a Raspberry Pi Dedicated Minecraft Server With LED Player Indicator

About: Lots of ideas, never enough time.

If you're a fan of playing Minecraft you have probably thought about how fun it would be to have your own personal server to share with your friends. My sons were constantly asking me for their own shared world, and eventually their interest in Minecraft combined with my interest in the Raspberry Pi, and the idea for the OreServer was born.

This project will show you how to set up a Minecraft server with a fun and unique feature - it's built to resemble an ore block, and it lights up with different colors depending on how many people are currently playing on your world!

But it doesn't stop there! We will also make the server accessible to anyone with the PC edition of Minecraft, so you can share your server address and invite friends into your world. It will be running 24/7, so even if you're busy or out of the house your friends can keep building. And we will set up automatic backups just in case tragedy strikes (that TNT cannon sounded like a good idea at the time...) so you can reset from a previous days work.

Step 1: Parts & Tool List

These are the parts, tools, and software you're going to need to complete this project. I've added links for reference, but most of these supplies are available from multiple vendors, so pick them up wherever is easiest / cheapest for you.

Parts:

Tools:

Software:

Step 2: Setup and Prepare the Raspberry Pi

Before we can start installing the server we need to complete some basic setup and configuration steps on the Pi.

1. Prepare the MicroSD card

First up, we need to put the Rasbian operating system onto our MicroSD card using etcher.io.

  1. Insert your MicroSD card into your card reader, and the card reader into a USB port on your PC
  2. Run etcher and use the Select Image button to load the Rasbian Lite ISO
  3. Select the MicroSD card for the installation drive
  4. Click Flash!

When the process completes etcher will detach the MicroSD drive from the system, but we need to add one more file so just unplug it and plug it back in. The card will now read as a drive labeled "boot". Copy a blank file named "ssh" into the boot drive, and then detach the MicroSD drive from the system again. The MicroSD card is now ready to move into the Raspberry Pi.

** If you can't download the "ssh" file, it's easy to make your own by simply renaming a blank text file. Make sure you delete the ".txt" extension. When it works, the icon will become blank like in the screenshot. **

2. Connect to the Pi's terminal

Now that the Pi has an operating system, let's power it up!

  1. Plug in both a wired ethernet cable and the power supply to the Rasberry Pi. Although the Pi 3 does have built in Wi-Fi support, a wired connection is more robust and preferable for our server.
  2. Next we need to retrieve the Pi's IP address from your router. This step will differ slightly depending on your router brand - in my case I enter 192.168.1.1 into my browser to login to the router control panel. You'll be looking for a DHCP client list, and an entry named "raspberrypi". Note the assigned IP address, in my example it is 192.168.1.115. Now is also a good opportunity to set the IP address as "reserved" or "permanent" so that it doesn't get assigned a different address later. If you have any difficulties with this step you'll want to check your router's documentation or support site for details.
  3. Now we can open Putty, enter the Pi's IP address in the "Host Name" field, and click "Open".

You should now be looking at a black screen with "login as:". This is your Pi's terminal, and it's where we are going to be doing the rest of the work of setting up the server. Remember, terminal screens are for keyboards! Your mouse won't be much use here.

3. Raspi-config

To finish the initial setup we need to login using the defaults:

login as: pi
password: raspberry

Now we can go through some basic setup of the Pi's default settings by entering the following

sudo raspi-config

We need to make several changes, and I'm going to take you through them in the same order as they are numbered on the configuration screen.

  1. Change User Password - This is a must! Everyone knows the default password, so change it immediately.
  2. Network Options
    1. Hostname - by default this is "raspberrypi", but if you wish you can change it to be more descriptive
  3. -(no change)-
  4. Localisation Options - if you aren't in the UK you're going to want to change these to your own country. My examples assume that's the US.
    1. Change Locale - use your down arrow to find an entry for "en_GB" with an * next to it. Use your spacebar to remove that * and then go down a little further to "en_US.UTF-8" and again use spacebar to mark it with *.
    2. Change Timezone - setting this is important for our timed tasks to work correctly
    3. Change Keyboard Layout - you might be able to skip this, but if left on UK there are a few keyboard symbols that are moved around
  5. Interfacing Options
    1. -(no change)-
    2. SSH - Enable this so that you can continue to use Putty after rebooting the Pi.
  6. -(no change)-
  7. Advanced Options
    1. Expand Filesystem - this makes sure the Pi can use all the space available on the SD card
    2. -(no change)-
    3. Memory Split - change this to 16 to free up more memory for Minecraft's use.

Now select "Finish", and then select "Yes" to reboot.

This will terminate your session in Putty. Simply give it a moment to complete the reboot, then open Putty again and reconnect to the Pi's IP address. Remember to use your new password!

Step 3: Install the Dedicated Server

Setting up the server software is the longest step, but also the most important. We will be spending a lot of time entering a bunch of boring Linux commands. Don't let that intimidate you! As long as you can copy and paste you can get through this part.

A Minecraft server is fairly complex, and running it on a computer as small as a Raspberry Pi requires some streamlining. I started out with this fantastic tutorial by James Chambers, because he has several great tips on maximizing server performance. I am going to summarize his installation process below, and highlight some changes and updates I've made, but I strongly recommend you give his page a read for more details.

Now that you've logged back in using the default "pi" and your new password, we can start entering the commands to install the server files.

Important - Lots of these commands are long and complex and would be a real pain to type into the terminal window. So don't do it! Highlight the command text in this window, copy it with ctrl-c, and then in your terminal window just right-click with your mouse to paste the text. See, that mouse is good for something after all!

For the rest of this step, you'll be copying each of the commands in these code text boxes.  
I'll give short explanations of what we are doing along the way.

We'll start by getting our software all up to date.

sudo apt-get update && sudo apt-get upgrade

Whenever you see a request for installation approval, type "y" and hit enter to accept and continue.

Minecraft runs on Java, but our "Lite" Rasbian install didn't include it, so let's grab that.

wget --no-check-certificate --no-cookies --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/8u161-b12/2f38c3b165be4555a1fa6e98c45e0808/jdk-8u161-linux-arm32-vfp-hflt.tar.gz

Note ** When Java gets updated to a newer version that command may become outdated. If you receive an error message you'll need to update the command for the latest version. Visit Oracle's Java downloads page, click the "Accept License Agreement" button, and then right click the link to the latest linux-arm32 file and select copy link. You'll need to use that updated link to replace the text in the above command, starting at http. **

Now we can install the Java files we just downloaded.

sudo mkdir /usr/java
cd /usr/java

If you had to change the download link for a new version, make sure you change the version number in these next commands to match.

sudo tar xf ~/jdk-8u161-linux-arm32-vfp-hflt.tar.gz
sudo update-alternatives --install /usr/bin/java java /usr/java/jdk1.8.0_161/bin/java 1000
sudo update-alternatives --install /usr/bin/javac javac /usr/java/jdk1.8.0_161/bin/javac 1000
cd ~

And finally, the main event you've been so patiently waiting for, let's install the Minecraft server. This is a specialized version of the server called Paper, and it is full of optimizations to improve performance.

mkdir Paper
wget https://github.com/TheRemote/RaspberryPiMinecraft/archive/master.zip
unzip master.zip -d Paper
mv ~/Paper/RaspberryPiMinecraft-master/* ~/Paper/
cd Paper
chmod +x start.sh
wget https://ci.destroystokyo.com/job/PaperSpigot/lastSuccessfulBuild/artifact/paperclip.jar
java -jar -Xms512M -Xmx800M paperclip.jar

That last command will start the server for the first time, and after a few moments you'll receive an error that says you must agree to the EULA. Open the EULA with the next command:

nano eula.txt

Change the line that says "eula=false" to "eula=true". Save your changes by hitting ctrl-x, then Y, then enter.

Note ** James Chambers mentions a method for overclocking your SD card at this point of his guide. I have not personally tried that step, because it requires a high quality card and the one I had available to use is not anything special. I believe that the overclocking would certainly improve performance further, but even without overclocking the server runs well enough that I've gotten no complaints from the kids playing on it. **

Let's quickly take a look at the Server Properties and make a couple of changes.

nano server.properties

There is a long list of things you can change about your server here, such as personalizing the server name and MOTD, changing the gamemode, or enabling PvP or command blocks. You can change things to your preference now, or you can open this file to make more changes later, but there are two changes we will make immediately.

max-players=8

server-port=25565

Eight players is the highest I would recommend, any higher and you are very likely to see server performance get laggy, even with all the optimizations made to run things on the Pi.

Server port should be changed because like the default "raspberry" password, everyone knows the default port of 25565. Even a minor change to 26565 will help keep your server secure. Jot down the port number next to where you saved the Pi's IP address. You'll need both of those later.

Once you have finished updating your settings, save the changes by hitting ctrl-x, then Y, then enter.

The next step in preparing your server is also going to take the longest amount of time once it starts, probably about an hour. These commands will pre-generate your world, which means the server won't have to do all this work later while you and your friends are exploring.

cd ~/Paper/plugins
wget --content-disposition -E https://dev.bukkit.org/projects/worldborder/files/latest
sudo apt-get install screen
cd Paper
./start.sh

It won't look like it anything happened, but your server has now started! In order to interact with the server we need to use this command

screen -r minecraft

And then we will pre-generate the world:

wb world set 1000 spawn
wb world fill 1000
wb fill confirm

This is the part that will take a long time. Go grab a snack and check back later! When the process is done, shutdown the server with a very simple command

stop

This will save and close the server and return you to the Raspberry Pi terminal.

Our final task is setting the server to start automatically when the Raspberry Pi is plugged in or restarted. We can do this by creating a simple script.

cd ~
nano startup.sh

We've used nano to edit a couple files before, but this time we are creating one from scratch, so the window will be empty. Copy these two lines into the file:

cd /home/pi/Paper
screen -dmS minecraft java -server -Dfile.encoding=UTF-8 -Xms512M -Xmx800M -XX:NewSize=300M -XX:MaxNewSize=500M -XX:+CMSIncrementalMode -XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:+CMSIncrementalPacing -XX:ParallelGCThreads=4 -XX:+AggressiveOpts -XX:+AlwaysPreTouch -XX:+DisableExplicitGC -XX:SurvivorRatio=16 -XX:TargetSurvivorRatio=90 -jar /home/pi/Paper/paperclip.jar nogui

Then save your new script by hitting ctrl-x, then Y, then enter.

chmod +x startup.sh
chmod +x /etc/rc.local
sudo nano /etc/rc.local

The very last line of the rc.local file says "exit 0". Directly above that line we are going to add this:

su pi -c /home/pi/startup.sh

And once more we save the file changes with ctrl-x, then Y, then enter.

sudo reboot

You'll get a message that the connection has closed, and you can close the Putty window.

That's it! You've made it through the boring bit! Now we're ready to test our server!

Step 4: Test Your Server and Invite Your Friends

Next up, we are going to check that the server is working and make sure that our friends can join.

Open your Minecraft launcher on your PC and hit Play. Make sure you are using the latest release version to match the Paper server.

On the main screen select Multiplayer, then Add Server. Enter the name you'd like to have on your server list, and for Server Address enter your Pi's IP and the port number. For my example we use 192.168.1.115:26565. Make sure you have a colon between the IP address and port number, and that there are no spaces. Click Done, and then click play on your server. After a few moments you'll find yourself dropped into your brand new world!

Wait, come back! Don't start building all by yourself, let's invite some friends! Unfortunately, they can't use the same IP address that you do. So to make this work, you first need to tell your router that it is OK for people that are outside of your house to connect to the Pi. This is called Port Forwarding and the exact process will differ a bit depending on your router. I've attached a screenshot of what it looks like on my TP Link brand router, but you may need to check your routers support site for more info.

In your Port Forwarding settings, enter the port number you chose for your server, and then the IP address for your Raspberry Pi. Your router now knows that when your friends try to connect to that port number, they should be directed to the Pi.

Next we need to use a free service such as No-IP to create your own unique address, called a Hostname. You will also setup either your router or your PC to keep the Hostname's IP address up to date.

Follow the steps of their Setup Guide now.

When you have finished setting up your No-IP account, your friends will be able to connect to your server by entering your new Hostname and the port number in the Server Address section of their Minecraft multiplayer screen. For example, hostname.ddns.net:26565.

Step 5: Save the World! (with Automatic Backups)

This step is optional, but it's a potential lifesaver. Your world faces some serious risks, whether from a corrupted MicroSD card, occasional mischief or griefing, or just those pesky creepers. To protect all your hard work, we will have the server automatically save your world file every night. To prevent your MicroSD card from filling up we will also delete any backups that are more than a week old. After that, you can easily copy them to your own PC or another backup drive for even more security.

We will start by using Putty to reconnect to our Pi in order to make another new script.

nano dailybackup.sh

Copy the following commands into the script:

# Stop the Minecraft server
screen -x minecraft -X stuff stop^M
sleep 5
# Copy Paper directory to backup/PaperYYDDMM
cp -a Paper/. backup/Paper$(date +%F)
# Delete backups older than 7 days
find backup/* -mindepth 0 -maxdepth 0 -type d -ctime +7 -exec rm -rf {} \;

And then, say it with me - save your file by hitting ctrl-x, Y, enter.

Now we will create a recurring task to run the backup script every night using crontab.

crontab -e

You'll be given a choice of editors the first time you run this command, select number 2 for Nano.

This will open a special file for scheduling tasks. At the bottom of this file add the following lines:

5 0 * * * /home/pi/dailybackup.sh
15 0 * * * sudo reboot

The first line tells the Pi to run your backup script at 12:05am every night. The second line tells the Pi to reboot ten minutes later. If you would prefer a different time for the backups and reboot you can change these lines to suit your preference. Just remember that the first number is the minute and the second number is the hour in 24hr format. The three asterisks make sure that this script will run every day.

Once your system has been running for a while, you may want to get in the habit of saving the backups to another location off of the Pi's MicroSD card. This task is made very simple by connecting to your server using Filezilla. Simply drag the backup folder off of the right side of the Filezilla and drop it to your PC. Once it copies all the files you can store them for as long as you'd like!

And if tragedy ever strikes and you need to go back to one of your save files, it's a quick and simple procedure. First make sure you've stopped the server:

screen -r minecraft
stop

Then use Filezilla to delete the Paper directory and replace it by dragging one of your saved directories back to the Pi. Make sure you delete the date from the directory name so it is again named simply Paper. Then you can restart your server with

./startup.sh

And just like that, you can get back to the business of building!

Step 6: Hook Up the LEDs

Time to add some lights! This is where your server starts to become more than just a dust collector behind your monitor. This step will show you how to solder and attach the Neopixel Jewel to the Raspberry Pi, and then install the software needed to run the LEDs. Soon after that you'll never have to wonder whether someone is online waiting to play with you, because your server will tell you with just a glance!

Adafruit's Neopixel's are fantastic LEDs. They are RGB, which means they can light up in any color you want. They are addressable, which means you can use software commands to change their color whenever you want. For a lot more great info on how the Neopixels work with Raspberry Pi take a look at the official Adafruit guide.

The Jewel has 7 LEDs which will give us plenty of strong bright color. There are also five solder contact points, but we will only be using three. I strongly recommend that you use three different colored wires to avoid mixing them up when you connect them to the Pi later. In my example photos I used red, black, and brown.

Before beginning this step you will want to have the Raspberry Pi completely powered down. Enter these commands and then unplug the Pi's power supply.

screen -r minecraft
stop
sudo shutdown -h now

Cut off three female GPIO wires, long enough that you have plenty of wire to work with while soldering. You can always loop up the excess like I did. Carefully solder the wires to the contacts on the Jewel. Then attach the female connectors to the Raspberry Pi GPIO pins:

PWR to pin 1 = 3.3V

GND to pin 6 = Ground

IN to pin 12 = GPIO18

Once the Jewel is in place, you can plug the Pi back in and use Putty to connect and install the LED software with the following commands. Watch for spots that may ask you to enter Y to continue the installation.

sudo apt-get install build-essential python-dev git
sudo apt-get install scons
sudo apt-get install swig
git clone  https://github.com/jgarff/rpi_ws281x.git
cd rpi_ws281x
scons

Important ** In the next step we are going to make a minor addition to the neopixel library. This is necessary to avoid a memory error that drove me nuts for several days. Without it the LEDs will work for a few hours and then stop updating correctly. **

cd python
python setup.py build
sudo nano build/lib.linux-armv7l-2.7/neopixel.py

Use the down arrow to scroll past the line that says "class Adafruit_NeoPixel(object):. Not far past that you'll find a section with blue text that says def _cleanup(self). You'll be copying the following line into this section, exactly as shown in the screenshot above.

ws.ws2811_fini(self._leds)

And once more we need to save changes with ctrl-x, Y, enter.

cd ~
cd rpi_ws281x/python
sudo python setup.py install

Next we need to tell the test file the number of LEDs we have, then we can light them up!

cd examples
sudo nano strandtest.py

Find the line that says LED_COUNT = 16 and change it to LED_COUNT = 7, then ctrl-x, Y, enter to save.

sudo python strandtest.py

If everything has gone correctly, you've just been blinded by a flashing rainbow explosion. When you can see again, hit ctrl-c to stop the lights. The LEDs won't turn off, but they will stop flashing and that is good enough for now.

Step 7: Program the LEDs to Check the Server Status

With our LEDs installed and ready, it's time to make them react to the server. Specifically, we will make them indicate the current number of players on the server:

Players = Ore

  • 0 = Redstone
  • 1-2 = Iron
  • 3-4 = Gold
  • 5-6 = Emerald
  • 7-8 = Diamond

If the server is not running, the Oreblock will be Coal (LEDs off). And as an added bonus, if the status check can't find an internet connection the LEDs will blink yellow!

In order to retrieve the player count from the server we are going to install mcstatus from Nathan Adams, one of Mojang's game developers.

sudo apt-get install python-pip
sudo pip install mcstatus

Then we need to copy the two python scripts below, mcled.py and ledoff.py, to our server with Filezilla. Simply drag and drop the two scripts into the box on the right, as shown in the screen shot.

Go ahead and test ledoff.py right now, so we can turn off the LEDs that got left on in the previous step.

sudo python ledoff.py

When running the scripts manually like this you'll receive a message saying "Segmentation fault". This is an unresolved issue in the Neopixel.py library that has no effect on what we're doing.

If you are curious about how these scripts operate, you can open them with any text editor on your PC, or using nano on the terminal screen. Just be careful not to accidentally save any changes that might stop them from working!

Note ** mcled.py assumes you are using port 26565 from my example. If you are using a different port you must change the script to match with the following steps **

sudo nano mcled.py

Find a red line of text that says "# Get server player count", and below that you will see a line that includes green text that says "localhost" and the port number next to that. Change the port number to match yours, and as always save your changes with ctrl-x, Y, enter.

In order to get constant updates on the server status we are going to tell the Pi to run the mcled.py script every minute, and that means setting up another couple of lines in crontab.

crontab -e

You'll see the two lines we added earlier for scheduling backups and reboots. Now we will add two more:

* 6-20 * * * sudo python mcled.py
0 21 * * * sudo python ledoff.py

The first line tells the Pi to run mcled.py every minute of every hour between 6am and 8:59pm. The second line tells the Pi to turn off the LEDs at 9pm. That's a personal preference, because by that time my kids are no longer playing Minecraft, even though the server keeps running. We also have the OreServer prominently displayed above our TV and the bright light becomes an irritant in the evening. You can of course alter these two lines to make the LEDs run non-stop, or turn off later, or whatever suits your own purposes.

Soon after your changes are saved (are you sick of ctrl-x, Y, enter yet?) the script will be called and your Jewel will light up again. It will most likely be red to indicate that the server is running but not in use. Take a moment now to launch Minecraft and join the server as we did during our earlier test. Shortly after you've joined, the LEDs should switch to white, and then back to red when you disconnect.

Step 8: Make the Ore Case

The final touch to bring this all together is the oreblock case for the Raspberry Pi. To make the Ore case, I used the Lulzbot TAZ6 3D printer at my local makerspace, RiverCityLabs. I've provided my printable .STL files for the base and top below. If you don't have your own 3D printer, check your area for a maker community, they're great! Or you might have a local library or school that has printers accessible to the public. There are also several online 3D printing services that can print and ship you a design. Or you can get creative! There's nothing to stop you from making the case out of cardboard or a pile of gray Lego or whatever else you have close to hand.

Some important notes for when you set up the 3D printer files:

  • Print the file without any scaling changes to make sure the mounting holes line up with the Pi.
  • Turn the Top upside down so that the open end is facing up.
  • Make sure to turn on your support settings, so the overhangs on the walls don't get messy.

Once your print is completed you can attach the Pi to the Base with four 2.5mm screws. I can't find a link to the actual product but I found these in a 2 pack at Menards, which was way better than ordering a box of 100 from Amazon.

Remove all the support material from the Top, and cut a sheet of parchment paper or white tissue paper to fit inside. This will diffuse the LED lights which makes the glowing effect look a million times better than just leaving the holes open.

Attach the right angle MicroUSB adapter to the power port so that the cable goes out the back of the case next to the ethernet port.

Now you can reconnect the power and ethernet cords, set the Top in place, and enjoy!

Step 9: Summary, Additional Thoughts, and Thanks

Your OreServer is now completely functional! The Minecraft server starts as soon as the Pi powers on, your world is openly accessible to your friends, the LED lights tell you how active your world is, and your progress gets automatically backed up everyday.

I hope you'll continue to explore the possibilities involved in running your own Minecraft server. Paper is compatible with a variety of plugins so there are lots of opportunities to personalize your server. However, keep in mind that loading up too many plugins could negatively impact the server performance.

Running the server on a Raspberry Pi also creates unique opportunities, as we've seen by adding LEDs via the GPIO pins. But there's no reason to stop there, and if you have other ideas for interesting improvements I encourage you to keep learning more about these systems.

I'd like to thank all the other makers that provided the tools, information, and inspiration that helped me make this idea into a reality:

  • James Chambers for the immensely helpful server blogpost
  • The devs of the Paper server
  • Jeremy Garff and Tony DiCola for the Raspberry Pi Neopixel library
  • Nathan Adams for the mcstatus server query tool
  • RiverCityLabs.space for the amazing community of local makers
  • and about a million unnamed internet strangers whose combined knowledge answered so many questions and resolved so many issues while I worked through this project.

And finally, I'd like to thank my family for being patient and supportive during the many hours spent completing this adventure.

Minecraft Challenge 2018

Grand Prize in the
Minecraft Challenge 2018

2 People Made This Project!

Recommendations

  • Clocks Contest

    Clocks Contest
  • Creative Misuse Contest

    Creative Misuse Contest
  • Water Contest

    Water Contest

43 Discussions

Fantastic tutorial, I did have a problem with getting the backup to work though. I got it working by making the dailybackup.sh script executable by doing chmod u+x dailybackup.sh and creating the directory /home/pi/backup if anyone else is struggling.

1 reply

I'm having this problem too ... so I created the "backup" directory under Pi, then I type "chmod u+x dailybackup.sh" or is there more to it? I have everything else working, this is the last piece. Thanks!

OK, so I started from scratch and redid the whole install from a clean card. I got as far as the revised "**Important** steps, and when i entered

python setup.py build

I got the following:

pi@OreServer:~/rpi_ws281x/python $ python setup.py build

Extracting in /tmp/tmp_4B2f9
Traceback (most recent call last):
File "setup.py", line 4, in
use_setuptools()
File "/home/pi/rpi_ws281x/python/ez_setup.py", line 140, in use_setuptools
return _do_download(version, download_base, to_dir, download_delay)
File "/home/pi/rpi_ws281x/python/ez_setup.py", line 120, in _do_download
_build_egg(egg, archive, to_dir)
File "/home/pi/rpi_ws281x/python/ez_setup.py", line 62, in _build_egg
with archive_context(archive_filename):
File "/usr/lib/python2.7/contextlib.py", line 17, in __enter__
return self.gen.next()
File "/home/pi/rpi_ws281x/python/ez_setup.py", line 100, in archive_context
with ContextualZipFile(filename) as archive:
File "/home/pi/rpi_ws281x/python/ez_setup.py", line 88, in __new__
return zipfile.ZipFile(*args, **kwargs)
File "/usr/lib/python2.7/zipfile.py", line 770, in __init__
self._RealGetContents()
File "/usr/lib/python2.7/zipfile.py", line 813, in _RealGetContents
raise BadZipfile, "File is not a zip file"
zipfile.BadZipfile: File is not a zip file

This last part sounded ominous, and when I tried to run

sudo nano build/lib.linux-armv7l-2.7/neopixel.py

I was told:

Directory 'build/lib.linux-armv7l-2.7' does not exist

I feel like I'm learning quite a bit from this exercise, but I can't parse this. Is there a bad file, or am I in the wrong directory? I feel like I'm getting close!

Thanks for your help with this ...

BTW I (partly) set this up on Saturday with James Chamber's updated instructions, when I initially asked you for help. I was playing Minecraft on the network at 550 frames a second on my gaming rig, but I apparently missed installing half the build!

1 more answer
1
user
Dwargh

Tip 2 months ago

At "chmod +x /etc/rc.local" I had to use "sudo chmod +x /etc/rc.local" to switch it to an executable ;)

OK, so I'm setting up the LEDs, I got this far OK and then I ran the command

sudo nano python/build/lib.linux-armv7l-2.7/neopixel.py

and nano says "no such file." If I look at the Pi in Filezilla, I see neopixel.py listed under

/home/pi/rpi_ws281x/python/neopixel.py

should I change the command line to refer to this file instead?

I feel like I'm missing some directory structure. I went by your updated installation script. Did I miss something?

My directory structure is home/pi/ and folders nano, minecraft and rpi_ws281x.

The python directory is under rpi_ws281x only contains an "examples" folder and 6 files.

I don't see a "paper" folder anywhere.

Thanks for your help!!

1 more answer

It's very important to change the neopixel.py file in the build directory because that's what gets referenced for the installation performed later in that step. But I just did a test of my instructions and I see what you mean about that directory being missing.

I added a couple of commands to the *IMPORTANT* section of Step 6 that should create the rpi_ws281x/python/build directory. I think I must have initially created it while I was banging my head against the memory error, and then didn't realize it required an extra step when I wrote up the instructable. Sorry for the confusion!

In the section where we set up the software for the lights, you've added some code with the statement

"Use the down arrow to scroll past the line that says "class
Adafruit_NeoPixel(object):. Not far past that you'll find a section
with blue text that says def _cleanup(self). You'll be copying the
following line into this section, exactly as shown in the screenshot
above."

I don't see any screenshot posted, is this something we can figure out without the reference photo?

Thanks so much for this! Fun project.

1 more answer

Step 6 has five photos, but only three of them are shown by default. If you click any of the photos to view the larger version, and then click towards the right side of the photo it will advance to the next one. The screenshot of the code update is the last photo in the group.

would it possible to use a CHIP computer instead, or would that reduce performance?

What would be the max players you would recommend for the new raspberry pi 3 model b+?

Found an interesting tweak to improve performance, be careful as you'll need a good quality class 10 SD card for it to work as it overclocks the SD card bus.

Add this line to the config file

sudo nano /boot/config.txt

dtparam=sd_overclock=100

If it doesn't work and crashes your Pi, then plug in the SD card to another machine and delete the line. Worked with my 16Gb Samsung class 10 card.

I tried this and everything worked fine until I rebooted after setting up "mcled.py" and "ledoff.py." When I rebooted, the light did not come on. I tried to execute the "mcled.py" and got the following,

p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 18.0px 'Andale Mono'; color: #feb60b; background-color: #000000; background-color: rgba(0, 0, 0, 0.9)}
span.s1 {font-variant-ligatures: no-common-ligatures}

Exception AttributeError: "TCPSocketConnection instance has no attribute 'socket'" in <bound method TCPSocketConnection.__del__ of <mcstatus.protocol.connection.TCPSocketConnection instance at 0x764f4e18>> ignored

Segmentation fault

I followed everything and as I said, everything worked until this point. Will someone please help me?

7 replies

Hi Jason! Great to hear you're making an OreServer! From that error, I think when the mcled script is calling mcstatus to get the player count it's unable to connect to the server, so the lights stay off as intended when the server is not running. To troubleshoot this, I would first make sure that the server is starting up correctly at reboot. If the server is running, double check what port number you are using and make sure you have edited the mcled.py script to match. Hopefully that will get you lit up properly!

I have verified that the server is running and is running on port 26565. I have also verified that 26565 is set as the port number in mcled.py. Also, I noticed that in mcled.py it says "localhost." Is this right since I am using a static IP?

Yes, "localhost" simply refers to the machine running the command, and should work regardless of the IP address.

From the pi command prompt you should be able to enter

mcstatus localhost:26565 status

and get an output like this:

version: vPaper 1.12.2 (protocol 340)
description: MOTD
players: 0/8 No players online

You should get the same message if you use the static IP assigned to the Pi such as:

mcstatus 192.168.1.115:26565 status

or by using your NoIP address such as

mcstatus noip.server.name:26565 status

because all of those commands tell mcstatus to check the same place.

However if the server is not running, or if the port address is incorrect, I receive the same TCPSocketConnection error that you did.

Another test you could try is the command

mcstatus skyblock.net status

This should connect to a popular public server and return something like this:

version: vBungeeCord 1.8.x-1.12.x (protocol 47)
description: "{u'text': u'', u'extra': [{u'color': u'green', u'text': u'Skyblock\n'}, {u'color': u'yellow', u'text': u'New spawn added to Classic SB!', u'italic': True}]}"
players: 134/750 No players online

I have verified my port number and I believe that is the same in all places. I noticed that the NeoPixel will blink yellow when there is no Internet connection but it is off otherwise. Why would it blink with no connection but not do anything else right?

It sounds like the script is operating correctly - No internet makes it blink yellow, and no server makes it stay dark. It won't light up with colors until the mcstatus script finds the server to confirm a player count.

Were you able to test the commands I recommended above on the console through putty? Can you get a response from "mcstatus skyblock.net status" but continue to get an error from "mcstatus localhost:26565 status"? The LEDs will stay dark until we figure out why mcstatus isn't locating your server.

The "mcstatus skyblock.net status" command works fine. When I put in "mcstatus localhost:26565 status", I get a bunch of errors. However, when I use my static IP, like "mcstatus 96.33.242.182:26565 status", it works like it should with no errors. Networking is not my strong suit. I really appreciate you sticking in here with me and getting this fixed.

If using your static IP works, you could replace it for localhost in the script and that should solve your issue. But if that ip ever changes you'll need to update the script each time.