The other thing that the HESA measures right now is the number of times that current was detected on the input pin, i.e., the pin was set HIGH. The HESA looks for power on the input pin for about one second. During that second, it takes 1,000 readings. The pin must be set HIGH for 500 readings in a row for the HESA to determine that there is water in the basement. There is a variable that keeps a running total of how many individual readings were HIGH in the past hour. That number is written to the database.
Each individual measurement is written as a separate row in the database. This way, I don't have to add a new column for every new thing I want to measure. I could measure the temperature in every room in my house and record a new row for each room. This is modeled after the SAP plant maintenance measuring point functionality. Each device or room I want to take measurements for would have a record in a table. Each thing I want to measure on each device or room would have a record in another table. The measurements themselves that are recorded are related to one of the measuring points. This should work out well.

Finally, I made a PHP web page to display the most recent results. It reads the last 48 readings from the database and displays them in a table. It's not really very impressive at this point (well, maybe it never would be). In the future, I would like to add more sensors to the HESA to measure temperature, humidity, CO2, radon, etc. Then, the readings might be a bit more interesting.
In other HESA news, I was getting a lot of false positives where it detected water when there was none. I think that was because I was using an electrical cable from a lamp. The ends of the cable were together but covered in insulation. They should not have passed electricity between them but apparantly, they were. Now, I separated the ends of the cable and attached them to opposite sides of a four inch PVC pipe. I have not had any false positives since I made that change.
No comments:
Post a Comment