Learning never exhausts the mind
Home >  Technology > Raspberry Pi > Bitcoin Mining with a Raspberry Pi

Published 14th January 2018 by

Have a spare Raspberry Pi and want to mine some bitcoins? This guide will show you how to get started mining Bitcoins.
Raspberry Pi Bitcoin Mining with AntMiner U2

Raspberry Pi Bitcoin Mining with AntMiner U2

Since this guide has been written the difficulty involved in mining Bitcoin has increased significantly. The techniques presented here are no longer profitable and you will spend more on electricity than you would ever hope to gain through mining. When I fired up my miner to update this, the estimated payout was in 108 years time, for 0.0001 Bitcoin. This is for information purposes only.

Raspberry Pi in combination with a USB ASIC miner chip makes a good Bitcoin miner (PiMiner) due to its low power usage and ease of configuration. ASIC devices are specialised computing processors specific to the SHA256 algorithm used in Bitcoin hashes. They are much more efficient than pure CPU computations. The Raspberry Pi is a very cheap and efficient way to control and monitor devices which are better suited to mining Bitcoins.

To get started mining Bitcoins with a Raspberry Pi and an Antminer U2 USB ASIC device, you will also need:

  1. A Pool Account (Recommended: SlushPool.com)
  2. A BitCoin Wallet
  3. Powered USB Hub (Optional for Pi3, Required for < Pi 2)

Firstly you need to get a pool account. For SlushPool simply head over to the website, register for a free account and once logged in, under the dashboard, you will find your worker details. We'll use these later.

Next, you need to download the latest and Flash Raspberry Pi Raspbian OS onto an SD card.

Once booted up you need to install a few development packages and the mining software.

sudo apt-get install build-essential libtool libcurl4-openssl-dev libjansson-dev libudev-dev libncurses5-dev autoconf automake

Next, we install the Bitcoin mining software:

sudo apt-get install bfgminer

Finally, we can launch the mining software and start mining some Bitcoins.

bfgminer -S all -o stratum+tcp://eu.stratum.slushpool.com:3333 -u <username.workernumber> -p x

Where is the details from the Slushpool worker configuration.

If everything is plugged in correctly bfgminer should automatically recognise the antminers and start mining. Depending on which version of Antminer you have, you will see the speed and hash rates shown in the screen. Antminer U2 should be around 1.6Gh/s.

The three speed numbers you see indicate the last 5s avg speed, the All-Time Average (for this program run) and the Effective Average (actual performance taking into account failures etc).

Sign up with CoinBase using this link and get $10 USD FREE when you deposit 100+ in your local currency.

While you won't get rich running a single Raspberry Pi Bitcoin Rig, you can learn about cryptocurrency, mining and of course the Raspberry Pi. As a tool for education, this can help you decide if you wish to invest in more appropriate equipment to mine cryptocurrency. Idea: Why not try bitcoin mining on a Raspberry Pi cluster?

2 thoughts on “Bitcoin Mining with a Raspberry Pi
  • 13th June 2019 at 3:56 am

    Hey Tim,

    I am trying to implement the "Bitcoin mining using RPi" project and am facing a little bit of trouble when I am trying to get the setup functioning to start mining bitcoins.Could you please help me out ?

    I am using a
    RPi 3 flashed with Raspbian stretch OS (full version, not the lite version)
    Gekkoscience compac USB ASIC
    Bitcoin core wallet
    SlushPool pooled mining account
    USB Hub

    I've already linked the Bitcoin core wallet to the slushpool account and also have installed the BFGminer onto the RPi.

    There seems to be some problem/error occuring when I run the final command i.e
    bfgminer -S all -o stratum+tcp://eu.stratum.slushpool.com:3333 -u -p
    The mining process doesn't start...the screen shows something like "waiting for devices...press M+ to add devices or Q to quit" something like that and the quickly it moves on to another screen which keeps displaying "Trying in 15 seconds" something like that..

    Can somebody help me out with this ?

    I will be able to share screenshots of error message if somebody is really interested in solving the issue.

    Thanks !!

  • 28th July 2018 at 12:00 am

    I'm trying to run bfgminer but I keep getting "No servers could be used. Exiting" trying to connect with nicehash and slush pool. Tried with and without sudo, and installed from repository using instructions here. Raspbian stretch 9. I heard it could be to do with libcurl or ufw but I don't know how to check or test these. Could somebody help please?


Leave a Reply

Fields marked with * are mandatory.

We respect your privacy, and will not make your email public. Hashed email address may be checked against Gravatar service to retrieve avatars. This site uses Akismet to reduce spam. Learn how your comment data is processed.