March 31, 2019

ย 

Dear Diary,

Its 1:30 in night. I am sipping my tea and writing to you. Tea is special too. I don't drink tea everyday, but i like tea. She liked it too, (on a sidenote, i think if we were to be together, one thing we'll always do would be drinking tea together, sitting across a white round table, of course with her i'll develop habit of drinking tea everyday, wearing our warm clothes and she wearing her woolen cap, its very cold usually in morning in the place where we are living. She is smiling, maybe thinking about how the dream we always had has come to life, we are both thinking the same and we are grateful to life. For that is the utter Joy, that is the moment of ultimate satisfaction). Anyway, that was totally on a sidenote. :P 


Something about falling and learning. Why is it that we can only learn by falling, by struggling, doing mistakes and wasting time. Or is it just the case with me, i am not sure :P. But today i learn an important lesson, Often when something is wrong we dig the top soil and check it 1000 times that maybe something in recent past must have gone wrong, but often this is the case "Problem is with the roots". The fault is hidden in the bottom, in the very beginning, and its justifiable because over the time we have learn many things, but in the beginning we had very less idea of the system and hence more vulnerable to mistakes. 

One more thing, I am sure about this thing now, in almost all the problems i have faced and solutions i have found, "It was never, Never in the place i was looking for, instead it'll always be an accident which points to a solution.". 


The case of Fan. 

For past 1 week or more, we have been disturbed with the case of Fan, The fan dimmer in our device wont work as expected in few fans, complained people. Then accidentally i discovered that in one, Just one of the fans in our office, its not working either. Remember, we have tested our device with at least 20 different fans, it was always working. And suddenly right after people started complaining about it, i found the issue in one of our office fans too. There is another fan, of same brand, same specification in the hall, and it works fine, but the fan in reception isnt. 


Once the dimmer is raised above 50%, its not going down, even if we set the dimmer to zero. But in this special case, it would go to zero, only if i turned of the manual switch. (The hint lied here, but i ignore it.)


It came to me like this is a problem we'll almost never be able to solve, but still, i told ramesh to check the hardware, we did change every piece in the circuit, we replaced capacitors with varistors, we removed resistors, increased capacitance,changed capacitors, we changed boards we kept CRO to use, draw the phase cutting diagram on paper for atleast 10 times. Nothing worked. 

Ramesh, in pursuit of finding the issue, even short circuited the CRO on the board and almost gave up and said he'll wait for a new isolated neutral wire to be pulled up before testing again. 

I dint buy it, as always, i always doubt everyone (This is bad, but somehow i am unable to control it for now.). 

So we are all set for testing the board again. I am pretty sure, the problem is in hardware. 


We tested three different waveforms on CRO, 

1. Octocoupler Input wrt Gound. - Should be a square wave. 

2. Octocoupler Output wrt Neutral should be broken sinosuidal

3. Channel to Neutral Should be broken sinosuidal and should change shape when varying potentiometer. 


We checked first configuration. We found, its absolutely right, The wave is a square wave. Software is 100% Right. 

2 and 3rd both are going bad after a certain value of potentiometer, they are perfectly sinosuidal, looks like shorted with phase directly. 

We remove a resistor, increase resistance, sandeep suggest of removing the capacitor, We do many things and see the same wave pattern every time, nothing is changing. Thats when i get an idea, maybe octocoupler is bad. Maybe this is beyond its specification, Maybe its not handling the back emf, maybe we need another type of octocoupler, saurabh suggest we can use MOC3063, so we ask shyam if we have MOC3063, we are not using it in any hardware, but somehow shyam finds one(I think if shyam would have said, he doesnt have it, it could have altered the entire course of the day today and upcoming days too, we will order and would wait for that octocoupler to arrive, untill then the testis is halted). Anyway, luckily shyam had one of those, its a special one, which has some zero cross detection inside itself, however, i do not know anything about what exactly is the function of zero cross detection in the octocoupler(Infact nobody, not even Ramesh, Saurabh knows it for sure, how things works, we just keep guessing different things, and thats also one reason i doubt people, because many times, it turns out to be different, then what they are guessing), but a little digging shows thats its probably something to do with the on/off at zero cross. Ok, so we replaced our octo with this one, and the fan is not even rotating, so ramesh suggest, that since it already has zero cross detection, probably we have to remove the turning off of gpio from our code, i try that, and the fan is now always full. Its not going below full anytime now. So i just thought that maybe we have to reverse the logic, instead of turning off the triac at zerocross, lets turn it on on zero cross, so i take backup of previos code and reverse the entire logic, i do some math, i verify it in serial, i get into another problems, somehow, its all not working at all. Meanwhile while reading about this zero cross and octo coupler, i just decide to check our 3 year old code, given by our first outsourcing company Armtronix, and i notice that turning off of triac after 10 microseconds thing. 


Sudeenly, Suddenly, i just decide to replace the new octo with our own, remove the newly written code entirely, keep the old code back again, and uncomment one line in that code, its a line i commented maybe 1 and half year ago, thinking it was not neccesary, not fully understading how triacs works. I uploaded code and varied the potentiometer, The fan just worked fine... It was done. Problem solved, we were all sitting in the reception area, looking at this, thinking that it may work only miraculously, and it did. 


The mistake was small, just two of these slashes "//" Added in front of one single line in my code. And we all wasted days on it...  


(Triacs are turned on whenever we send gate to high, but will not turn off until the zero cross, even if the signal is low, so for triggering it for half a cycle, we just have to send a high and set the signal back to low again). I dint know this and i just copy pasted and did some jugaad to set something into motion, dint exactly know what i was doing when i wrote that code 2 years ago. 


In the process, i learn something about CRO, and how to use it, i learnt of triacs, i lern of back emfs, and i learnt, where to look for mistakes, and i learnt, maybe this is all magical, i wasnt set out to find a bug in the code, remember, we verified, we said code is 100% fine, it has been running on so many devices for so many months, if its failing on this paticular fan, it must be hardware, we'll, it is due to some conditions of the hardware, but it was an implementation mistake from the software. 


Is this the only way we are supposed to learn things ? Why cant we just read it and know.... It took many days of our time. I am sad and i am happy... 


Goodnight๐Ÿ˜‰๐Ÿ˜‰๐Ÿ˜‰







Loading...
Comments