Uncategorized

Mining bitcoins on a solar-powered Raspberry Pi 2: first steps

Update: Here are the links for Part1 (this one), Part 2, Part 3, Part 4, and how to run the Pi from a battery

Mining for Bitcoins is nothing new; heck, I’ve done it for years and made quite a profit from it. On Raspberry Pi, it mostly works. Minepeon is a great piece of software to mine bitcoins on the original Raspberry Pi which I have used for a long time.

Powering stuff with solar panels, even less. Powering Raspberry Pis with solar panels? Easy peasy! There are tutorialssoftware tools, videos even portable kits.

Now, mining Bitcoins on a Raspberry Pi under solar power? Not so easy.

The biggest issue here is power. While the Raspberry Pi itself is a big on the hungry side of power consumption regarding this kind of machine, it’s nothing really absurd. The problem lies in the miners.

The Miners

See, in order to have some meaningful Bitcoin income, you need some hashing power. A 330mh/s Block Erupter won’t consume much power, but won’t make any dough either. The increasing difficulty in hashing means that you need WAY more than that to make a dent. DISCLAIMER: the setup portrayed here will probably never give me any money. This is a hobby and should be considered as that. I am doing this because I want to learn, not because I want to make money out of it.

51nHUrI4khL

One of these Block Erupters won’t make you rich.

Good thing is, you can have some quite powerful miners for cheap today – they are powerful compared to the aforementioned Block Erupters, that is. You can buy something around ten times faster than that for 10 dollars on eBay.

So, for the sake of this experiment, I am going with the Antminer U2. They can hash around 2GH/s.
ip.bitcointalk.org

I bought four of them on eBay por 12 bucks – not bad.

There are dozens of other models on the market. There are much faster ones, but those are quite stable, and most importantly, they don’t require active cooling, like the Bi Fury, for example. The fact that they play nice with the Raspberry Pi is a plus. You would be surprised by how many miners go horribly bad with the Pi.

Another thing I am going to try with is the Antminer U3: Those pack a more serious punch (for last year’s standards), that I just happened to have here.

00320150109110101006f7KWzNtm06C7

Those can do 65gh/s, but their power draw is not to be neglected.

The Pi 2

I have some Raspberry Pis model B laying around doing nothing, so why not use them?

Well, I wish I could.

Turns out that the Raspberry Pi has the shittiest USB connection ever known by man. It just sucks. Even using the recommended, powered USB hub, the Pi will have problems with it. Believe me, I tried.

u0731-1

The original Raspberry Pi B. It doesn’t like your USB stuff and you won’t like it

I have around a dozen of different USB hubs here, and it complains about all of them, except for this, which is hard to find: meet the 7-Port USB 2.0 Hub (DUB-H7) from D-Link

DUB H7 B1

The Pi likes this buddy

So in order to try and avoid USB issues, I bought the new Raspberry PI 2 B+, which comes with 4 USB ports instead of two. This allows me to connect the four small Antminers on the powered USB hub, and two powerful Antminers directly on the Pi, and I still have one free port, for wi-fi!

FullSizeRender

My Pi2 with the D-Link hub, two Antminer u3, and a wi-fi usb module.

The same combination would not be possible on my old Raspberry Pi model B, simply because they don’t like my USB Hubs, no matter which one I try.

For the Wifi connection, I use an EW-7811Un. It just works. As the Pi will stay on my balcony, pulling an Ethernet cable would be a bummer. To connect with the Cube miners on the basement, I have a TP-Link Powerline adapter. I’m still undecided if I will turn them on.

Software

As I went for the Raspberry Pi 2, Minepeon does not work anymore. The project seems abandoned, and, to be honest, I’m not a fan of ArchLinux. So I went with a default Raspbian, and BFGMiner, compiled from source. The instructions are easy to find on the internet. In the future I will make the Raspbian read-only, so, as soon as there is no solar power, the whole thing turns off – I don’t want batteries.

The only “trick” is that I set it up with Wi-fi, assigned it a fixed address in my router, and added this line on my user’s crontab -e:

@reboot /usr/bin/screen -dmS bfgminer /usr/local/bin/bfgminer -u myuser.raspberrypi2 -p mypassword -o http://api2.bitcoin.cz:8332 -S all

This makes sure that every time the PI reboots, there is a BFGMiner running, under the amazing “screen” utility. In order to check its working, I just need to SSH to the Pi and do a “screen -r”, to see the miner’s screen. Control-A Control-D leaves the session without closing it.

Why do I use BFGMiner instead of CGMiner? Well, CGMiner does not like my Antminers on the Pi2 – I don’t know why – and it does not support http proxy. I have several Block Erupter Cubes on my basement (wired to my network), which I might enable later as well. So, CGMiner is a no-no.

41En9ODSKfL

These are the most trouble-free miners ever. As long as you don’t use CGMiner.

The Solar Panels

As I sad at the beginning, the power required to hash is not trivial. It’s easy to power a Raspberry – the miners, not so much. DISCLAIMER: I have little idea what I’m talking about. I don’t know much about electronics, to be honest.

Let’s go with some numbers. We need to power:

  • The Pi itself
  • The Wi-fi card
  • The Miners
  • The USB Hub
  • Some extra monitoring hardware for the future (as I said, I will shut down everything when there’s not enough power). Will probably use an Arduino.

It’s clear that a small 20x20cm solar panel won’t do the trick. Indeed, I went full retarded and bought a damaged solar panel: this one:

$_57

I got this for 7 euros on eBay.

This thing is 1.70m high. It’s huge. While it does not provide 100% of its alleged former efficiency, for this price I couldn’t care less. I’m yet to measure its power draw.

As I went full retard, I also got one of these:

Img.ashx

So, I have 2 panels that could give me 360W on a proper day. That should cover my needs.

Next post: how to make these panels give me some power, and how to convert it to something the Raspberry and the other equipment can use.

Advertisements
Standard

5 thoughts on “Mining bitcoins on a solar-powered Raspberry Pi 2: first steps

  1. Pingback: Mining bitcoins on a solar-powered Raspberry Pi 2: Part 2 | Linux, Technology and Beer

  2. Pingback: Mining bitcoins on a solar-powered Raspberry Pi 2: Part 3 | Linux, Technology and Beer

  3. Pingback: Mining bitcoins on a solar powered Raspberry Pi 2: part 4 | Linux, Technology and Beer

  4. Pingback: It’s ridiculously easy to run a Raspberry pi from a battery | Linux, Technology and Beer

  5. Pingback: Mining bitcoins on a solar powered Raspberry Pi 2: part 5 | Linux, Technology and Beer

Leave a Reply

Fill in your details below or click an icon to log in:

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 )

Google+ photo

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

Connecting to %s