A Practical Guide to Blockchains & Ethereum Mining

blockchains

I recently started hearing a lot about Ethereum which takes the cryptocurrency concept from Bitcoin, and expands it even further.  The underlying technology is very interesting, and if you believe the hype it could revolutionize many aspects of the internet.  I decided to build a mining rig to see if it’s possible to actually make money by tying into the Ethereum blockchain and also to learn more about how it actually works.

This guide will touch on some high level topics and give some suggestions on how to build a practical rig on a limited budget if you’re curious about how to do it.

WTF is Ethereum, Mining and a Blockchain?

The overly simplified answer is that Ethereum is similar to Bitcoin – it is a cryptocurrency (plus much more).  Both are built on a technology called a blockchain which is basically a public ledger.  Mining is the process of using your computing power to verify the transactions being added to the ledger.  Digital coins (Ether, Bitcoin, etc) are distributed as an incentive for performing the verification work.

For the full explanation, check out the links below – they cover the basics & address some of the questions I had when getting started.  The blockchain concept itself will likely be integrated into more and more platforms, so I’d recommend checking these articles out even if you have no interest in actually mining.

Blockchain Potential

Currently the most well known uses for blockchains are financially related – transferring money, etc.  But the technology could be used anywhere you want to decentralize data and make it more difficult to hack.  Some possible examples:

  • Distributed cloud storage – no single failure point
  • Eliminating identity theft – no single source to hack & steal credentials from
  • E-commerce – transactions could not be falsified since it would be immediately noticed by all other nodes on the network
  • Decentralized notary – a transaction or document can be hashed & timestamped to prove it took place.  It could never be falsified, or the block would be altered & automatically rejected.

Now Onto Mining – Does It Really Earn You Money?

Yes, with the right hardware you can make a small amount of money from mining.  Once you earn a coin (or fractions of a coin) it is deposited in your “wallet” and it’s yours to keep.  You can hold on to it (maybe it will increase in value), you could trade it for a different type of coin (for example, Bitcoin), or you could sell it to recoup some of your costs for the mining rig.

Unless you have a very high end home computer, you probably want to build a dedicated computer (rig) just for mining.  Normal computers aren’t powerful enough, and you’ll spend more on electricity than you’ll gain from mining.  To prove that point, I’ve measured the mining speed on my rig with 2 GPUs and it is over 500 times more powerful for mining than my normal home computer.

Your monthly profit will depend on the current exchange rate, how much electricity your rig is consuming and most importantly your hashing rate.  A very rough estimate is that a single high end GPU could earn roughly $40-60 a month (after subtracting ~$15 for electricity costs).  I’d suggest aiming for a hash rate of at least 20 Mh/s when looking at GPU’s.

At this point, you’re probably thinking, “what’s the catch?”  There are a few complications you need to consider:

  • The coins get progressively more and more difficult to mine over time, so your profits will likely slow down
  • The Ethereum mining algorithm will change – this likely means at some point you won’t be able to mine Ethereum any more, but there could be other currencies to switch over to.
  • Cryptocurrency prices are very volatile – Ethereum was at $400 a few weeks ago, and now down around $200.  So you’re looking at probably 6+ months to make back your original investment, maybe more if the prices fall.
  • Hardware can fail – you’re running high end GPU’s 24/7, possibly pushed beyond their originally designed limits.  If you make $50 or $100, but then fry your GPU, you didn’t even make enough to cover it’s cost.

If you understand & can live with those risks, then you might want to try mining!

Disclaimer – I’m not an expert on this & there are still a lot of aspects that I am still researching.  An incorrectly designed rig could be a fire hazard, so be careful!  

The Hardware

Most of the mining rig can be assembled with very basic components.  An average motherboard & processor (LGA 1150 or similar), 4GB RAM and small hard drive would likely only come to a total of ~$200-225 – maybe even less if you have any spare components.

There are only 2 areas where you’ll want to invest money for high quality components:  the power supply and GPU(s).

  • Power Supply – it takes a decent amount of electricity to run a mining rig, so you want to be as efficient as possible.  A common rating system for PSUs is “80+” which has Bronze, Silver, Gold and Platinum tiers.  Gold or Platinum is recommended for mining.
  • Surprisingly, the processor does very little work in a mining rig because it isn’t optimized for the type of calculations using in mining.  It’s the GPU which is best suited for mining & you’ll need a very powerful one.  The GPU will be the most expensive component, and will probably be more expensive than your motherboard, processor, ram and hard drive combined.  More on the GPU’s later…

When building a rig, you generally want to maximize the airflow since the GPUs are running 24/7 and generate significant heat.  So instead of using a computer case, most rigs are completely open and look more like a rack to prevent heat from building up.

Another thing to keep in mind is that you should be able to power a single GPU directly from the PCI slot on the motherboard, but once you go to 2+ GPUs you’ll want to use PCI risers for a few reasons:

  • the motherboard may not be able to safely supply enough power to 2+ high end GPUs
  • there won’t be enough airflow around GPUs so close together on the motherboard to keep them cool
  • the PCI slots may be too close together on the motherboard for 2 GPU’s to fit

My suggestion is to skip the PCI riser for the initial build with a single GPU, any worry about installing them once you decide to install more than 1 GPU.

20170617_202056

20170709_114649

Evolution of my mining rig.  First photo is using a spare shoe rack – single GPU which is plugged directly into the motherboard (no PCI riser).  Second photo is using an actual storage rack – 2 GPUs, and they are lifted off the motherboard & using PCI risers.  The blue cables are USB cables which connect them into the motherboard.

The Software

There isn’t much software you need:

  • Operating system – you can use Linux which is free, Windows, or even custom OS’es specifically designed for mining.  I first tried Linux, but eventually used Windows because it’s easier to adjust the GPU’s for overclocking, etc
  • Mining software to run – I’ve used Claymore Dual Miner which is very popular, but there are many others

20170709_001236

A little blurry, but here I’m running Claymore with a single GPU.  Notice the hashing speed at ~30 MH/s, and diagnostic info showing the GPU temperature at 56C and fan at 67% of max speed.

  • You’ll also need to sign up for a digital “wallet” and optionally a mining pool:
    • A mining pool allows you to combine your mining power with others – you’ll get smaller, more frequent payouts.  In general, this is probably a good idea for you unless you’ve built an incredibly powerful rig.  There are many different pools to join – I chose nanopool since it has lower minimum payouts.
    • A wallet is one of the most important decisions you’ll make.  Security is extremely important and you’ll also want to pay attention to minimum transfer balance.  Keep in mind that if you build a small rig with 1 GPU, you’ll be earning fractions of a coin per week or even month.  So a wallet that requires a deposit of at least 1 full coin probably isn’t a good fit for you.

Which Power Supply Should I Use?

This depends on your long-term plan.  Most tutorials suggest a power supply of 1200 Watts or more.  This is not needed unless you’re planning to hook up 6-8 GPUs, which you’d also need a specialized motherboard for.  Assuming you’re starting with 1 GPU, I’d suggest sizing the power supply to be able to add a couple more if you want to.

You’ll probably want a device like a Kill-a-Watt to know exactly how much power you’re drawing.  For example, going with a 650W power supply may be overkill for 1 GPU, but it allows you to easily add a 2nd and possibly a 3rd GPU.  And remember to design in a margin of safety – you probably don’t want to draw more than 80% of what the power supply is rated for.

Which GPU Should I Use?

If you do some research, you’ll see that everyone recommends AMD cards, and claims Nvidia cards are total crap.  Two of the most popular AMD cards right now are the RX 570 and RX 580 – good luck finding them in stock!  They are sold out everywhere and the prices have skyrocketed from the original price of around $200-250 to now closer to $400.

Since this is meant as a practical guide to mining, I think Nvidia cards are an acceptable 2nd choice.  Something like the GTX 1060 with 6GB of RAM will be easier to find and less expensive.  They will have a lower hash rate, but they also consume less power than the high end AMD cards, so you’ll have lower electricity costs.

Whichever card you end up with, you’ll probably want at least 4GB memory on the card itself.  Here’s one compiled list showing some of the popular GPUs and the estimated hash rates.

Final Thoughts

Hopefully you learned a bit about the power & potential of blockchains even if you have no interest in actually building a mining rig.  This only skimmed the surface, and didn’t get into the details of how to configure a miner, how to overlock, etc.  Maybe that’ll be in Part Two!

Was this article helpful?  If you decide to actually build a rig and start making money, feel free to send a small Ethereum donation to the address below!

Ethereum address:

0x6fea33589f1f37a938e80ba187a0694d81cac70c

And finally, if you want to see what a super high powered mining rig looks like, you’ll definitely want to check this out!

Advertisements

Building An Alexa Skill Is Easier Than You Think!

Intro

I recently bought an Echo Dot and after reading these two tutorials (Step by Step Guide & Build a Skill in Under an Hour) I thought I’d give it a shot.  My idea was to build a skill called Goat Compliments which would tell the user a random compliment along with some screaming goat sound effects to add some humor.  Overall, I was surprised how easy the whole process was – hopefully this post will motivate others to try it out as well!

screenshot_2016-11-02-10-13-22-1.png

Going into this, my only advantage was that I was already familiar with JavaScript.  I didn’t know anything about the technology behind Echo skills, haven’t done much with Node development and didn’t know anything about the various AWS technologies such as Lambda functions or S3 storage.  So if those terms seem unfamiliar, don’t worry!

Key Components of a Skill

As the articles above explan, a skill is made up of 2 main parts:

  • The JavaScript code which you’ll likely want to deploy as a Lambda function on AWS.  This basically allows you to run your code on Amazon’s “cloud” and it’s free unless you happen to build an incredibly popular skill that generates a lot of traffic.  This code, and configuring the Lambda function is where you’ll spend 90% of your time.
  • Alexa Skill Kit.  This part is pretty simple and after the initial config, there isn’t much that you’ll need to change.  Setting the icons, description, category, etc are all pretty much a one time thing.
    • The “Test” tab for the skill is very useful for debugging.  You can send requests to your skill, check the request/response JSON, and even hear the response with the “Listen” button in the lower right cornerskill-test
    • The “Interaction Model” tab is where you define the utterances your skill will respond to, and it’s a good idea to have it respond to a wide range of possible phrases.  Here’s an example of how I set mine up – everything after the “GetGoatComplimentIntent” prefix is what Alexa is listening for.

utterances

v1 – Bare Bones Functionality

There are a lot of examples that Amazon has posted on GitHub – check out the Samples or main Alexa page.  The easiest way to get up to speed is to look at their samples, and then reuse parts of their samples.  By reusing Amazon’s code as opposed to random code found somewhere else, when you submit the skill to be reviewed you can add a note saying it’s based on one of their samples and hopefully this makes the approval go quicker.

For example, with my skill Goat Compliments I used some code from the Space Geek sample (how to retrieve a random value from an array), and some code from the Tide Pooler sample (using SSML to play a sound along with text).

By reusing as much of the sample code as possible, I had my first version of the app built, deployed and running in developer mode on my own Echo in probably about 90 minutes.  After cleaning up a few more things with the code and doing more testing, I then submitted the skill for certification & publishing.  I was surprised to see it only took 3 days to hear back and it passed certification!

v2 – Enhancements

Soon after Goat Compliments was published, I thought of 2 key areas that I wanted to improve:

  • I didn’t like having the array of compliments hard-coded in the app since this made it more difficult to update those values.
    • I decided to upload a JSON file to AWS S3 storage which holds the array of compliments.  This allows me to easily update that list, upload the new version to S3 and Goat Compliments can immediately start using it.  In case anyone is wondering how to do this, here’s a code snippet:
var params = { Bucket: '(-- your bucket name--)', Key: '(--your file name--)' };
new AWS.S3().getObject(params, function (err, json_data) {
   if (!err) {
       var result = JSON.parse(new Buffer(json_data.Body).toString("utf8"));
   }
   else {
       // handle error condition
   }
});
  • I wanted some customized statistics to get an idea of how often my skill was actually being used.
    • This article shows a very quick & easy way to tie your Alexa skill into Google Analytics.  This gives me a way to see how often compliments are being generated, but I wish there was also a way to see how many users are enabling (i.e. downloading) the skill to their Echos.

I was expecting to need to go through the certification process again for the changes to take effect, but as soon as I uploaded the changes to my Lambda function the production app started using the compliments from S3 and generating hits on Google Analytics.  Which brings me to my next topic…

Lessons Learned

  • By default, your dev and published skill will point to the same Lambda function so if you have problems (syntax errors, etc) while making improvements you’ve also taken your production skill offline!
    • This setup can be good since you don’t need to go through the certification process again and wait days for the changes to take effect.
    • But this can also be bad if you incorrectly assume (like I did) that the Lambda function code for  your published skill was locked down until you submitted another certification request.
    • While I was working on an improvement to read the compliments from S3 storage, I accidentally introduced an error.  I initially thought this was limited to my development version of the skill, but this quickly turned into an “oh shit!” moment once I realized it was also impacting the published skill.
    • Apparently there’s a way to have multiple versions of the Lambda function – this allows you to have 1 locked down for production and 1 that you can safely mess with during development.  This forum post has some more info, but I haven’t tried that yet.
  • Vague & unhelpful error messages
    • I wish Amazon would improve the error messages, because this caused me a lot of trial and error.  There were a few times I saw weird errors like “unexpected token < in JSON at position 2” when I was trying to edit my Lambda function.  I’m pretty sure this was caused by me leaving my browser open, letting my session expire and then coming back later and trying to pick up where I left off.  Reloading the page and logging back in fixed this.
    • Another problem I ran into was that I changed the description of my Lambda function and all of a sudden it stopped working.  I didn’t touch the JavaScript logic, and the ARN didn’t change, but my skill started giving the error “The remote endpoint could not be called, or the response it returned was invalid.”  Luckily I was able to fix this by re-uploading the .zip file with the skill logic.
  • S3 files must be marked public!
    • After uploading a file to S3, make sure you right-click on it and select “Make Public” so that your Alexa skill can access it.  It’s easy to forget to do this if you’re uploading a new version, so make sure you do this every time you upload a file.

Hopefully this article explained the basic process for building a skill.  Be sure to check out  Goat Compliments and rate it if you like it!

I’m already thinking about ideas for my next project – I may try to build a voice controlled robotic bartender.  If you want to hear about how that progresses, be sure to follow me on Twitter!

P.S.  If you’re still undecided about whether to build a skill or not, Amazon is running a promotion where they’ll give you a free hoodie if you publish a skill – this was originally a T-shirt when I published mine, so it seems like the promotion keeps getting extended.

 

 

 

Lessons Learned From Building an IoT Flamethrower Tank

tank-banner

Background

This project all started because I’m lazy and I hate yard work.  My goal with this project was to create a tank with a small weed torch (flamethrower sounds much more intimidating) that I could remotely drive around to burn any weeds that had the nerve to grow in my yard.

Disclaimer:  this should go without saying, but obviously a remote controlled flamethrower can be very dangerous!  Don’t try copying this & then blaming me if something goes wrong!

Since I had already worked with a Raspberry Pi for  my home arcade cabinet, I figured an Arduino microcontroller would be a good fit for this project. As an added bonus, it gives me a better understanding of a core component for future Internet of Things (IoT) projects.

Don’t feel like reading the whole article? Skip to the video and photo gallery!

Design Progression

  • Concept 1 – The controller was actually hard wired, I had the wrong types of motors, and this was pieced together with mostly spare parts.  This is a very sad looking “tank” – but I didn’t burn the house down, and it motivated me to put more time into it

tank-concept1

  • Concept 2 – This was using a simplified Android app that I wrote which sent commands over Bluetooth.  A Bluetooth receiver was hooked up to the Arduino to process the commands.  The frame was a little flimsy, and trying to send commands from the smartphone was not very user friendly.

tank-concept2

  • Concept 3 – The first fully working version!  Commands are now sent with an Xbox controller and there’s a USB Xbox wireless receiver which relays the commands to the Arduino.  Still not perfect, but it’s very close to being functional.

tank-concept3

 

Lessons Learned / Complications

  1. The Arduino IDE is a bit painful to program in, especially for anyone who’s used to an IDE with more features such as Visual Studio.  Luckily, there’s a Visual Studio extension called Visual Micro which lets you write the Arduino logic & debug your code.  I’m still trying it out, but so far it looks pretty good.  Just the Intellisense capability alone makes it worth it!
  2. Programming an Arduino is easier than I expected it to be.  The code itself is basically C++ (along with some custom wrappers), and it’s divided into 2 main sections – a setup() function that gets run once as the Arduino powers up (initialization logic goes here), and a loop() function which gets executed continuously (here’s where you can read inputs, run custom logic, then set outputs).  Obviously, as your program grows in complexity you probably want to break out the code into additional functions, but technically you only need these 2 functions to have  a fully working program.
  3. Arduino microcontrollers are amazing, and there’s a ton of variety both with the different models of Arduino’s and the “shields” (i.e. expansion boards) that are available.  I chose to use the Arduino Uno to keep the cost down – this is basically the entry level model.  I’m already starting to hit the limits of what it can do, so maybe a fancier model such as the Mega would have been better.  Halfway through the project, I abandoned my original plan to use a custom smartphone app sending commands over Bluetooth, and realized I could use a USB Host shield with a wireless receiver to process commands from a wireless Xbox 360 controller.  If you’re thinking of starting an IoT type project, I’d suggest researching the processors, shields, etc out there so you know what your options are.
  4. Now for the bad news with the Arduino shields – some of them try to use the same I/O ports.  For example, both the USB Host shield and the Motor Control shield tried to use pins 11-13, which is obviously a problem.  There are several workarounds for this.  One option is to use a Go-Between Shield to basically reroute the signals you need.  I was tempted to do this, and might have chose this option if I needed to reroute a lot of pins, but it seemed like overkill for my situation and might just introduce more failure points.  So to follow the “Keep It Simple” principle that’s popular in software development, I just decided to run jumpers to spare pins and that solved the problem.
  5. Can’t find a part you need?  3D printing is easier than you think!  There are some very complicated CAD programs out there with steep learning curves, but those are overkill for 90-95% of the situations.  For most of what I print, I use TinkerCAD – it’s web based so you do not need to install anything, you can access your designs from anywhere and it is extremely simple to use.  By making your parts partially hollow they are very cheap & quick to print.  The tank uses quite a bit of 3D printed parts, and the material for all of it was probably only about $10.  3D printers used to cost several thousand dollars, but they are rapidly dropping in price and some are as low as $250-300.
  6. OK, I’m cheating a bit on this point since I haven’t actually made the tank a true “smart”/connected device yet.  I should’ve thought about the connectivity issue a bit more up front, because one option is to use an Arduino Yun instead of the Uno.  The Yun comes with wifi connectivity built in, so it’s a great choice for IoT projects.  There are many other options to consider – one that looks pretty neat is Blynk, but I haven’t tried it out yet.
  7. Getting the treads to reliably run was much more tricky than I expected – too loose and they’ll pop off the sprocket & guides, too tight and they’ll stall the motors.  Even with the current design it’s still not great, and I’ll likely try to improve it further
  8. Configuring the USB Host shield shouldn’t have been difficult but I was referring to some conflicting & outdated information.  I finally figured it out, and posted a tutorial to help anyone else who might need to set one up.

Next Steps

  • Hardware upgrades to make it a true “smart”/IoT device.  This would enable features such as:
    • Data logging & reporting through RESTful web services on www.joshcaplin.com for reporting (total distance traveled, confirmed foliage kills, etc.)
    • Internet or smart phone integration for sending remote commands from anywhere in the world
    • Live video feeds
  • Increase speed, improve reliability for the tracks/treads
  • On/off control from the Xbox controller for the flamethrower
  • Swappable turrets for multitasking such as a beer drink delivery assistant, poor mans Roomba with a shop vac, etc.
  • Maybe a 3D printed drone with vision system to track and follow the tank?

 

Video

Photo Gallery

 

Final Words

For anyone looking to do something similar, two companies I’d suggest looking at are  SparkFun and ServoCity.  They both have a wide variety of parts, both ship very fast, and tech support for both of them are very helpful!

Hopefully this article was helpful – leave a comment below if there’s any details you want me to add, and follow me on Twitter to see my next experiment!

 

 

 

 

 

Configuring an Arduino USB Host Shield – a beginners guide!

I recently struggled through configuring an Arduino USB Host shield.  In hindsight, it’s pretty simple but there was conflicting information I found and I’m not an expert with Arduino development.  Below is the process I’d follow if I needed to do it all over again – this may save you some time if you’re in the same situation I was.
  • Purchase the SparkFun USB Host Shield (and header pins if needed)- part number DEV-09947.  Caution – there’s apparently an old version of the SparkFun shield, there are shields from other vendors, etc.  If you do not have this exact product, then your setup may be different!
  • Solder the pins onto the board.  Be careful not to accidentally connect adjacent pins when soldering.  I took a multimeter and checked for continuity between adjacent pins to help confirm the connections were good.  There are 2 ground pins next to each other, so you should see a connection there, but not for any other adjacent pins.
  • With the SparkFun board, it seems like you MUST supply external power on Vin or the barrel jack.  5V from the USB cable did not work for me.
  • You must also run a jumper from pin D7 to RESET.
  • The external power & jumper issues were the 2 biggest reasons I struggled with getting the board set up – these seem to be mandatory, at least for SparkFun DEV-09947
  • The code/drivers you need to use for this board are on this GitHub page.
  • I didn’t realize it at first, but there’s a diagnostic test which is extremely useful for checking whether your board is working correctly.  Upload this sketch to your Arduino, then open the Serial Monitor to see the diagnostic info.
  • Step 1 – you’ll see it recognize the board, and start a transfer test:

usb-host-shield-diagnostics-step1

  • Step 2 – you’ll see it attempt to test the GPIO pins – you’ll get a scary looking “GPIO test failed” message, but what I didn’t realize at first is that this can be ignored.  Type something in box at the top of the Serial Monitor, then hit “Send” button and the diagnostic test will continue.

usb-host-shield-diagnostics-step2

  • Step 3 – you should see it cycle through a bunch of resets, then it will attempt to detect a USB device – make sure you have something plugged into the USB port on the shield.  You should then see some summary info with a final message of “All tests passed”.

usb-host-shield-diagnostics-step3

  • Next problem I ran into – the light would not come on for the XBox wireless receiver when plugged into the shield, even though it lit up fine when plugged into my PC.  This was a rookie mistake, but I needed the correct library/driver loaded in my sketch file.  Once I did this, the device was recognized and everything worked great.  So make sure you are referencing the correct driver (Bluetooth, PlayStation, XBox,etc) before uploading your Arduino sketch.

Now that I’ve got the shield & wireless receiver working, I’m wrapping up the last few details on my robotic tank.  Follow me on Twitter to see the final result!

Home Arcade with a Raspberry Pi & RetroPie (with trackball)

arcade-box2

Build a home arcade with a joystick, trackball & buttons wired through an I-PAC to a Raspberry Pi running RetroPie!

Before attempting to build my arcade cabinet, I spent weeks and weeks researching how to do it.  I put this overview together to cover the key points & to help answer common questions.  If I skipped over any critical details you’re still curious about, leave a comment and I’ll try to improve this post!

Disclaimer: This is for educational purposes only. I am deliberately not covering the details of how to install the games (ROMs).

10,000 Foot Summary

I used a Raspberry Pi and installed the RetroPie operating system.  For the physical cabinet, I went with 6 action buttons, plus an additional 2 buttons for Start & Select/Insert Coin.  All controls (joystick, buttons & trackball) get wired into an Ultimarc I-PAC2.  The I-PAC2 plugs into the Raspberry Pi and emulates a USB keyboard so it makes the configuration a little easier.

I broke this project into several phases because I had zero experience using a Raspberry Pi before this project, and I honestly had no idea whether this would be successful.  I didn’t want to buy all the components and then get stuck at the very first step of trying to install RetroPie.

  • Phase 1 (~$75) – Raspberry Pi & USB Nintendo controller for initial testing
  • Phase 2 (~$120) – joystick, buttons, I-PAC and cabinet hardware
  • Phase 3 (~$100) – Ultimarc U-Trak trackball

How to Get Started

Here’s a few questions you’ll need to answer that will help scope out the project:

  1. Is your main interest the games or the physical arcade controls?  If you skip the arcade cabinet it will save you a lot of time and money.  A working system for the old home consoles such as Atari, Nintendo, etc can be fully set up in an hour or two and for well under $100 – this Raspberry Pi kit and these USB Nintendo controllers are about all you’d need (plus a micro SD card, maybe from an old phone?).
  2. If you want the physical arcade controls, what games are you looking to play & what layout do you want?  I went with 6 action buttons, but some games require more.  There are a ton of button layout options – this slagcoin page lists some good options.    You’ll also need to be comfortable with basic electrical wiring.
  3. Do you want a trackball for any games?  This was the toughest part for me – the configuration is tricky, only certain emulators support a trackball, and it significantly increases the cost.   

My Cabinet Design

There are lots of awesome designs out there that are full sized arcade cabinets or a 2 player tabletop cabinet.  But they’d be more expensive and take up more space, so I decided to go with a smaller design for 1 player that can easily be put away in a closet when not in use.

I wanted to make sure there was plenty of room for the components & wiring, so I used a width of 22”, height of 8” and a depth of 10” using 0.5” thick MDF.  You could shave 1-2” off each dimension if you want to get it as small as possible, but wiring in a smaller enclosure might be more difficult.

I used the Japanese style layout for the 6 action buttons where the left column is slightly lower than the middle and right columns – this seems to better line up with how you comfortably position your fingers.

How To Setup RetroPie On A Raspberry Pi

The First Installation page on the RetroPie site has a good explanation of how to configure your Pi. The video tutorial seems WAY too long (over 30 minutes!), so my advice is to follow the text instructions further down the page. You’ll likely need to download the Win32DiskImager program and possibly a utility like 7-Zip to unzip the downloaded image.

I was expecting this to be one of the most difficult parts since I was unfamiliar with Raspberry Pi’s, but it was surprisingly easy to do.

Why Use The I-PAC?

Depending on what you want do you, the I-PAC may not be necessary and it would save you ~$50 to not use one.  If you just want to use USB controllers (Nintendo style, Super Nintendo style, etc) then those can plug directly into the Raspberry Pi.  I used an I-PAC for 2 reasons – 1.)  I’m pretty sure all of the inputs I had (8 buttons, plus trackball wiring, plus joystick wiring) would be too much to wire directly into the Raspberry Pi, and 2.) it emulates a plain old USB keyboard & mouse so I figured that would be easier to get configured.

arcade ipacNote: The I-PAC should not be placed directly on the bottom of the cabinet because you’ll likely damage the solder joints.  The photo above shows the 3D printed supports I designed & used, but even simple wooden supports at the corners would probably work.

Electrical Wiring & U-Trak Trackball Installation

The buttons and each directional switch on the joystick will have 1 wire going directly back to the I-PAC, and the second side will be “daisy chained” to the Ground terminal.  See the sketch below to get a better idea of how it should be wired.

(sketch coming soon)

Since my design is meant to be portable, I took the extra step of tightly wrapping the wires and wire nuts together with electrical tape to reduce the possibility they’d come undone if cabinet was moved or bumped.

arcade insideNote: Inside of the finished cabinet. If you decide to use a trackball, the positioning is extremely important otherwise the X & Y readings will be incorrect. The screws should line up along the vertical and horizontal center lines, and the hole with an arrow next to it should point directly towards the “back” of the cabinet.

Emulators and Games

RetroPie supports a HUGE variety of game systems, and each system has a different emulator.  The arcade games caused me quite a bit of confusion because there are apparently multiple versions of the arcade game files (ROMs), and multiple arcade emulators.  So this means you need to know which ROMset version a particular emulator uses and make sure your game ROMs match that version.  My advice is to start with the other emulators (Atari, Nintendo, etc) which are MUCH easier to configure, then do some research on the arcade configuration and tackle that later.

The RetroPie site has helpful information which explains the different arcade ROMsets and how to convert a ROM from one version to another, but it is complicated and somewhat tough to follow.

Misc Tips & Advice

  • The RetroPie site contains a lot of very useful information, read through it!  There were several times I wasted time trying to find an answer through Google only to realize it was already on the RetroPie site.
  • Raspberry Pi’s are amazing!  Everything runs on a microSD card, so you can use a single Raspberry Pi for multiple purposes.  I have 3 different SD cards that I swap in and out so that lets me use the Pi as an arcade system, control interface for my 3D printer, and as a media center.
  • For some of the more advanced config & troubleshooting you may need to exit the UI and run Linux commands.  This can be intimidating for someone who’s unfamiliar with it, but there is a section on the RetroPie site which gives a good starting point.
  • For the wiring, leave yourself some slack in the wires.  At some point a button will fail, or a wire will come undone and it’ll be much easier to fix if you have enough slack to move the top panel out of the way to troubleshoot.
  • If you don’t plan on using a trackball, then you can reduce the width of cabinet quite a bit – down to maybe 14-16”.
  • You may want to practice cutting/drilling the wood and stripping/daisy chaining the wiring before starting on the actual cabinet.  For the trackball hole, I used a hole saw, and for the button holes I used a spade drill bit.  Place a piece of scrap wood below the panel you’re drilling into, so the bottom doesn’t splinter as you finish the cut.

Check out www.joshcaplin.com to see my other content & projects.