Author

Topic: How to Automatically Adjust Antminer Frequency And Fan Speeds On a Schedule (Read 3426 times)

member
Activity: 88
Merit: 85
Hi know this is old topic, but i just used it to start automating an Antminer A3

This is what is working for me, it is bit different than your solution. Maybe someone needs it like i did, so thats why i am replying. Advantage of this solution is no need of an command.txt file wich need to be placed on antminer after a powerdown/reboot. These are direct commands to the miner.

Code:
@echo Slowing down antminer to Frequency 600 with Fan Speed xxx
@echo Uploading cgminer.conf
"C:[full path to pscp.exe]\pscp.exe" -scp -pw [password] "C:\Batch\antminerA3\[slow/mid/fast]\cgminer.conf" [username]@192.168.xxx.xxx]:/config/cgminer.conf
@echo Uploads complete! Rebooting now...
"C:[Full path to plink.exe]\pLink.exe" -ssh -batch -pw [password] [username]@192.168.xxx.xxx /etc/init.d/cgminer.sh restart
pause

For me this is the only way to get it working within windows10

I do not run a command from a file, i just send the command directly. Somehow running from a file did not work with me. Hope its useful to someone.

edit: @ this moment i am switching between two coins using this script.
Now i want to depend the freq on the outside temp.
Using phyton for this, so i made this phyton script:
Code:
# coding: utf-8
# python 3.7.3
import urllib.request
import json
# put openweathermap key below
key = "[Key]"
# put city below
plaats = "[City]"
# open weathermap URL
url = "http://api.openweathermap.org/data/2.5/weather?q=" + plaats + "&appid=" + key + "&units=metric"
response = urllib.request.urlopen(url)
data = json.loads(response.read())
temp = data['main']['temp']
# print result, degrees Celsius or Fahrenheit depends on your personal settings on openweathermap website
print(temp)

This gives me result of outside temp in my city.

Now i am figuring out how to use this to adjust the freq in config file automatically.
When i solved that i'll post it here.
newbie
Activity: 1
Merit: 0
Does anybody know how to do this directly on the Antminer S7? I tried making a cron job but it got erased once I rebooted. Then I tried modifying the script called by the only cron job (/usr/bin/ntpdate-sync called by cron job /var/spool/cron/root) but it didn't run my modified script, and the modified script was replaced by the original script once I rebooted. The scripts I wrote will only work if run manually, but they can tell what the time is and adjust the frequency and fan settings accordingly, depending on what time you manually run the script. Any suggestions how to make it automatic? No other forums seem to have working answers that only use the actual miner. Also, does anyone know where the Antminer OS is getting the original cron job and script when I reboot? Thanks!
newbie
Activity: 1
Merit: 0
I got the config file from my s5 and it came out as

Code:
{
"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

Code:
"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?
newbie
Activity: 3
Merit: 1
@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.
hero member
Activity: 756
Merit: 560
For those with linux knowledge check out Ansible playbooks and cron jobs. You can do it pretty easily in linux as well.
newbie
Activity: 1
Merit: 0
newbie
Activity: 3
Merit: 1
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.
legendary
Activity: 3682
Merit: 2607
Evil beware: We have waffles!
And just which Antminers does this work with? Only s7 and earlier and only non-autotune s9's?
newbie
Activity: 3
Merit: 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://bitcointalksearch.org/user/bittalc1-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 [email protected]:/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
antminer_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" [email protected]:/etc/init.d/cgminer.sh
@echo Uploading cgminer.conf...
@echo Uploads complete! Rebooting now...
"C:\Program Files (x86)\PuTTY\plink.exe" [email protected] -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!
Jump to: