Anvil Uplink Rasberry Pi Temp and Humdity Readings

So in my ball python app I was wanting to track in the admin panel my temperatures in my snake room and my rat breeding room so I setup a pi with a DHT11 sensor and thus this below was born, if anyone wants specifics let me know and I can maybe do a complete write up on it.

I basically have a anvil uplink running on the pi with python code that calls a function to check the readings on the pi sensor connected to the temp/humidity sensor. Each time the page loads or I’ll put a refresh button is pressed it would call the function and get the values.

I’m also going to write these hourly to a db so I can track temperatures and such in my rooms over time.

2 Likes

I’ll be switching to a DHT22 Tuesday cause they are way more accurate just a FYI in case someone does this

So using the anvil client code I’m able to take these readings and on a hourly schedule the pi updates a table in anvil and then I can do this :slight_smile: among some other cool stuff

1 Like

That is very cool. Well done.

This is extremely cool!

Are you planning to distribute these gadgets to your customers? If so, you might be interested in the Client Uplink - it lets you distribute uplink code without giving it privileged access to your data tables. (It’s an uplink with the same privilege level as your in-browser code. You can even do things like authenticating with anvil.users.login_with_email()!)

Yea I was going to play with that next and use the client uplink to do that. I had planned on once this is all done selling preconfigured pi’s with the sensors already configured and a UI that just loads up or something that they can plug in their username/pw to the app and boom they get the same info.

I have some tests atm with hourly temps and humidity being written to a table and then using that to populate tables with some charts eventually, I’m actually using the client uplink here to just send the readings up to the table. I didn’t know you could do the auth though, that was the missing piece for me so now I know what I need to do :slight_smile:

2 Likes