PiMiner and cgminer status API

General project help for Adafruit customers

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
itorront
 
Posts: 3
Joined: Fri Jul 16, 2010 12:32 pm

PiMiner and cgminer status API

Post by itorront »

Hi,
I have the PiMiner up and running, plus configured. But the PiMiner python script can't seem to find the MHS average on the first page. I can see the rest of the pages (on the 16x2 LCD) but when i go to the first page i only see ' MHS av" on both lines. Is there a setting i need to change in the python script for it to show this page?

Please let me know if you have any questions.
Thanks!

collinmel
 
Posts: 58
Joined: Thu Aug 07, 2008 12:16 pm

Re: PiMiner and cgminer status API

Post by collinmel »

itorront wrote:Is there a setting i need to change in the python script for it to show this page?
Nope - it should work as-is. What version of cgminer are you running & what type of miner are you using?

itorront
 
Posts: 3
Joined: Fri Jul 16, 2010 12:32 pm

Re: PiMiner and cgminer status API

Post by itorront »

Thanks for the reply!

I am running CGMiner 3.8.5 and i ahve a single (at the moment) Bitmain Antminer U1.

User avatar
mdax
 
Posts: 12
Joined: Mon May 06, 2013 9:54 am

Re: PiMiner and cgminer status API

Post by mdax »

I recompiled and now get the same result as the original poster first screen shows two lines of
'MHS av'

I'm very interested in what cgminer you are using
I can get my Ant U1 to 1.5Gh/s using https://github.com/AdvancedStyle/cgminer (3.8.5) however piminer hangs at "connecting to cgminer
"

User avatar
mdax
 
Posts: 12
Joined: Mon May 06, 2013 9:54 am

Re: PiMiner and cgminer status API

Post by mdax »

I managed to get my raspi working great with the LCD and Ant U1

Steps
git clone https://github.com/fractalbc/cgminer
cd cgminer
sudo apt-get install libusb-1.0
sudo apt-get install libudev-dev
./autogen.sh
./configure -–enable-bmsc
make -j 6

Running this .config
{
"pools" : [
{
"url" : "stratum.BANNED.cz:3333",
"user" : "minerName",
"pass" : "minerPassword"
}

]
,
"api-listen" : true,
"api-mcast-port" : "4028",
"api-port" : "4028",
"expiry" : "120",
"hotplug" : "5",
"failover-only" : true,
"log" : "5",
"no-pool-disable" : true,
"queue" : "1",
"scan-time" : "60",
"shares" : "0",
"kernel-path" : "/usr/local/bin",
"api-allow" : "0/0",
"bmsc-options" : "115200:20",
"bmsc-freq" : "0881"
}

Commands
sudo nohup /home/pi/cgminer/cgminer --config /home/pi/cgminer.frac.conf >/dev/null 2>&1&
sudo python /home/pi/cgminer/PiMiner/PiMiner.py &

Image

itorront
 
Posts: 3
Joined: Fri Jul 16, 2010 12:32 pm

Re: PiMiner and cgminer status API

Post by itorront »

Cool! Thanks for the Reply mdax.

I'll give it a try either tonight or this weekend. I'll post my results.

Thanks!

remoteBC
 
Posts: 1
Joined: Mon Feb 03, 2014 5:48 pm

Re: PiMiner and cgminer status API

Post by remoteBC »

To resolve the 'MHS av' 'MHS av' problem edit the file PiMinerInfo.py ...

nano PiMinerInfo.py

Change line 143 which shows

s2 = 'avg:%s' % self.hashrate(float(d['MHS av']))
return [s1, s2]


to this

if ('MHS av' in d):
s2 = 'avg:%s' % self.hashrate(float(d['MHS av']))
else:
s2 = 'avg GHs:%s' % float(d['GHS av'])
return [s1, s2]

User avatar
jamesfreeman
 
Posts: 25
Joined: Sun May 15, 2011 3:17 pm

Re: PiMiner and cgminer status API

Post by jamesfreeman »

I've made a slightly more elaborate fix, to keep everything properly decorated when the values scale:

Replace the "hashrate" subroutine with the following two subroutines:

Code: Select all

def hashrate_mega(self, h):
	  u = 'Mh/s'
	  if h >= 1000.0:
		u = 'Gh/s'
		h = h / 1000.0
	  elif h >= 1000000.0:
		u = 'Th/s'
		h = h / 1000000.0
	  s = '%s %s' % (h, u)
	  return s
	  	
	def hashrate_giga(self, h):
	  u = 'Gh/s'
	  if h >= 1000.0:
		u = 'Th/s'
		h = h / 1000.0
	  s = '%s %s' % (h, u)
	  return s
Change the invocation within the parse_summary subroutine to:

Code: Select all

if 'MHS av' in d:
			s2 = 'avg:%s' % self.hashrate_mega(float(d['MHS av']))
		else:
			s2 = 'avg:%s' % self.hashrate_giga(float(d['GHS av']))
Hope that this helps.

Jim

Locked
Please be positive and constructive with your questions and comments.

Return to “General Project help”