Ice Alarm for car - Page 1
Forum section: electronics / projects

author: pete1111
author_rank: Contributor
timestamp: November 13, 2016, 12:49:22 am
content: Wondering if anyone would be nice enough to look over this schematic for me to see if it will work as expected.want it to turn a blue led on when temperature is 1c or below. And stay off over 1cwould be a useful project for wintermaybe this design could be improved? trying to keep it simple and cost effective

author: Delta
author_rank: Super Contributor
timestamp: November 13, 2016, 12:56:24 am
content: Seems good at first glance. But use a proper comparator (LM319 or such) rather than an opamp...

author: Zero999
author_rank: Super Contributor
timestamp: November 13, 2016, 01:01:39 am
content: Exchange the + & - pins and use the comparator to drive the LED directly, rather than via a transistor.

author: pete1111
author_rank: Contributor
timestamp: November 13, 2016, 01:44:13 am
content: Thank you for reply's everyone! i did consider going arduino but really its too much work for such a simple project.i did try going this route but ran into temperature reading errors due to voltage reference and input voltage not being exact and so on.this project is just to give you a heads up that temperature is at least 1c or below. i know it wont be 100% accurate due to moving at speed and the floor surface.i was recently in a car that had this little feature and thought it be cool if we could come up with something to add to other carsmainly wanted to go all smd parts to keep is very small. this is the original design

author: Len
author_rank: Frequent Contributor
timestamp: November 13, 2016, 03:16:40 am
content: Seems awfully complicated for a LED that just has to turn on in November and turn off in April...

author: Zero999
author_rank: Super Contributor
timestamp: November 13, 2016, 07:33:15 pm
content: Quote from: pete1111 on November 13, 2016, 01:44:13 amSee the simplified version, which drives the LED directly. The 10k resistor in parallel with the LED, ensures it properly turns on/off, rather than remaining dimly lit, due to the current flowing via the 270k resistor. The extra 1k resistor in series with the potentiometer prevents the full battery voltage from being connected directly across the thermistor which could cause it to smoke due to thermal runaway. The thermistor has a negative temperature coefficient, so if it's connected directly to 12V (the potentiometer is ste to its minimum resistance) it will heat a little, the resistance will drop, causing more current to flow and more heating, which could ultimately cause it to burn out.Quote from: Len on November 13, 2016, 03:16:40 amYou've clearly no idea of what the climate in the UK is like. Frost is sporadic from October to May. It may remain above freezing for weeks in the depths of winter or could be frosty in late spring, so a frost indicator on a car is handy.

author: kripton2035
author_rank: Super Contributor
timestamp: November 13, 2016, 07:41:04 pm
content: would be better with a window comparator, i.e. two opamps.because otherwise the led will blink when around 1°you should light it up under 1° and put it off over 2°C or something like that.don't forget also you have to place the thermistor far from the led, somewhere in the right outdoor mirror is okI made one with a pic 16f628, a small 3 digits led display, a 18b20 temp sensor, and a buzzer.good luck in your project.

author: cowana
author_rank: Frequent Contributor
timestamp: November 13, 2016, 07:58:48 pm
content: Quote from: kripton2035 on November 13, 2016, 07:41:04 pmThat's adding hysteresis, rather than making it as a window comparator.A window comparator would turn it on between a range (say between -1°C and 1°C).Adding a small degree of positive feedback via a hysteresis feedback resistor will stop oscillation around the setpoint.

author: Zero999
author_rank: Super Contributor
timestamp: November 13, 2016, 08:04:44 pm
content: Quote from: cowana on November 13, 2016, 07:58:48 pmYes hysteresis will solve the problem with oscillation but you want the temperature set comfortably above freezing. Frost can occur on the ground, when the air temperature is above freezing, due to radiative cooling. A more sensible setting would be on below 4oC and off above 5oC.

author: kripton2035
author_rank: Super Contributor
timestamp: November 13, 2016, 08:07:08 pm
content: actually on most cars where it's integrated, it's below 3° and above 6°Cit's not very important if the display is only a ledit would be very annoying if there is a beeper ...

author: Brutte
author_rank: Frequent Contributor
timestamp: November 13, 2016, 08:47:05 pm
content: Quote from: kripton2035 on November 13, 2016, 08:07:08 pmI think it is better not to have the thingy onboard than to depend on its reliability and miss the freezing point at some cross-road. So either run a self test at each trip and make it impossible to ignore or do not install it at all.

author: pete1111
author_rank: Contributor
timestamp: November 13, 2016, 09:27:35 pm
content: Thanks to everyone's input! i wanted to install a blue led behind my MPH needle so it will light it up at 1c or below. and obviously stay off over 1c. i know this wont be 100% accurate i just wanted something that tells me outside temp is at least 1c so i can be careful when out driving. a BMW Z4 I was recently a passenger in had this feature (along with an annoying buzzer that kept going off every 5 minutes!)i will give this a go on breadboard soon just waiting on the lm311 to be delivered

author: Seekonk
author_rank: Super Contributor
timestamp: November 13, 2016, 10:31:42 pm
content: All those potential setting changes to solder in, that is why I like using a nano for this stuff. Plus a breadboard is included. I've been doing some water heating projects and I have been buying those 12V temp controllers for $3. You can program temp, hyst, time delays, and temp cal. I use them even with a nano just to get the digital readout. Only bad thing is they only come in degrees C. Blame Jimmy Carter I can't figure that out! And they have a relay that can be selected for on or off. Same resistive temp sensor, just feed that voltage into the micro.

author: Zero999
author_rank: Super Contributor
timestamp: November 13, 2016, 11:27:13 pm
content: Quote from: pete1111 on November 13, 2016, 09:27:35 pmIf you're really desperate to try the circuit. It may work with the 741 but don't expect great performance.Another thing, rather than using a potentiometer, why not simply use the correct value resistor to get it to turn on/off around about 4 or 5oC.According to the table on page 29 of the datasheet linked below. The NTC 3470 thermistor will have 2.281 times the rated resistance value at 5oC, which is 22.81k for a 10k resistor, so replacing the pot with a 22k resistor should give a threshold close to 5oC.http://catalogs.avx.com/NTC-Thermistors.pdf

author: pete1111
author_rank: Contributor
timestamp: November 14, 2016, 12:46:17 am
content: Well i just tried this on breadboard and i cannot get to to work at all. even by swapping the 10k pot with a 22k resistor.,, I have the NTC (waterproof) in a cup of ice with a thermometer in there as well to read temperature and at 5c i get no output voltage at all to light the led up.i get no output voltage at all at any temperature. Rather i have a faulty part of im doing something really wrong here.so frustrated i i drew out my breadboard connections to double check

author: CatalinaWOW
author_rank: Super Contributor
timestamp: November 14, 2016, 01:25:18 am
content: I know that you aren't trying for perfection, but detecting ice on the road is much more complex than measuring air temperature. There can be differences of several degrees in both directions between road surface and air temperature, depending on air temperature history, insolation, road temperature history, wind speed and numerous other factors. If you want a general be careful warning I would turn it on when the air temperature is about +4 C and leave it on for all lower temperatures. If you are only interested in the most dangerous form of ice, that which has a film of water, or which can develop a film under the pressure and temperature of a tire you could turn the light back off at something like -4 C, but it hardly seems worth the complexity for the simple goals you can reliably achieve with this sensor.

author: Audioguru
author_rank: Super Contributor
timestamp: November 14, 2016, 02:54:10 am
content: Don't forget that dew (condensation) evaporates and cools the surface to below freezing when the air is 2 or 3 degrees C.

author: DaJMasta
author_rank: Super Contributor
timestamp: November 14, 2016, 06:39:40 am
content: Calibrating it to be ~2-3C instead of 1C is probably going to be more generally useful because of these other factors mentioned, but if the point is to emulate the freeze warning light some cars have, measuring external air temp is probably plenty sufficient (maybe on the underside of the car, to keep the sun off it).Just a thought for a totally different circuit: you could use an infrared thermometer element to measure the road surface directly, which regardless of air temperature would be a much more accurate measure of the potential for ice. Seems like asphalt and concrete have similar emissivities too, so you could set it to be like half a degree measured over a few samples and get a pretty good real time reading of the temperature of the road surface without too much fancy hardware.

author: Fisher77
author_rank: Regular Contributor
timestamp: November 14, 2016, 06:52:56 am
content: Quote from: Len on November 13, 2016, 03:16:40 amThats some funny shit right there.Here in Texas that blue LED would be worn out from turning on and off so much from November to April.

author: Zero999
author_rank: Super Contributor
timestamp: November 14, 2016, 11:05:26 am
content: Quote from: pete1111 on November 14, 2016, 12:46:17 amThat should work.Have you measured the resistance of the thermistor at different temperatures?What are the voltages at pins 2 & 3 relative to 0V?

author: pete1111
author_rank: Contributor
timestamp: November 14, 2016, 05:03:01 pm
content: Quote from: Hero999 on November 14, 2016, 11:05:26 ami using a LM311M DIP-8 DIFFERENTIAL COMPARATOR.im using the SMD Version but i think it has same pin outs as the THROUGH HOLE versiondoes it matter if i use LM311P or the LM311M ?as someone els mentioned i do like the idea of a sensor measuring the temp on the road surface but i think this would be too much of a complicated/expensive project to build.

author: Zero999
author_rank: Super Contributor
timestamp: November 14, 2016, 09:44:06 pm
content: Quote from: pete1111 on November 14, 2016, 05:03:01 pmI know. Measuring the voltage on both inputs will tell you whether the output should be high or low and if there's a problem in the circuit which might cause the common mode range to be exceeded. To turn the LED on, the output of the comparator should be near 0V, so the voltage on pin 3 needs to be higher than pin 2. The voltages on both pin 2 & 3 should be fairly close to half the power supply voltage.If you measure the resistance of the thermistor both at freezing and 25oC, you can calculate the resistor values to use, rather than just guessing.One thing you could try is test the comparator is actually working properly by removing the thermistor and associated resistors and use the potentiometer to check the LED turns off when the voltage on pin 2 is higher than pin 3.QuoteYes, the SMD version has the same pinout as the through hole package. How have you assembled the SMD part on a breadboard? Is it on an adaptor board or have you made your own adaptor board? Check the package is the correct way round and there are no unwanted solder bridges.I haven't read the datasheet (it can be found using a search engine, if you're really interested) to check the difference between the LM311P and LM311M but it's most likely the temperature rating, package material or offset voltage. The circuit should work with either.

author: pete1111
author_rank: Contributor
timestamp: November 16, 2016, 09:40:11 pm
content: So i decided to get the Arduino out and do it that way. i wanted to use Attiny13A as i have loads of them and there really cheap. problem is my code is too big. Apparently some talented people out there can make the code smaller. iv added it here encase there is such a person on here willing to help me out? failing that ill have to use an Attiny85(the code basically turns a led on at round 4C and under (Colder) And led off over 3C)For Arduino UNO-Needs to be converted for Attiny13APasteBin Linkhttp://pastebin.com/8ASEYVAK

author: kripton2035
author_rank: Super Contributor
timestamp: November 16, 2016, 10:21:24 pm
content: http://elabz.com/arduino-shrunk-how-to-use-attiny13-with-arduino-ide/

author: Zero999
author_rank: Super Contributor
timestamp: November 16, 2016, 11:49:51 pm
content: Quote from: pete1111 on November 16, 2016, 09:40:11 pmIf you've decided to go down the MCU route then how about using a digital temperature sensor, which will give more predictable results than a thermistor?

author: pete1111
author_rank: Contributor
timestamp: November 17, 2016, 02:13:48 pm
content: Thanks. i dont think its possible to shrink the code to fit on Attiny13. 2,500 and i have to get it down to round 1000im not skilled in writing code so i guess ill have to jump upto Attiny45 or an Attiny85PasteBin Linkhttp://pastebin.com/8ASEYVAK

author: kripton2035
author_rank: Super Contributor
timestamp: November 17, 2016, 03:13:28 pm
content: you may be able to do it in assembly on a tiny13 (or c) but not with the arduino bootloader, takes too much space.

author: grifftech
author_rank: Frequent Contributor
timestamp: November 17, 2016, 04:14:56 pm
content: Quote from: Fisher77 on November 14, 2016, 06:52:56 amLEDs don't care about being turned on and off

author: pete1111
author_rank: Contributor
timestamp: November 17, 2016, 04:56:33 pm
content: i was thinking on using one of theseeBay auction: #http://www.ebay.co.uk/itm/Digispark-Kickstarter-Micro-General-USB-Development-Board-For-Arduino-ATTINY85-/141673518845?hash=item20fc6656fd:g:SqAAAOSwZd1VXvMdBut i would like to get an Attiny45 and design a pcb board in eagle.i think an Attiny45 should be able to run this code just fine.not sure if i would have to add an external crystal or not.

author: Fungus
author_rank: Super Contributor
timestamp: November 17, 2016, 05:09:11 pm
content: Quote from: pete1111 on November 17, 2016, 04:56:33 pmNo Xtal is needed if you program the chip using an ISP programmer. It's really just the chip on a PCB.(plus power components, eg. regulator+decoupling capacitor)PS: Those Digisparks are a pain in the ass to work with. I had one that required me to unplug it and plug it in again every time I wanted to upload a program. Life's too short for that.I hear there's some with a reset button but that's not really an improvement.The ISP programming interface needs a separate $4 programmer but it's definitely the way to go.

author: Seekonk
author_rank: Super Contributor
timestamp: November 17, 2016, 05:12:41 pm
content: For under $3 this makes a perfect ice detector for those that don't want to reinvent the wheel. Hyst, time delays, offsets to cal and you get a display. I've bought a half dozen of these for projects and they work great.http://www.ebay.com/itm/50-110-C-Digital-Thermostat-Temperature-Control-Switch-DC-12V-Sensor-Module-SC-/291945436946?hash=item43f94dd712:g:3AAAAOSwdzVXod8d

author: pete1111
author_rank: Contributor
timestamp: November 18, 2016, 11:45:13 am
content: well i decided to just stick ATMEGA328P. overkill and a waste buy hey it gets the project doneknow you can buy ready made products that do this but i wanted something very basic that i can pot and just mount inside the car and forget.

author: Zero999
author_rank: Super Contributor
timestamp: November 18, 2016, 06:20:46 pm
content: Quote from: pete1111 on November 18, 2016, 11:45:13 amGood, I'm glad you've found something which works for you but aren't you that little bit curious as to why the other circuit didn't work? It should have worked. All it does is compares two voltages with one another and turns the LED on/off.Now you're using an MCU, how about going for the DS18B20, rather than the thermistor? It's more accurate than a typical thermistor and it outputs binary codes, so there's no need for the analogue to digital conversion which costs more accuracy. If you've already send the PCB for manufacture then you should still be able to use the DS18B20 without modifying the board.http://datasheets.maximintegrated.com/en/ds/DS18B20.pdfwww.hobbytronics.co.uk/ds18b20-arduino

author: pete1111
author_rank: Contributor
timestamp: November 18, 2016, 08:44:17 pm
content: iv already sent it out to Fab house (Osh Park) but i would be interested in using DS18B20 sensor. also looked at the LM36 but just went with thermister in the end for the cost more than anything.Just wanted to ask. the project is powered by 5v when i measure the voltage its 4.94v would the input voltage make a difference to the temperature reading ?the car max voltage is 13v thats knocked down to 5v with the help of a 78M05 and some decoupling caps.

author: Zero999
author_rank: Super Contributor
timestamp: November 18, 2016, 09:07:38 pm
content: If the ADC is referenced to the power supply, then it should make any difference as any changes in voltage on the potential divider due to the +V changing will be cancelled out.

author: mtdoc
author_rank: Super Contributor
timestamp: November 18, 2016, 09:28:52 pm
content: Quote from: Seekonk on November 17, 2016, 05:12:41 pmThanks for the link.I have no desire to reinvent the wheel and this looks like just what I need to set up a temperature alarm for my recently built chicken coop.I may also use one to set up an alarm for the aging freezer in my garage which is full of 250 lbs of meat. I've been worried it could fail and I don't catch it until it's too late.

author: pete1111
author_rank: Contributor
timestamp: November 18, 2016, 09:37:56 pm
content: Quote from: Hero999 on November 18, 2016, 09:07:38 pmhow do i ADC referenced to the power supply ? i have aref and avcc pins connected to 5v power supply. do i have to edit my code ?CODEhttp://pastebin.com/iKRLjb3q

author: Zero999
author_rank: Super Contributor
timestamp: November 18, 2016, 09:49:58 pm
content: I don't have any experience with using that microcontroller. The answer to your question will most likely be on the data sheet.http://www.atmel.com/Images/Atmel-8271-8-bit-AVR-Microcontroller-ATmega48A-48PA-88A-88PA-168A-168PA-328-328P_datasheet_Complete.pdf

author: Seekonk
author_rank: Super Contributor
timestamp: November 20, 2016, 12:21:17 pm
content: It was 3am, only read a few lines and got bored. Obviously I'm from a different universe. I use a 328 to control a freezer closely at 33F measuring forward voltage on a string of diodes and a couple of water heaters with that thermistor. I can tell you that the A/D will bounce around 5 counts and if you don't average, your numbers are crap.