1. Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.
    Dismiss Notice

Controller reset

Discussion in 'Microcontrollers' started by piccontrollerlearner, Jul 26, 2017.

  1. piccontrollerlearner

    piccontrollerlearner Member

    Joined:
    Dec 31, 2015
    Messages:
    34
    Likes:
    0
    I know it is a common question but still we cannot get rid of it. We are using stm8s003f3 in our project. An ac motor is switched ON and OFF by a 12V relay (using timer).


    The controller frequently resets itself when a relay is tripped ON or OFF. We used pf on the controller pin, pulled up the NRST pin with a 10K and a pf, used 7805 instead of lm1117, and tried a few other things, but couldn't succeed.


    It would be a great relief for us if anybody can provide solution for it.


    THANK YOU.
     
  2. Nigel Goodwin

    Nigel Goodwin Super Moderator Most Helpful Member

    Joined:
    Nov 17, 2003
    Messages:
    39,218
    Likes:
    641
    Location:
    Derbyshire, UK
    You need to provide a FULL schematic and a picture of how it's assembled, to get any meaningful answers.
     
    • Thanks Thanks x 1
  3. RadioRon

    RadioRon Well-Known Member

    Joined:
    Oct 7, 2005
    Messages:
    1,755
    Likes:
    53
    Location:
    BC, Canada
    While there are many possibilities to explain the problem, the first thing that comes to mind is the fact that an AC motor has a large surge current intake on start-up and this surge current will force a brief drop in line voltage due to the fact that your source resistance on the line is not zero. If you are powering your controller from the same AC line as the motor, then the controller will suffer a brief power dip which is likely to reset it. This problem may be dealt with by using separate line voltage sources, which may be impractical, or by adding additional filtering to the controller DC power supply prior to the voltage regulator (mainly additional capacitors on the DC after the power supply rectifiers). It may take a fairly large capacitance to resolve this.

    Perhaps you can test this theory by briefly powering the controller from a battery instead of from the AC line.
     
    • Thanks Thanks x 1
  4. dave

    Dave New Member

    Joined:
    Jan 12, 1997
    Messages:
    -
    Likes:
    0


     
  5. piccontrollerlearner

    piccontrollerlearner Member

    Joined:
    Dec 31, 2015
    Messages:
    34
    Likes:
    0

    Ok. The relative files are attached here.
     

    Attached Files:

    • sch.zip
      File size:
      90.3 KB
      Views:
      28
  6. piccontrollerlearner

    piccontrollerlearner Member

    Joined:
    Dec 31, 2015
    Messages:
    34
    Likes:
    0
    Ok. But we have tried filtering. It hasn't worked. Though with battery, it operates without resetting.
     
  7. Pommie

    Pommie Well-Known Member Most Helpful Member

    Joined:
    Mar 18, 2005
    Messages:
    10,019
    Likes:
    317
    Location:
    Brisbane Australia
    ONLINE
    We need a schematic we can look at.

    Mike.
     
    • Thanks Thanks x 1
  8. piccontrollerlearner

    piccontrollerlearner Member

    Joined:
    Dec 31, 2015
    Messages:
    34
    Likes:
    0
    Ok.
     

    Attached Files:

  9. jpanhalt

    jpanhalt Well-Known Member Most Helpful Member

    Joined:
    Jun 21, 2006
    Messages:
    5,897
    Likes:
    502
    Location:
    Cleveland, OH, USA
    The fact that it works fine off a battery and not your power supply implies that maybe the esr of your supply is too high, so you are seeing brown-out resets during periods of high current demand. You mention a decoupling capacitor and the schematic shows what looks like "p7" from pin 9 to ground, but no value is shown.

    You may want to consider a larger capacitor (at least 0.1 uF ceramic ). Some devices that are sensitive to such glitches use a decade series of capacitor values in parallel, such as 10uF,1 uF and 0.1 uF or 1 uF, 0.1 uF and 0.01 uF. I have even seen low pass filters (i.e., RC) implemented at the MCU supply pin to smooth noisy supplies.

    What value is "p7"? What value(s) did you try with no improvement?

    John
     
    • Thanks Thanks x 1
  10. piccontrollerlearner

    piccontrollerlearner Member

    Joined:
    Dec 31, 2015
    Messages:
    34
    Likes:
    0
    We have used parallel combination but the problem was still there.
    We have used 104,103 as p7 cap.
     
  11. jpanhalt

    jpanhalt Well-Known Member Most Helpful Member

    Joined:
    Jun 21, 2006
    Messages:
    5,897
    Likes:
    502
    Location:
    Cleveland, OH, USA
    Try a larger cap than 104 (0.1 uF?). Just for testing to localize the problem, try adding a 10 uF.

    John
     
    • Thanks Thanks x 1
  12. RadioRon

    RadioRon Well-Known Member

    Joined:
    Oct 7, 2005
    Messages:
    1,755
    Likes:
    53
    Location:
    BC, Canada
    The surge current into a motor is dependent on a lot of things, but it usually lasts a fair bit of time (on the order of tens to hundreds of milliseconds). I think that a 104 cap is still woefully small to be an effective filter. I would consider upwards of 100uF or more as an experiment.
     
    • Thanks Thanks x 1
  13. piccontrollerlearner

    piccontrollerlearner Member

    Joined:
    Dec 31, 2015
    Messages:
    34
    Likes:
    0
    I really appreciate the help from all of you, but the capacitors 10,100,1000 nf also didn't work.
    One more thing is that, we were using PIC controllers for the same project (single sided) earlier and there was no issue.
    Now we have switched over to ST and double sided PCB, so I was wondering whether the PCB design can cause such problem (i.e. ground plane being too near or far from other layers).
     
  14. RadioRon

    RadioRon Well-Known Member

    Joined:
    Oct 7, 2005
    Messages:
    1,755
    Likes:
    53
    Location:
    BC, Canada
    When I suggested a large value capacitor, I did not mean at P7. The data sheet is clear that P7 should not exceed 3300 nF. My reference to a large capacitor was to put it on the rectifier output across C1.

    I find your schematic is not drawn very well and is hard to follow. Does the primary power for the controller enter at TR1 and TR2 (13VAC)? What is I2? It looks like it might be a 5V linear voltage regulator.

    As for the pcb design, the first question I must ask is how the connections are made from J5 to the relay RL. The motor power contacts should be very well isolated from every other conductor on your control board. By well isolated I mean with no metallic contact to your board conductors or planes, no overlap to your board planes, and at least 5 mm clearance (preferably a lot more clearance) to other traces and planes. If it were me, I would not bring the motor power onto this board at all, I would use an off-board relay to guarantee good isolation.

    A 1HP ac motor, depending on what mechanical load it has, can require more than 5 kW of momentary power to start. I would use a very substantial (ie. large) relay to switch such a motor on and off.

    If the current drain of the uP alone (and its I/O) is small you can put a small series resistance and large shunt capacitor in line with the 5V rail to the uP to act as an additional filter. If your total current consumption from the 5V regulator is small, such a filter is best placed on the input side of this regulator so that it's voltage drop has little effect.
     
    Last edited: Jul 28, 2017
    • Thanks Thanks x 1
  15. RadioRon

    RadioRon Well-Known Member

    Joined:
    Oct 7, 2005
    Messages:
    1,755
    Likes:
    53
    Location:
    BC, Canada
    What program was used to draw the schematic?
     
  16. jpanhalt

    jpanhalt Well-Known Member Most Helpful Member

    Joined:
    Jun 21, 2006
    Messages:
    5,897
    Likes:
    502
    Location:
    Cleveland, OH, USA
    Maybe I misread the schematic. It appeared to me that p7 was attached to pin9, which is VDD. Vcap, which is limited to 3300 nF, is pin8, and was also identified as c3.

    upload_2017-7-28_12-19-12.png

    John
     
  17. RadioRon

    RadioRon Well-Known Member

    Joined:
    Oct 7, 2005
    Messages:
    1,755
    Likes:
    53
    Location:
    BC, Canada
    You are correct, John. My mistake. I guess that illustrates how the schematic could be improved. I still would rather see a larger cap at C1 first, followed by an RC filter between C1 and the 5V regulator.
     
  18. piccontrollerlearner

    piccontrollerlearner Member

    Joined:
    Dec 31, 2015
    Messages:
    34
    Likes:
    0
    Sorry for inconvenient schematic.
     
  19. piccontrollerlearner

    piccontrollerlearner Member

    Joined:
    Dec 31, 2015
    Messages:
    34
    Likes:
    0

    Yes. I2 is regulator IC.

    Separate board for motor may not be possible for us, as we were running products successfully with PIC controller in the same board earlier.

    The filtering you had suggested, couldn't help.
     
  20. piccontrollerlearner

    piccontrollerlearner Member

    Joined:
    Dec 31, 2015
    Messages:
    34
    Likes:
    0
    We are using Altium for designing.
     
  21. piccontrollerlearner

    piccontrollerlearner Member

    Joined:
    Dec 31, 2015
    Messages:
    34
    Likes:
    0
    Also, I wanted to confirm that the problem is hardware related only or not. May there be something that we are missing in the software part? Although necessary precautions have been taken care of.
     

Share This Page