Using the Raspberry Pi to Control a Bitcoin ASIC Mining Rig

Raspberry Pi Bitcoin Miner

As the total hashrate of the Bitcoin network continues to rise mining for Bitcoins using GPUs is quickly becoming obsolete.  In order to stay involved in Bitcoin and continue mining without losing money on electricity I decided to order a few of the ASICMiner USB Block Erupters.

BTC Guild recently started reselling the Block Erupters as individual units eliminating the need to participate in a larger group buy which has made it much easier to purchase these tiny ASICS.  You can also purchase them directly on Amazon, or you can buy some Bitcoins and buy them directly from BTC Guild, or on the Bitcoin auction site Bitmet as well.

Adafruit recently posted a guide explaining how to use the Raspberry Pi and PiMiner as a headless controller for Bitcoin ASIC miners.  This seemed like a cool use for the Pi and reason to get the soldering iron out so I decided to order the parts and put it together.

Parts Used

Below is a list of all of the parts I used for this project.  You don’t necessarily need a model B Pi, the model A would work just fine if that’s what you happen to have on hand.  You don’t need a very big SD card either but if you need to purchase one you might as well buy an 8GB card since the prices are so cheap now.

ComponentPrice
Raspberry Pi Model B$39.99
Adafruit Pi Box Enclosure$14.95
Adafruit RGP Positive 16×2 LCD Keypad Kit$24.95
Edimax Nano Wireless Adapter$9.99
D-Link 7 Port Powered USB Hub$25.18
Arctic Breeze USB Powered Fan$7.99
SanDisk 8GB SD Card$7.54
ASICMiner USB Block Erupter$8.99

ASICMiner USB Block Erupters

The Block Erupters are one of the few ASICs that you can purchase without having to wait for a pre-order.  With a power requirement of only 2.5 watts each these are a good option for anyone looking to stop mining on their GPUs and move to a more power efficient mining rig.

The three ASICs below are from the saphire batch and produce about 330 mh/s each.  I ordered these from BTC Guild and received them in about a week.

If you don’t have any Bitcoins to use for the ASIC purchase on BTC Guild’s store you can easily acquire some through Coinbase.

ASICMiner USB Block Erupter

 

Cooling Solutions

The Block Erupters use a passive heatsink for cooling.  After running for a few minutes the heatsink gets extremely hot, you can easily burn your hand on them if you are not careful.  While using a fan isn’t required doing so keeps the error rate low and will probably extend the lifespan of the miners.

The Arctic Breeze fan works good for this project since it has an adjustable gooseneck that allows it to be pointed where it is needed.  This fan is almost completely silent too, I can barely even notice it when is running.

Arctic Breeze USB Fan

 

This image shows how far you can bend the fan, it keeps my miners nice and cool.

 

USB ASIC Mining Rig

USB Hub Compatibility

When I first looked at doing this project I was planning to use an Anker 10 port USB 3.0 hub that would allow the ASICS to sit vertically into the hub.  As I started researching this hub I found that many users reported issues with using the Raspberry Pi with the Anker hub.  As I began reading I discovered that the Pi has several known issues with USB 3.0 hubs in general.  More specifically it seems that the Pi has issues enumerating USB 1.x/2.x devices on 3.0 hubs.  Since the Block Erupters are USB 1.1 devices they fall into the scope of this bug.

Several people were reporting success with the D-Link DUB-H7 hub, and it is also listed on the RPi verified peripherals wiki page.  I decided to purchase this hub to avoid any potential compatibility issues and I can confirm that it does work well with the Pi.

D-Link DUB-H7 USB Hub

Why I Like The Adafruit Pi Box Enclosure

There are quite a few different enclosure available for the Pi but the Adafruit Pi Box is a good fit for this project since the top portion of the case can be removed providing easy access to the GPIO pins on the Pi.  If you happen to have access to a 3D printer  or a Full Spectrum Hobby Laser you can download the SVG file and make your own case.

If you purchase this case from Adafruit it comes as a kit that can be assembled very easily.

Adafruit Pi Box Pieces

Here is what the case looks like after it has been assembled.

Adafruit Pi Box Assembled

This video shows how the Pi Box is assembled.

Adafruit LCD Kit

Adding the LCD to this project is optional but besides being very cool it gives you an easy way to check on the status of the ASIC miners.  Adafruit provides some python code that displays several screens of information on the LCD such as hash rate, errors, current Bitcoin prices, and network difficulty.

So if you plan to run these miners without a monitor connected to the Pi then the LCD makes perfect sense.  I also enjoy soldering electronics so the fact that the LCD comes as a kit adds to the general fun level of the project for me.

I ordered the RGP Positive kit which has a muli-colored backlight (7 different colors).  Adafruit also sells the same display as RGP negative, or blue/white.

Here is what the Adafruit kit looks like.

Adafruit LCD Kit

The picture below shows what the entire board looks like after assembly.  The soldering difficulty level was pretty easy, the entire board took less than 30 minutes to build.

The main screen shows the number of accepted shares, rejects, and average hash rate.

Finished Pi Miner

Displaying the current BTC price, and the daily high and low price.

Pi Miner LCD BTC Price

Listing the number of devices and the hardware error rate.  When using a fan the error rate remains below 1%.

Pi Miner LCD Error Rate

Overall Performance

I’ve been running my ASIC mining rig for about a week now with very few issues.  The cgminer monitoring script seems to occasionally crash which results in the LCD locking up.  The monitoring script runs as a separate process so it does not stop cgminer from running when it dies.  Aside from debugging the python script a simple solution would be to setup a cron job to periodically restart the script.

Comments

Are you using the Pi to control your Bitcoin mining system?  If so do you have any tips to share?  Leave a comment below to assist other miners.

 

Sam Kear

Sam graduated from the University of Missouri - Kansas City with a bachelors degree in Information Technology. Currently he works as a network analyst for an algorithmic trading firm. Sam enjoys the challenge of troubleshooting complex problems and is constantly experimenting with new technologies.

29 thoughts on “Using the Raspberry Pi to Control a Bitcoin ASIC Mining Rig

    1. Thanks John! So Far my rig has been working well, no issues to report yet. I would like to make a 3d printed case for the entire unit, but I need to get a 3d printer first 😉

  1. Sam, Great post. I’ve been running the same rig as you for several weeks now. I’ve been using 10 port Rosewill USB 2.0 hubs, although I only insert 7 ASICs into each hub to accommodate the current limit of the power supplies. I have a question: You mention a maximum of 48 ASICs. I seem to be able to run a maximum of 18 ASICs using three hubs. I should also mention that the hubs are not daisy chained (although I have tried that) – they are plugged into separate ports on a 7 port Manhattan USB 2.0 hub which is connected directly to the Raspberry. I’ve double checked my rc.local file and it’s perfect – USB0 through USB18 – which should allow for 19 ASICs. However plugging in an additional ASIC simply makes one of the other ASICs inactive at boot – one of the ASICs – no telling which one – LED will not extinguish. I’ve swapped ASICs around and it makes no difference so I do not believe I have a faulty ASIC. I’ve googled this problem several times but I seem to be the only one with this experience. I would be interested in your thoughts, if you have any on the subject. Thank you for your time and keep up the good work. – Jack

  2. great build you got a ‘like’ form me for your YouTube video! my only question is this, has your rig payed itself off yet? doing the math its a $230 ish build, im curious as to how much you’ve been able to mine? has this build been doing well for you? im wanting to get into bitmining myself i id like to replicate your rig here but i don’t want to waste the investment you know?
    hope all is well for you
    and thanks for posting this!

    1. I’ve just barely been able to pay off my mining rig, partially due to the recent increase in Bitcoin price. The difficulty has been rapidly increasing over the last several months (http://bitcoindifficulty.com) which has decreased the amount of coins these ASICs are able to mine.

      Overall this rig has been very stable and is still generating some small ammounts of BTC. Luckily I was able to get some of these USB Block Erupters early enough to earn some return before the difficulty rose too high. I was also able to get some more ASICS at a low cost through BTC Guild’s coupon program that allowed me to buy more at a big discount.

      As it stands today I would not recommend buying these Block Erupters since you will not be able to recover your investment. In fact they are being discontinued in anticipation of a newer model being released.

      This Raspberry Pi setup will work with any USB miner supported by cgminer so if a newer model comes out that looks profitable you can still apply the same concept. I recommend running the numbers through the Gensis Block Mining calculator (http://mining.thegenesisblock.com/) to estimate ROI.

      I’d still encourage anyone who wants to learn more about Bitcoin and the mining process to buy one and try it out. Just don’t tie up a bunch of money expecting to get rich!

  3. I love your design and i plan to try it out for my self. But i was wondering, is the lcd display and the extra components needed? i’m new to raspberry pi’s and want to do little circuit board work.

    1. Thanks Sam!

      The LCD display is completely optional, you can still do everything with out it. You can monitor the miner using a connected monitor, or run it headless once you have everything configured. At the bare minimum you will need a powered USB hub since the Pi doesn’t provide enough power output to run an ASIC.

  4. I thought this D-Link 7 Port Powered USB Hub cant handle more than 4 of these miners o.0? or is it just recommended not to use more than 2A or 10W?

  5. This stuff is really interesting, but most miners wont disclose whether or not their rig is profitable, how much does this rig make or lose?
    ,

  6. I was wondering, if the ASICMiner Block Erupter Blades might work with this? I don’t know much about them right now and when I looked at a video of setting one up, it looked rather complex, someone said you can do it through LAN though and it just made me curious is all. It appears you have a spare LAN port with the video you shown so if it does work through LAN, that adds 10.7GH/s right? ( http://www.amazon.com/ASICMiner-Block-Erupter-Blade-10-7gh/dp/B00FPG1MOW/ )

    The LCD attaching part looks rather complex to me, I don’t think I’d be able to do that part, even though it would be a nice thing to have. Would be nice if you were to sell the built version of the LCD attachment with the PI, then we’d all just need to get the other parts ourselves and get the LCD attached pi from you.

  7. My wireless network has a password, how can I make the Edimax Nano Wireless Adapter can access the network with the same password?

    1. You’ll need to edit a couple of the network files in Raspbian to get wifi working, this works for wifi networks using WPA2.

      First, edit /etc/network/interfaces. It should look something like this:

      auto lo
      iface lo inet loopback
      iface eth0 inet dhcp
      allow-hotplug wlan0
      iface wlan0 inet manual
      wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
      iface default inet dhcp

      Then edit /etc/wpa_supplicant/wpa_supplicant.conf , replace “ssid” and “password” with the info for your wireless network.

      ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
      update_config=1
      network={
      ssid=”ssid”
      psk=”password”
      proto=RSN
      key_mgmt=WPA-PSK
      pairwise=CCMP
      auth_alg=OPEN
      }

      Adafruit has a pretty good tutorial on the Raspbian wifi setup with some screenshots.

      After saving the changes you’ll need to do a service network restart, or just reboot the pi. It should connect via wifi using DHCP to obtain and IP address.

  8. hi
    looks like a good setup. and i also have the screen kit. I have just ordered some more Erupters.
    I’ll need a new USB hub, do you think the D-Link will power 6 Erupters and the Pi at the same time?
    Thanks

  9. Hello there Sam thankyou for all of this

    firstly did you connect LCD n Keyboard with it right! and you used Linux based OS. Also you think ASICMiner Block Erupter USB is useful and that too from BTC , heard that things are getting complex so u need atleast 10GH/s to mine. Also what if i am not using a BTC pool , then should i be using their mining devices.

  10. also you said to use CGMiner why can’t I use MultiBit or GUIMiner , hey u also said not to purchase the above ASIC Block Enrupter as something new is coming up , so what is that new thing and what should i buy then. also this Adafruit RGB Positive 16×2 LCD+Keypad Kit for Raspberry Pi is a bit hastle , as I don’t have a solidering kit and don’t know how to do is there any other alternate

  11. I would just like to know is this all hooked up to a computer if so dose the computer have to be a powerful computer or could it just be a basic Mac mini

    Thanks keep up the great work
    Matt

    1. Thanks! Unfortunately it will not work for Litecoins since they use a different algorithm (scrypt). They can be used to mine any coin that uses the SHA256 algorithm such as Namecoin, Hashcoin, Globecoin, etc.

  12. How muc time does it takes to Mine 1 BTC and how muc electricity it consumes(assume) while mining one BTC….???? it would be great if u provide an answer for it….!!!

Leave a Reply

Your email address will not be published. Required fields are marked *