From the dawn of mankind...
...driven by curiosity and aspiration...
...men urged for a device...
...to log air pressure?...
...using a microcontroller?
WHAT THE..?!
I'M OUTTA HERE!
Hey wait...
...okay.
Today we will create a simple temperature,
pressure and altitude logger.
This device should be really easy
to build. So, hang on!
We will use three component blocks:
The main driver is the WeMos microcontroller
It's based on the esp8266, which has
built-in Wi-Fi capabilities.
You can get one delivered for under $3.
The pressure sensor is available as this shield
It provides precise temperature and air
pressure measurements.
The output will be done on this OLED shield.
To have enough juice while logging we will power it from this power bank.
You can find the links to the parts in the description.
The only soldering needed is to attach
the pin headers.
Anyone can do this!
The altitude is calculated from the air
pressure.
This is rather an approximation:
The higher the altitude, the lower the
air pressure.
The current altitude is estimated from 
1000hPa at sea level
and the current measured pressure.
This is dependent on the weather.
It will overestimate the altitude at bad weather
and underestimate it at good weather.
But more on this when we build a weather station.
For the software part of the microcontroller
we will be using the arduino IDE this time.
You can download my sketch from github.
The link is in the description.
The most of the work is done by some libraries.
First of all you need to add the esp8266 support, 
if you haven't yet.
Check out my other tutorials for this.
Then, we need also the following libraries:
Adafruit MQTT, Sparkfun micro
OLED, Adafruit BMP085
Install all of them and you are good to go.
There are some settings to make in the code.
First of all, we need some access point
credentials.
Since we will be logging the values using MQTT
we have to set up the MQTT server here.
I am using Adafruit IO.
You have to enter your username and
your secret API key here.
If you want to change the feed names you can do this here.
This delay defines at which rate values will be sent to the MQTT server.
Ok, you can also switch to Imperial values
but please don't crash another space probe.
My code will calculate the average values from each time span.
The Sparkfun OLED library seems to be the only one,
which supports the OLED screen
with 48 pixel rows without any code changes.
Let's flash it!
To log the values outdoors I'm using my smart phone as an access point.
On Android this can be done using a mobile hotspot.
I'm using the same credentials as the ones from my lab so I don't need to reconfigure it.
But you could also add additional access
points in the code like this.
Let's test it!
Okay you can clearly see a pressure
difference here,
but that's not good enough.
Okay, I think we arrived at the
place where to test it.
And this is what it shows.
The altitude in the mountains
was off by around 5%.
The logging works also nice.
I can see a nice graph on Adafruit IO.
The only thing missing is the case.
So, let's create one!
Good news!
I'm doing YouTube full-time now.
So that means one video a week!
To celebrate it I will give away three of
those here on YouTube
and two additional on my Patreon page.
You can get additional content there
and also get your name displayed in my videos like these supporters here.
To get one of these here simply write a comment containing the hashtag #giveaway and pick a color.
You also need to be a subscriber.
If you have missed this giveaway simply subscribe to get a chance next time.
See you next week, bye!
