Author Topic: Arduino question: unstable signal  (Read 10331 times)

0 Members and 1 Guest are viewing this topic.

Offline NivagSwerdna

  • Super Contributor
  • ***
  • Posts: 2495
  • Country: gb
Re: Arduino question: unstable signal
« Reply #25 on: March 24, 2019, 09:54:05 pm »
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.

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

current = millis();

Just be aware that millis() being 1000th of a second... is not continuous... https://www.arduino.cc/reference/en/language/functions/time/millis/ it wraps... and your code should handle that.

PPS
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
 
« Last Edit: March 24, 2019, 10:01:58 pm by NivagSwerdna »
 

Offline billbyrd1945Topic starter

  • Regular Contributor
  • *
  • Posts: 203
  • Country: us
Wow!
« Reply #26 on: March 25, 2019, 01:15:17 am »
EUREKA!

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.
 

Offline NivagSwerdna

  • Super Contributor
  • ***
  • Posts: 2495
  • Country: gb
Re: Arduino question: unstable signal
« Reply #27 on: March 25, 2019, 08:46:34 am »
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.

Cheers!

PS
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.
« Last Edit: March 25, 2019, 10:27:41 am by NivagSwerdna »
 

Offline StillTrying

  • Super Contributor
  • ***
  • Posts: 2850
  • Country: se
  • Country: Broken Britain
Re: Arduino question: unstable signal
« Reply #28 on: March 25, 2019, 10:19:26 am »
Is there some way to put averaging in the program?

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);
delay(4);
value += analogRead(sensorPin);
delay(4);
value += analogRead(sensorPin);
delay(4);
value += analogRead(sensorPin);
value = value/4;

« Last Edit: March 25, 2019, 10:28:24 am by StillTrying »
.  That took much longer than I thought it would.
 

Offline TK

  • Super Contributor
  • ***
  • Posts: 1722
  • Country: us
  • I am a Systems Analyst who plays with Electronics
Re: Arduino question: unstable signal
« Reply #29 on: March 25, 2019, 12:33:50 pm »
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
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf