Configuring a Bitcoin Antminer S9 to Run Only part of the Day During Non-Peak Hours

I’ve started tinkering with Bitcoin Mining. Power usage is the single largest cost, so you need ensure that you are using the absolute least expensive power in order to generate as much profit as possible. I live in Georgia and subscribe to Georgia Power’s ‘Smart Usage’ program, which has lower costs most of the time, but peak periods which are Mondays-Fridays in June-September between 2pm and 7pm have a much higher power cost. My full calculation puts the non-peak price per kWh at about $0.048 and peak prices at about three times higher at $0.151 per kWh. Mining bitcoin on an Antminer S9 is mildly profitable at the non-peak price, but definitely loses money at the peak price.

Since it runs on a 220v plug, I can’t use something off-the-shelf like a smart plug to turn it on and off. I’m a linux geek anyway and would rather do it with software. The Antminer has a very bare-bones Linux OS, but it fortunately has crond installed, even though it is not running. These steps will enable crond and create a cron job that kills the bmminer process during the peak hours. It then reboots when the peak period is ending and starts everything back up.

Note that the machine is still on with fans running. It just doesn’t run the mining process which consumes all of the power.

You can see my power usage in the chart below, showing that power usage dropped significantly during the time from 2pm-7pm.

Here is how to make it work:

  1. SSH into the Antminer. Default user is root, password of admin
    ssh root@192.168.1.200
  2. Have it start cron at boot by adding this line to the bottom of /etc/inittab:
    echo "cron:2345:once:/usr/sbin/crond" >> /etc/inittab
  3. mkdir /var/spool/cron/crontabs
  4. Run crontab -e to edit the root crontab in vi
  5. Paste in this content, modify for your desired time times. Note that times are in Universal Coordinated Time (UTC)
  6. ## Here we will stop `single-board-test` and `bmminer` from running during "Peak" periods for Georgia Power
    ## when it is unprofitable to mine due to increase in power cost
    ## 'Peak' is defined as 2pm-7pm, Monday-Friday, in June-September
    
    ## Since monitorcg is started from inittab and can't effectively be killed, we kill single-board-test and bmminer every minute
    ## during the peak hours
    
    ## kill `single-board-test`, which monitors and restarts `bmminer`
    * 18-22 * 6-9 1-5  /bin/kill `/bin/ps -ef | /bin/grep single-board | /bin/grep -v grep | /usr/bin/head -n1 | /usr/bin/cut -c1-5`
    
    ## Also, obviously kill `bmminer`
    * 18-22 * 6-9 1-5 /bin/kill `/bin/ps -ef | /bin/grep bmminer       | /bin/grep -v grep | /usr/bin/head -n1 | /usr/bin/cut -c1-5`
    
    
    ## Reboot at 6:59pm EDT, which will restart the whole machine, bmminer with it (and takes a few minutes to start back up)
    59 22 * 6-9 1-5 /sbin/reboot
    
  7. Exit vi with saving by typing<ESC> :wq<ENTER>
  8. Finally, just type reboot at the command line to have the machine restart.

9 thoughts on “Configuring a Bitcoin Antminer S9 to Run Only part of the Day During Non-Peak Hours”

  1. Sorry, if your peak times are between 2pm and 7pm why is the range set from 18 to 22. Could you clarify? This is really helpful. Thank you.

  2. Hey awesome – this is super useful. Three questions if you have the time to get back to me.
    1. Do you have a list of other useful SSH commands for the S9?
    2. I see there is a “poweroff” command but it loses the connection to the miner and was wondering if there are other simple commands to control when it mines? Trying to create a simple programme to remotely control mining activity.
    3. Why does your power spike in the graph above?

    Thanks – Dereck

  3. Actually you can stop the monitorcg by comenting the inittab line and issue an “init 3” and avoid killing the process.

  4. Hi, i would like to remotely and realtime control the power consumption of an Antminer or similar miner (between 200W and 3000W).
    This to be able to adapt the mining power consumption to match my excess of solar energy (my digital electricity meter tells me how much kW i am injecting to the grid, for which i nearly get no fees returned – on sunny days i have 6kW excess electricity).
    So my question is – via remote control (API) – if i can realtime control the miner to consume X energy (or set X hashrate)? (so i do not want to kills the bmminer process but control it)

  5. I don’t know of a way to do this fractionally on a miner. You could run multiple miners and programmatically turn them on and off. Each of them uses about 1400W, so if you are producing 6,000 watts extra, you could have four miners and turn them off as your excess lowers.

  6. Hi Brandon, I’m Jason from Canton. I have been on GA power’s smart usage rate for 4 years now and using homeseer to control peak kwh usage. Power savings are very significant compared to other rate plans. This winter I discovered that I could heat my home AND pay my power bill using some S9s from ebay! Thanks for this thread, I’m trying to figure out whether I can afford to keep these running in Summer. Question, have you tried the lower power mining modes like braiins os and the upgraded antminer firmware have? Perhaps these modes are still profitable on peak in Summer.

  7. Hi Brandon, I have 21 s9 miners working, been trying several OS like Vnish, Awesome, Hiveos, etc’s Its been crazy the experience … The best one for me is VNISH which is pretty much base for many guys, but, the DevFee is really abusive for my point of view since they have been ON 24/7 during 2 years now, and no option to remove the DevFee.
    I know to login via ssh can send commands , and also tryed to modify some files through winscp //

    Do you have any way to remove or deactivate the DevFee? I believe you will do good to many people here.
    Thanks for your input.

Leave a Reply

Your email address will not be published. Required fields are marked *