Cover image for Mining When the Sun is Out

Mining When the Sun is Out

howbotnik profile image howbotnik ・2 min read


For my first post I will introduce you to a piece of software I have been working on for the past few weeks.

Since getting into mining (in a purely recreational way) I have been trying to come up with a way to automate my miner. I live in a house with solar panels on the roof but no way to store the electricity generated. So I have been trying to solve the problem of turning on my mining software only when the weather is acceptable, therefore, generating your choice of cryptocurrency from free electricity!


I started with the idea that my software needed to follow these requirements:

  • Check to see if the sun is up
  • Check to see if the weather is acceptable
  • Start or stop the miner depending on the conditions


Head over to https://github.com/howbotnik/sunmine to grab a copy and see how this could run on your system.

The config file needs building first and the project runs using Python:

# for local weather information
country_code = GB
location = London

# for the sunrise / sunset api
latitude = 51.5074
longitude = 0.1278

open_weather = **OpenweatherAPIKey**

# Emails user when turning mining on or off
recipient_email = test@test.com
sender_email = test@test.com
password = password

smtp_server_address = smtp.gmail.com
smtp_port = 587

# read the documentation for best practice
program_location = **path to your executable miner**


This config file makes a lot of the program customisable and the program is set up to email when the miner switches on and off.

The Weather_types section allows the user to adjust the types of weather that are acceptable for mining using the https://openweathermap.org weather codes.

As for scheduling, I have had this running successfully as a Scheduled Task on Windows and you can also run it as a cron task on Linux systems.

Do you have a use for this? Have you found any problems with the code? Could you suggest any further improvement?

Other Uses

This program could be used to initiate any program and is not only limited to mining. Certain home-automation processes may only need to run during sunny periods. The rest is up to you!


markdown guide