Skip to content

caternuson/ESP8266_BMP180_Server

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ESP8266 BMP180 Server

thumbnail
An Adafruit HUZZAH ESP8266 based server for an Adafruit BMP180 pressure/temperature/altitude sensor.

Hardware

Software

You will need a USB console cable to program the HUZZAH. Follow this guide for information on how to setup the Arduino IDE.

Dependencies

Configure

You will need to create a file called network_config.h that will include information for connecting to your wifi network. It also includes information for setting up the IP address and port configuration for the ESP8266. It should have the following contents.

#define MY_SSID "your_ssid"
#define MY_PASSWORD "your_password"
#define MY_PORT 65050
#define MY_IP_ADDRESS 192, 168, 1, 100
#define MY_IP_GATEWAY 192, 168, 1, 1
#define MY_IP_SUBNET 255, 255, 255, 0

Replace your_ssid and your_password with your wifi network specifics. The remaining values configure the ESP8266 once it is connected. Some nominal values are shown, which should be changed depending on your network setup.

Getting Data

Once the ESP8266 HUZZAH has been programmed, powered, and successfully connected to your network, you should be able to request temperature and pressure from it. A python code snipet below shows how to request the current temperature.

def get_OAT():
    """Get outside air temperature in Fahrenheit."""
    try:
        s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
        s.settimeout(5.0)
        s.connect(('192.168.1.100',65050))
        s.send('GCT')
        data = s.recv(1024)
        s.close()
        temp = float(data)
        return temp
    except (socket.error, ValueError):
        return -999.0
    except:
        return -999.0

About

ESP8266 Based BMP180 Server

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Other 100.0%