Episode 17: Writing MQTT data to an SQLite database

Поділитися
Вставка
  • Опубліковано 28 січ 2025

КОМЕНТАРІ • 42

  • @davegregory4545
    @davegregory4545 4 роки тому +8

    Great video. If you're running a headerless Pi and/or you don't have apache2 installed yet, you just need to run these commands instead of restarting the service:
    sudo apt-get install apache2
    sudo systemctl enable apache2
    sudo apt install php libapache2-mod-php
    sudo apt-get install php-sqlite3
    sudo systemctl start apache2

    • @ChilliChump2
      @ChilliChump2  4 роки тому +1

      Hi Dave Apache is installed by default with the Raspberry pi installation we did earlier in the series. So it should be there.

    • @davegregory4545
      @davegregory4545 4 роки тому +1

      @@ChilliChump2 ah I'm using the headerless version of raspbian on a Pi Zero - must be one of the packages they don't include. I'll edit my comment for people who don't have it. Cheers!

    • @ChilliChump2
      @ChilliChump2  4 роки тому +1

      Its good to have regardless, if people are following along and not using the rPi image....they can still install apache.

    • @stretchn-on1132
      @stretchn-on1132 4 роки тому +1

      Note: after installing Apache2 redo the following steps otherwise phpLiteAdmin will not run properly.
      sudo apt install php-mbstring
      sudo systemctl stop apache2
      sudo systemctl start apache2
      @Dave, thanks for your missing apache2 guide

    • @ChilliChump2
      @ChilliChump2  4 роки тому +3

      I have modified the accompanying text document to include the install of Apache in case it isn't already on the users device.

  • @BalticHomesteaders
    @BalticHomesteaders 2 роки тому +2

    Having found your other channel last night I've worked my way through your tech videos today. Finally, I have a better idea of how a Pi and the boards and sensors work together, thank you, and to have it in context of gardening is a bonus! I'm proficient with SQL so seeing how that works with node red (which looks like a real nice piece of kit) is great. I'm still not entirely sure how many ESP32s I need to run the various things I want to do but that will come in time. I also need to get my head around powering everything. Am thinking small solar chargers (as most will be away from any mains outlets) but anyway that's for another day. Having had this idea in my head for a year or so finally I can see clearly how it will work. Very excited about the potential for captured data analysis particularly with weather records and water usage. Thanks for all the hard work you've put into these videos.

  • @eken74
    @eken74 3 роки тому

    Tack!

  • @bgable7707
    @bgable7707 3 роки тому

    AWESOME, This is the simplest, most clear, straight forward intro/setuo of SQLite that I've seen. And, I've watch to many to remember. I'll be setting this up today! Sweet.

  • @tenapier
    @tenapier 4 роки тому

    The rabbit hole deepens with excellent teaching on meshing database in with automation software. And learning more about computer command line code. This is an absolutely excellent resource for learning automation and IOT! Thanks so much Shaun!

  • @bremfrey
    @bremfrey 4 роки тому

    Great series, thank you so much!! I implemented this running PiOS Lite (Kernel 5.4) which required me to install Apache2 separately. The comments below were quite helpful for me to get it sorted, and now it is working great. I am really looking forward to the next episode!! Keep up the great work!

  • @zachchenoweth6622
    @zachchenoweth6622 4 роки тому +1

    Wonderful. SQL I do know and was just waiting on a way to make the data more useful. Very timely and well crafted video as always. Thanks man.

  • @linaso9739
    @linaso9739 4 роки тому +2

    Great info! Will add sqlite to my raspberry.

  • @younsyour5099
    @younsyour5099 3 роки тому

    You are great man and great teacher

  • @stretchn-on1132
    @stretchn-on1132 4 роки тому

    Great Stuff!!! Another efficient quick kick-off tutorial with the bare necessary essentials to get started. Now l've got homework to digest & implement it on my system. With humble thanks.

  • @dave-in-nj9393
    @dave-in-nj9393 2 роки тому

    Your format for this tutorial is about as good as they come. well done.
    I am using an old PC, not an RPi, Ubuntu, so this tutorial has been really good.
    I got all the way to the web page. the first one came up perfect, Apache2 Ubuntu Default Page.
    once I added /database/phpliteadmin.php
    I got a very long text based page not sure what programming language...... sigh.... not sure what I did wrong.
    had to check each program for errors. getting closer each time.
    I am getting up to the errors saving data.... the fact that I am even seeing the error is a huge stride forward !

  • @TheNCGardener
    @TheNCGardener 3 роки тому

    Have you thought about adding OTA? I would like to see how that is incorporated into the rest of the code. I am making an 16 ch relay board using an ESP32 and want it to control my 9 zone drip system. It will also monitor the temp, humidity, and hopefully soil moisture. Using the MQTT protocol and will also integrate with home assistant and node red. This will be in an outside enclosure out in the garden. OTA sure would be nice! Really enjoying this series of videos.

    • @ChilliChump2
      @ChilliChump2  3 роки тому +1

      Hi there. I'm glad you are enjoying the videos. This particular series is aimed at absolute beginners so have kept it as simple as possible for people that have never even tried coding before. Once this series is done, there will be more of the advanced stuff that I will share. With regards to OTA...I have done some work with it. Still trying to figure out how I feel about it with the projects I am working on.

  • @joshua023156
    @joshua023156 4 роки тому

    Thanks for the vid chilichamp!

  • @graham-kirby
    @graham-kirby 4 роки тому +1

    Have you considered using a time series database such as InfluxDB instead or do you think SQL offers something that these databases do not provide?

    • @ChilliChump2
      @ChilliChump2  4 роки тому +1

      I use other tech for my main prod system. For this series I had to use a stack that is easy for complete beginners to get a start with. And SQLite provided a good basis to learn about databases.

  • @Wazzzzzzeeeeeep
    @Wazzzzzzeeeeeep 4 роки тому +1

    Hey yo thx for helping us all but I wanted to ask if you tested the sql code now because it seems that it doesn't populate my database the code is identical just changed the device and sensor name in sql code. Do you have any ideas?

    • @ChilliChump2
      @ChilliChump2  4 роки тому

      Yes the code is tested. Can you share your DB schema, and the actual SQL code you are using please?

    • @Wazzzzzzeeeeeep
      @Wazzzzzzeeeeeep 4 роки тому

      @@ChilliChump2 do you have an email that I can send you the details?

    • @ChilliChump2
      @ChilliChump2  4 роки тому

      www.chillichump.com/contact

    • @Wazzzzzzeeeeeep
      @Wazzzzzzeeeeeep 4 роки тому

      @@ChilliChump2 sent you the layout and everything in .png form

  • @Wojas23033
    @Wojas23033 3 роки тому

    5:45 it only shows me code from the file in browser

    • @Wojas23033
      @Wojas23033 3 роки тому +2

      Nvm. Had to install php and reboot raspberry

  • @Wazzzzzzeeeeeep
    @Wazzzzzzeeeeeep 4 роки тому

    I have another question how are you using your variables in the mqtt callback function do you convert the floodinterval to string or something like that to use in your program for functions?

    • @ChilliChump2
      @ChilliChump2  4 роки тому +2

      I am converting the variables. I will be sharing the client side code in the next video. It will be coming out in the next two weeks while I have some time off from work.

  • @ShortBusTrip
    @ShortBusTrip 4 роки тому

    Can’t wait for you to compete this. Any idea for when the next part is out? Also you talked about the LCD display. Would love to see that hooked up. I know SQL can be a rabbit hole tho

    • @ChilliChump2
      @ChilliChump2  4 роки тому +2

      Episode 18 is out now. There will be maybe 2 more episode in this specific series. And then I will be freed up to put some more interesting bits up to help you folks out!

    • @ShortBusTrip
      @ShortBusTrip 4 роки тому

      @@ChilliChump2 Awesome thanks. You pepper vids have inspired me. I've also always been a tech junkie so see you do this has also inspired me to look deeper into self programming automation. You're awesome bud, keep it up.

  • @kimrosvol6205
    @kimrosvol6205 6 місяців тому

    my phpliteadmin page dont load. I get a http error 500. I have restartet apache and my pi.

  • @eken74
    @eken74 3 роки тому +1

    If I want to take the temperature in the garage, how do I add an esp32 with 1 thermometer as client.
    Thanks for the super interesting youtube school.
    Very educational, even think I should try!

    • @ChilliChump2
      @ChilliChump2  2 роки тому

      Hi there, have a look at some of my other episodes, the earlier ones should help you with doing exactly what you need. If you get stuck, get in touch through my website! chillichump.com/contact

  • @colinbruijnen9975
    @colinbruijnen9975 4 роки тому

    Still love the series Shaun! Installed everything in my greenhouse, waiting for spring to arrive. When will be the next episode?

    • @ChilliChump2
      @ChilliChump2  4 роки тому +1

      Hi Colin...don't worry, I haven't forgotten this series. There have been a few things going personally that has limited my time over the last few months. I will be releasing the next episode as soon as I can make enough time to do it right.

  • @grossethomas2256
    @grossethomas2256 3 роки тому

    Hi.
    I have an issue when deploying in node red, the debugger print "Error SQLITE_READONLY: attempt to write a read only database".
    I'm on pi and don't really master linux commands.
    But i tried chmod and with ou without sudo when creating the table.
    If you have an idea of what it could be, I will be glad to know !
    Thank you (and sorry for my approximate english ^^)

    • @ChilliChump2
      @ChilliChump2  3 роки тому

      Hi there. Have a look at the text document I linked in the description and follow the instructions regarding setting permissions. This will fix your issue.

  • @yjawhar
    @yjawhar Рік тому

    This SQL statement is susceptible to SQL injections. Since it's a private, automated data, it's fine, but otherwise the statement should be sanitized