Missing Libraries in Weather Station Sketch

I’m trying to run a weather station program using an ESP8266 board with a BME280 and a OLED display. The sketch I was provided loads SFE_BME180.h, WeatherStationFonts.h and WeatherStationImages.h, but I can’t find those files in any libraries when I search.

I’ve attached a copy of the sketch, with a .txt extension, so it’s easy to read.

I would really appreciate any help I could get finding these files.

Thanks,

Bill

WeatherStationDemo2.txt (12.4 KB)

nashville_bill:
The sketch I was provided loads SFE_BME180.h

Look more closely. It's SFE_BMP180.h

nashville_bill:
I can't find those files in any libraries when I search.

That's really strange. When I do a Google search for those file names I see Arduino libraries that contain them. Please try again.

In a perfect world, the author of the sketch you found would be considerate enough to provide links to the library dependencies in the documentation. I strongly recommend that you look around at wherever you found that sketch to see if they did this. If not, you just have to resort to your Google skills. The tricky thing is that there will often be multiple Arduino libraries or versions of Arduino libraries that contain these files and there's no guarantee that the one you pick randomly is compatible with your code. Well, you just have to work your way through it.

It was a typo on the SFE_BMP180.h.

There were libraries that were part of the instructions, but none of them contain any of the three .h files.

Using Google, I did find libraries that contained these files, but no files to download. Maybe I need to copy the text for these libraries and make text files using them? I don't know if they will work, but at least they would get me past the "#include" part of the sketch.

Thanks,

Bill

But then, what do I do for a .cpp file to go with the .h file? I don't see any WeatherStationFonts.cpp, WeatherStationImages.cpp, or SFE_BMP180.cpp files on Google.

I'll guide you through the process of installing the library that contains SFE_BMP180.h and then you can see if you can apply the same process to the other library.

In your Google search, a highly ranged result should have been this page:

So let's say you had decided you wanted to install that library to see if it was the one your code was written for. The majority of Arduino libraries are hosted on GitHub, so the process of installing this library can be used to install many other libraries.

The first step is to go to the home page of the repository. At the top of the page, you can see some links: "LowPowerLab/SFE_BMP180". The first link is the user name of the person who owns the repository. If you click on that, you will go to their GitHub profile page, which is no what you want. The second link: "SFE_BMP180" is the name of the repository. If you click on this link, it takes you to the home page of the SFE_BMP180 repository, which is what you want. In this case, the Google link happened to already point to the home page of the repository so this step was unnecessary, but in other cases you'll end up with a link to a subpage of the repository and the following instructions only work from the home page.

GitHub repositories contain the up-to-date development work on the project. As a regular user (rather than a developer or beta tester), you will generally want to use a release version of the library, rather than the beta version, since the beta version is not as well tested as the release version. You'll see a bar on the repository home page that says something like this:

6 Commits 1 Branch 0 Releases 2 Contributors

The "0 Releases" link will take you to the releases page of the repository, which has links to download the .zip file of the library for each release. In this particular repository, the "0" part indicates the repository owner never bothered to make a release, so you're stuck using the beta version of the library. The beta version is downloaded like this:

  • Click the "Clone or Download" button.
  • From the menu that opens, click the "Download ZIP" button.
  • Wait for the download to finish.

Now you have a .zip file that contains the contents of the repository in your download folder. It's time to install the library:

  • (In the Arduino IDE) Sketch > Include Library > Add ZIP Library
  • Select the downloaded file.
  • Click the "Open" button.
  • Wait for the teal bar on the Arduino IDE above the black console window to show the message "Library added to your libraries. Check "Include Library" Menu.

In some cases, the library installation will fail and it will instead say "Specified folder/zip file does not contain a valid library". Assuming the repository actually does contain an Arduino library, the problem is usually that the .zip file does not have the correct folder structure for installing from a .zip file. The Arduino IDE requires that the library folder is located directly under the root of the .zip file, not in a subfolder of the .zip file. In the case where the library author put the library in a subfolder of the repository, you can install it like this:

  • Unzip the downloaded file.
  • (In the Arduino IDE) Sketch > Include Library > Add ZIP Library
  • Select the folder that contains the library.
  • Click the "Open" button.
  • Wait for the teal bar on the Arduino IDE above the black console window to show the message "Library added to your libraries. Check "Include Library" Menu.

As you can see, despite the menu name, Add ZIP Library can install libraries from folders as well as from .zip files.

Congratulations, you have now installed the library! More importantly, you now understand how to install any Arduino library you find on GitHub, which is an essential skill for every Arduino user.

Pert,

Thank you so much for taking the time to explain the process and explain what is happening!

Obviously, I picked the wrong project to start my Arduino career with.

Bill

You're welcome. I'm glad if I was able to be of assistance.

This is a fairly common thing to need to deal with to use Arduino code you find on the Internet. It's unfortunate if the author of the code doesn't bother to take a few seconds to provide links to where you can download the library dependencies, but you'll find that happens all too often. Other than that, the library installation skills you gain will be useful to you again and again so that it time well spent.