problem with pic circuit

Discussion in 'Embedded Systems and Microcontrollers' started by kyu9971, Jan 28, 2016.

  1. kyu9971

    Thread Starter Member

    Mar 28, 2015
    57
    3
    hi everyone,
    i have an problem with an circuit based on pic18f2550.
    the circuit purpose is supply an water pump when the voltage of battery reaches the value of 13,5 volt and remain on for 10 minutes.
    while on the bench is ok (i have simulated the pump with a led), when i connect the circuit to the pump and the voltage reaches the fix value (13,5), the pic gone reset.
    the 12 volts battery is recharged with an fotovoltaic modul while the pump have a power of 30 wh /12 v.
    anybody can suggest me an way for solve this problem.
    thank you so much everyone
     
  2. MaxHeadRoom

    Expert

    Jul 18, 2013
    10,550
    2,374
    Do you have a proper pull up for the MCLR?
    Also you may not have suitable decoupling and if a uni-directional pump you could fit a BEMF diode, how are you switching the pump?
    Max.
     
  3. Brownout

    Well-Known Member

    Jan 10, 2012
    2,375
    998
    Are you connecting the PIC IO directly to the pump? Ah, Max got there first.
     
  4. kyu9971

    Thread Starter Member

    Mar 28, 2015
    57
    3
    the pump is connected to the via an relais 12v and between it and the pic there is an npn transistor.can be the problem caused from the pump that is an inductive load?and as i can solve this?
     
  5. MaxHeadRoom

    Expert

    Jul 18, 2013
    10,550
    2,374
    Are your two supplies isolated from each other?
    Does the relay coil have a BEMF diode?
    Max.
     
  6. kyu9971

    Thread Starter Member

    Mar 28, 2015
    57
    3
    i am doing some test and i could see that if i connect the pump after the swithing of relais, the pic not reset, while it is reset when the pump is connect before the switching.
    on the relais coil i have mounted ad 1n4148.
    the supply is common for pump and pic.
     
  7. kyu9971

    Thread Starter Member

    Mar 28, 2015
    57
    3
    i measured the voltage between the pin 1 for supply the pic and ground ,when is reset and it is 5,07 v, it not drop. for supply the pic i used an voltage regulator lm7805 connected as its datasheet
     
  8. kyu9971

    Thread Starter Member

    Mar 28, 2015
    57
    3
    i doing other test. i replaced the pump with an 10w led light with it, is reset always, also if i attach the bulb after the switching relay.for moment i doing test with the battery (12v/12Ah) and i modified the code into the pic so as get the switching at 12,3v.in this moment the battery measured 12,7v, but the led light it is just a flash.
    practically i turn on the circuit, the relais do "tic" the ligth it is just a flash and the pic is reset.
     
  9. kyu9971

    Thread Starter Member

    Mar 28, 2015
    57
    3
    i separated the supply with 2 battery.one for pic and one for pump . now is ok and the pic not reset more, but as can do for supply with only one battery?
     
  10. ErnieM

    AAC Fanatic!

    Apr 24, 2011
    7,392
    1,605
    To really be helpful a schematic of your work will go a long way.

    And if it is not too much to ask take a decent picture of your build.
     
    absf likes this.
  11. kyu9971

    Thread Starter Member

    Mar 28, 2015
    57
    3
    i attached two picture of my job, but for diagram i have only the schematic on paper
    drawn manually and it is not very clean . i hope that with the picture can you have an idea of situation . anyway the circuit work ok only without load in output. if i connect the pump or an led light 10 w the pic is reset when relais switching on.
    I hope I explained correctly
     
  12. Picbuster

    Member

    Dec 2, 2013
    374
    50
    You are facing a power dip as result of switching the motor on.( internal motor resistance low so current high)
    To solve this:
    Split motor circuit from pic.
    Couple the pic via a diode resistor of 50ohm and a 1000uF capacitor.
    two +V wires running from your battery one to the motor
    The other +V one via 50 Ohm and diode to +1000uf minus to PIC gnd the +1000uF goes to the input of the 5V lm7805.
    ( the cap 1000uF will act as a battery) and diode will stop Vbatt go low as motor start.
    The relay coil should be fed directly via +Vbatt.
     
    absf likes this.
  13. Picbuster

    Member

    Dec 2, 2013
    374
    50
    A small schematic for explaination
     
  14. ErnieM

    AAC Fanatic!

    Apr 24, 2011
    7,392
    1,605
    You can use your camera to take a picture of your schematic.
     
  15. kyu9971

    Thread Starter Member

    Mar 28, 2015
    57
    3
    i see schematic that you have posted, and i found many differents from my schematic .
    i not never used the schottky diode and ask to you if possibile use that in picture .
    for supply the pump i used only one contact of relais (positive) while the negative is connected directly to ground .
    the relais is drived with an npn transistor "c945" but you speak of mosfet , what type?
    for supply i used an lm340t05 (7805) with two disc capacitors from 10000pf (maybe these are wrong) .
    in input i mounted an electrolitic capacitor from 1000uf/16v while in output i mounted an more small always elettrolitic capacitor from 100uf/25v .
    in input to the circuit there is an capacitor 10uf/50v .
    at this point i believe that i have wrong many things .
    300120163306.jpg i attached a parts of my schematic so you can see my errors . 300120163308.jpg 300120163310.jpg 300120163311.jpg 300120163312.jpg 300120163313.jpg
     
  16. kyu9971

    Thread Starter Member

    Mar 28, 2015
    57
    3
    this is the complete diagram 300120163314.jpg
     
    absf likes this.
  17. kyu9971

    Thread Starter Member

    Mar 28, 2015
    57
    3
    i solved with an 1000 uF capacitor , 50 ohm resistor and schottky diode in input to the circuit before of the lm 7805 as the Picbuster schematic .
    while, with an 50 ohm resistor and schottky diode after the lm 7805, the pic not work for the voltage low.
    thank you so much for your helped
     
Loading...