Products > Embedded Computing

Arduino question: unstable signal

<< < (6/6)

75.8F = 10.72K ohms
60.1F = 14.76K ohms

Apart from those quaint F units looks very like my thermister above... Resistance increases as it gets colder... NTC... and around 10k at 25C

It must be a power supply issue.  Try powering the Arduino from a seperate 9V wall wart.  Use my sketch above with your Arduino away from the rest with just 10k fixed resistor and the thermister as a voltage divider between 5V and GND... then report back.  I think I used A0 on an UNO clone.

I see you have start to think about timing...

current = millis();

Just be aware that millis() being 1000th of a second... is not continuous... it wraps... and your code should handle that.

Don't feel guilty about asking simple questions; it's that type we have a chance of answering... the tricky ones we leave to the experts.  :-DD


It worked! Thank you a million times!

There are a couple more tweaks needed: The code provides two states. I would need a third one for a long transition from off to the first cool down. The cooler is so well insulated that I may not need it though. It may be able to function well with only short ons, long offs, gradually getting cool enough and able to hold it when off.

The other thing is that there is some on/off behavior between full off and full on. It's so regular, it looks like a blink program. Too many number changes take place on the way to getting inside a window of solidly on or solidly off. I plugged in a three second delay in order to get a good look at the numbers. And I had to change the code settings from 500/520 to 768/762.

The behavior is as follows:

>768: solidly off
<768 and > 762: blink program
<=762: solidly on

I didn't concern myself with actual cooler temps as I'm confident that moving the numbers up and down will take care of that. The fantastic thing is that the program actually works AND, I get to use the thermistors that I had completely given up on! The only problem with them is noise from the power supply I ordered. The testing tonight was with my bench supply that produces no noise. But that's another issue all together.

I'm a happy man if I can get the blinking to go away. Then, all I'll need is some means of killing the noise from my power supply.

Is there some way to put averaging in the program? I'm almost afraid to touch it. But I will though. Gotta try. I'll just keep a copy of this one. Or you can send an updated code if you would be so kind.

The blinking will be because your thresholds and or conditions are the wrong way around. (or your thresholds are too close relative to noise)
Now welcome to the interesting part....
In compressor fridges there are a number of trade offs so for example many start stops is a bad thing so parameters like minimum off time or max continuous on time can be considered. Also ice builds up on the cooling elements so at some points they stop cooling and let the ice melt perhaps by using a heating element (and typically lie to the user about their temperature).

Have a Google for the instruction manual for an elliwell controller to get an idea for the sort of parameters.


Averaging isn't your problem. Averaging might allow you to eliminate some Gaussian wobble but it won't help if you have droopy signals because the ADC reference is moving.  You could consider using a better reference, possibly an internal AVR one or fix your power supply to the controller.  I have seen this with a design of a circuit that drove multiple servos and the designer was stumped that the circuit behaved badly when the motors ran leading to brownouts, confusion and general mayhem.


--- Quote from: billbyrd1945 on March 25, 2019, 01:15:17 am ---Is there some way to put averaging in the program?
--- End quote ---

It's very easy to test some averaging, just replace the the single analogRead() with 4 summed and then divided by 4, you can put it into a loop later. I think averaging will help even if it's supply noise. If your ADC value's noise is only +/- 3 counts that's not terribly bad.

value = analogRead(sensorPin);
value += analogRead(sensorPin);
value += analogRead(sensorPin);
value += analogRead(sensorPin);
value = value/4;

When dealing with thresholds, it is better to go with min/max rather than average.  Measure the min and max for N measurements, then set your on/off thresholds based on those values


[0] Message Index

[*] Previous page

There was an error while thanking
Go to full version