Esp32 Temperature and Humidity Web Server Using PYTHON & Zerynth IDE

Intro: Esp32 Temperature and Humidity Web Server Using PYTHON & Zerynth IDE

Esp32 is a magnificent micro-controller, It is powerful just like an Arduino but even better!
It has Wifi connectivity, Enabling you to develop IOT projects cheaply and easily.

But Working with Esp devices is frustrating, First it is not stable, Second it is extremely difficult to develop your projects with the official SDK. Third it is a huge headache to find a suitable working library.

What if you could use all of the functionalities of the mico-controller while also code it in PYTHON.
Would it make a difference? of course, Python is powerful, easy to read and extremely easy to write.
Plus you don't have to worry about all of the low level stuff (pointers, registers and configuration files)
Also, You are using Zerynth stable system.
If you are not familiar with Zerynth yet, it is the next BIG THING!

It gives you all of the functionalities of the micro-controller with the easiness of Python and it is Free

Let me introduce to you the Esp32 Temperature and humidity web server written in Python.




Step 1: Step 1 : Hardware Connection

The hts221 Temp and humidty sensor uses I2C connection, You have to connect the sensor to the appropriate pins in the ESp32

Node-MCU Esp32s Hts221 Sensor

3v3 pin --> 3.3v pin

GND pin --> GND pin
IO26 --> SCL pin

IO25 --> SDA pin

Step 2: Step 2 : ESP32 Code

  • Inside the application; Create a new account and vertualize your device.
    Use this guide to help you
    https://docs.zerynth.com/latest/official/core.zer...
  • Now Create a new project from main toolbar ; Project --> New -->Write a name for the project and save it.
  • Find the code Attached
  • Copy the code and Uplink ( upload to the uC)
  • Open serial monitor
  • Copy the Ip-address to your browser and open the web page !

    If you need help with the IDE : https://docs.zerynth.com/latest/index.html

Step 3: Step3 : Code Sample !

You can find the whole project attached!
This wanted to show you how easy it is:

from stm.hts221 import hts221

temp_hum = hts221.HTS221( I2C0,D16) #initiate i2C protocol with the sensor

temp, hum = temp_hum.get_temp_humidity() # get the current temp and humidty using the library !

--------------------------------------------------------------------------------------------------------------------

from espressif.esp32net import esp32wifi as wifi_driver #importing Esp32 Wifi driver

WifiAP_name = "WIFI AP Name"
Wifi_Pass = "Wifi Pass!"

wifi_driver.auto_init()

wifi.link(WifiAP_name,wifi.WIFI_WPA2,Wifi_Pass)
---------------------------------------------------------------------------------------------------------------------

It is that easy to use Zerynth IDE with python.

Share

    Recommendations

    • Audio Contest 2018

      Audio Contest 2018
    • Electronics Tips & Tricks Challenge

      Electronics Tips & Tricks Challenge
    • Optics Contest

      Optics Contest

    Discussions

    0
    None

    Welcome to Instructables. Thanks for sharing with the community.