July 4

Weather Station Project: ESP32 with LoRa Telemetry

Heltec ESP32 with LoRa radio

Monsoon season is rapidly approaching. Last year my neighbors were heavily affected by the weather when we received over a foot of rainfall in just a few hours. Flooding was well over 8 feet in some low lying areas. For my neighbors down the road, who park under their apartment complex, over 30 vehicles were lost during the storm.

In an effort to help my neighbors, I am working on an early warning storm detection system. Ultimately, I have two separate projects in mind: a weather station and a storm warning sentinel. As alluded to in my previous post on project management, I have split the ultimate goal of the early warning detection system up into the two separate projects. The prerequisite steps learned in the weather station project will enable the storm warning sentinel project.

Today marks an exciting day for The Engineer’s Workshop. Today, I am kicking off a new feature of this blog- a recurring series of projects. Each project will start with a design overview followed by a timeline of the intermediate steps devised to build the project. Subsequent posts for the project will then be dedicated to each intermediate step. Let’s get started on building our weather station!

The first step you should take on any engineering project should be researching the design. Time spent designing your project up front will pay dividends later. When I design an engineering solution, I start off with clearly defining the goal. After that, I define the requirements/criteria. With microcontroller projects such as this, I also explicitly list the inputs and outputs involved so that I don’t forget them in my design. In the case of this weather station project, I came up with the following design overview:

Outdoor Weather Station:

Goal: Create an outdoor weather station to detect ambient weather conditions and transmit to a listening station. The listening station will record the data to a SQL table which will then be made visible via an internet dashboard.


- Weatherproof
- Self-powered
- Wireless radio transmission


1) Temperature
2) Barometric pressure
3) Humidity


- Transmit data to listening station over LoRa radio.
Weather station design document

I am a visual thinker so I also like to sketch out a rough high-level design:

Weather monitoring station transmits to listening station over LoRa which then saves off the information to my Web/SQL server.
Weather monitoring station transmits to listening station over LoRa which then saves off the information to my Web/SQL server.

The design I’ve come up with is that I will have an outdoor weather monitoring station which will transmit (over LoRa) to a listening station I have indoors. The listening station will be connected to a web/SQL server via wifi. Any information it receives from the weather monitoring station, it will turn over to the SQL server for storage.

With the above design for my weather station, the project checkpoints easily reveal themselves:

Project plan for weather station
Project plan for weather station

Breaking down the project, we see the following steps are necessary:

  1. Create a web dashboard to display the data
    • For this, I have chosen to use Django
  2. Interface basic sensors with ESP32 for the Weather Monitoring Station
  3. Interface listening Station with SQL Server to log data
  4. Connect Weather Monitoring Station to Listening Station via LoRa
  5. Polish Django dashboard

Stay tuned! In subsequent posts, we will build out each objective in turn.

June 11

Django Error Silver Bullets

I’ve recently been teaching myself Django. I was working on creating a new web app to handle the backend for some IoT projects I’ve been working on and recently came across two errors. In case anyone else comes across them, I will post the silver bullets below to hopefully save you some time.

1. no such table: main.auth_user__old

This was an unhandled exception that occurred whenever I tried to POST data from the Django admin:

Request Method: POST
Request URL:
Django Version: 2.1.1
Exception Type: OperationalError
Exception Value: no such table: main.auth_user__old
Exception Location: /home/engineer/anaconda3/envs/djangoEnv/lib/python3.5/site-packages/django/db/backends/sqlite3/base.py in execute, line 296
Python Executable: /home/engineer/anaconda3/envs/djangoEnv/bin/python
Python Version: 3.5.6
Python Path: [‘/home/engineer/Projects/WEATHERSTATION/weathersite’, ‘/home/engineer/anaconda3/envs/djangoEnv/lib/python35.zip’, ‘/home/engineer/anaconda3/envs/djangoEnv/lib/python3.5’, ‘/home/engineer/anaconda3/envs/djangoEnv/lib/python3.5/plat-linux’, ‘/home/engineer/anaconda3/envs/djangoEnv/lib/python3.5/lib-dynload’, ‘/home/engineer/anaconda3/envs/djangoEnv/lib/python3.5/site-packages’]

Solution: This problem is described in Issue #21982. It has since been fixed. Since I use Anaconda (“conda”) as my package manager, the simple fix for me was to just update my Django environment to the latest version.

2. ModuleNotFoundError: No module named ‘sqlparse’

I thought I was home free at this point now that I had updated my Django environment to the latest version in conda, but alas that was not the case. This time, I received the following error:

Traceback (most recent call last):
  File "manage.py", line 15, in <module>
  File "/home/engineer/anaconda3/envs/djangoEnvNew/lib/python3.7/site-packages/django/core/management/__init__.py", line 381


File "/home/engineer/anaconda3/envs/djangoEnvNew/lib/python3.7/site-packages/django/db/backends/sqlite3/base.py", line 28,
 in <module>
    from .introspection import DatabaseIntrospection            # isort:skip
  File "/home/engineer/anaconda3/envs/djangoEnvNew/lib/python3.7/site-packages/django/db/backends/sqlite3/introspection.py",
 line 4, in <module>
    import sqlparse
ModuleNotFoundError: No module named 'sqlparse'

Thankfully the error stack is pretty helpful here. The most recent call with the error “ModuleNotFoundError: No module named ‘sqlparse'” is pretty descriptive. To resolve this error, you simply need to install the module with the following command (while in your virtual environment):

conda install sqlparse

That’s it! Hopefully this helps someone else. As always, let me know if you have any questions!