arduino Controlling Circuit Hangs when controlling 230v ac fan using a relay

Discussion in 'Embedded Systems and Microcontrollers' started by Patel Jyotin, Aug 22, 2016.

  1. Patel Jyotin

    Thread Starter New Member

    Aug 22, 2016
    9
    0
    hi.......
    i have made a circuit for controlling home appliances like light fan etc.
    when i control lightning load arduino works fine but when control fan or operate fan after two or three time operation it hangs/freeze the arduino.
    i m using atmega 328 ic, uln2003, 12v relay for controlling 230v ac load.
    i have attached the PCB Diagram with thread.
     
  2. Papabravo

    Expert

    Feb 24, 2006
    10,136
    1,786
    The sheets of a layout is not much to go on for a problem that may involve you application code. How about a schematic diagram and the code for your sketch.
     
  3. Alec_t

    AAC Fanatic!

    Sep 17, 2013
    5,773
    1,103
    Welcome to AAC!
    Can you post your schematic?
     
  4. ErnieM

    AAC Fanatic!

    Apr 24, 2011
    7,386
    1,605
    Yep, need that schematic.

    What is your plan to suppress the relay kickback?
     
    MaxHeadRoom likes this.
  5. MaxHeadRoom

    Expert

    Jul 18, 2013
    10,509
    2,368
    @ErnieM +1 if no diodes used across the relay coils.
    Max.
     
  6. Patel Jyotin

    Thread Starter New Member

    Aug 22, 2016
    9
    0
    i dont have any plan for that i will send you my schematic and circuit diagram.
    actually i m controlling fan speed by triac firing i have used zero cross detector.
    for triac firing i m using moc3021 optocoupler.
    my problem is when i on and fan rapidly microcontroller got freeze.
     
  7. Patel Jyotin

    Thread Starter New Member

    Aug 22, 2016
    9
    0
    here is my schematic, kindly give me solution

    Mod edit: added image of Atmega 328 pin functions.
    [​IMG]
     
    Last edited by a moderator: Aug 23, 2016
  8. Patel Jyotin

    Thread Starter New Member

    Aug 22, 2016
    9
    0
    Hey Max what will be possible solution for this problem kindly suggest me.
     
  9. MaxHeadRoom

    Expert

    Jul 18, 2013
    10,509
    2,368
    As long as you have pin 9 of the ULN2009 connected to +ve supply then you have this feature already.
    Max.
     
  10. Patel Jyotin

    Thread Starter New Member

    Aug 22, 2016
    9
    0
    any other suggestion that i can change in my schematic to solve my problem
     
  11. KeepItSimpleStupid

    Well-Known Member

    Mar 4, 2014
    1,138
    200
    You probbably have a software algortithm issue if you can control lighting and not motors.

    The triac turns off at both zero voltage AND zero current AND they don;t occur at the same time for motor loads.

    If speed is proportional to V, the the first is to map phase angle with the RMS of V.

    The second is to constantly PULSE the triac and turn off the pulses when the time is up and control only a half cycle.

    You CAN'T just wait for a zero crossing, wait and turn the triac on. Won't work for motors. It will work for lighting.

    Aside: If your doing heating, it best to use phase angle vs the RMS of V^2.

    Understand the design of the zero cross detector. It can be important.
     
  12. MaxHeadRoom

    Expert

    Jul 18, 2013
    10,509
    2,368
    Are you earth grounding the motors?
    Max.
     
  13. Patel Jyotin

    Thread Starter New Member

    Aug 22, 2016
    9
    0
    no there is no grounding.
     
  14. Patel Jyotin

    Thread Starter New Member

    Aug 22, 2016
    9
    0
    hey ErnieM will you give me suggestion it will help me lot. please help me.
     
  15. Patel Jyotin

    Thread Starter New Member

    Aug 22, 2016
    9
    0
    do you have any suggestion for changes in schematic.
     
  16. MaxHeadRoom

    Expert

    Jul 18, 2013
    10,509
    2,368
    Is grounding just not used or not available, if it is try grounding the frame of the motors, this is a customary standard in most parts of the world.
    Max.
     
  17. Patel Jyotin

    Thread Starter New Member

    Aug 22, 2016
    9
    0
    by putting 0.1uf capacitor near to microcontroller solved my problem somewhat but problem not solved completely. any other suggestions by experts needed.
     
  18. ErnieM

    AAC Fanatic!

    Apr 24, 2011
    7,386
    1,605
    Add lots more 0.1 uf caps across the board. One at every device as close as you can.

    Can't tell what C2 is, should be a nice tantalum cap say 10 uf, PLUS a 0.1 too.
     
Loading...