In this project I decided to install a temperature & humidity sensor in my car. I was having a problem throughout winter, not knowing if my car’s windscreen was frozen. So I used an ESP8266 hard-wired into my fuse box using a 12V-5V regulator, to detect my windscreens temperature and humidity. I then sent the data to ThingSpeak, an IoT analytics platform, to send a webhook to IFTTT, which then alerts me on my phone via their app.
This project involved the following skills and techniques;
- Car Electrical Circuits
- Battery Management
- IoT Analytics
Presentation of Final Product
This is the result of around 30 hours of work. Its a simple wifi enabled arduino board with a basic temperature & humidity sensor. I’ve placed it in my car to detect when my car is likely to have a frozen windscreen. It will then send my phone a notification and that will let me know before I leave the house that I may need to spend 5-10 mins defrosting my car.
Why This Project
This might seem like a trivial issue but I’m a lastminute.com person and I like to leave the house last minute. It would be really helpful for me to know before hand that I need to add an extra 5-10 mins to my journey time. My car gets a lot of moisture build up from within, especially if I have the whole family in the car whilst the engines off. It’s also cold in the North of England. Letting me know before I leave the house early in the morning or late at night, that the windscreen is frozen would be a big help for me.
How It Works
The whole thing is just 3 simple components
- Main Module ESP8266-12E
- DHT11 Temperature & Humidity Sensor
- 12V to 5V DC to DC converter
The Wifi Module will turn on, look for the strongest wifi signal it can find from the ones I’ve given it. Then once connected, it will send the temperature in celcius and humidity in percentage to the cloud. Once the data is sent, the wifi module goes to sleep for 15 minutes. Thereafter it wakes itself up and repeats.
Whilst the wifi module is asleep: Each record of data will be checked against the rules I’ve set for it. So if the temperature is below 5 degrees Celsius or the humidity is above 70%, it will send a http request to an App on my phone which will notify me via an alert that either the temperature is too low or the humidity is too high. Also The cloud service I’m using graphs all the data and stores it. I can access all this data via the app on my phone and I also have a widget on the second page of my phone that I can easily swipe to when getting ready to check the temp or humidity.
Side note: if you follow my instructions in this video you’ll be done in 2 hours. It just takes me long since I was winging it the whole way and have no idea what I’m actually doing. For example I spent 8 hours trying to to extend my home wifi out to my car using a Raspberry Pi and then ended up just using a wifi extender. 😂
Initially I intended to just use a power bank and charge it once a month. I then checked the power draw and was literally minimal. In deep sleep mode its like 20uA and when running for the 5 seconds it runs, its 80mA max. Running off a power bank would be fine.
I wanted to have a solution that was set it and forget it so I ordered this 12V to 5V dc to dc converter with a fuse adapter from Amazon. Attached that to my fuzes in my car. Just prodded each fuse with a multimeter to see which was live whilst the car was off. Then use that to power the board.
This 12v to 5v DC to DC converter actually has a built-in voltage protection whereby it will cut out once the voltage is less than 11.6v. therefore I can leave the sensor plugged in forever and not worry about getting a dead battery.
Using The Data
The data from the sensor is sent to a cloud service called Thingspeak.com
ThingSpeak is an open-source Internet of Things (IoT) free service. It uses APIs retrieve data from things using the HTTP and MQTT protocol over the Internet.
This application saves all the data from the microcontroller sends it and stores it in graphs. The graphs can be viewed from the browser, mobile apps and even widgets on my home screen. Now before getting ready it’s a simple swipe to the left and I can see both stats right there.
Thingspeak is brilliant. It also allows you to set rules on incoming data that when certain conditions occur, then it will activate an http request or even send a tweet out.
I’ve got mine set up such that when the temperature is below 5 degrees celscius it will send a http request to IFTT.
IFTTT is a well known website where you can program responses to events that occur. So e.g. I use it to turn off my wifi when I leave my house.
This will then send an alert to my phone. If you want to do this yourself, check out the description. I followed two tutorials. The first to set up the temperature sensor and microcontroller, although the code in that tutorial didn’t work so I’ve linked to this code which did work for me. The next tutorial is to set up the connection between thingspeak.com and IFTTT.
Links are in the description for these.
Deep Sleep NodeMCU: https://randomnerdtutorials.com/esp8266-deep-sleep-with-arduino-ide/
As well as the less than 5 degrees temperature alert. I also have a greater than 70% humidity alert.
You can set it such that each time the condition is met it will alert you or just simply alert you once and then it will automatically reset once the condition is no longer true. So in my case when the temperature rises above 5 degrees or when the humidity drops below 70%.
Storage Location In Car
The next challenge was storing the sensor in the car. I needed it close to the windscreen and also kinda in the open such that it would get a decent WiFi signal. Thankfully I previously installed this android tablet in my car and I had to mount my GPS in a similar position so I just put the my microcontroller and sensor next to it.
I actually bought the wifi module and the temp sensor as part of a weather station kit that came with a pressure sensor and alight sensor. £12 on Banggood.
I’m considering adding the light sensor such that when the esp8266 wakes up, it check if theres loads of light, if so, then it goes back to sleep and doesn’t bother taking a reading. That way it only reads the data during the night time. Its very rare that my screen freezes over during the day.
I’m also quite interested in data collection and handling data. I like to know what’s going on so would be cool to add some more sensors. I have an idea to have a raspberry pi in the car and have it connected to my OBD2 port. The idea would be for it to track things like 0-60 times. I’d love to have it basically be able to check car performance. Perhaps I would integrate this temp and humidity sensor with that. Add a tyre pressure sensor and maybe have a whole car monitoring setup.
Anyways I hope you enjoyed the video, I’ll see you in the next one.