Grafana Weather Dashboard on a Raspberry Pi using InfluxDB and an ESP32 - In-Depth Tutorial

Ғылым және технология

Following one of my previous projects where I built a weather station dashboard on the reTerminal, I had quite a few requests to do a more in-depth tutorial on how to get each part set up and running. So in this tutorial, I’m going to be going through each part of the process, step-by-step, so that you can get a similar setup running on your Raspberry Pi.
ADDITIONAL INFORMATION
---------------------------------------------------
Visit my blog for the full written tutorial - www.the-diy-life.com/grafana-...
PURCHASE LINKS
---------------------------------------------------
Raspberry Pi 4b (A Pi 3b/Pi 400/CM4 can also be used) - amzn.to/3dYeVqg
Power Supply - amzn.to/3EhPts8
ESP32 Microcontroller - amzn.to/3obvOV7
MicroUSB Cable - amzn.to/32oxy54
Grove Sensor's From Beginner Kit - amzn.to/31my42U
Breadboard - amzn.to/3lnrqAB
Breadboard Jumpers - amzn.to/3xFop3f
Equipment Used
Portable Monitor (Shown at the end) - amzn.to/3n4Lk3X
Some of the above parts are affiliate links. By purchasing products through the above links, you’ll be supporting this channel, with no additional cost to you.
CHAPTERS
---------------------------------------------------
0:00 Intro
0:55 Setting Up The ESP32 & Sensors
2:45 Sending Our Sensor Data To InfluxDB
6:35 Creating Our InfluxDB Database
11:06 Installing Grafana On Our Raspberry Pi
14:45 Creating Our Weather Dashboard
18:01 Resizing The Dashboard For Fullscreen Mode
18:35 Final Thoughts
If you've got any ideas for Raspberry Pi, Arduino, or other Electronics projects or tutorials you'd like to see, let me know in the comments section.
#influxdb #raspberrypi #grafana #esp32

Пікірлер: 85

  • @TheRoeckie
    @TheRoeckie2 жыл бұрын

    Exactly what I'm looking for. I'm going to put a bunch of sensors inside and outside my greenhouse to see how environmental parameters influence the growth. Great explanation!

  • @MichaelKlements

    @MichaelKlements

    2 жыл бұрын

    That's great! Try using BME280 sensors, they accurate and each does temperature, pressure and humidity all in one.

  • @BillEason

    @BillEason

    Жыл бұрын

    @@MichaelKlements In my experience with BME280 over the past 6-7 years, I find that the part has 1-2 degrees (F) of self-heating. If you're looking for reliable temperature sensing, I'd go with something else, but the barometric pressure sensing is amazing. It's able to detect changes in elevation of under 1/2 meter just based on the air pressure. Hard to believe, but true. To test the self-heating, (1) compare temp readings vs. other parts, like the SHT30 or (2) set it up to display temperature at short intervals -- like a couple of seconds apart. When you first power on the device, the temperature reading will be fairly accurate, but just watch it climb a degree or two within the first minute or so that it's turned on, then stabilize. Obviously, you'll have to turn it off and let it reach ambient temperature before doing that second test.

  • @jacocoetzee762
    @jacocoetzee7622 жыл бұрын

    Fantastic! I’m using the nano 33 sense with the esp32. Been looking exactly for this tutorial. Thanks so much!

  • @MichaelKlements

    @MichaelKlements

    2 жыл бұрын

    That's great!

  • @alvarogascon9161
    @alvarogascon91612 жыл бұрын

    great video! Just what I was looking for!

  • @PoisonWaffle3
    @PoisonWaffle32 жыл бұрын

    Nifty! I've used similar hardware for a similar project, but used a completely different software approach. I've got a Pi hosting Home Assistant + ESPHome, InfluxDB, and Grafana (both HA add-ons), and it all runs locally. It's pretty straightforward to take the temperature/humidity from DHT22s connected to ESP8266 or ESP32 boards and display it in Grafana. I also have various other temperature sensors for my ecobee thermostat and inside my SmartThings buttons that I can pipe right into Grafana as well. I followed a few different guides on KZread for the general concept, but did a few things a bit differently.

  • @MichaelKlements

    @MichaelKlements

    2 жыл бұрын

    That's awesome, sounds like you've got a pretty neat setup running!

  • @georgeboydratcliff1036
    @georgeboydratcliff10368 ай бұрын

    Absolutely brilliant! Thank you!

  • @gensys244
    @gensys2442 жыл бұрын

    Amazing beyond interesting 🧐 great job very much enjoy your projects !

  • @MichaelKlements

    @MichaelKlements

    2 жыл бұрын

    Thank you!

  • @mohammedrezk8072
    @mohammedrezk80722 ай бұрын

    Very useful and straight forward many thanks

  • @GeekendZone
    @GeekendZone3 ай бұрын

    Thanks it works, I make some modifications and used it with a BME280 sensor.

  • @extremeroom7u7
    @extremeroom7u72 жыл бұрын

    i really likes your videos the are very informative

  • @muhammadrizkhi8428
    @muhammadrizkhi84282 ай бұрын

    Wow greate video!! Thanks for tutor

  • @nielsnelson3570
    @nielsnelson3570 Жыл бұрын

    Hey thank you for this tutorial it was very helpful. I want to ask if it is possible to show me how you added the measurements into fields in Influxdb?

  • @DavRH
    @DavRH9 ай бұрын

    Very nice!

  • @KawaiRonin
    @KawaiRonin Жыл бұрын

    Great work here man! I also noticed for ease of use, maybe include the libraries. I used a different set of sensors and libraries.

  • @MichaelKlements

    @MichaelKlements

    Жыл бұрын

    Thanks for the suggestion and feedback!

  • @legion9826
    @legion98262 ай бұрын

    Hi, thnks for whare it. How did you transfer the grafana dashboard to the tablet? simple browser or what?

  • @TexanMechanicus
    @TexanMechanicus17 күн бұрын

    I have followed your tutorial all the way through and it was very well explained. I am running into one issue and it is that I can not get grafana to display the temperature in Fahrenheit. Is there something I'm missing?

  • @gregruthenium
    @gregruthenium Жыл бұрын

    Hi. Can this be used with ESp8266? Also, can you direct to which library you used for MultiWifi.h

  • @radish6691
    @radish66912 жыл бұрын

    Nice! What is the little screen shown at the beginning, the one with the F1, F2, and F3 buttons?

  • @MichaelKlements

    @MichaelKlements

    2 жыл бұрын

    It's called a reTerminal by Seeed studios. It's a full Raspberry Pi based touch panel, it's got an embedded CM4 module.

  • @FSISThakurAshish
    @FSISThakurAshish Жыл бұрын

    Pls make a separate video for grafana with prothemus using esp32,since no tutorial are available on KZread 🙏

  • @abhijithnscs1364
    @abhijithnscs136410 ай бұрын

    Can i use multiple esp32 as input

  • @zuwei8490
    @zuwei84902 жыл бұрын

    谢谢. Thank you

  • @kulaniscap
    @kulaniscapАй бұрын

    10/10🙂

  • @noeliafernanda1061
    @noeliafernanda1061 Жыл бұрын

    Good project 👍 But, one question: Where do I configure so that the panel updates in real time or refresh the screen automatically??? 🤔

  • @MichaelKlements

    @MichaelKlements

    Жыл бұрын

    In your dashboard settings there is an option to refresh the dashboard in a set time period

  • @kayezero703
    @kayezero7032 жыл бұрын

    Nice

  • @dukara702
    @dukara702Ай бұрын

    Great video! Can I use a raspberry pi rather than ESP32 to collect sensor data following this tutorial?

  • @MichaelKlements

    @MichaelKlements

    Ай бұрын

    Yes you could log the data to InfluxDB using the Pi directly.

  • @laszlobanyik2175
    @laszlobanyik2175 Жыл бұрын

    Hi, it's a great and resourceful video. When I am trying to search for Arduino Client Library nothing comes up. Only Python Client library. Could you please help me out if you know the answer?

  • @doncucumber

    @doncucumber

    Жыл бұрын

    Same problem here! Is it now only in the paid plans, maybe?

  • @DamianMyszko

    @DamianMyszko

    Жыл бұрын

    Okay, I had same problem, but found a solution. Pick different library and change ending of URL adres. If you picked python, the ending should look like this ..../new-user-setup/python. Now just change "python" to "Arduino" and you'll see a page for arduino setup. I have no idea why it's hidden but it works.

  • @SmithyScotland
    @SmithyScotland2 жыл бұрын

    When using graphana the most important thing to remember is to click the save button. Nothing auto saves. Very easy to throw away hours work. I speak from bitter experience. Also to say the dht11 is incredibly unreliable and inaccurate. Best to use an i2c sensor or at a push a dht22.

  • @MichaelKlements

    @MichaelKlements

    2 жыл бұрын

    Yeah I probably should have mentioned this a few more times, I have also lost a few hours work on Grafana because I didn't save and simply closed the browser. I agree, the DHT11 sensor is quite poor, but it was just one that I had lying around for this tutorial. My weather station uses a BMP280 sensor.

  • @YuxiangChi

    @YuxiangChi

    2 жыл бұрын

    agree, also their 'newer' python library is very unreliable. Do you have any i2c sensor recommended?

  • @MichaelKlements

    @MichaelKlements

    2 жыл бұрын

    The BME280 and BMP280 sensors often have I2C interfaces (all of Adafruits ones do).

  • @bigpickles

    @bigpickles

    2 жыл бұрын

    @@MichaelKlements The BME280 is the best choice out of all the above mentioned. Excellent little sensor and it's cheap!

  • @nicklaspersson4687
    @nicklaspersson46872 жыл бұрын

    Great video and update to PI as a data collector. However in my experience the sensor DHT22 does not seem to survive below 0 dgr C. It will work for a few months and then crash your system. See others who also have had similar problems with it used outdoors, also it does have very low accuracy for humidity. Imho. its not worth the trouble.

  • @MichaelKlements

    @MichaelKlements

    2 жыл бұрын

    Thanks Nicklas! Yeah the sensors I've used here are just for the tutorial, they're not particularly accurate or reliable. I use BME280 sensors in my weather station and air quality monitoring setups.

  • @laidbackobs
    @laidbackobs2 жыл бұрын

    Great video! Quick question. If I want to view the Grafana dashboard from any website instead of on my localhost how can I do that?

  • @MichaelKlements

    @MichaelKlements

    2 жыл бұрын

    Do you mean embed the dashboard on another site? Or just access it remotely?

  • @raphaelf.martins7455

    @raphaelf.martins7455

    2 жыл бұрын

    @@MichaelKlements He asked a good question. Please, I would also like to know how to remotely access Graphana dashboards through a website too, which I can access from anywhere. And thank you for ur detailed tutorial, it's all what I needed.

  • @Armand79th

    @Armand79th

    Жыл бұрын

    The well-documented method would be to configure a reverse proxy.

  • @vishnudpillai
    @vishnudpillai2 жыл бұрын

    so to store data, do we need a cloud provider's support like aws or azure? can we store data in influxDB? or can we setup only with esp32+influxDB+grafana?

  • @MichaelKlements

    @MichaelKlements

    2 жыл бұрын

    Both influxDB and Grafana have local or cloud options, so you can decide whether you want the data to be stored locally or in the cloud. You don't need to use aws or azure as well.

  • @vishnudpillai

    @vishnudpillai

    2 жыл бұрын

    @@MichaelKlements so which is more cost efficient for a new entrepreneur? using influXDB+grafana or aws_iot _core+aws_timestream+grafana ? which is best to scale the devices in future?

  • @FSISThakurAshish
    @FSISThakurAshish Жыл бұрын

    How can we do it with Prometheus pls help??pls

  • @scrody33
    @scrody332 жыл бұрын

    I am trying to figure out how to use grafana on my ras pi locally with no internet connection. Any one know how to do that ?

  • @FSISThakurAshish
    @FSISThakurAshish Жыл бұрын

    Confused 🤔 Can we see our database on computer 💻 after configuring it with the esp as you shown?

  • @MichaelKlements

    @MichaelKlements

    Жыл бұрын

    Yes, by going to the Grafana web dashboard on any computer on your local network

  • @thewatchmaker.
    @thewatchmaker.11 ай бұрын

    Isn't it possible to make influxdb/grafana take MY timestamp (e.g. a field named "timestamp") instead of what it creates itself when data is added to the database? Since I am collecting sensor data for about 10 minutes every 3 seconds and I need to send this data every 10 minutes to reduce the impact of Wi-Fi on the battery. Thanks!

  • @MichaelKlements

    @MichaelKlements

    10 ай бұрын

    I don't see why you couldn't create a new field for your own timestamp just like any other data field. The issue you'll probably run into is that most standard visualisation tools are designs around their time series and a data field so you'd have to modify these to be across two fields rather.

  • @MrCentrax
    @MrCentrax4 ай бұрын

    Excelent tutorial. Just one question. Why did you chose InfluxDB instead of Prometheus?

  • @MichaelKlements

    @MichaelKlements

    4 ай бұрын

    InfluxDB is a better choice for time series logging, like weather metrics changing with time.

  • @laszlobanyik2175
    @laszlobanyik2175 Жыл бұрын

    Pls, help would be greatly appreciated. I don't understand, I created an account just like on the video, but I do not have the same dashboard and I do not have Arduino Client Library. The question is that something to do with my OS environment? Do I need to install something on the windows machine?

  • @sussyimposter6994

    @sussyimposter6994

    Жыл бұрын

    I have the same problem.... Have you got a solution yet?

  • @DamianMyszko

    @DamianMyszko

    Жыл бұрын

    Okay, I had same problem, but found a solution. Pick different library and change ending of URL adres. If you picked python, the ending should look like this ..../new-user-setup/python. Now just change "python" to "Arduino" and you'll see a page for arduino setup. I have no idea why it's hidden but it works.

  • @FSISThakurAshish
    @FSISThakurAshish Жыл бұрын

    Pls bro make a another short video for grafana with prothemus for air quality monitor no one else has made it ,so it will be of great use to many others like me since prothemus is very popular and effective 🙏🙏🙏🤝

  • @kelgar1
    @kelgar12 жыл бұрын

    Hi, great tutorial, could you do a video with the BME280? Would be great to have these outside (in an appropriate case) and then multiple sensors indoors in each room, then feed all of that to the dashboard 👍🏼

  • @MichaelKlements

    @MichaelKlements

    2 жыл бұрын

    Thank you! My weather station project uses a BME280 sensor, so you could combine the two to get what you're after. All the code on the InfluxDB and Grafana side is the same regardless of what sensor is used.

  • @kelgar1

    @kelgar1

    2 жыл бұрын

    @@MichaelKlements okay thanks for the reply

  • @Armand79th
    @Armand79th Жыл бұрын

    You're immediately correct... I don't know what "dah-ta" is. pLeAsE eXpLaIn. 😅

  • @8m405
    @8m4057 сағат бұрын

    Can graphana show it on Alexa echo show devices

  • @MichaelKlements

    @MichaelKlements

    5 сағат бұрын

    You can display a web page through the built in browser Silk, this would allow you to display a Grafana dashboard

  • @generalknowledge9555
    @generalknowledge95552 жыл бұрын

    ESP 32 with used to connect water flow sensor. This sensor value is stored in the InfluxDB database. while the below-shown Arduino code is removed we can get the correct accurate flow rate. But in this code is removed, then data can not be sent to the InfluxDB database. (water flow sensor is connected with an interrupt pin). if (!client.writePoint(sensor)) { Serial.print("InfluxDB write failed: "); Serial.println(client.getLastErrorMessage()); } Please give me the correct solution as soon as possible. It will be a big help for me.

  • @MichaelKlements

    @MichaelKlements

    2 жыл бұрын

    Have a look at my code that I've used for this example, you should be able to use the parts of the code that write to the database to get yours to work. The above is only a small portion of your code, there could be a number of issues in other areas.

  • @srikumarc
    @srikumarc Жыл бұрын

    Can I use nodemcu instead of esp32?

  • @MichaelKlements

    @MichaelKlements

    Жыл бұрын

    Yes you can use any microcontroller with WiFi

  • @srikumarc

    @srikumarc

    Жыл бұрын

    Thanks Micheal for your excellent guide. Exactly what I was looking for. Great resource indeed.

  • @srikumarc

    @srikumarc

    Жыл бұрын

    Micheal, I am trying to implement your code as it is but am running into errors. One specific error is "assert failed:XqueGenericSend queue.c820 (pxQueue). There are other lines in the serial monitor too.

  • @srikumarc

    @srikumarc

    Жыл бұрын

    Micheal, disregard my earlier comment. I could resolve the issue. Everthing works ! perfect ! Thanks a lot for the video

  • @srikumarc

    @srikumarc

    Жыл бұрын

    Michael, can you modify this video to include Mosquitto & Nodered (on the web) so that the data from ESP32 is passed through Nodered to InfluxDB using Mosquitto? . This will be wonderful because all elements of the stack will be on the web.

  • @Juliodonadello
    @Juliodonadello2 жыл бұрын

    can you share the code?

  • @MichaelKlements

    @MichaelKlements

    2 жыл бұрын

    The code for the ESP32 is available on my blog post, linked in the video description

  • @bewingbewing
    @bewingbewing2 жыл бұрын

    Thanks for this. I'm a little unclear about where you install influx. You're apparently working on a Windows machine at install time (06:38), but toward the end of the video (14:26), it seems to be co-located with Grafana on the Raspberry Pi. I'd rather it all be in the Pi, not cluttering up my PC. BTW, I'm trying to set up a CO2 sensor to establish the effectivity of my Covid-inspired ventilation system, using an AirGradient setup. It works great but just displaying a value isn't enough; I need to see the effect, over time, of people in the room (or not) with and without ventilation.

  • @MichaelKlements

    @MichaelKlements

    2 жыл бұрын

    I run through the two options for each near the beginning, I'm not installing Influx locally, I'm using their cloud server in this tutorial. Yes, I use both a Windows PC and Raspberry Pi - I don't like working with Arduino programming on a Raspberry Pi so I do this from the Windows PC. It sounds like this sort of data logging setup would be perfect for what you're trying to achieve!

  • @EvgeniX.
    @EvgeniX. Жыл бұрын

    8:13 is it me, or somebody just pwned his soundcard 4 a moment 🤔

  • @kishore3466
    @kishore34662 жыл бұрын

    How much ram need

  • @MichaelKlements

    @MichaelKlements

    2 жыл бұрын

    You can run this on a 2GB variant quite easily.

  • @RonWolfHowl

    @RonWolfHowl

    Жыл бұрын

    @@MichaelKlements Thank

  • @The_Unobtainium
    @The_Unobtainium Жыл бұрын

    cloud based services SucK!

Келесі