[Menu]>[Circuits Gallery]>[Room temperature controller]


Troubleshooting of Room temperature controller

Some troubles occurred in the process of this project. I put these for reference.

Timer interruption operation will stop on the way.

Cause : Because the bank of a memory was not set up by interruption processing.
Measure : The bank was set as 0 at the beginning of interruption processing.

The following composition is adopted in this processing. The display of LED and reading of SW are base level processings (processing which is not interruption). Reading of temperature sensor is interruption processing of timer 0. Control of external circuit is interruption processing of timer 1. In base level processing, PORTB is set as output mode in LED processing, and set as an input mode in SW reading processing. This mode change is performed by setting change of the TRISB register on the bank 1. Since base processing is interrupted, W register and STATUS register saved at the beginning of interruption processing. And when interruption processing is completed, those registers are returned to the original contents.
This phenomenon will occur, if interruption is carried out while changing bank 1 on a base level and performing processing of TRISB register. Since the bank had changed to 1, the memory in interruption processing was not able to be operated normally.
There is a method of forbidding interruption by processing of a base level as other solutions. Before memory processing competition arises, the GIE bit of an INTCON register is set to 0, and interruption is forbidden and setting GIE to 1 at the end of memory processing and enabling interruption of it.

tempcont.asm
397
398
399
400
401
402
403
404
405
406
407
408
;********************************************************
;                 Interruption Process
;********************************************************
int
        movwf   w_save          ;Save W register
        movfw   status          ;Read STATUS reg
        movwf   s_save          ;Save STATUS reg
        bcf     status,rp0      ;Change to Bank0
        btfsc   intcon,t0if     ;Check TMR0
        goto    temp_detect     ;TMR0 time-out
        btfsc   pir1,tmr1if     ;Check TMR1IF
        goto    out_control     ;TMR1 time-out

Temperature display is not stabilized.

Cause : Because the temperature sensor oscillated.
Measure : Multiple connection of the capacitor was carried out to the output of a sensor.

With this equipment, in order to measure indoor temperature and outdoor temperature, two temperature sensors are used. The phenomenon occurred by one of them. A temperature display changes scatteringly and is not stabilized. When two sensors were replaced, the phenomenon moved. It is the peculiar phenomenon of one of the two's sensor. The phenomenon was not repaired although exchanged for a new sensor. The oscillation phenomenon was checked with the oscilloscope. The length of a cable seems to be related. Although how to change a cable was considered, I decided to put a capacitor into the output of a sensor.
The oscillation stopped by putting in a 0.1-micro F capacitor. Although it does not change a lot like when oscillating, the temperature display is changing in several °C. This was the same also as two sensors. When capacity of a capacitor was set to 2.2 micro F, very small change of a temperature display was lost. Change of a temperature display is also normal. The resistor for capacitor electric discharge is not attached. It discharges by the sensor and an operational amplifier.

External drive circuit will operate also except setting conditions.

Cause : Because reading of a BCD switch is unstable.
Measure : When the same value was able to be read continuously 3 times, it was presupposed that it is effective.

The conditions which drive an external circuit are the following conditions. In case of UP mode, external circuit is operated, when room temperature is higher than preset temperature and higher than outdoor temperature. But even when room temperature was lower than preset temperature, the phenomenon in which an external circuit operated occurred. The fault of software is not found.
Then, the trap was devised to comparison processing of room temperature and preset temperature. When detecting that room temperature was high in the situation where preset temperature is higher than room temperature, it was made for a control circuit 2 to operate. When several minutes had passed, the circuit 2 operated. This time is not fixed. There is a case of several minutes, and there is a case of tens of minutes.
Next, reading processing of a BCD switch was checked. The read value was saved and it compared with the next reading. Thereby, carrying out a reading error was checked. A cause is not certain. Even when reading waiting time is doubled( 200 microseconds ) , a phenomenon does not change. Investigation of the primary cause seems to be difficult. Then, I judged that it was infallible, when the same value could be read continuously three times. The time which reading takes 3 times is an about 25 milliseconds. On the other hand, temperature comparison processing is the cycles of 2 seconds. Although read 3 times, there is no problem. Even if reading goes wrong, since the value read before that can be used, a problem does not have this, either. Moreover, since the change frequency of preset temperature is low, it does not become a trouble. Although it was not fundamental management, since it was substantially satisfactory, I decided to adopt this method. Henceforth, malfunction by this phenomenon has not been carried out.

tempcont.asm
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
process8
        movlw   b'01111111'
        movwf   portc           ;Set PORTC
        call    t200us          ;Wait 200 microseconds
        movfw   portb           ;Read PORTB
        xorlw   b'11111111'     ;Reverse bits
        movwf   preset1         ;Save 1st of preset
        movlw   b'00001111'     ;Set mask
        andwf   preset1,w       ;Pick up sw data
        movwf   preset1         ;Save 1st of preset
        movwf   presetw         ;Save preset(Binary)
        movfw   preset10        ;Read 10th of preset
        incf    preset10,w      ;10th of preset + 1
        movwf   presetb         ;Save count
process81
        decfsz  presetb,f       ;Count - 1 = 0 ?
        goto    process84       ;No.
        movfw   repeat          ;Yes. Read repeat counter
        btfss   status,z        ;Repeat counter = 0 ?
        goto    process82       ;No.
        movfw   presetw         ;Yes. Read preset data
        movwf   presetlk        ;Save preset last look
        incf    repeat,f        ;Repeat conter + 1
        goto    proc_end
process82
        movfw   presetlk        ;Read last look
        subwf   presetw,w       ;Preser - last look
        btfss   status,z        ;Preset = last look ?
        goto    precess83       ;No.
        incf    repeat,f        ;Yes. Repeat conter + 1
        movlw   3               ;Set reference data
        subwf   repeat,w        ;Repeat counter - 3
        btfss   status,z        ;Repeat counter = 3 ?
        goto    proc_end        ;No.
        movfw   presetw         ;Read preset data
        movwf   preset2         ;Set preset data
precess83
        clrf    repeat          ;Clear repeat conter
        goto    proc_end

process84
        movlw   10              ;Set add value
        addwf   presetw,f       ;preset + 10
        goto    process81

Temperature of 3 terminal regulator is high.

Cause : Because input voltage is high, a regulator generates heat also a little current.
Measure : The output voltage of the transformer was lowered and a heat sink was attached.

This phenomenon is natural. But it is easy to overlook. Reference "Circuit explanation for +5V Switching regulator"
The transformer of AC12V was used at first. In this case, regulator input voltage when two relays operate was 14.15V, and current was 0.15A. Therefore, the electric power consumed by the regulator is ( 14.15V - 5.00V ) x 0.15A = 1.37W.
When the output of the transformer was changed into AC10V, regulator input voltage when two relays operate was 11.10V. Therefore, the electric power consumed by the regulator is ( 11.10V - 5.00V ) x 0.15A = 0.92W. Although it is about 0.5W difference, generation of heat is suppressed.
The difference of the input voltage and output voltage of a regulator is 3V grade necessity. Therefore, it is necessary to use the transformer beyond AC8V at the lowest. Although the transformer output was incidentally set to AC7V, when two relays operated, equipment did not work normally.
Since remarkable heat comes also out of the power consumption of 0.92W from the regulator, it is necessary to attach a heat sink.