DIY Aquarium Controller - Measuring Temperature with DS18B20 Probe

Поделиться
HTML-код
  • Опубликовано: 1 авг 2024
  • Go check out Yohan M and show him some support!
    • Diy light Build |:| PA...
    ReefBuilders Article on Cerebra 2
    reefbuilders.com/2017/10/19/c...
    ====================================================
    Amazon Affiliate Store Links*:
    ====================================================
    DS18B20 Temperature Probe (5-pack)
    www.amazon.com/gp/product/B00...
    10k Ohm Resistors (100-pack)
    www.amazon.com/Projects-100EP...
    * We are a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for us to earn fees by linking to Amazon.com and affiliated sites.
    #=====================================================
    #Source code:
    #(Based on Adafruits DS18B20 tutorial)
    #cdn-learn.adafruit.com/downlo...
    #=====================================================
    import os
    import glob
    import time
    os.system('modprobe w1-gpio')
    os.system('modprobe w1-therm')
    base_dir = '/sys/bus/w1/devices/'
    device_folder = glob.glob(base_dir + '28*')[0]
    device_file = device_folder + '/w1_slave'
    def read_temp_raw():
    f = open(device_file, 'r')
    lines = f.readlines()
    f.close()
    return lines
    def read_temp(scale):
    lines = read_temp_raw()
    while lines[0].strip()[-3:] != 'YES':
    time.sleep(0.2)
    lines = read_temp_raw()
    equals_pos = lines[1].find('t=')
    if equals_pos != -1:
    temp_string = lines[1][equals_pos+2:]
    temp_c = float(temp_string) / 1000.0
    temp_f = temp_c * 9.0 / 5.0 + 32.0
    if scale == "F":
    return "{:.1f}".format(temp_f)
    if scale =="C":
    return "{:.1f}".format(temp_c)
    else:
    return temp_c, temp_f
    while True:
    print(read_temp(""))
    time.sleep(1)
  • ЖивотныеЖивотные

Комментарии • 45

  • @Blacksmith-Joe
    @Blacksmith-Joe 6 лет назад +2

    Just ordered my raspberry pi 3. Great series on the aquarium controller, keep them coming please.

    • @ReefSpy
      @ReefSpy  6 лет назад

      I plan to get back to this as soon as I finish up a few other projects. Good luck with your project!

  • @quartermilereefer8752
    @quartermilereefer8752 6 лет назад +1

    now that's a clever DIY love the way it's coming along I'm requesting a new video of your beautiful reef tank I want to see how much it's grown out

    • @ReefSpy
      @ReefSpy  6 лет назад

      rob sool Aquatics you got it man. thanks for watching

  • @scottsparks5231
    @scottsparks5231 6 лет назад

    you must be a very intelligent guy, this is awesome work sir

    • @ReefSpy
      @ReefSpy  6 лет назад

      Shady Reef haha. Thanks. I am just learning as I go and passing the knowledge along to the next guy.

  • @airtripko
    @airtripko 6 лет назад

    Very nice

  • @julienmagnenot4261
    @julienmagnenot4261 6 лет назад

    Le projet prends forme ! Superbe Idée en tous cas !

  • @Davelembo
    @Davelembo 6 лет назад

    Hey Mark. This is very cool. I'm a bit lost with the code writing but I'm hangin in there.

  • @danielhalat9464
    @danielhalat9464 6 лет назад

    Awesome video. Rearranging a bunch of things in my sump and a temp probe like this was one of my things on my “to do” list. Can you make a video on how to show the readings in a program or maybe a display screen (maybe a tablet?)

  • @jlaustill
    @jlaustill 6 лет назад +1

    I just used a couple of these to put together a fan controller for a root cellar. Basically, if the outside temp < cellar temp and cellar temp > 35ish degrees turn the fan on. I found a library called w1thermsensor that seems to work fantastic and makes getting data from these super easy. I may even PR back some improvements over time. If you wanna see my project it is on github under jlaustill/pmac :) Great video, keep it up!

    • @ReefSpy
      @ReefSpy  6 лет назад

      cool, I'll check it out!

  • @YohanM99
    @YohanM99 6 лет назад

    😂😄😄😀 thank you for the shout out Sencei. Love the reefpi tutorials they help me a lot on my pi build.

  • @vernonsaunders7920
    @vernonsaunders7920 6 лет назад

    I love these videos and plan on using your videos as a template for my own build on one of there... I am curious about the App you had in the first video in the series that displayed everything. Could you do a video on that and also how to wire the 8 socket relay together correctly.

    • @ReefSpy
      @ReefSpy  6 лет назад

      I hope to work on this again soon. Other projects took priority for a little while.

    • @vernonsaunders7920
      @vernonsaunders7920 6 лет назад

      I understand, life happens. I was just wanting to make a request for content of a future video and let you know I appreciate your time and effort going into this.

  • @kellyvb9881
    @kellyvb9881 5 лет назад

    how did you know where to get all that stuff you used to set up for the probe? Would like to learn where you got that stuff.

  • @ju_p9011
    @ju_p9011 4 года назад

    Does anyone know if the wire shield is safe if in the aquarium water and if it will leech any chemicals? Should I coat them with aquarium safe silicone just to be sure?

  • @devonreef5351
    @devonreef5351 6 лет назад

    I’m building my own controller with Arduino and really enjoying this. Are you going to be doing more videos?

    • @ReefSpy
      @ReefSpy  6 лет назад

      That's the plan, I need to get focused and start working on this again! lol

  • @hadimiqbal
    @hadimiqbal 3 года назад

    How many sensors can you connect? and how?

  • @jacklee5020
    @jacklee5020 6 лет назад +2

    Hi! This has worked a treat with my system.
    But what i was wondering, how did you create youre gui? I've used Tkinter and it looks alot more basic than yours. Maybe you could do a how to regards to a gui?
    But thanks!! Keep up the great work!! 🐠

    • @ReefSpy
      @ReefSpy  6 лет назад

      Hi Jack, I am so glad you found this helpful! Yes, I did use Tkinter. The toolset is kind of basic, but i was able to do what i needed so far. Sorry i haven't done another update on this yet, was busy on some other projects but plan to get back on this soon. I'll see what i can do with regards to Gui....

    • @jacklee5020
      @jacklee5020 6 лет назад

      +ReefSpy I look forward to what you do next! I would also be very interested in how you have coded your light cycle

  • @xyclops23
    @xyclops23 3 года назад

    I am getting beloe error after one reading. Please help
    (28.375, 83.075)
    Traceback (most recent call last):
    File "temp_probe.py", line 37, in
    print(read_temp(""))
    File "temp_probe.py", line 21, in read_temp
    while lines[0].strip()[-3:] != 'YES':
    IndexError: list index out of range

  • @estebanmourellebermudez57
    @estebanmourellebermudez57 3 года назад

    I know this is 3 years old but I’m thinking of using the shelly1 to do this , what do you think

    • @ReefSpy
      @ReefSpy  3 года назад

      I don’t have any experience with that, but sounds like a great project!

  • @davidecapasso4928
    @davidecapasso4928 5 лет назад

    Hey, I would love to get some help from you
    I would like to make my first aquarium and I had the idea to monitor the aquarium using raspberry pi. While I was surfing the internet, I found your channel and I really enjoy your videos.
    Can I add temperature module or any module when all the fishes are inside the aquarium?
    Because I would like to build my "monitor setup" step by step
    Have a great day!

    • @ReefSpy
      @ReefSpy  5 лет назад +1

      Thanks for watching. Sure, you can build this in pieces and add things like temperature monitor right away. Where I would be careful is things that have direct effect on aquarium environment like temperature control, you want to make sure it is working flawlessly before adding somewhere with fish. If you get it wrong you could cook them!

    • @davidecapasso4928
      @davidecapasso4928 5 лет назад

      @@ReefSpy Thanks for your time!

  • @StephenOlner
    @StephenOlner 6 лет назад

    Have you thought about using event handerlers rather than the loops ?

    • @ReefSpy
      @ReefSpy  6 лет назад +1

      Stephen Olner yes, that is a good point. This was just an example to show how to get data from the probe. In my main project I will do things differently.

    • @ReefSpy
      @ReefSpy  6 лет назад

      P.S. any help you can offer on how to do that would be welcomed. I am still just learning 🤓

    • @StephenOlner
      @StephenOlner 6 лет назад

      ruclips.net/video/qHLHcFwXH8o/видео.html

    • @StephenOlner
      @StephenOlner 6 лет назад

      You might want to look at PubNub for your logging. its an IOT data logging service. ideal for aquarium controllers. www.pubnub.com/

  • @ManicLalo
    @ManicLalo 6 лет назад

    What are you hooking up the temp sensor to?

    • @ReefSpy
      @ReefSpy  6 лет назад

      fishtank

    • @ManicLalo
      @ManicLalo 6 лет назад

      It looks like you have something between the sensor and the pi

    • @ReefSpy
      @ReefSpy  6 лет назад

      Manic Lalo are you talking about the breadboard?

    • @ManicLalo
      @ManicLalo 6 лет назад

      Is that what that is? I know you said that you could add three more. It's in the begining of the video

  • @lotus0237
    @lotus0237 5 лет назад

    Traceback (most recent call last):
    File "/home/pi/Documents/sandbox/temp_probe.py", line 9, in
    device_folder = glob.glob(base_dir + '28*') [0]
    IndexError: list index out of range
    >>>

    • @lotus0237
      @lotus0237 5 лет назад

      whats wrong in the line looks the same as the one in the video

    • @ReefSpy
      @ReefSpy  5 лет назад

      what?

    • @ReefSpy
      @ReefSpy  5 лет назад

      I am guessing the Pi is not recognizing the temperature probe you have wired up, so it is not creating the directory in the location you are looking for it. Index out of range at index 0 means your list is empty, The function returned no results.