Home > Delphi, nodeJS, Object Pascal, Raspberry PI > Node-Sega, this is cool!

Node-Sega, this is cool!

It was in the year of our lord 2015, when a norwegian brilliant scientist, dirsturbingly norwegian, but brilliant non the less – came to create the most awesome nodeJS server the world had ever seen.

And he putteth not one, ney, nor two, ney, nor three, ney — but four Raspberry PIes which he ordereth from the gloomy land called brittania through fed-ex, or fed-up or whatever the lord callest them sad men in browish cars delvering goods.


What do you get when you marry Raspberry PI (four of them), a Sega MegaDrive II, nodeJS and a whole afternoon of free time? Well if you are around me you will get the all singing, all spanking – Node-Sega MegaJS (ta-da!).

Ok serious: I ordered a Sega MegaDrive II from AliExpress, which ships good from China. I didnt expect much from this product because, let’s face it – they do sell a lot of rubbish on that website; but since the verison II of the megadrive never came out up here in Norway — what did I have to loose? It cost something like $30 or so – with shipping (!)

Daddy's new toy -- it goes with the 16 other collectables I own

Daddy’s new toy — it goes with the 16 other collectables I own

Well, I get the sucker delivered and the first thing I find is a maelformed power socket. And to make it even more interesting its a 9 volt adapter. Not 6, not 8 or 12 – something normal that you may have around the house. Nope, a nine volt adapter.

I open the damn thing up and check, and the motherboard actually runs on 5 — which I just happen to have a ton of. So a quick modding and it’ working. Sort of. For 3 seconds until it goes up in smoke. They really dont make’em like they used to! I remember my US produced Amiga computer. I spilled coke over it, fall off a motorbike with it in my backpack, i even jumped into a pool once with my Amiga in the napsack — it didnt even glitch. You could set the bloody thing on fire and it would still boot up.

Wow, they really polled out all the stops for this one. $0.30 in parts?

Wow, they really polled out all the stops for this one. $0.30 in parts?

Old box, new tricks

So with a freshly “burnt out” Sega Megadrive at my disposal, what should a man do? But build a Raspberry PI cluster containing: Mame arcade game emulator, NodeJS web server interface for uploading and downloading MAME Roms. A dedicated PI for database work and a fallback server so nodeJS can spawn threads on a secondary machine.

So my trusty old, very new Sega megadrive will not end it’s days on the skip having come here all the way from china — instead it is being transformed into a supe sega! When sega machines talk about heroes they will whisper the name of the super-sega who went to Norway to become a most powerful sega in the universe. Mohahahaha…

Alas, this GPU is no more of use.. oh the horror

Alas, this GPU is no more of use.. oh the horror

Now to squeeze in 4 of these babies!

Now to squeeze in 4 of these babies!

I guess I dont need to tell you where this is heading right? I must admit it’s going to be so fun to do this mod. I can just imagine the face of my boss when he asks me to bring my nodeJS monster to work. And I bring a Sega megadrive, hook it into the network and watch everything light up 🙂

Still, it does need some work. There is a height difference I need to fix, also need two types of switches (reset and movable), a HDMI extender (short) a power-led extender and splitter. A USB splitter (it will have 16 USB ports!).

Now that’s a megadrive!

And what should we call this freepascal and Smart Mobile Studio powered cluster? Why Sonic ofcourse!

Sonic clustering

Sonic clustering

Why is the seganodeJS megadrive so sexy?

The megadrive chassis is just the perfect size to do a avant-garde mod using Raspberry PI. First of all because it has plenty of room, but also because of height and the position of power-in and video/sound-out match our goals — well, perfectly!

It turns out the HDMI-out and power-in socket on the RPI fits neatly. This means that you will have power-in and HDMI out exactly where similar sockets used to be. This is a fingertip-rule when doing mod’s. Always, always try to retro-fit new sockets and parts where the older versions were. It will save you so much time and headache later.

To demonstrate just how much space the Sega chassis gives us, consider this fab setup I have in mind:

4. diasy-chained Raspberry PI 2B
2. Re-chargable power banks
1. Terrabyte slim 2.5″ USB 3.0 storage
1. USB splitter (1 to 6) which will be exposed in the cartridge bay-door
1. Fully working reset button, safe shutdown due to power-banks
1. Fullt working shutdown (hard) button
1. 5v internal fan
4. mico-heat sinks to keep the CPU’s fresh
Assorted cables

You would never, ever get anything like this into a PSX1 or psx2. You would have to gut open your XBox 360 or something, because the PSX is utterly dominated by the CD-ROM and blueray “brick” inside.

Another thing: If you decide to place the first PI right at the back and re-cycle the old power-input holes, you are lining yourself up for a neat gadget, because: one of the cooler things about the RPI is that it’s perfectly happy getting it’s power from a USB connection. And since the RPI comes with 4 USB ports, thats 3 ports to power the other RPI’s with one spare port.

And you use that spare port with a USB splitter which gives you six USB 2.0 ports in return.
This gives you 6 + 9 = 16 fully functional USB ports available to your cluster (!)

Software setup

Since the RPI has become so famous around the world, plenty of software can be downloaded for it. This includes cluster software, home-cloud solutions and whatever you can imagine. But for my solution you dont really need that much.

The vanilla Noobs setup with Raspdebian is more than ok. Because the only thing you are going to do is to pick one of them to be head-honcho. And this linux box PI should provide the following:

  • DNS service
  • Firewall service
  • Internet provider for the other machine
  • Shared HW resources (e.g “printer”, “keyboard” etc)
  • 6 extended USB ports are shared out from this unit
  • Desktop service
  • Freepascal
  • NodeJS
  • Mame
  • Remote desktop access

What you want to do here is to first setup the linux system so that it works, then and only then do you install MAME with a boot menu — that way when you fire it up the system will boot into a menu of games, and you can use your joystick ($10 gamepad, sega lookalike on amazon) to scroll around and pick a game.

But, you also want to be able to access linux. So pressing ESC on a BT device or physically connected keyboard should break you out of the MAME cycle and boot X as normal.

The second machine

The second machine is the actual nodeJS server where you will be running most of your programs. A linux system can have a maximum of 1024 sockets in read/write mode at any given point (but thousands of allocated sockets waiting) so you want to dedicate a full RPI for this task.

  • Standard Raspbean install
  • Remote desktop access
  • NodeJS
  • network name “http”

The third machine is the boring RPI, namely the database. The setup is pretty much the same as the server, except this one should have mySQL running.

  • Standard Raspbean install
  • Remote desktop access
  • MySQL
  • network name “DATA”

The last and final machine is more popular, it’s the storage manager for the entire system. This machine will have all it’s USB ports used and connected to storage, which it shares openly with it’s own network. Since the network doesnt extent beyond the DNS and firewall, it’s all good for our little cluster.

You can also install samba and use it as a backup target for time-machine if you own a mac, or a backup target if you work exclusively with windows. So your Sega Raspberry nodeJS drive can become your most priced possession 🙂

Well — thats it for me today! I have a SEGA to assemble 🙂

  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: