An rocked the Pacific Northwest in June. Oregon turned into an oven. This gave me yet another reason to break out a Raspberry Pi and collect some data. I sent it to because it remains one of the greatest places to send and look at IoT data. unprecedented heat wave Adafruit During the first day, I placed a Raspberry Pi under my deck to collect and send temperature and humidity data. I wanted to get ambient air temperature as accurately as possible. I placed the Raspberry Pi (Zero) under the deck so it wouldn’t be in direct sunlight. It’s in shade 24/7. The breeze is blocked by joists. Then my son had an incredible idea: Let's put a sensor in a car to see how hot it gets inside the cabin. Great! So I set up a 2nd Raspberry Pi for that purpose. I put it in the center console of our Ford Focus. I didn’t want that one in direct sunlight either. The car itself was in direct sunlight the entire time. I parked it in an area where it didn’t receive shade. I cracked open each window about 2 inches: And then measured the results over a few days. In this article, I’ll show you how we built this setup, and the data I found. Step 1: Setting up the Raspberry Pis To gather and send this data, I used two Raspberry Pis set up identically. Under the Deck (Outside Temperature) Raspberry Pi Zero W AM2302 Temperature and Humidity Sensor Raspberry Pi OS Python Script using Adafruit DHT Circuit Library Inside the car Raspberry Pi 3 AM2302 Temperature and Humidity Sensor Raspberry Pi OS Python Script using Adafruit DHT Circuit Library I wired up the sensors like so: They were both set up if you’d like to try it yourself. with these instructions I even when I set up the Pi in the car if you want to see it in action. did a live stream Step 2: Gathering the Data I sent the data to Adafruit and let it collect data for a few days. Adafruit gave me some nice real-time graphs to look at: This was great for realtime data. Setting this is up is very easy, again I cover and set up a dashboard. how to send data to Adafruit While the dashboards are neat, I wanted to take the entire data set and look at it. The dashboards only show a 24-hour window, but Adafruit collects the data and you can export it to JSON or CSV. So I exported the data for the few days into CSV files. I could browse through them and spot-check things but I wanted to merge all the data. I decided to drop them into an SQLite database to do that. Step 3: Processing the Data I had a couple of issues right off the bat when dropping these into a database. I have four separate feeds of information: Outside temperature Outside humidity Car temperature Car Humidity I had to consolidate them into a single database. Which created another issue: The samples were all taken at slightly different times. The sensors took samples every thirty seconds. The two Raspberry Pis were not synchronized, and there was some clock drift. Since the timestamps showed that sensors never took temperatures at the exact same time, I would have to sacrifice some precision. I tackled this problem live on my Twitch stream. I decided to round off the seconds and use that timestamp as an index for the values. timestamp := records[i][ ][: (records[i][ ]) ] seconds, err := strconv.Atoi( (timestamp[ (timestamp) :])) err != { log.Printf( , err) } seconds >= { timestamp = timestamp[: (timestamp) ] + } { timestamp = timestamp[: (timestamp) ] + } ourValue, err := strconv.ParseFloat(records[i][ ], ) 3 len 3 -4 string len -2 if nil "Error: %v" if 30 len -2 "30" else len -2 "00" 1 64 I wrote a Go program live on stream that did the following: Read in CSV files (one per data stream) Stored them in Sqlite First, I took in it. That way I knew we would have the most overlapping values. Some data streams were longer, but they wouldn’t have values in the smaller streams. So this was the starting point. the CSV with the fewest records I read in that file and created a table with the timestamp and the value included. The timestamp would be our index. { insertReadingSql := statement, err := db.Prepare(insertReadingSql) err != { log.Println( ) , err } _, err = statement.Exec(timestamp, value) err != { log.Println( ) log.Printf( , timestamp, value) , err } , } func FirstInsert (db *sql.DB, timestamp , value ) string float64 ( , error) bool `INSERT INTO Reading (TimeStamp, CarTemperature) VALUES (?,?)` if nil "Failed to prepare SQL Statement" return false if nil "Failed to insert data" "Timestamp: %v \n Value: %v \n" return false return true nil Then for the subsequent feeds, I read in each of those CSVs and inserted values to the corresponding timestamps: { updateReadingSql := + columnname + statement, err := db.Prepare(updateReadingSql) err != { log.Println( ) , err } _, err = statement.Exec(value, timestamp) err != { log.Println( ) , err } , } func InsertData (db *sql.DB, columnname , timestamp , value ) string string float64 ( , error) bool `UPDATE Reading SET ` ` =? WHERE TimeStamp = ?` if nil "Failed to prepare SQL Statement" return false if nil "Failed to insert data" return false return true nil And in the end, I had a nice SQLite database with the values I needed. You can download . all this data and the application to process it here So How Hot Did it Get?? Now, I can dive into the data and try to get a good handle on how hot it got outside and how hot it was in the car. Maximum temperature outside: Maximum temperature in the car: Wow. So that was a bit unexpected. And of course, I’d like to match things up a little to see the inverse of each. The temperature reached its hottest point at so, June 29th at 5:34 PM. 2021-06-29 00:34:30 The outside temperature peaked at and the temperature inside the car was . Incredible. 119.84 159.08 So what about the peak car temperature? Unfortunately, the outside temperature sensor failed to read during this time, but it was about an hour later and reached degrees. This is with windows cracked open. While this was during 100+ temperatures this is something to consider when you see a child or pet in a car on a hot day. 170.78 There are some other things we can look at with this data. Let’s see the relationship between the two temperatures. Here’s a nice graph of the car temperature vs outside temperature: It’s interesting how late at night when things “cooled down” to around 80 degrees, the two temperatures almost equalize. Yet if we zoom in deeper we can visually see how the heat builds in the car: At a certain point, it even appears the car was than the outside temperature. cooler At midnight the car was a mere than the outside temperature. two degrees hotter At 5 am it was in the car. four degrees cooler A couple of hours later it was than outside. eight degrees hotter Near the peak of the day, it was in the car. Incredible. 50 degrees hotter You can see the peaks and valleys in the graphs. I’ll be doing even more with this data in the future. Very curious about how it ramped up and I want to look into it more. Conclusion So I’ve always been against leaving children and pets in your car on a hot day. Most of us are. But it’s interesting to see exactly how hot it gets inside a car. This is absolute justification for calling the police when you see it. . End rant This data is unique in that we were measuring during 110+ degree days, but you can still see the effects of the car. The only time the car hotter than the outside is when the sun wasn’t on it. So we can deduce the sun shining through windows (they are not tinted on this car) affects the inside temperature. If it were an 80-degree sunny day, I imagine the inside still capable of being 120 degrees or more. wasn’t Lesson: We all know cars sitting in the sun get hotter, now we can see exactly how much hotter. I wanted to share this data, how I put it together and what the results were. I hope you’ve enjoyed it. You can download and process it yourself. The timestamps are UTC and I am in the PST region so keep that in mind. I’m curious to see what others might do with this data. this data And be sure to I’ve done working on this data. check out some of the live streams Questions? Reach out to me in the Hackernoon comments!