visit
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:
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.
timestamp := records[i][3][:len(records[i][3])-4]
seconds, err := strconv.Atoi(string(timestamp[len(timestamp)-2:]))
if err != nil {
log.Printf("Error: %v", err)
}
if seconds >= 30 {
timestamp = timestamp[:len(timestamp)-2] + "30"
} else {
timestamp = timestamp[:len(timestamp)-2] + "00"
}
ourValue, err := strconv.ParseFloat(records[i][1], 64)
func FirstInsert(db *sql.DB, timestamp string, value float64) (bool, error) {
insertReadingSql := `INSERT INTO Reading (TimeStamp, CarTemperature) VALUES (?,?)`
statement, err := db.Prepare(insertReadingSql)
if err != nil {
log.Println("Failed to prepare SQL Statement")
return false, err
}
_, err = statement.Exec(timestamp, value)
if err != nil {
log.Println("Failed to insert data")
log.Printf("Timestamp: %v \n Value: %v \n", timestamp, value)
return false, err
}
return true, nil
}
func InsertData(db *sql.DB, columnname string, timestamp string, value float64) (bool, error) {
updateReadingSql := `UPDATE Reading SET ` + columnname + ` =? WHERE TimeStamp = ?`
statement, err := db.Prepare(updateReadingSql)
if err != nil {
log.Println("Failed to prepare SQL Statement")
return false, err
}
_, err = statement.Exec(value, timestamp)
if err != nil {
log.Println("Failed to insert data")
return false, err
}
return true, nil
}
Maximum temperature outside:
Maximum temperature in the car:
The temperature reached its hottest point at 2021-06-29 00:34:30 so, June 29th at 5:34 PM.
The outside temperature peaked at 119.84 and the temperature inside the car was 159.08. Incredible.
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 170.78 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.
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:At a certain point, it even appears the car was cooler than the outside temperature.
At midnight the car was a mere two degrees hotter than the outside temperature.
At 5 am it was four degrees cooler in the car.
A couple of hours later it was eight degrees hotter than outside.
Near the peak of the day, it was 50 degrees hotter in the car. Incredible.
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.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 wasn’t 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.
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.And be sure to I’ve done working on this data.Questions? Reach out to me in the gzht888.comments!