[Menu]>[Circuits Gallery]>[Decorative light]


Trouble shooting for Decorative light Controller

The assembly of equipment was ended. However, it did not operate normally.
I will describe the contents of obstacle, and measures below.

TRIAC repeats ON/OFF an early cycle.

Phenomenon check 1

This phenomenon occurred, when operating four or more TRIAC circuits. In the case of three or less circuits, it did not occur.

Phenomenon check 2



If synchronizing signals are observed with an oscilloscope, there is a time of the signal not having come out.


Cause -- Supply voltage descent



Since it is the phenomenon of occurring when the drive circuit of TRIAC is increased, the fall of supply voltage can be considered. As a result of observing supply voltage, falling by about 1V momentarily was checked. The synchronizing signal has stopped between about 60 milliseconds from the time.


Measure 1 -- A voltage regulator is exchanged for the thing of big capacity.


I used the 100mA type voltage regulator (78L05) supposing current required for the power supply of 5V as follows.
-PIC : 2mA-Pilot lamp : 10mA
-TRIAC drive circuit : 14mA x 5 = 70mA
-Others : Several mA

However, if all TRIAC drives are turned on, it may become just before capacity and voltage may fall.
Then, I exchanged the voltage regulator for 1A type 7805.
A result has no change. It was not a phenomenon by the shortage of capacity of a voltage regulator.

Measure 2 -- The brown-out detect function of PIC is suspended.


There is a brown-out detect function in PIC16F628. It supervises supply voltage and if the fall of voltage is detected, it will reset PIC. This function may be committing this phenomenon. If all drive circuits operate simultaneously, much current will flow, supply voltage falls momentarily, and it seems that PIC would be reset. The synchronizing signal is pulled by +5V on the pull-up voltage in PIC. When PIC is reset, pull-up voltage is lost, and it seems that the synchronizing signal disappeared.
Control of the brown-out detect function of PIC is controllable by the BODEN bit of configuration word. The default value of this bit is "detecting" by 1. I changed this into 0 and did for "not detecting."
 __config _hs_osc & _wdt_off & _pwrte_on & _lvp_off & _boden_off
A result came to operate normally. A synchronizing signal does not stop.
The voltage drop of a power supply seemed to be the cause.

Measure 3 -- An electrolytic capacitor is added for supply voltage stabilization.



Equipment came to operate normally in a measure 2. However, the measure to supply voltage change is required. An electrolytic capacitor is put into the output side of a voltage regulator, and the supply voltage of 5V is stabilized. Although it was somewhat big, the capacitor of 2200µF/10V was used.

Measure 4 -- The drive current to a TRIAC drive circuit is reduced.


The photo triac(TLP560) used this time can operate with several mA drive current. It was driving with about 14mA current until now. However, the resistance of a drive circuit is changed and it was made to drive with about 5mA current. It is checked after change that it can drive normally.

This phenomenon was solved by the above.


The value of a BCD switch is influenced with the BCD switch set point of other circuits.

Phenomenon check 1

Especially the BCD value of a circuit 5 is influenced of the set point of the BCD switch of a circuit 4. There are few frequencies of the occurring but the influence comes out with the other circuit.

Phenomenon check 2


I investigated wiring of a circuit minutely with the circuit tester. However, abnormalities are not discovered. Wiring on the BCD switches of the front panel which I added later was checked especially minutely. There is not to be abnormal.
It seems that a cause is in software supposing it is not the abnormalities of hardware.


It was a bug of software.

Cause -- There is no time margin after carrying out decoder specification until it reads the state of a switch.


sw_mode_sub
        movwf   portb           ;Write scan data
        movfw   portb           ;Read PORTB
The above-mentioned step is a program before change. PORTB is read at the step immediately after writing the control data of a decoder to a PORTB register. Since the 4MHz clock is used in this circuit, the execution time of one step is 1 microsecond. Therefore, if a decoder operates within 1 microsecond, the value of a switch can be read normally. In the case of this circuit, it seems to be the limit of the working speed of a decoder. I don't find the reason why a lot of malfunctions occurred to circuit 5.

Measure -- The waiting time is made from a decoder setup to switch value read-out.


sw_mode_sub
        movwf   portb           ;Write scan data
        movlw   d'2'            ;Set 7us wait
        movwf   s_count         ;Save count
loop
        decfsz  s_count,f       ;7us ?
        goto    loop            ;No.
        movfw   portb           ;Read PORTB
I made the waiting time for 7 microseconds, after specifying a decoder before reading the value of a switch. This phenomenon was solved for at least 4 microseconds. However, I made it a little bit long because of safety. But if the following phenomena is taken into consideration, it may be a thing with a sufficient short time.

This phenomenon was solved by the above.


Brightness control of the lamp of load is not smooth.


Phenomenon check

This is the phenomenon in which the lamp of load sometimes becomes bright like a flash. A lamp becomes dark with a blink a little. Also when becoming bright gradually, the same phenomenon occurs.
A left screen is the load voltage of the moment that control is confused. Originally it is in the state which is carrying out 55% of control. The thick line which can be seen at the center is 0V. At this time (45%), the TRIAC should become OFF. However, you can find that voltage is sometimes be applied at the time, too.
At this screen, the condition that the TRIAC becomes OFF and the condition of the abnormal control overlap and can be seen. This is because the oscilloscope is observing voltage repeatedly and there is an afterimage.
It is difficult to explain easily.

This is the phenomenon of shining so that a lamp may flash. Since it is interesting, it may not be necessary to correct. I think that it is suitable for the Christmas tree. I implemented following Measure 1 and made the occurring frequency of this phenomenon little.


Cause -- The off-timing of the Photo-Triac shifts by the processing waiting of a synchronizing signal.


The synchronizing signal which is made by the polarity reversals (0V) detection of AC voltage, and is inputted into RB0 port, and interruption processing is carried out. Double interruption processing cannot be performed in PIC. Therefore, if interruption processing of TMR0 or TMR1 is performed when the interrupt of RB0 occurs, interruption processing of RB0 will be kept waiting until those processings finish. In the software this time, after turning ON the Photo-Triac, it is not turned OFF until the interrupt of RB0 occurs. If interruption processing of RB0 is overdue, the Photo-Triac becomes ON already at the time of the beginning of the next period with AC voltage. In this case, the voltage control by the TRIAC is not performed in that cycle and the lamp will be in a lighting state momentarily.


Measure 1 -- It makes the waiting time of the switch reading short.


Since the cause of this phenomenon was not found at first, the waiting time of reading of a switch was made into 750 microseconds. I did this time in the 7 microseconds and suppressed the frequency of the occurring.

Measure 2 -- The drive signal of Photo-Triac is made into a pulse. ( undisposed )


The above-mentioned phenomenon should be able to be mitigated by driving Photo-Triac by a pulse signal. That is, after driving Photo-Triac, a drive signal is stopped by a definite period of time. Even in such a case, it may overlap with the following cycle by the width of a pulse, and the processing waiting time of RB0. I think that it is necessary to make a little R1-4 into a small value when a drive signal is made into a pulse.
Since the phenomenon in which it has occurred this time is interesting in my case, measure has not been carried out.