Designing a Time Delayed Relay

chopnhack

Apr 28, 2014
1,576
Joined
Apr 28, 2014
Messages
1,576
Code done! (needs a cleanup and perhaps writing of functions to make more compact, but working)

Problem occurred while writing code that had me chasing ghosts.... My test light GP5, to simulate activation of the relay on the board, stayed lit under certain situations. Turns out that U3 Allegro chip was outputting 5v instead of 1/2Vcc - 2.5vdc at no load. I am not quite sure why that is. If I have voltage present between U2's sensing pins 1-4, pin 7 on U3 goes high to 5v. If I move the voltage source to U3, U2 behaves as expected with 1/2Vcc as does U3 and the circuit works as expected. Of course, we need both Allegro chips to function properly with voltage present!!!

I am not sure how to troubleshoot from here - is it a bad Allegro chip? A tin whisker? Gremlins!!!!

Any thoughts?

Code:
void main()

{
  // Variable Declaration
  int AN3_AD_IN_110 = 0;                        // variable to hold value of A/D input from U2 Allegro chip, 110v line.
  int AN2_AD_IN_220 = 0;                        // " from U3 Allegro chip, 220v line.
                                                // This signal is baseline of 2.5VDC with a 0-2.5VAC signal riding on top. 
  int max = 511, min = 511,   
          max1 = 511, min1 = 511;               // variables for min/max comparisons on both channels 110/220
  int temp_peak = 0, temp_peak1 = 0;            // Hold temp values to compare ADC against
  int count = 0;
  CMCONbits.CM = 0b111;                         // Turn comparator off
  //ADC Setup
  ADCON0bits.ADFM = 1;                          // Right justified A/D results
  ADCON0bits.VCFG = 0;                          // Voltage reference set to Vdd 
  ADCON0bits.ADON = 1;                          // Turn A/D converter on
  __delay_us(15);
  TRISIO = 0b010100;                            // Only AN2 and AN3/MCLR are inputs all else outputs.
  GPIObits.GP1 = 0;                             // Turn off GP1 output initially
  GPIObits.GP5 = 0;                             // Turn off GP5 output initially
  //Analog Select Register Setup
  ANSELbits.ADCS = 0b101;                       // Clock derived from internal osc - max of 500kHz - problem with 4MHz xtal freg??
  ANSELbits.ANS2 = 1;                           // Sets AN2 as analog input (page 46 of pic675 manual states this and trisio need to be set)
  ANSELbits.ANS3 = 1;                           // Sets AN3 as analog input
      
while(1)
{ 
    while (count < 128)                            // set counter to prevent infinite loop
      
     {
       ADCON0bits.CHS = 0b11;                      // Channel select register set to 0b11 to select AN3
       __delay_us(15);
       // Start A/D conversion process
       ADCON0bits.GO = 1; 
       __delay_us(15);
        while (ADCON0bits.nDONE){}                  // Wait for conversion to be done
         //
        AN3_AD_IN_110 = ADRESL + (ADRESH << 8);     // 1024 bit resolution 5v/1023 = 4.88mV per bit
      
       // ADC Setup
       ADCON0bits.CHS = 0b10;                       // Channel select register set to 0b10 to select AN2
       __delay_us(15);
        // Start A/D conversion process
       ADCON0bits.GO = 1; 
       __delay_us(15);
        while (ADCON0bits.nDONE){}                  // Wait for conversion to be done
         //
        AN2_AD_IN_220 = ADRESL + (ADRESH << 8);     // 1024 bit resolution 5v/1023 = 4.88mV per bit
  
          if (AN3_AD_IN_110 >= max)                 // check for 511 (1/2 Vcc) or greater
            {
              max = AN3_AD_IN_110;                  // set variable max to 511 or greater
            }
  
          if (AN3_AD_IN_110 <= min)                 // check variable min for 511 or less
            {
              min = AN3_AD_IN_110;                  // set var. min to 511 or less
            }
          
          if (AN2_AD_IN_220 >= max1)                // check for 511 (1/2 Vcc) or greater
            {
              max1 = AN2_AD_IN_220;                 // set variable max to 511 or greater
            }
  
          if (AN2_AD_IN_220 <= min1)                // check variable min for 511 or less
            {
              min1 = AN2_AD_IN_220;                 // set var. min to 511 or less
            } 
      
      
       count = count + 1;                          // incrementing counter
       if (count == 128)
        {                                           // REMOVE from final - only for testing on dev.board
         GPIO1 = 1;                                 //    write a =! GPIO statement to turn led GP1 on and off every 128 cycles
         __delay_ms(50);
         GPIO1 = 0;
        }
     }
        
     temp_peak = max - min;                     // temporary peak value established and used to compare later
     temp_peak1 = max1 - min1;
     min = 511;                                 // reset variable
     max = 511;                                 // reset variable
     min1 = 511;
     max1 = 511;
    
     if ((temp_peak >= 80)||(temp_peak1 >= 80)) // control statement - if peak value is above threshold
                                                // and if 0.354V above and below Vcc - (110v threshold) then proceed
        {
          __delay_ms(2000);                     // 2 second delay before turning on
          //GPIO = 0b000001;                    // set GP0 high to turn on relay
          GPIO5 = 1;  //REMOVE ONLY FOR TESTING // this is to check code on dev. board - GP5 outermost LED to corner should light
        
        } 
  
     if ((temp_peak <= 60)&&(temp_peak1 <= 60)) 
        {
          __delay_ms(3000);
          GPIO5 = 0;         
        }
      
      count = 0;                               // reset count variable to zero for next go around
    }
}
 
Last edited:

hevans1944

Hop - AC8NS
Jun 21, 2012
4,968
Joined
Jun 21, 2012
Messages
4,968
Twenty-one pages is a goodly and magic number for this thread.:cool:

Will look at your code and try to find the answer to your Allegro problem. Yes, look for solder bridges and things like that. Sounds like one of the Allegro chips isn't working right, based on your description of the problem. You might try running DC through the Allegro inputs (instead of AC currents) to see what the output does. You do have a variable DC bench supply by now, riiight? Zero to plus and minus fifty volts or so at ten or twenty amps would cover most hobbyist applications.:D
 

chopnhack

Apr 28, 2014
1,576
Joined
Apr 28, 2014
Messages
1,576
Twenty-one pages is a goodly and magic number for this thread.:cool:
Be fair now, this was a large undertaking :D:rolleyes: LOL

Sounds like one of the Allegro chips isn't working right, based on your description of the problem.
I didn't have trouble soldering those at all, but the pins 1-4 internally are linked via a large piece of copper, so its possible there could have been accumulated heat damage. I did drag solder the sucker...

You do have a variable DC bench supply by now, riiight? Zero to plus and minus fifty volts or so at ten or twenty amps would cover most hobbyist applications.:D
I am glad you jest :D I am not retired, sir! :D:D

To reiterate though, the U3 allegro misbehaves with no current - just as soon as a voltage is across U2. Please re-read post 401 as I had to edit it.
Thanks!
 

hevans1944

Hop - AC8NS
Jun 21, 2012
4,968
Joined
Jun 21, 2012
Messages
4,968
If I have voltage present between U2's sensing pins 1-4, pin 7 on U3 goes high to 5v. If I move the voltage source to U3, U2 behaves as expected with 1/2Vcc as does U3 and the circuit works as expected. Of course, we need both Allegro chips to function properly with voltage present!!!
The Allegro chips are Hall Effect current sensors. There should be virtually no voltage measured across the sensing inputs, pin pairs 1-2 and 3-4. And voltage measurement from those pins with respect to anything else is totally irrelevant!

" I have voltage present between U2's sensing pins 1-4". This should not happen! There is only 1.2 milli-ohms resistance between these pin-pairs. You should not be able to measure any appreciable voltage between these pin pairs unless the copper trace between them, inside the plastic package, is open. It is highly unlikely that you could accidentally apply enough current to make that happen. The datasheet does say the device is internally fused. The chips are rated to carry 5X maximum rated current without damage, so if you bought the X20A version that would be 100 A overload before internal destruction. The internal "fuse" would probably prevent the package from exploding, merely rendering it inert to current input. Under those conditions, I would expect the output to remain at Vcc/2 not go to Vcc.

You may have a defective Allegro chip, possibly damaged by overheating it with "drag soldering" if the internal flip-chip solder balls were melted as a result of this practice. The Allegro datasheet states: "Internally, the device is Pb-free, except for flip-chip high-temperature Pb-based solder balls, currently exempt from RoHS." Who knows what "high-temperature" means? Best to mount SMDs on solder paste and melt the paste in an oven. I will build one from a Black and Decker toaster oven "real soon now".:D

Please let me know what you find out. And, please, try the suggestion I made to use a variable DC power supply to test the Allegro chip functionality. No AC connections. Just apply a DC current, perhaps using a current-limiting resistor if all you have is a constant-voltage power supply to use for testing. Look at the Allegro output with your multi-meter as you vary the magnitude and polarity of the current.
 

chopnhack

Apr 28, 2014
1,576
Joined
Apr 28, 2014
Messages
1,576
Please let me know what you find out.
I looked really carefully and couldn't find any traces that where crossed, no tin whiskers, etc. Just some rosin left over. I hit it with the brush and blew out a few times and tried it again. So far after about 45 minutes of intermittent testing, it is working as it should. Vout from the U2 Allegro is at 1/2 Vcc, so we are a go. I have no answer as to the why unless I dislodged something that I couldn't see.

There should be virtually no voltage measured across the sensing inputs, pin pairs 1-2 and 3-4.
What I meant by that is, when I plug my connector that has 110v into my run delay board, then current can pass between those pins, there is a very small potential between the pins due to the low resistance, but I didn't want to implicate that at standby there was a load passing through as it is at a passive state. Does that make sense?

Best to mount SMDs on solder paste and melt the paste in an oven.
True, at the time I didn't have my reflow oven ;):p

And, please, try the suggestion I made to use a variable DC power supply to test the Allegro chip functionality.
I have some 9v batteries and some resistors as well as some wall warts, but that's about it for DC power supplies. Makes me wish I still had my train set from when I was a kid. I used to use that power pack for electrolysis experiments too!

Edit:

The only other oddity I am trying to understand now is GP5 going high initially on power up, i.e. when I unplug/replug AC to the entire circuit and sometimes as well when I unplug the connector which passes the AC to the Allegro chips (so far its been random and occurs at either chip's connector). It sounds to me like a bit of software should take care of this, and I thought I had it covered when I initiated GPIObits.GP5 = 0 in my ADCsetup near the top of the code.
 
Last edited:

hevans1944

Hop - AC8NS
Jun 21, 2012
4,968
Joined
Jun 21, 2012
Messages
4,968
Could you post your entire source code file as an uploaded attachment instead of posting it inline inside
Code:
brackets? I'll open the file and inspect the code in the latest version of MPLAB X and print it out if necessary. There is probably some sort of metastable state during power-up that is preventing GP5 from getting set, and remaining set, to zero. Some sort of delay before entering main() will probably solve that problem, giving everything time to settle down.
 

chopnhack

Apr 28, 2014
1,576
Joined
Apr 28, 2014
Messages
1,576
Could you post your entire source code file as an uploaded attachment instead of posting it inline inside
Code:
brackets?

Sure, gotta wait for eldest to finish cad'ing his latest 3D creation, lol. Going to need another desktop soon!

I'm not sure what you mean by metastable, but I did check the power on routine to see what the GPIO ports are set at. They are all x's, so unknown... Made me think though, if it happens at power on AND when I swap the AC connector at the board to the Allegro chips (power stays on to rest of board), then its not solely isolated to power on.... I hooked up a meter to both outputs from the Allegro's and watched them while power cycling/ swapping the AC connector and interestingly GP5 went high with the AC connector not connected to any Allegro's! Nothing noted on the multimeters... so that kind of brings me back to it being a pic issue?

edit: Emailing the file Hop, the forum doesn't allow .c file type.
 
Last edited:

hevans1944

Hop - AC8NS
Jun 21, 2012
4,968
Joined
Jun 21, 2012
Messages
4,968
Metastable (definition by Murphy): A system that is stable while you are looking at, but changes states when you look away.

On testing the Allegro chips: You could use an AC load plugged into the convenience outlet and then use your spiffy DSO to see the waveform at the PIC socket coming from the Allegro chips. Should see the usual DC offset plus whatever AC is superimposed by the appliance current. I think it would be interesting to plug in a dim-able appliance to see what kind of wave-forms those produce. Your min-max algorithm is not going to work with SCR/TRIAC switched dimmers, just in case you decide to expand your horizons to other applications.:D
 
Last edited:

CDRIVE

Hauling 10' pipe on a Trek Shift3
May 8, 2012
4,960
Joined
May 8, 2012
Messages
4,960
I have some 9v batteries and some resistors as well as some wall warts, but that's about it for DC power supplies. Makes me wish I still had my train set from when I was a kid. I used to use that power pack for electrolysis experiments too!
Ha, you just brought back a memory. It was a lifetime ago but yes, me too! I used my old Lionel power pack for AC experiments and my HO gauge for DC.

Regarding flux: I never had any issues with paste flux but when I used a clear liquid flux for a uC project that included some Hi Z inputs I can't tell you how much grief that sh!t caused me! I scrubbed the board repeatedly with multiple solvents until it was finally all clean. Stuck my Ohmmeter probes in the bottle and damn near had a heart attack. The stuff was a fair conductor! Never used it again.

Chris
 

chopnhack

Apr 28, 2014
1,576
Joined
Apr 28, 2014
Messages
1,576
Metastable (definition by Murphy): A system that is stable while you are looking at, but changes states when you look away.
Good grief... this defines many things in life, LOL. Good one, Hop.

On testing the Allegro chips: You could use an AC load plugged into the convenience outlet and then use your spiffy DSO to see the waveform at the PIC socket coming from the Allegro chips.
That is what I have been doing, courtesy of the wife's 1875 Ionic pink hair dryer, and yes - she consented ;). I checked it before I started programming to determine that on low it draws about 4A. Of course after repeated tests this will drop some as the coil gets hot and requires less A at startup. That is how I have been triggering my code. I think you are correct and that a delay prior to main, or even a bit of ASM to make sure GP5 is low at startup may be the cure. I will play with that after I wrap up the function for the code instead of reiterating all the code.

Ha, you just brought back a memory. It was a lifetime ago but yes, me too! I used my old Lionel power pack for AC experiments and my HO gauge for DC.
Hehe, cut from the same cloth, are we :D. I was fortunate to have the HO scale, no Lionel's but I loved them quite a bit. I even still have one model from my HO track that my parents brought down to me. I really loved that engine the best because it puffed real smoke - had a special chamber that would heat a proprietary smoke formula that you bought from the hobby shop (probably some kind of glycerol based deal). If I can find a picture I will send it to you Chris.

The stuff was a fair conductor!
The wet form I can understand because there is some type of solvent which aids in conductivity, but when dry, I doubt there is much conduction. Perhaps put some on glass and leave it in the sun and test the film?
 

hevans1944

Hop - AC8NS
Jun 21, 2012
4,968
Joined
Jun 21, 2012
Messages
4,968
If you are dealing with high impedance, anything above about ten meg-ohms, cleanliness is the rule. Most flux residue is hygroscopic to some extent, even if the label says it isn't. If there is any moisture in the air then your flux residue becomes a problem in the making.

I always drench circuit boards in 91% isopropyl alcohol (anhydrous is even better if you can get it), scrub vigorously with a stiff brush, and allow the residue to roll off and the remainder on the board to evaporate. Hold the board up to a bright light at an angle to observe the evaporation: it should be even all over the board simultaneously if the board is "clean". Of course, for very high impedance approaching 1000 meg-ohms, ceramic circuit boards or Teflon-insulated wiring terminal posts are required. This only become necessary for FET and sensitive electrometer tube circuits, and not all of those. Most circuitry works fine with standard FR4 fiberglass circuit boards.
 

chopnhack

Apr 28, 2014
1,576
Joined
Apr 28, 2014
Messages
1,576
Some sort of delay before entering main() will probably solve that problem, giving everything time to settle down.

I was unable to enter any form of code prior to main (such is the construct of C programming - even embedded ASM has to be called from within main, as best as I understood/tested). I did add a delay at the beginning of main of 1 second. I am still not sure as its hard to reproduce GP5 going high, but sometimes shaking the dev. board can cause GP5 to go high. I did this while holding/not holding the wires that went to the run delay board just so that I could isolate the two. It seemed to happen regardless of wire handling. I can only assume that there is perhaps a loose connection or bad solder joint somewhere. Perhaps one of the jumper wires is suspect. Lots of variables. I have had the board running for over 4 hours with no recurrence of GP5 going high (unless via programming/testing with hairdryer). I have power cycled as well as reset MCLR on the unit numerous times. I have also moved the AC connector between U3 and U2 numerous times while testing with no repeats of GP5 going high.

The hair dryer has three speed settings and a 'cool' button. Six different current consumption models to measure.

The VAC reading is from AN2 or U3 Allegro output, amp readings provided by knockoff clamp on tool.
Speed 1: 0.378VAC, 3.5A, binary value: 77 .........w/button: 0.154VAC, 1.4A, binary value: 31
Speed 2: 0.580VAC, 5.6A, binary value: 118 .........w/button: 0.179VAC, 1.7A, binary value: 36
Speed 3: 1.219VAC, 12.0A, binary value: 249 .........w/button: 0.196VAC, 1.8A, binary value: 40

AN3, U2 Allegro output
Speed 1: 0.389VAC, 3.2A, binary value: 79 .........w/button: 0.158VAC, 1.2A
Speed 2: 0.593VAC, 5.0A, binary value: 121 .........w/button: 0.186VAC, 1.4A
Speed 3: 1.248VAC, 10.9A, binary value: 255 .........w/button: 0.201VAC, 1.6A


You can see there is a little difference between the multimeter values in VAC and the clamp on measurements in Amps. True amperage should be a shift in the decimal spot of the voltage input by one place to the right, so 0.378VAC is equal to 3.78A. Looks like both Allegro's are functioning well and have nearly identical outputs - about a 2% variance between units across all measurements.

Newest wrinkle is with expected setpoint - i.e. if I want AN2's channel to trigger the circuit when current is over 4.8A (100 in binary), but not trigger on anything less than 0b100, why is GP5 going high on speed 1 (3.5A) with a binary value of 77?

I had to go all the way up to 0b210 in my code (a bit of hit or miss at 209 - bounce) for the circuit to not respond to the 3.5A load!!! That 0b210 value is equal to 10.26A.

To compare, AN3, pin 3 on the pic, which is input from Allegro U2, performs the same way except at a slightly higher binary value (statistically insignificant) - bounce at 0b218, but at 0b219, circuit does not actuate.

What am I missing here?
 

chopnhack

Apr 28, 2014
1,576
Joined
Apr 28, 2014
Messages
1,576
Some more data from today's trials - I wanted to test AN2's (U3 Allegro) linearity with respect to various current levels. Here is what I found:

Amperage.........Expected Binary Value............Tested Binary Value........Variance From Expected Value
3.5....................77.............................................218................................283%
5.6..................118.............................................333................................282%
12...................249.............................................693................................278%

I am convinced the current sensing chips are functioning as intended.

What I am not understanding is the difference between expected and tested binary values. Is there a misinterpretation due to the code handling of ADRESH and ADRESL? A problem with the right justification of the A/D results?
 

chopnhack

Apr 28, 2014
1,576
Joined
Apr 28, 2014
Messages
1,576
Some photos of the intended enclosure: a 2 gang 4" square deep box, modified to accept the 'power on' LED as well as a power switch for the control board. The box has some offsets to raise the board off of the back, its a pretty tight fit, but the height was needed because of the box's ground screw mounting location, which is a raised bump tapped for the ground screw(bottom right corner second photo). Previous attempts to pound it flat led to deformation of the box and separation of the welds as well as having to retap the screw hole. At that point, I figured that if I was going to go that route, I might as well just fab up a custom box - I didn't care for that since it would be too much work and obvious red flags for any home inspection (if it looks normal, fewer questions).

As for the issue with the binary values, I still haven't been able to solve that, but I needed two values, one for the 110v line and one for the 220v line, so from testing and extrapolation I picked two values, updated the code, removed the GP5 testing entries and put in GP0 so that pin 7 would trigger my relay, loaded, tested, debugged once :rolleyes:;), tested again - all working fine, ready for coating. The board can be mounted only after the box is installed on the wall, so I plan on cleaning the backside of the board once more with denatured alcohol and then giving it a shot of this conformal coating. Full cure can take up to three days, I wonder if its safe to use prior to full cure?

20160909_201421_zpsig9qyhtk.jpg

20160909_201446_zpsbd80xsoj.jpg
 

hevans1944

Hop - AC8NS
Jun 21, 2012
4,968
Joined
Jun 21, 2012
Messages
4,968
I needed two values, one for the 110v line and one for the 220v line, so from testing and extrapolation I picked two values
It is unfortunate that the actual versus predicted values turned out to be so different, but the "proof is in the pudding" so you have to go with what works.

Since this is a one-off project, there seems to be little incentive to delve deeper into the "problem," except for academic curiosity, but if it were a production item with thousands being sold every day and distributed world wide (with a warranty)... well, that's a different can of worms. Then you would definitely want to know WTF happened? (I still haven't had time to analyze your code line-by-line, so no help from me on that!)

I plan on cleaning the backside of the board once more with denatured alcohol and then giving it a shot of this conformal coating. Full cure can take up to three days, I wonder if its safe to use prior to full cure?
After waiting this long, what is three days? Apply several thin coats and allow the coats to dry for several hours. Avoid applying too heavy a coat that runs... this only increases the drying time. Read the reviews, and Q&As on Amazon. This appears to be really good stuff for protecting PCBs, but please build up the coating instead of trying to do it all at once. On an historical note, I used to the use clear Krylon acrylic spray paint for coating PCBs. This stuff you found is polyuerthane and appears to be a much better choice for conformal coating and PCB protection.

Congratulations, John, on finishing the project! I think Kris would be proud of you. I know I am.

It's now time to move on to another PIC project! Got any ideas what that will be? Learning to use the sleep mode effectively is a good project, especially for low-power and/or energy harvesting applications.

Hop
 

chopnhack

Apr 28, 2014
1,576
Joined
Apr 28, 2014
Messages
1,576
It is unfortunate that the actual versus predicted values turned out to be so different, but the "proof is in the pudding" so you have to go with what works.
Indeed! I am still baffled and not sure if it was interpretation of code, code not cycling adequately, my misunderstanding of how ASRESH, ADRESL were handled, the list goes on and I have researched some, but still coming up empty handed. I will throw it out on the Microchip forum to see if anyone has a clue on how this occurred so that I can learn from it, but since it works, so what :D

After waiting this long, what is three days?
LOL, I grow impatient :eek::D:D No worries, if I remember to do it tomorrow it can sit for at least two and half days since I will be busy at work.

Congratulations, John, on finishing the project! I think Kris would be proud of you. I know I am.

It's now time to move on to another PIC project! Got any ideas what that will be? Learning to use the sleep mode effectively is a good project, especially for low-power and/or energy harvesting applications.

Thanks mate! I really appreciate both of you immensely, I wish Kris was around to see this! Chances are he is smiling down or laughing, amazed that it finally happened, LOL. Cheers Kris!!

I think the 'blink' project wants to be done next. I am certainly more confident with handling pics, programming a bit with them. Blink may need ASM though to fit in such a tiny package or an upgrade in chip... But first, I need to make some sawdust! I have some much delayed projects that need completion before I get hung by SWMBO.

Here is the outlet plate I painted for the circuit. If it wasn't for that damn ground bump in the 4" box I think the whole thing would have fit!!! I will pickup an extender ring, and give myself more room for the wires.

20160910_234708_zpsrjdkgqiv.jpg
 

chopnhack

Apr 28, 2014
1,576
Joined
Apr 28, 2014
Messages
1,576
Got the coating done this morning, I can recommend the product based on its ease of application and quick dry time despite the high humidity!

Hop, those wire ferrules, bootlace ferrules, whatever they're called, are the bee's knees :D Apparently they have been in use worldwide, but not mandated here. I am shocked... this is a great way to prevent frayed strands from coming loose and falling into your electronics. The heat shrink at the end also acts as a small strain relief -they are brilliant!!!

Was able to finish wiring the connectors, so we are ready for install at this point. I will sit down and write out a wiring plan to make sure I get everything connected properly and with the correct size wire nut.

20160911_161558_zpsn0djfiip.jpg
 

chopnhack

Apr 28, 2014
1,576
Joined
Apr 28, 2014
Messages
1,576
I had a chance to install the boxes today, but after I finished wiring and turned the power back on, I hear the relay click on, about 2-3 seconds after powering on the circuit via the rocker switch at the top with no load! :confused::mad:
At first I thought I wired the 220v portion incorrectly, so I switched off that breaker to take that part out of the equation. Still no go, relay clicks on. This was working when on the breadboard at my desk, only difference being at that time I only had one sensor under power at a time, which should not matter... I will include my chicken scratch diagram that I followed when hooking up the circuit to power, there were many connections, so I laid it out before to verify and to use as a checklist.

Maybe I am overlooking something simple? The 110V receptacle was made 1/2 hot by breaking off the tab between the two hot side screws. The small rectangles are the 6 pin connectors, 3 wires are one side of each allegro chip and on the right hand side of the diagram, 3 wires are on either side of the relay.

Top questions that came to mind:
1. Does it matter which side of the relay is hot? (I don't think so)
2. Did I connect the 220v circuit correctly through the sensor chip and outlet? (i think so)

Briefly, 110v line comes in at point 5 through a fuse to the switch and then to that small 3 pin connector. Point 5 also supplies line to point 3 which is the connection point of three wires going into the 110v allegro, the other three wires lead out of the sensor to point 2 which is then connected to the top half of the outlet, line side, which we will call the sensed outlet. The lower half of the outlet is isolated from the top via the broken tab, it is wired to one side of the relay, with the other side of the relay wired to point 5 (via point 4 - couldn't find a wire nut large enough to accommodate six #14's and one #12! - I should have investigated some type of 3 pronged tab with wire crimp at the end to save space...). Point 7 is the connection of neutral for the 110v circuit, the upper receptacle and the boards neutral are tied here. Ground is terminated at point 6 - box, recepts and board. **The lower connector was circled and redone on the bottom since space was tight. The 220v circuit L1 goes into one side of the 220v allegro and out the other three wires to one side of the 220v receptacle. L2 is then placed on the other side of the receptacle, thus completing the circuit.

Any thoughts?

out_zpsthxo6don.png


There are a lot of wires, I may have exceeded my box fill capacity :eek:




20160919_130654_zpso7orjdlu.jpg


20160919_150158_zpsygnevfal.jpg
 

hevans1944

Hop - AC8NS
Jun 21, 2012
4,968
Joined
Jun 21, 2012
Messages
4,968
Well... it didn't catch on fire or trip any circuit breakers, so there probably isn't anything wrong with the wiring. This sounds like the same problem you had earlier with the dust-collector relay operating immediately after power is applied. It is possible that all those wires are electromagnetically coupling into the PIC's ADC inputs, overriding the Allegro signals. If this is a possibility, the only way I know of to troubleshoot it is to remove ALL the AC wiring except for the 110 VAC that goes to the fuse and rocker switch and then re-connect them a pair at a time until you have narrowed the problem down. Just disconnect the wires at the terminal boards and tape or wire-nut the ends to keep them from shorting. That includes the wires that connect to the dust collector switched outlet. The only wires you want to remain are L, N, and G that power the board.

Do you have the circuit common on the board connected to the neutral (white) wire of the incoming 110 VAC power? Don't do this! The circuit board common should connect only to ground (green) wire of the incoming 110 VAC power. Since power comes into the board through a 3-terminal screw connector strip, I assume that circuit common does connect only to the G terminal and the transformer connects only to L and N. There should be no other connections to the board from the 110 VAC power line (other than the fuse and the rocker switch mounted on top of the box)

Turn 110 VAC circuit breaker back on and see if the relay behaves itself with all the extra wiring removed. If it clicks on, it isn't a problem with the power wiring. Maybe power-on glitches, which I thought you took care of in software.

If the relay does remain off, turn off power at the circuit breaker and connect the dust collector outlet wires. Power up again and verify the relay does not operate. If they relay does not operate, the problem is probably voltages induced by the extra wiring. You may have to install another adjacent box with the load-sensing receptacles and run your power wiring through the adjacent box walls to physically isolate the power wiring from the electronics board.

So, beginning with the 110 VAC wiring, reconnect the load sensing wires two at a time, in/out, without any load and verify that the relay does not operate. You will of course have to "patch in" the "hot" (black) lead of the 110 VAC power line with a wire nut, unless you have already done this at the isolated 110 VAC receptacle. It is hard to tell from your photo how you got all those black wires connected.

Plug in a hair dryer load (or lamp or whatever) with just one pair of in/out sense wires connected. Power up, verify the relay does not operate, then turn on the hair dryer at high heat. Verify the relay operates. Continue adding sense wire pairs to the 110 VAC circuit until you have all six wire re-connected to the 110 VAC in/out terminals and the isolated 110 VAC receptacle. The relay of course must not operate unless the hair dryer load is turned on.

Continue the above procedure with the 220 VAC load-sense wires, one pair at a time. You probably don't have a convenient 220 VAC load to test with, but that isn't important. What is important is that you can eventually re-connect all six of the 220 VAC in/out current sensing wires without the relay actuating. Although I would first suspect that it is the 220 VAC wiring that is causing problems, you did state that turning off the 220 V circuit breaker had no effect: the relay still actuated when powered on. So maybe you won't even get this far before you find the culprit.

If after doing all the above the relay is behaving as it should, re-attach the panel with the receptacles. At this point, Mr. Murphy will step in and render it inoperable again because all the wires are now scrunched up inside. Murphy loves scrunched wiring, the more inaccessible the better. So it's then time to add another box and re-route all the power wiring to it, leaving just the dust collector receptacle on the original box. Looks like you have plenty of room on the wall to do that. :D And you can claim that is what you had in mind all along, providing room for expansion and the addition of other power tools.
 
Top