Bitcoin Forum
December 11, 2017, 10:29:08 AM *
News: Latest stable version of Bitcoin Core: 0.15.1  [Torrent].
 
   Home   Help Search Donate Login Register  
Pages: [1]
  Print  
Author Topic: How to Automatically Adjust Antminer Frequency And Fan Speeds On a Schedule  (Read 1874 times)
djripcord
Newbie
*
Offline Offline

Activity: 3


View Profile
July 31, 2017, 05:05:27 AM
 #1

Hey everyone! This post is my version of how to adjust the fan speed and frequency of your Antminers on a schedule.

Thanks to https://bitcointalk.org/index.php?action=profile;u=397375 bittalc1 for the work he did that allowed me to take a similar approach.

As a matter of fact, my method is almost exactly the same, but I wanted to go more in depth so some people without the technical know-how can recreate it for themselves.

Disclaimer: I'm not responsible if you somehow manage to brick your miner.


You will need to have the following programs installed on a Windows machine to do this. It's also possible on Linux but I will not be covering that in this post.
  • PuTTY, a command-line telnet and ssh client.
  • PSCP, a secure-command line file copy program for PuTTY
  • Plink, Command-line interface for PuTTY
  • Windows Task Scheduler
  • WinSCP
  • Notepad++ (recommended)

All of the PuTTY clients can be downloaded here: http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html

I will not be registering the PATH variables in this post, so if you don't know what I'm talking about here, don't worry about it. Just drop plink.exe and PSCP.exe into your PuTTY folder under Program Files(x86).

Begin by downloading the original config files for your miner to a safe location. I chose to download them to my desktop, where I would then copy the files to a folder named "ORIGINAL CONFIGS".

Run this in CMD:
Code:
"C:\Program Files (x86)\PuTTY\pscp.exe" -scp -pw admin root@192.168.1.XXX:/etc/init.d/cgminer.sh "C:\Users\USER_NAME\Desktop\cgminer."


Obviously, change your file paths and IP address. This will work assuming you didn't change your root password.

That will download the config file from your miner to your desktop. It will be named cgminer and may not have an extension. I have found that the period at the end of the file-path is important or PSCP will throw a "cannot create file error"

Once you have your file, put it in a safe place. You may need to come back to it if you make a mistake.

Create some separate folders for the files, make a folder for each frequency setting and or fan speed you would like. You can make infinite configs. Just be aware that you will have to modify your batch script to match your configuration.

 I made the following folders:

antminer_slow
antminer_mid
andminer_fast

Each folder contains my config file that I modified for each. We will now learn how to mod our configs to our liking.

Your cgminer.conf file should look something like this:
Code:
{
"pools" : [
{
"url" : "POOL_URL",
"user" : "WORKER1",
"pass" : "123"
},
{
"url" : "POOL_URL",
"user" : "WORKER1",
"pass" : "123"
},
{
"url" : "POOL_URL",
"user" : "worker1",
"pass" : "123"
}
]
,
"api-listen" : true,
"api-network" : true,
"api-groups" : "A:stats:pools:devs:summary:version",
"api-allow" : "A:0/0,W:*",
"bitmain-fan-ctrl" : true,
"bitmain-fan-pwm" : "90",
"bitmain-use-vil" : true,
"bitmain-freq" : "700",
"bitmain-voltage" : "0706"
}

The values we're worried about are "bitmain-fan-ctrl", "bitmain-fan-pwm", and "bitmain-freq" Don't modify any other parameters unless you know what you're doing.

"bitmain-fan-ctrl" is the parameter that determines whether or not your fans are controlled automatically or manually. Usually manual (true) is the best for our purposes.
"bitmain-fan-pwm" is the parameter that determines your fan speed on a percent scale. 2 is 2% and 90 is 90% with a max of 100.
"bitmain-freq" is the parameter that determines your ASIC chip's operating speed. Take note of your max and min values in the GUI web interface. Don't exceed your max value unless you have adequate cooling and voltages for your chips. Overclocking can be very dangerous to your miner.

In my setup, I have my antminer_slow file set with fan speed 15%, and frequency 100. This runs at absolute minimum and the fan speed is audible but not disrupting.

Once you have your config, save it as cgminer.conf in your folder of choice. In my case, it's saved in "antminer_slow".

Now you are almost ready to upload your files. First, we need a file called "commands.txt" create it in your folder root and put this command at the top line:
Code:
/etc/init.d/cgminer.sh restart
That will restart your miner after we upload the config files. Doing such is necessary to make them active. Otherwise, your miner will not change until you reboot manually or it gets a power failure.

Make yourself a .bat file in the root of your antminer files directory. Call it "slow.bat" for this case.

Place the following code into the file and save.
Code:
@echo Slowing down antminer to Frequency 100 with Fan Speed 15%
@echo Uploading cgminer.sh....
"C:\Program Files (x86)\PuTTY\pscp.exe" -scp -pw admin "C:\Users\USER_NAME\Desktop\ANTMINER_FOLDER\antminer_slow\cgminer.sh" root@192.168.1.xxx:/etc/init.d/cgminer.sh
@echo Uploading cgminer.conf...
@echo Uploads complete! Rebooting now...
"C:\Program Files (x86)\PuTTY\plink.exe" root@192.168.1.xxx -pw admin -batch -m commands.txt

Do a test run of that batch file and see if it works. The command prompt should clearly show when an upload is successful and you should hear your miner reboot upon completion. If not put a "PAUSE" command at the end of the batch file to let it stay open so you can read the errors.

You can easily scale this file for as many miners as you have. Just duplicate the PSCP and PLINK lines for each and modify the IP addresses for each. You can put them all in the same .bat file.


Assuming that worked, we can now make our scheduled tasks. Open up Task Scheduler and create a new basic task. Set your name, description, trigger to a date and time. Set your action to start a program, and select your .bat file. If you want, you can even make tasks wake the PC when they run, so you don't need to have a constantly running desktop to perform them.

It's that simple! Now your miner(s) will automatically change speeds based on a timeframe that you set! This is great for miners who have cheap electricity during nighttime hours or want their miner to be quiet when they're home.

Let me know if any parts of this don't make sense or if you need help.

Thanks for reading and another huge thanks to bittalc1 for discovering this method!
1512988148
Hero Member
*
Offline Offline

Posts: 1512988148

View Profile Personal Message (Offline)

Ignore
1512988148
Reply with quote  #2

1512988148
Report to moderator
1512988148
Hero Member
*
Offline Offline

Posts: 1512988148

View Profile Personal Message (Offline)

Ignore
1512988148
Reply with quote  #2

1512988148
Report to moderator
1512988148
Hero Member
*
Offline Offline

Posts: 1512988148

View Profile Personal Message (Offline)

Ignore
1512988148
Reply with quote  #2

1512988148
Report to moderator
Creating a Bitcoin client that fully implements the network protocol is extremely difficult. Bitcoin-Qt is the only known safe implementation of a full node. Some other projects attempt to compete, but it is not recommended to use such software for anything serious. (Lightweight clients like Electrum and MultiBit are OK.)
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction. Advertise here.
1512988148
Hero Member
*
Offline Offline

Posts: 1512988148

View Profile Personal Message (Offline)

Ignore
1512988148
Reply with quote  #2

1512988148
Report to moderator
NotFuzzyWarm
Legendary
*
Offline Offline

Activity: 1288


Evil beware: We have waffles!


View Profile
July 31, 2017, 01:11:02 PM
 #2

And just which Antminers does this work with? Only s7 and earlier and only non-autotune s9's?

-Joshua Zipkin aka Joshua Alexander leaked AMT A1 miner skype chats http://bit.ly/1Qjt6lj
-For bitcoin to succeed the community must police itself.
-Support Sidehacks miner development. Donations to:   1BURGERAXHH6Yi6LRybRJK7ybEm5m5HwTr
djripcord
Newbie
*
Offline Offline

Activity: 3


View Profile
August 01, 2017, 01:21:48 AM
 #3

And just which Antminers does this work with? Only s7 and earlier and only non-autotune s9's?

Unfortunately, I have not had the honor of using an S9 yet. So from what you're describing this may not work with them. It may be worth the try if the conf files are similar though. I'm sure I will update this post once I get some time with an S9.
nunoms
Newbie
*
Offline Offline

Activity: 2


View Profile
September 12, 2017, 10:34:22 AM
 #4

Hi,

Good post, that is exactly what I need, unfortunately I got stucked right on the beginning... :-(

So for my S7 unit...
I download the conf file using the command:
pscp.exe -scp -pw admin root@192.168.1.91:/etc/init.d/cgminer.sh c:\_files\miner\cgminer_u2
The file was downloaded 4Kb but the content has nothing to do with your post, the have, check bellow:
(help to get this step done would be much appreciated...)



#!/bin/sh

PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/usr/bin/cgminer
NAME=cgminer
DESC="Cgminer daemon"
CONFIG_NAME="/config/asic-freq.config"
USER_SETTING="/config/user_setting"
set -e
#set -x
test -x "$DAEMON" || exit 0




do_start() {

   NIC=eth0
   MAC=`LANG=C ifconfig $NIC | awk '/HWaddr/{ print $5 }'`
   #echo $MAC | tr '[a-z]' '[A-Z]'
   upmac=`echo $MAC | tr '[a-z]' '[A-Z]'`
   #echo $upmac
   curti=`date "+%Y-%m-%d %H:%M:%S"`
   #echo $curti

   OUTPUT=/tmp/pic_mac
   echo "${upmac:0:2}"" ${curti:2:2}" > $OUTPUT
   echo "${upmac:3:2}"" ${curti:5:2}" >> $OUTPUT
   echo "${upmac:6:2}"" ${curti:8:2}" >> $OUTPUT
   echo "${upmac:9:2}"" ${curti:11:2}" >> $OUTPUT
   echo "${upmac:12:2}"" ${curti:14:2}" >> $OUTPUT
   echo "${upmac:15:2}"" ${curti:17:2}" >> $OUTPUT

   # check network state
   #network_ok=`ping -c 1 114.114.114.114 | grep " 0% packet loss" | wc -l`
   #if [ $network_ok -eq 0 ];then
   #    return
   #fi

   # gpio1_16 = 48 = net check LED
   if [ ! -e /sys/class/gpio/gpio48 ]; then
      echo 48 > /sys/class/gpio/export
   fi
   echo low > /sys/class/gpio/gpio48/direction

   gateway=$(route -n | grep 'UG[ \t]' | awk '{print $2}')
   if [ x"" == x"$gateway" ]; then
      gateway="192.168.1.1"
   fi   
   if [ "`ping -w 1 -c 1 $gateway | grep "100%" >/dev/null`" ]; then                                                   
      prs=1                                               
      echo "$gateway is Not reachable"                             
   else                                               
       prs=0
      echo "$gateway is reachable"    
   fi                   
   #ping $gateway -W1 -c1 & > /dev/null
   #prs=$?
   if [ $prs = "0" ]; then
      echo heartbeat > /sys/class/leds/beaglebone:green:usr3/trigger
      echo 1 > /sys/class/gpio/gpio48/value   
   else
      echo none > /sys/class/leds/beaglebone:green:usr3/trigger
      return
   fi
   sleep 5s
   if [ -z  "`lsmod | grep bitmain_spi`"  ]; then
      echo "No bitmain-asic"
      insmod /lib/modules/`uname -r`/kernel/drivers/bitmain/bitmain_spi.ko
   else
      echo "Have bitmain-asic"
      rmmod bitmain_spi.ko
      sleep 1
      insmod /lib/modules/`uname -r`/kernel/drivers/bitmain/bitmain_spi.ko fpga_ret_prnt=0 rx_st_prnt=0
      #insmod /mnt/mmc1/bitmain_spi.ko fpga_ret_prnt=0 rx_st_prnt=0
   fi
   #control console printk level
   #freq_value="`awk '{if($1 == "option" && $2=="\047freq_value\047") print $3}' $CONFIG_NAME | sed "s/'//g"`"
   #chip_value=`awk '{if($1 == "option" && $2=="\047chip_freq\047") print $3}' $CONFIG_NAME | sed "s/'//g"`
   #timeout=`awk '{if($1 == "option" && $2=="\047timeout\047") print $3}' $CONFIG_NAME | sed "s/'//g"`
   freq_value=0782
   chip_value=200
   chip_num=54
   freq_m=$(($chip_value * 1000))                                                                           
   timeout=$((2 ** (32 - Cool * (256 / $chip_num) / freq_m / 64))                                             
   echo $timeout

   queue_value="`awk '{if($1 == "queue") print $2}' $USER_SETTING | sed "s/'//g"`"
   echo " queue_vale=$queue_value"
   if [ -z $queue_value ]; then
      queue_value=8192
   fi

   #PARAMS="--bitmain-dev /dev/bitmain-asic --bitmain-options 115200:32:8:$timeout:$chip_value:$real_freq"
   PARAMS="--bitmain-dev /dev/bitmain-asic --bitmain-options 115200:32:8:$timeout:$chip_value:$freq_value:0725 --bitmain-checkn2diff --bitmain-hwerror --version-file /usr/bin/compile_time --queue $queue_value"
   echo PARAMS = $PARAMS
   start-stop-daemon -b -S -x screen -- -S cgminer -t cgminer -m -d "$DAEMON" $PARAMS --api-listen --default-config /config/cgminer.conf
   #cgminer $PARAMS -D --api-listen --default-config /config/cgminer.conf 2>&1 | tee log
}

do_stop() {
        killall -9 cgminer || true
}
case "$1" in
  start)
        echo -n "Starting $DESC: "
   do_start
        echo "$NAME."
        ;;
  stop)
        echo -n "Stopping $DESC: "
   do_stop
        echo "$NAME."
        ;;
  restart|force-reload)
        echo -n "Restarting $DESC: "
        do_stop
        do_start
        echo "$NAME."
        ;;
  *)
        N=/etc/init.d/$NAME
        echo "Usage: $N {start|stop|restart|force-reload}" >&2
        exit 1
        ;;
esac

exit 0



nunoms
Newbie
*
Offline Offline

Activity: 2


View Profile
September 12, 2017, 02:54:40 PM
 #5

Got it,

the config files is this one:
root@192.168.1.90:/config/cgminer.conf
fanatic26
Hero Member
*****
Offline Offline

Activity: 560


View Profile
September 12, 2017, 03:20:13 PM
 #6

For those with linux knowledge check out Ansible playbooks and cron jobs. You can do it pretty easily in linux as well.

Stop buying industrial miners, running them at home, and then complaining about the noise.
djripcord
Newbie
*
Offline Offline

Activity: 3


View Profile
October 14, 2017, 12:39:21 PM
 #7

@nunoms

You're kinds right. I didn't mention it in my original post, but that file is only necessary if you want to use load_balancing. There's a setting you can add in that file that will allow you to balance hashing power between the three pools.
Nephy
Newbie
*
Offline Offline

Activity: 1


View Profile
October 28, 2017, 09:56:02 PM
 #8

I got the config file from my s5 and it came out as {
"pools" : [
{
"url" : "stratum+tcp://us-east.stratum.slushpool.com:3333",
"user" : "worker1 ",
"pass" : "123"
},
{
"url" : "stratum+tcp://stratum.mining.eligius.st:3334",
"user" : "nep",
"pass" : "123"
},
{
"url" : "us1.bitminter.com:3333",
"user" : "Nephyln",
"pass" : "123"
}
]
,
"api-listen" : true,
"api-network" : true,
"api-allow" : "W:0/0",
"bitmain-freq" : "3:350:0d82",
"bitmain-voltage" : "0725"
}


the
"bitmain-fan-ctrl" : true,
"bitmain-fan-pwm" : "90",
"bitmain-use-vil" : true,
is not included. do I add it in there or is it located at a different location for s5?
Pages: [1]
  Print  
 
Jump to:  

Sponsored by , a Bitcoin-accepting VPN.
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!