Tag: pi

  • DHT22 is logging

    DHT22 is logging

    For my indoor garden I wanted to monitor the temperature inside and outside the tent. It is in the basement, which I don’t think ever gets above 70 or below 50, but to control the plant’s cycles I need to control light and temp. The light came with an App so I just needed to get temp data into my database. Here is the code I’m using at the moment. I’d also like to log outside temperature data, but I haven’t figured that out yet. I’m think there has got to be an API for the NWS that I can put in a zip code and get the temp and humidity. Here is the code, and some notes.

    We need to get some libraries and connect to the sensors.

    I have two functions. One to get the data from the sensors, and one to insert the data into the database.

    sensors
    insert data

    Where the magic happens

    and some cleanup

    So I calculated the space needed by putting 10 readings in the db, and if the average holds(which it should only go down) I will use about 840 MB a year to get a reading every minute, which I don’t really think I would need, so I’ll probably lower it to once an hour maybe later.

    1638 average row size, in bytes(i think)

    so 1.6kb a reading.

    60 minutes * 24 hours * 1.6kb = 2,304kb a day

    2.3MB * 365 = 839.5MB a year

  • Raspberry Pi 5

    I finally got a Pi after hearing my cousin talk about it a few times over the past few days. I so far am amazed at the performance to price ratio. Below are benchmark results for it and the thecweb.com server(which is quite old really). For ~$125 it is a steal.

    Benchmarkthcweb.compi5
    CPU
    events per second
    1062.192730.24
    Memory
    MiB/sec
    6025.36 3649.76
    File IO read
    MiB/sec
    19.109.46
    File IO write
    MiB/sec
    12.736.31

    So, the pi5 appears to be much faster than the Intel Core i5-4570T running thecweb.com. But, not surprisingly the pi5 can’t compete with the memory and file io.

    Since it has 8 GB of RAM and CPU to spare, I installed all the recommended software when I copied the OS to the SD card. It comes with some lightweight window manager I don’t recognize and a few useful tools for updating the Pi and what not. Debian based to nothing new for me there. I moved the webcam over to it from thecweb.com and installed Motion. It seems to work fine.

    So far I really haven’t had much fun setting it up. Too easy. But, I’m sure I’ll be tearing my hair out once I get to the electrical side of things. It has been over 20 years since my time a Devry. And I was a real shitty student.