RSS

CGMiner on Raspberry Pi

19 May

raspberry-cgiminerI really don’t know but a few simple Unix commands so it was a painful process, but here are the steps and links I took to make it happen.

First I grabbed an 8gb SD card and copied the NOOB Setup files as described at http://www.raspberrypi.org/help/noobs-setup/. Apparently you can actually by an SD card with NOOB installed, but it is by far the easiest step so if you get stuck here, give up. You really are just downloading files and copying them to the card. I did have to download the SD formatter utility mentioned in the article after trying first without formatting the card. It was free and easy, just took a couple of minutes. I chose the Raspbian distribution.

I first tried plugging it into a television using a standard composite video cable but got nothing. Turns out, you have to hit 1, 2, or 3 on your keyboard to switch between video sources as the board is not sending video more than one output at a time. I think 3 was the magic number, but the default and better quality is to just go with HDMI so I recommend an HDMI cable.

At this point I managed to break the SD card holder on the board while trying to get it into a plastic case I purchased for it. Without the SD card port, the board is useless and looking for a solution I found that many experience this problem. It is pretty easy to break so be careful. I attempted to glue a micro-SD adapter into place as a fix so I could just insert and remove the micro SD card as needed but I was unsuccessful and ended up buying another Raspberry Pi.

I had some trouble with my USB hub. As I needed one USB slot for WiFi, I had to switch between a mouse and keyboard until I managed to get a VNC server installed. I wanted to do this anyway so I wouldn’t need to plug it into a TV (or a mouse and keyboard for that matter). I tried a couple before I found these simple instructions: http://www.penguintutor.com/linux/tightvnc

I reserved an IP for the Raspberry Pi for consistency so I could always connect remotely by the same IP. The only speed bump here was that the instructions made it sound as if the port number was to be 1 but is actually 5901. The instructions at the link mentioned above also explain how to have it start automatically.

I was still having to enter credentials at startup so I set it up for automatic login using the instructions found at http://raspisimon.no-ip.org/rpi_autologin.php

Now I could plug it in and have it come right up with tightVNC loaded so that I could just plug it in, wait a couple minutes and then be able to access it via a VNC client on my Mac (I use iTeleport).

Finally, I was ready to run CGMiner only to discover it was not that easy. Unlike on Mac or Windows, you don’t appear to be able to download a built version and instead must build the program yourself. This took quite a lot of figuring out but in the end, these were the commands I ran to pull it off. Be prepared: some steps take a very long time (the first time, subsequently it’s much less time consuming).

sudo apt-get update
sudo apt-get upgrade
sudo apt-get install libusb-1.0-0-dev libusb-1.0-0 libcurl4-openssl-dev libncurses5-dev libudev-dev autoconf libtool 
sudo git clone https://github.com/ckolivas/cgminer
cd cgminer
sudo ./autogen.sh 
sudo ./configure –enable-bitfury –enable-ants1
sudo make 
sudo make install

I created a bash script (another first for me) to avoid having to type the long command line to actually run CGMiner. Working out the command line was something I had worked out a few weeks back getting it going on OSX and Windows:

./cgminer -o stratum+tcp://stratum.bitcoin.cz:3333 -u audiocraft.Article -p 12345 –bxm-bits=56

The bxm-bits argument is one I found to control speed. When running too fast, it would get hot and enter a zombie state. 56 is a slower speed and, coupled with a fan, lets the chip run without overheating.


 

I’ve got it running now and built to handle the ASIC USB devices I run on Windows and PC now. I’ve been able to run some only on Windows, others only on Mac so my hope is to run them all on Raspberry Pi now. Aside from getting USB hubs set up with fans to connect them all I’ve got a couple other problems I’m still working on:

1) I’d like CGMiner to run automatically at startup. I’ve already got a script to run it:

#!/bin/bash
cd cgminer
./cgminer -o stratum+tcp://stratum.bitcoin.cz:3333 -u audiocraft.Article -p 12345 –bxm-bits=56

I saved mine as cgmine.sh, but had to make it executable before I could run it:

sudo chmod +x cgmine.sh

I found a couple of ways to run the script automatically, but my problem is I want to be able to see it running in my VNC session. That I’ve not figured out how to do: I want to plug it in and have it start running CGMiner in X so that I can VNC in and see it (not a new session where it tries to run a second time).

2) I’ve also got two Yellowjacket Bitfury (Nanofury) USB devices, but I can only seem to run one per computer no matter if it is OSX, Windows or Rasbian. It seems like the solution could be here, but I’m really not sure how to move forward. I want to be able to run both on this computer at the same time. Right now, when I plug in a second one, they both show 0.00 gh/s.

Advertisements
 
Leave a comment

Posted by on May 19, 2014 in Tech

 

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

 
%d bloggers like this: