In this article, we discuss how to send IoT data from Arduino to Questdb in a few simple steps. So I immediately went to connect an IoT device to QuestDB to see how it went. Unsurprisingly, it went quite well. So here's how it went, from start to finish.
As you can well imagine, I've been super busy in my new job at QuestDB so this has taken me longer than I would have liked, but here we are. If you know me at all, you know that one of the first things I always do with new things is, well, connect things to them! So I immediately went to connect an IoT device to QuestDB to see how it went. Unsurprisingly, it went quite well. So here's how it went, from start to finish.
The first thing I had to do was to get QuestDB up and running. Luckily, this is very straightforward. I guess I could have gone the Docker route, but as you're probably aware, I'm not a huge fan of Docker (in no small part due to the fact that it will literally suck the life out of a macOS laptop). There's also (for you MacOS users)
brew install questdb but since I work here, and I wanted to test out the latest and greatest web console, I decided to build from source:
It builds really quickly due to the lack of external dependencies, so that is great! Then all I have to do is start it:
That is literally all there is to getting QuestDB built and running. But that's just the first part. Now it's time to do something mildly useful with it. First, I'll need to create a table in QuestDB to store my IoT Data (A bit more on this later, so store a pointer to this).
Remember, we're doing SQL here, so there's no new language or syntax to learn. This is a really simple table that I'm building because I'm going to be using an ESP8266 with a (really awful) DHT11 temperature and humidity sensor on it.
For this, I'm going to use an ESP8266-based WEMOS D1 Mini only because I happen to have a giant pile of them lying around. I buy them in bulk because they are a dollar or 2 each, easy to use, and largely disposable if I blow one up (which I do with alarming regularity.). The circuit is extremely simple to do:
I used an actual WEMOS Shield with the DHT11 on it, so I didn't have to breadboard it, but this schematic gives you an idea of how simple the wiring is. It's literally 3 wires.
Here is where the magic happens. How I actually send the sensor data to the database. There is a simple example program included with the Adafruit DHT Unified Sensor Library that I recommend starting with in order to make this a bit easier. It already has all the parts to read from the sensor so you don't have to write those from scratch. Remember: Good developers copy, but great developers paste!
Since I'm using the 8266, and I'll need internet connectivity, I'll need all the WiFi bits:
That ideal world is one where there is widespread support for an open Internet that ensures that publicly available information is equally transmittable from - and accessible to - all people and businesses.
Data Visualization in R with ggplot2: A Beginner Tutorial. Learn to visualize your data using R and ggplot2 in this beginner-friendly tutorial that walks you through building a chart for data analysis.
Get your R programming journey off on the right foot with this RStudio tutorial that walks through everything from installation to best practices.
Learn how to load a data set and clean it using R programming and tidyverse tools in this free beginner-level data analysis tutorial.
The deep learning and knowledge graph technologies have been developing rapidly in recent years. Find out more about graph databases.