Monday, September 4, 2017

HighTek - About Me

Email: hightekgrow@gmail.com
Github: github.com/smoriarty21
Website: hightekco.com
Facebook: facebook.com/hightekgrow
Twitter: twitter.com/HighTekGrow
Reddit: reddit.com/r/hightek/
Support HighTek: patreon.com/hightek
Donations: paypal.me/atarimaster

[ About Me ]

    Whats up fellow techies and horticulturists!  My name is Sean but those who know me best call me Atarimaster.  I grew up playing games and being obsessed with computer security.  My obsession with security eventually lead me to programming.  I have worked with all sorts of platforms and all sorts of languages from C++ to Python and everything in between.  My primary background is working as a full stack developer in start-up environments.
    Eventually, life tossed an Arduino in my path and I fell in love with building physical devices that I also write the software to control how they behave.  For a long time I spent all my free time either working on games or working on learning web application security as best I could but, from here on out I was a maker through and through.  I started messing with LEDs and other little components making super simple projects.
    A few years later, I decided I wanted to get some automation and monitoring going on inside of my grow rooms.  I hit the internet and was shocked at the price of very simple suites that barely scraped by on my minimum requirements.  It was that day that HighTek was born.  I set out every day to spread the word of open source grow room management software.  I hope to spread my highly inexpensive units to every grow room that wants automation and doesn't want to pay thousands for it.
    If you have any questions or would like to chat for any reason you can find all of my contact info above.  I will always respond to emails and that is the best way to get in touch with me.  As always thanks for reading and happy growing!

Sunday, September 3, 2017

Twitch Grows Peppers - Live Growroom Control Via Twitch Chat!

Live Stream: https://www.twitch.tv/hightekgrow
Email: hightekgrow@gmail.com
Github: github.com/smoriarty21
Website: hightekco.com
Reddit: reddit.com/r/hightek/
Support HighTek: patreon.com/hightek
Donations: paypal.me/atarimaster

[ The What ]


    Is there someone out there really crazy enough to let the twitch community control the fate of his pepper plants? Yes, I'm that crazy bastard!  As many of you may or may not know I have been hard at work the past few months working on open source growroom automation software.  This software is called HOBloom and can be found at my github page linked above.  I decided to have a little fun with this and setup a small tent and allow the public to interact with the environment via twitch chat.  You can issue a command into twitch chat and every one minute, the bot will tally up all of the votes and announce a winner.  It will then do whatever the winning action was rather it be running an appliance on or off or raising/lowering the humidity thresholds.  Below I will go over all of the available commands and what they each do.  Feel free to check out the stream and try entering them in chat yourself to cast your vote!  Remeber the bot counts votes every minute so it may take up to that time for you to see the results of the voting round.  The dashboard should then update within thirty seconds to show the new changes.  You can find the live stream here.

[ The Commands ]


    Below is the list of available commands at the moment.  Leave a comment if you have ideas for more controls you would like to see and I will be sure to get them in there!


  • !turnonlights - Turn on the lights
  • !turnofflights - Turn off the lights
  • !raisemaxh - Raise maximum humidity by one percent
  • !lowermaxh - Lower maximum humidity by one percent
  • !raiseminh - Raise minimum humidity by one percent
  • !lowerminh - Lower minimum humidity by one percent
  • !turnonfan - Turn on circulating fan
  • !turnofffan - Turn on circulating fan
  • !turnonexhaust - Turn on exhaust fan
  • !turnoffexhaust - Turn on exhaust fan


[ Wrap Up ]


    This is going to be a fun little social experiment and I would be thrilled to have you be a part of it!  Come in try the commands and watch the progress of the plants from day to day!  As always thank you for reading and happy growing!

Sunday, August 20, 2017

The Magic Of VPD

Email: hightekgrow@gmail.com
Github: github.com/smoriarty21
Website: hightekco.com
Reddit: reddit.com/r/hightek/
Support HighTek: patreon.com/hightek
Donations: paypal.me/atarimaster


[ Intro ]

    What do you think of when you hear the word humidity?  For many many years, horticulturists of all types kept close track of the relative humidity in there grow environment.  The dictionary defines relative humidity as the amount of water vapor present in air expressed as a percentage of the amount needed for saturation at the same temperature.  This means of expressing the amount of moisture in the air was great until our current day champion VPD came around.

[ What Is VPD ]

    VPD stands for vapor pressure deficit.  Vapor pressure deficit is the difference the moisture currently in the air and the total amount of moisture the air can possibly hold.  In other words, we take the difference between the current moisture level and the amount of moisture the air can potentially hold before it becomes fully saturated.  It is very important that we keep an eye on VPD.  If our air becomes over saturated it will release water molecules creating a film on our plants.  This will encourage rot in our greenhouse and that is a problem we don't want to deal with.  Below is an image of the VPD chart. The chart has green, yellow, and red sections.  The green section is the ideal range for your plant at the given temperature.  In the yellow, it is not ideal but should not cause any harm to your plants.  In the red range, you may see problems.


[ Calculating VPD ]

    Calculating VPD can seem like quite the daunting task but in all reality, it is not very difficult.  Big props to alchimiaweb for their article on calculating VPD.  I will be referencing a lot of information from them as it is the best article I found when learning about VPD.  In order to calculate our VPD we need three things.  We need our room temperature and relative humidity.  With these two things, we can calculate our SVP or saturated vapor pressure.  The saturated vapor pressure is the max amount of moisture the air can hold.  We can find our SVP using our temperature(in Celsius) and the chart below to the find SVP for our room at the current temp.


    Once we have our SVP it is very easy to calculate our VPD.  We can do this using the following formula.


VPD = ((100 - CRH) / 100) * SVP

   As you can see in the formula above all we need to do to find our VPD is first minus the current relative humidity from 100.  Next, we divide the result of that by 100 and multiply the result by the SVP we found using the chart above.  Now we know our VPD and we can start adjusting out room accordingly.

[ Controlling Your VPD ]

    If you would like to take a look at an open source system that can manage VPD and temperature in your greenhouse check out my open source grow room automation system here.  If you need any help or have any questions please comment or reach out using the information a the top of the page.  As always thanks for reading an happy growing! 

Sunday, August 13, 2017

Open Source Time Lapse Manager

[ Intro ]

This weekend I decided I wanted to get some time lapses of my peppers and basil plants I have in both my indoor and outdoor gardens.  Not only will it be fun to watch the difference between the two environments but it can also be very useful having on demand time lapses of anything we want.  I wrote this system to run on a Raspberry Pi model 3 but, you can run it on almost anything.

[ What You Need ]

  • Windows/Mac/Linux machine to run the software.  I will be using a Raspberry Pi Model 3
  • USB Webcam
  • Micro SD Card(Only needed for Raspberry Pi)
  • Git Installed
  • Pyton 2.7

[ Instructions ]

Plug in your webcam preferably using a USB hub with dedicated power.  The client and server are written in Python and node js so they should run on any of the major operating systems.  In this guide, I will be using a Pi model 3 running the latest version of Raspbian Jessie.  The very first step is to get all of the source code we need from GitHub.  This can be accomplished by cloning the repositories for both the client and server.  This can be done using the following two commands below:

    cd ~/

    git clone https://github.com/HighTekGrow/growlapse-client.git

    git clone https://github.com/HighTekGrow/growlapse-server.git

[ Server Setup ]

Now that we have both the server and client side code we need to get everything setup and running.  First, enter the server directory using the command below.

    cd ~/growlapse-server

In the root of the server repo and run the commands below to install opencv on both your system and in the python enviroment.

    sudo apt-get update
    sudo apt-get install python-dev python-opencv

Once we have completed that we can install the python dependencies using the command below.

    pip install -r requirments.txt

    pip install -U numpy

We should now be able to run our server by issuing the following command.

    python growlapse.py

Our server is now ready to go.  All we need now is the client in order to give us a nice UI to manage our time lapses.  If you would like to know that the server is running for sure you can use curl to test it.  Running the following command should issue you back a blank response with a 200 status code.

     curl 127.0.0.1:5002/timelapse

[ Client Setup ]

Before we get the client up and running we need to upgrade nodejs.  The easiest way to do this is to first run the following commands to remove any old version of node that may be on the system.

    sudo apt-get remove nodejs

    rm -f /usr/bin/node /usr/bin/npm

Now we will grab the latest version of node and unpack it to our home directory from the node download servers.

    cd

    wget https://nodejs.org/dist/v6.11.2/node-v6.11.2-linux-armv7l.tar.xz

    tar xvf node-v6.11.2-linux-armv7l.tar.xz

    cd node-v6.11.2-linux-armv7l

Once we have the latest version of node for ARMv7 we need to link our new npm and node binaries to our path making it easier to run node.  To do this we use the following commands.

    sudo ln -s bin/node /usr/bin

    sudo ln -s bin/npm /usr/bin

Now that we have the latest version of node its time to install our dependencies for the client using the command below.

    cd ~/growlapse-client

    npm install

Once this finishes we can run the client in dev mode by using the following command.

    node_modules/.bin/ember serve

This will give you the output shown below after getting everything setup and ready.  I have also attached images of the main dashboard and the create new time lapse screen.  Hope you enjoyed this entry and as always don't forget to comment and check back regularly for more content!










Sunday, August 6, 2017

HOBloom - Building Smart Outlets

Email: hightekgrow@gmail.com
Github: github.com/smoriarty21
Website: hightekco.com
Reddit: reddit.com/r/hightek/
Support HighTek: patreon.com/hightek
Donations: paypal.me/atarimaster

[ Intro ]

    In this lesson, we will be going over creating smart outlets for your HOBloom automation system. This same wiring will work for any other software but we specifically will be building it to work with HOBloom.  Once we build the outlet and wire up out relay we can use each port on the outlet to control our appliances in our grow room.  Below you will find a list of the materials needed to build the outlet.

[ Materials ]
[ Prepare The Outlet ]

    The first thing we need to do is break the little metal tab on your outlet.  This will allow you to control both outlets individually.  We only need to break the tab on the hot side of the outlet.  We can leave the tab on the neutral side of the outlet as the power is the only thing we need to control separately, they can still ground to the same negative without any issue.  Below are images of the tab before and after removal.





[ Connecting Earth Line ]

    The earth wire is the green(it may also be green and yellow striped) wire coming off your power cable.  If you just have a normal extension cable cut it and strip each wire coming off of the male end of the extension cord.  The green wire gets connected to the green screw on the outlet.  There will only be one and it will be off on its own.

[ Connecting Neutral ]

    Next, we will be connecting our neutral lines from the outlet to the power cable.  Connect the white wire from your power cord either of the two screws on the neutral side of the outlet matching the image below.




[ Connecting The Positive ]

    To connect out positive line we first need two pieces of wire about two inches long.  One end of each wire will be going inside the small holes on the back of the outlet on the positive side.  On the back of your outlet, you should see a small recess with the word "strip gage" or something along those lines.  This is a guide to show you how much you need to strip off your wire to properly seat it in the holes we will be using to set the wire in the positive outlet connectors.  Check out the image below for an idea of what you are looking for and how to use them.






    Now that we have that end connected we will be stripping a very small amount off the other end of the wire and securing it in the first socket in each relay(first from the left) as shown in the image below.



    Once this is all connected, we need to connect the outlets right next to the one we just used on each relay(the middle outlet on each relay).  We are going to connect a wire with a very small bit stripped off the end to each of these sockets.  Just like before it is important to just strip enough to allow the relay to grab the wire.  You should not have any visible wire coming out of the end without shielding on it to avoid the wires touching.  Saftey first is our goal.  Once we have these connected we need to strip a bit off the other end and connect them together as well as the black wire from our power cord using a wire nut.  The images below will show you what this should look like through the process.







[ Connecting Relay To Base ]

    Now that we have our outlet all wired up it is time to move on and connect our relays to our base unit.  On the back of the relay, you will see four pins sticking out.  From top to bottom in the image below the pins are 5V power(VCC), relay 2 control, relay 1 control and ground(GND).


  Use the diagram here for reference on where to connect these pins. Power down your BeaglBone before connecting your smart outlet.  I also highly suggest labeling the two outlets with the pin they are connected to.  This will be shown in the images below and will help immensely when you are setting up appliances in your client.   The VCC pin on the relay gets connected to any of the VDD_5V pins on the BeagleBone.  This would be either pin P9_5 or P9_6.  The next two pins are the control pins for the relay.  These can be plugged into any of the GPIO pins on the BeagleBone.  Finally, the GND pin gets connected to any of the pins labeled DGND on the BeagleBone.



[ Testing Your Outlets ]

    I have created a small python utility for testing the outlets after you have connected them.  To use this tool all you need to do is boot back up your BeagleBone after connecting all the wires for your smart outlets.  Once you are back in, navigate to your /home/debian/repo directory or wherever your home directory is.  For this next section, n you will need to know the GPIO pins you connected your smart outlet relay to in the step above.  First, clone the repo and then enter the repositories root directory using the command below.

    git clone https://github.com/HighTekGrow/hobloom-outlet-tester.git

    cd hobloom-outlet-tester

    Once you have all the code in place and you are in the root directory for the repo you can start the script using the following command.

    sudo python outlet-tester.py

    This will open the testing utility that will ask you to enter your pins you have connected your smart outlets too.  Enter a pin and type Y when prompted if you have more pins to enter, if not type in N.  Once you have completed entering the pins the script will turn them all off and then one by one power the outlets on.  The way I use this tool is plugging a small light or fan or something like that into each outlet.  I then run the script and watch the output, it will tell you what pin it is turning on.  When it outputs a pin look at what appliance it turned on and label that outlet for future use.  When you setup your appliances in your grow room you will be asked what pin the appliances are connected to.  When you are asked this it is referring to the pin the smart outlet you have the appliance connected to is using.

[ Wrap Up ]
    
    As always thank you for reading and don't forget to leave a comment below if you have any questions or suggestions.  If you would like to support open source horticulture software like this please check out the paypal and patreon links at the top of the article!

Saturday, August 5, 2017

HOBloom - How To Automate Your Grow Room For Next To Nothing

Email: hightekgrow@gmail.com
Github: github.com/smoriarty21
Website: hightekco.com
Reddit: reddit.com/r/hightek/
Support HighTek: patreon.com/hightek
Donations: paypal.me/atarimaster

Intro

Today we are going to be looking at HOBloom the newest open source product created by HighTek.  This software allows you to use a BeagleBone Black to control your lights, heaters, ACs, humidifiers, dehumidifiers and intake/exhaust fans.  It also logs data automatically and gives you a nice web interface to monitor and configure everything with.  In this article, I will go over how to build, setup and configure everything to get this system up and running in your grow room.  We will be setting up and installing the base unit, installing sensors, building smart outlets and learning how to put it all together.  I will go over getting your BeagleBone Black up and running on Linux, OSX and Windows.

What You Need




Preparing Your BeagleBone Black

This step varies a bit depending on what operating system you are running.  Below I have added links to the individual posts on setup for each system. Credit for the Linux article goes to Otto Linnemann for his great instructional!  The same goes to Derek Molloy for his awesome instructional covering Windows and Linux.

Once you have flashed your device, if you are using Linux or Windows you can find the instructions for SSHing into your BeagleBone below.
Now that you have SSH access to your BeagleBone we will start to prepare our system.  The very first thing I would recommend is changing the password for your debian and root users.  First, change the password for the current user by running the command "passwd". This will prompt you to enter the current password for the user(temppwd) and then will ask you to set a new password.  Once you have changed the password for this user I would also change the root users password.  You can do this by running the command "sudo -u root /bin/bash", entering your password that you just changed for your debian user and then running the "passwd" command again to change the password for root.  Once you are done setting the root users password type the command "exit" to go back to your debian users terminal session.

Once we have changed our password is setup we need to flash our operating system to the eMMC on the BeagleBone.  To do this you need to run the command "sudo nano /boot/uEnv.txt".  Once you have the uEnv file open you need to uncomment the line shown below.

##enable BBB: eMMC Flasher:
#cmdline=init=/opt/scripts/tools/eMMC/init-eMMC-flasher-v3.sh


Uncomment the last line from above, save and exit your text editor.  Now type the command "sudo shutdown now" to shut down your BeagleBone.  Hold down the boot button on the BeagleBone and press the power button.  This will make the lights flash for about 30 minutes and then all four lights will go out.  Once the lights are out you may remove the SD card and restart your BeagleBone Black.  For images and more detailed instructions on the boot and power button sequence check out this article.

Now that we are no longer running our operating system off of our SD card we can format it and use it to store our code and database.  This will also give us enough storage to run the client directly on the device.  Put the SD card back in your Windows/Linux/OSX machine and format it using FAT.  Shutdown your BeagleBone and insert the SD card then start it back up.  Once you are back into the BeagleBone via SSH we can format the SD card, mount it and set it to mount automatically on reboot.

Once your system comes back up with the SD card inserted, run the command "sudo fdisk -l".  This should give you an output something like the image below.


In the image above my SD card is "/dev/mmcblk0".  From here on out I will refer to it as /dev/device, whenever you see this insert your device id from the output on your machine.  It may not and likely will not be the same name as mine.

In order to format our drive we need to first run the command "sudo fdisk /dev/device".  This will open fdisk a linux command line tool for managing drives.  Once in the fdisk console you can type "m" to print out the help menu and show you the list of commands as seen in the image below.


Our first step is to remove any old partitions on the drive.  To list the partitions(if any) we type the command "p" to print the current partition table.  This will show you something like the image below.  Yours may only have one partition or it may have more it just depends on how your drive was previously partitioned.


If you have any partitions on the list when you run the "p" command you can run the "d" command to delete partitions.  We are just clearing all of them so you can just keep entering the "d" command and pressing enter to let it delete the default partition.  The default is always the last partition on the drive.  Once you see that it is deleting partition number one you can stop(after deleting partition one).  If you are confused just keep running the "d" command until you get an error about there being no partitions.

Now we are going to create one partition that takes up our entire drive.  To do this run the "n" command.  You may press enter through the questions and allow it to use the defaults.  Once we have the partition created we just need to write the partition table and exit using the "w" command.

Here we will find ourselves back at the Linux terminal and out of fdisk.  We now can run the command "sudo mkfs.ext4 /dev/devicep1" to create an ext4 filesystem on your new partition.  Note here you need to add the partition number to the command, this means you have to append "p1" to the end of your root device path you have been using previously.  This can be seen in the example command above.  Next, we need to make a folder to mount our partition and hold our code.  For this we run the command "mkdir /home/debian/repo". The only step we have left is to set the partition we just created to mount every time we boot our BeagleBone.  To do this we need to edit the fstab file using the following command: "sudo nano /etc/fstab".  Once you have the fstab file open in your text editor add the following line to the end of the file: "/dev/devicep1 /home/debian/repo auto rw 0 0".  Reboot your BeagleBone using the command "sudo reboot now".

Once your BeagleBone comes back up and you can SSH back in you should see your partition in the mounted partition table by typing the command "mount | grep /dev/device".   We are now ready to start installing all our dependencies and grabbing our source code.

To setup wifi using a USB wifi adapter follow the guide here on the HighTek wiki page.  You may also hardwire your system but, I don't suggest the wireless option.

HOBloom uses sqlite to keep track of sensors, appliances and to log data.  This database is never shared and is always kept internal to your device.  For this to work we need to install sqlite on our BeagleBone.  The Beaglebone must have an internet connection from this portion of the install forward.  Run the command "sudo apt-get update; sudo apt-get install sqlite3 git".  This will update apt and then install the sqlite3 package as well as the git package that we will need to grab our code on your system.

In order to run the client we need to upgrade the nodejs install on our BeagleBone.  To do this you need to download the latest ARMv7 binary from here.  Running the commands below will bring us into our repo directory and download the nodejs ARMv7 binary onto our SD card.

    cd ~/repo

    wget https://nodejs.org/download/release/v7.8.0/node-v7.8.0-linux-armv7l.tar.xz

    tar xvf node-v7.8.0-linux-armv7l.tar.xz

    sudo apt-get remove node

    sudo rm -rf /usr/bin/node /usr/bin/npm

    sudo ln -s /home/debian/node-v7.8.0-linux-armv7l/bin/node /usr/bin/node

    sudo ln -s /home/debian/node-v7.8.0-linux-armv7l/bin/npm /usr/bin/npm

These commands will download the correct version of node for our system, remove the old version of node and npm and link our new binary to the main path making it easier to use.

Our system is now ready to clone the HOBloom repo and start getting the server up and running.  In order to get the code we need to first enter our SD card by running the command "cd /home/debian/repo".  We can now grab our code by running the command "git clone https://github.com/smoriarty21/hobloom.git".  We should now be able to run "cd hobloom" and see our code base by using the "ls" command.  This should output the files below.


Now that we have our code our very next step is running the setup script to get our config file and database setup for us automatically.  In order to do this, we need to run the command "sudo python setup_db.py" and allow the script to run.  When it asks you about your temperature sensor give it any name you would like.  For the type enter either "dht11" or "dht22" depending on what model you have purchased.  When asked for the pin enter "P8_7", once we are done setting up the software we will shut our unit down and install the sensor in the pin we just specified.  The script should complete and now you should have your database and config files all setup to get the system running.  The last thing we need to do for the server is installing the node dependencies.  We can do this by running the command "npm install". This may take a bit to finish but should complete error free.

Before we can hook up our temperature and humidity sensor we need to shut our BeagleBone down using the command "sudo shutdown now".

In the images below I will be hooking up the dht22 but the setup for the dht11 is exactly the same.  In the images below I connected three jumper wires to my dht22 and zip tied it to my case.  This is the same case in the kit linked above and you could set it up the same if you would like.  You can see the wires hooked up in the image below.




Those three pins in the image from left to right are ground(GND), 5V power(VCC) and data(DAT). For the rest of the setup, you will need to refer to the BeagleBone pinout diagram.  This diagram should be fairly easy to read.  The pins on the left side are all "P9_" the number in the yellow or white box.  The same goes for the right side except the prefix has changed to "P8_".  The ground cable can be connected to any of the pins labeled DGND.  This means we can use either P9_1, P9_2, P9_43, P9_44, P9_45, P9_46, P8_1 or P8_2.  In the image above I have it plugged into P9_2.  The next pin is power and can be plugged into any pin labeled VDD_5V(P9_5 and P9_6).  The data pin will go into P8_7 as that is what we entered above in the setup script. Below are more images of my sensor connected to my base unit.






Now that we have our temperature and humidity sensor installed we are ready to get our unit up and running.  Power back on the BeagleBone Black and enter the directory with your code(cd /home/debian/repo/hoblom).  Run the command below to start the server.

    sudo node hobloom.js

Now that our server is running we want to get the client up and running so that we can ensure the system is working as it should be.  For this, we need to spin up a new ssh session into our BeagleBone just like we have in the past.  enter the client directory inside the main repo using the command below.

    cd /home/debian/repo/hobloom/client

Once inside this client directory run the command below to install the dependencies for the client.

    npm insall

Before we are ready to start the client there is one last thing we must do.  For this step, you will need to know the IP address of your BeagleBone.  It is the address you have been using to SSH into the device.  We will need to update our clients GlobalConfig file to point to the IP address of your specific BeagleBone.  Use the command below to open up the GlobalConfig.

    nano app/classes/GlobalConfig.ts

When you run this command you will be shown the file in the picture below.


Here we need to navigate to the line "export const IP: string = '192.168.0.21';" and change the IP from 192.168.0.21 to whatever IP you are using for your device.  Once you have changed this IP address to your BeagleBones IP address we are ready to start the client.  In order to do this, we need to run the command below.

    npm start

This command will run and first you will see the message shown below.


The important part in the image above is the sections labeled "Access URLs".  You can see mine says the external URL is 'http://192.168.0.21:3001'.  This is the address you need to type into your browser in order to see the client.  You can now point your browser at that URL and view your client.  You should see a dashboard like the image shown below.


As always thank you for reading and check back often for more.  Next, I will be going over creating smart outlets to control your appliances and setting up the fire detection sensor.

Setup Your Smart Outlets

If you would like to setup smart outlets that allow you to control your lights and appliances check out my article here.

Support More Work Like This

If you would like to help support open source horticulture software the easiest ways are through PayPal or Patreon.  Thank you for reading and as always comment below if you have any questions or feedback!

Block Ads Spotify Desktop

Email: hightekgrow@gmail.com
Website: hightekco.com
Reddit: reddit.com/r/hightek/
Support HighTek: patreon.com/hightek
Donations: paypal.me/atarimaster


[ Intro ]

Today I will be teaching you how to easily block the servers hosting Spotify ads on your machine. This will allow you to listen all day long on a free account without hearing a single ad.  This trick is very simple, legal and works great.  Spotify may catch on and find some way to stop this from working but, as of today (08/05/2017) it works swimmingly.

[ Blocking Ad Server ]

In order to remove those pesky ads, all we need to do is setup out hosts file to override the DNS for Spotify's ad servers and redirect that traffic to our local machine.  When the traffic hits out local machine the call will fail and the ad will be skipped.  Follow the steps below to add the entries needed.


  • Open your hosts file using your favorite text editor.  If you are using windows this life is located at "c:\Windows\System32\Drivers\etc\hosts".  If you are using Linux or Mac it is located at "/etc/hosts"
  • Add the following lines to the bottom of your hosts file:

# Block Spotify Ads

127.0.0.1 media-match.com
127.0.0.1 adclick.g.doublecklick.net
127.0.0.1 www.googleadservices.com
127.0.0.1 open.spotify.com
127.0.0.1 pagead2.googlesyndication.com
127.0.0.1 desktop.spotify.com
127.0.0.1 googleads.g.doubleclick.net
127.0.0.1 pubads.g.doubleclick.net
127.0.0.1 securepubads.g.doubleclick.net
127.0.0.1 audio2.spotify.com
127.0.0.1 http://audio2.spotify.com
127.0.0.1 www.audio2.spotify.com
127.0.0.1 www.omaze.com
127.0.0.1 omaze.com
127.0.0.1 bounceexchange.com
127.0.0.1 core.insightexpressai.com
127.0.0.1 content.bitsontherun.com
127.0.0.1 s0.2mdn.net
127.0.0.1 v.jwpcdn.com
127.0.0.1 d2gi7ultltnc2u.cloudfront.net
127.0.0.1 crashdump.spotify.com
127.0.0.1 adeventtracker.spotify.com
127.0.0.1 log.spotify.com
127.0.0.1 analytics.spotify.com
127.0.0.1 ads-fa.spotify.com
127.0.0.1 cs283.wpc.teliasoneracdn.net
127.0.0.1 audio-ec.spotify.com
127.0.0.1 cs126.wpc.teliasoneracdn.net
127.0.0.1 heads-ec.spotify.com
127.0.0.1 u.scdn.co
127.0.0.1 cs126.wpc.edgecastcdn.net
127.0.0.1 pagead46.l.doubleclick.net
127.0.0.1 pagead.l.doubleclick.net
127.0.0.1 video-ad-stats.googlesyndication.com
127.0.0.1 pagead-googlehosted.l.google.com
127.0.0.1 partnerad.l.doubleclick.net
127.0.0.1 prod.spotify.map.fastlylb.net
127.0.0.1 adserver.adtechus.com
127.0.0.1 na.gmtdmp.com
127.0.0.1 anycast.pixel.adsafeprotected.com
127.0.0.1 ads.pubmatic.com
127.0.0.1 idsync-ext.rlcdn.com
127.0.0.1 www.googletagservices.com
127.0.0.1 sto3.spotify.com
127.0.0.1 spclient.wg.spotify.com
127.0.0.1 d361oi6ppvq2ym.cloudfront.net
127.0.0.1 gads.pubmatic.com
127.0.0.1 ads-west-colo.adsymptotic.com
127.0.0.1 geo3.ggpht.com
127.0.0.1 showads33000.pubmatic.com

127.0.0.1 spclient.wg.spotify.com

  • Save your hosts file and restart your desktop spotify client
You should now be able to listen to all the music you want without every hearing another advertisment.


[ Why This Works ]

To understand how this works we first need to understand the role DNS plays in our operating system.  When we are communicating with other services on the web everything is referenced by IP address.  For instance, when I tell my browser to go to google.com, it has to know where to find google.com.  This is where DNS comes into play.  DNS short for Domain Name Servers is a service that translates human readable, easy to remember domain names into IP addresses that other machines can communicate with.  Whenever you add an entry to your local hosts file you are overriding the DNS entry locally for whatever domain you enter.  For instance, if I add the line "127.0.0.1 test.local" to my hosts file, whenever i type "test.local/" into my browser, it will see the entry in my hosts file and use the IP 127.0.0.1(locahost) rather than reaching out to a DNS server to try and resolve that address.  Where this comes into play for us is overriding Spotify ad servers.  When we add an entry for each server that hosts ads for Spotify and points them to our local machine, we are ensuring that whenever Spotify reaches out for an add it hits our local machine instead of the real ad server and gets an error. WhenSpotifyy detects this error it stops trying to attempt to run the ad and the ad is skipped.


[ Wrap Up ]

Hopefully after reading this you have a better understanding of how DNS works, how to override it and how to never have to listen to another spotify ad again.  As always I love feedback so leave a comment down below if you have anything you would like to add.