How to make an over-current fuse/switch to avoid damage to a brushless motor

Discussion in 'OnBoard Electronics & Controls' started by BertKu, Aug 15, 2015.

  1. BertKu
    Joined: May 2009
    Posts: 2,478
    Likes: 42, Points: 58, Legacy Rep: 223
    Location: South Africa Little Brak River

    BertKu Senior Member

    Hi ElectricKajak and Porta.
    There are a number of different possibilities for an over-current switch/fuse.
    We will only make a unit for plus 12 Volt line and for +/- 20 Ampere over current .
    The unit is NOT polarity protected, in view that the current has to up to 20 Ampere and for my application even more than 20 Ampere, thus a large diode is a nuisance. You just have to be wide awake when connecting it up.

    Let start with the block diagram.
    For making the printed circuit board we will make it as simple as possible by cutting the tracks on a bare pcb. The software block diagram will do the following.
    Note: the voltage is 5 Volt and thus with a 8 bit (256 steps) processor it means that the 5 Volt is broken down in 5 divided by 256 = 19.53 milliVolt steps. Although the ADC module is a 10 bit module, the microprocessor is a 8 bit processor. and 2 bits will be in the processing shift lost. Thus the current gets measured in 19.53 milliVolt steps = 132 milliVolt ( 20 Ampere) divided by 19.53 = 6 bit ( actual 6.75 bit) and by the 7th bit the MOSfet gets switched off. Thus the MOSfet get not switched off at 20 Ampere, but at 20.52 Ampere.
    Note 2. The sensing can thus be changed by changing the number of 10 milli-Ohm resistors place serial/parallel or in the software by changing the 6/7 bit to let say 4/5 bit.

    In the next thread I will display the software and the photo’s of the module and if it is at all possible a video of the unit and in working. Give me some time to make it.
    Bert
     
  2. BertKu
    Joined: May 2009
    Posts: 2,478
    Likes: 42, Points: 58, Legacy Rep: 223
    Location: South Africa Little Brak River

    BertKu Senior Member

    Hi Porta, Electrickayak. Attached the proposed circuit diagram. I will be out tomorrow the whole day and will only next week put it all together and make any changes if necessary.

    Porta, if you are wondering how to get hold of a programmed microprocessor, you have helped me greatly with the magnet solution for my batteries, although I hope that the heavy currents will not alter the magnetic performance, I will post you one. If I have a few components to spare, I will also include them . I just need in my private box, your poste restante address, or any addtesss, you like to have it send to you. Also I need your resistance for measuring and the current to be switched off. I will have to find out what the power dissipation is of those small surface mounted 10 milli-Ohm resistors. Bert
     

    Attached Files:

  3. BertKu
    Joined: May 2009
    Posts: 2,478
    Likes: 42, Points: 58, Legacy Rep: 223
    Location: South Africa Little Brak River

    BertKu Senior Member

    Here is the provisional software for the PIC12F675. There maybe small changes and it should not be regarded as final. It has to be tested first and I can do that only next week. It is written in assembler, it will be too complex to do it in C and there are no modules for this kind of application.

    include "f675.inc"
    List p=P12F675
    ; Author : Bert Kuijpers
    ; : Private
    ; Date : August-14-2015

    cnt equ 20h
    #define reading gpio,0 ; input current voltage pin 7
    #define Cap-low gpio,1 ; BC337-low pin 6
    #define Cap-high gpio,2 ; BC337-high pin 5
    #define Mosgate gpio,4 ; BC327-gate via BC337-40 pin3
    #define Buzzer gpio,5 ; buzzer pin 2



    org 0x000
    nop ; required for ADC


    goto init
    org 10h ; startup vector

    init

    bsf status,rp0 ; bank1
    movlw b'10000000' ; oscillator adjusted to center 4 Mhz frequency.
    movwf osccal

    movlw b'00000001' ; trisio register AN0 (pin cpio0) = input cpio 1-5 = output.
    movwf trsio

    movlw b'00110001' ; set internal osc A/D from PIC12F675 >>>> pin 2 set as analogue input AN0.
    movwf ansel

    movlw b'00000000' ; settings for Option register.
    movwf option_reg

    bcf status,rp0 ; bank0
    movlw b'00000001' ; settings for Input output. AN0 = input all other ; pins = output.
    movwf gpio
    clrf gpio ; Init GPI0

    movlw b'00000001' ;Settings for Analogue to Digital, left justified.
    movwf adcon0
    bsf adcon0,go ; start the analogue to digital converter.
    bcf Mosgate ; switch MOSfet off.
    bcf Buzzer ; switch buzzer off.
    bcf Cap-low ; switch for Capacitor1 BC337-low off.
    bcf Cap-high ; switch for Capacitor1 BC337-high off.
    start
    call ReadADC
    sublw b'0000011011' ; subtract maximum voltage allowed = ;"0000011011" = 0.133 Volt (10 bit = 5 Volt = 1024 ;= '1111111111' 20 Ampere x 6.66 milliOhm = 0.133 Volt
    ; because we shift 10 bit to the left, we truncate ;2 bit, what is left over = 8 bit >> adresh

    ; adresh = 0h6 in 8 bit version (10 bit left ;justified by 2 positions)
    ; if current voltage is higher = '00000111'i.e 0.136 ;Volt( if current voltage lower = '000000110'i.e 0.117
    ; Volt, because the 10 bit is truncated by the 2 lowest
    ;10 bit digits,
    ;The accuracy is no longer 4.88 milliVolt but 4 x worse
    ; = 19.53 milliVolt per bit. Who cares???

    btfss status,0 ; if carry bit is 1 skip i.e voltage is higher ; if carry bit is 0 voltage is lower or equal
    goto finish
    btfsc status,2 ; if zero bit is 0, skip , voltage is lower
    goto finish
    bsf gpio,4 ;Mosgate switch BC337 and BC327 will open the gate
    bcf status,2
    bcf status,0
    again
    bsf Cap-low ; Switch BC337-low on and fill the capacitor1.
    timeloop
    movlw 0xFF
    movwf cnt
    loop
    decfsz cnt
    goto loop
    bcf Cap-low ; switch BC337-low off
    nop
    nop
    bsf Cap-high ; switch BC337-high on and dump 12 Volt into cap2
    call ReadADC
    sublw b'0000011011' ; subtract maximum voltage allowed = ;"0000011011" = 0.133 Volt (10 bit = 5 Volt = 1024 ;= '1111111111' 20 Ampere x 6.66 milliOhm = 0.133 Volt
    ; because we shift 10 bit to the left, we truncate ;2 bit, what is left over = 8 bit >> adresh

    ; adresh = 0h6 in 8 bit version (10 bit left ;justified by 2 positions)
    ; if current voltage is higher = '00000111'i.e 0.136 ;Volt( if current voltage lower = '000000110'i.e 0.117
    ; Volt, because the 10 bit is truncated by the 2 lowest
    ;10 bit digits,
    ;The accuracy is no longer 4.88 milliVolt but 4 x worse
    ; = 19.53 milliVolt per bit. Who cares???

    btfss status,0 ; if carry bit is 1 skip i.e voltage is higher ; if carry bit is 0 voltage is lower or equal
    goto finish
    btfsc status,2 ; if zero bit is 0, skip , voltage is lower
    goto finish
    bsf gpio,4 ;Mosgate switch BC337 on and BC327 will open the gate
    bcf status,2
    bcf status,0
    movlw 0xAF
    movwf cnt
    loop1
    decfsz cnt
    goto loop1
    bcf Cap-high ; switch BC337-high off
    goto again

    ReadADC
    btfsc adcon0,not_done
    return
    bsf adcon0,go ; start the analogue to digital converter
    btfsc go_done,1 ; check whether A/D properly has read
    goto $-1
    movf adresh,w
    return

    finish
    bsf Buzzer ; at this point the buzzer get switched on with red LED
    loop2
    nop
    nop
    nop
    goto loop2 ;endless loop! 12 Volt to be switched off and over-current will ;be cleared when over-current is re-solved.

    final
    end

    Hope we haven't made too many mistakes. The PIC12F675 cannot handle higher voltages than 5 Volt, thus we have a BC337-40 put in the circuit, which will trigger the BC327-40, which in turn will switch the MOSfet IRFP064N on or off.
    Bert
     
  4. BertKu
    Joined: May 2009
    Posts: 2,478
    Likes: 42, Points: 58, Legacy Rep: 223
    Location: South Africa Little Brak River

    BertKu Senior Member

    Porta, ElectricKayak, Here is the provisional pcb layout. Porta need some information from you to finish yours. i.e. I need to know at what current should the MOSfet switch off and is 12 Volt the correct Voltage or do you want 24 Volt.
    At 24 Volt I must change the voltage double to limit the voltage on the gate of the MOSfet to lower than 24 Volt. Also your Poste Restante or whatever adress you want me to sent complete unit to at no cost to you. (I have decided not to sent you only the microprocessor programmed, but a complete unit). Bert
     

    Attached Files:

  5. ElectricKayak
    Joined: Mar 2015
    Posts: 78
    Likes: 0, Points: 0, Legacy Rep: 10
    Location: Canada

    ElectricKayak Junior Member

    Thanks for posting this Bert.

    Can you describe the required development environment? Run on Windows etc? How much does it cost? Is it easy to use? Also what is the programming interface to the chip? Thanks.
     
  6. BertKu
    Joined: May 2009
    Posts: 2,478
    Likes: 42, Points: 58, Legacy Rep: 223
    Location: South Africa Little Brak River

    BertKu Senior Member

    The development platform is Microchip, MPlab, which runs under Linix or Windows.
    The cost basically lies in 3 items. 7405 +/- 1/2 dollar, PIC12F675 approx 3 dollar and IRFP064N approx 2 dollar the rest is probably in total 1/2 dollar. The problem is that normally I buy in quantities. A good price idea is www.Mantech.co.za basically 13 Rand = 1 USA dollar. Printed circuit board, you can make yourself. Buy a few off cuts from a printed circuit board manufacturer. In the software are the 2 parameters embedded, the maximum current. I wrote it in assembler. Easy to follow and with little knowledge and lots of logic, you can work it out yourself. The platform is free of charge downloaded from their website. You need some experience not to get lost in what to do.

    I am battling with my film layer and if you wait for a few days or even maybe a week, I might be able to make one for you at no cost.
    However it depends totally whether I can get the film layer in this cold weather to act properly. I have only 3 blank IC's here and haven't checked how easy it is to get.

    The unit is dead simple. You connect the minus to minus and plus to plus. Should there be an overload of a few miliAmpere the software goes in a loop and by switching your plus off and on again it clears itself.

    I haven't heard from Porta. I promised him one at no cost. If he does not take my offer up, I can make a plan for you.
    Bert
     
  7. portacruise
    Joined: Jun 2009
    Posts: 1,101
    Likes: 29, Points: 48, Legacy Rep: 218
    Location: USA

    portacruise Senior Member

    Sorry for the delay Bert, have been unavailable. If you can give me 24 hours of delay, I can get back to you. If you are pressed for time, or don't hear by then, go with alternate plans. And thanks for your generous offer!

    Porta
     
  8. BertKu
    Joined: May 2009
    Posts: 2,478
    Likes: 42, Points: 58, Legacy Rep: 223
    Location: South Africa Little Brak River

    BertKu Senior Member

    Thank you Porta, no pressure of time. It is raining and then I cannot make printed circuit boards. I don't like to get rust in my tools in my workshop due to the chemicals used. I always do it outside weather permitting. Thus you have all the time. Bert
     
  9. ElectricKayak
    Joined: Mar 2015
    Posts: 78
    Likes: 0, Points: 0, Legacy Rep: 10
    Location: Canada

    ElectricKayak Junior Member

    I can see that... LOL

    I was looking at their site and am getting the basic concepts except I'm not clear on what is actually used to burn the IC and at what cost? Their PICkit 3 seems to do this (at $50-$75) although I think only in-circuit. Your schematic doesn't show a programming connection. How do you burn the IC?
     
  10. portacruise
    Joined: Jun 2009
    Posts: 1,101
    Likes: 29, Points: 48, Legacy Rep: 218
    Location: USA

    portacruise Senior Member

    OK, thanks. I like to catch up on sleep during rare rain periods here..
    Your circuit would be used on a brushed motor with 2 speed resistor control, so wonder if it will still work? What measured dimensions will the circuit be? I am presently using a DC thermal? type circuit breaker (feels warm when tripped) rated for 1.5 amps but it trips unreliably at above 2 amps, have been looking in surplus places for magnetic type with lower ratings.

    Some background:
    I run 24V kick boats at 100% power to 3 knots about 95% of the time and the other (resistor) speed (besides off) is slider adjustable from 50% power up to maximum power as needed. I do have a PWM but found I don't really need it for such slow speeds plus it has burned when used with the instant panic on/off switch (arcs?). First time (or disabled, elderly) guest riders on my trips with the other 2 boats find that flipping a prominently placed toggle is more user friendly than having to locate and fiddle with a ESC dial.

    PC
     
  11. BertKu
    Joined: May 2009
    Posts: 2,478
    Likes: 42, Points: 58, Legacy Rep: 223
    Location: South Africa Little Brak River

    BertKu Senior Member

    Hi Porta,
    your application.
    1) No, I cannot make it variable, because the cut-off is dictated by 4 x 10 MilliOhm resistors and when the current of 2 Ampere flows through, it create a voltage of 80 MilliVolt. The Analogue to Digital converter is in the program set for anything over the 5 bit or equal (i.e. 19.53 x 4 = 78.12 Milli-Volt and 5 bit = 97.65 Milli-Volt which represent 2,44 Ampere. If this is not acceptable to you, then we must set the ADC to 4 bit i.e. it cuts at 1,953 Ampere or any current above this level. My recommendation is to set it at 5 bit i.e. 2,44 Ampere.
    2) If you need to change the level, you have to ask somebody from Microchip to help you to convert the program from 4 or 5 bit to whatever you like to have, 6 or 7 or whatever.
    3) The 4 resistors 10 Milli-Ohm, can handle each 0.75 watt i.e. ; total maximum power consumption below 75 degrees = 3 watt. ( maximum 8 Ampere)
    4) Are you happy that the interval time between measuring the over current is 64 – 80 Micro-second. It takes 60 Micro-second to fill the Electrolytic capacitors. i.e. should it senses an over current , within 2 Micro-Second it will go to a loop and switch the MOSfet off. All in all a few more Micro-seconds. As soon I have it all working for you at 24 Volt, I will communicate with you and seek your permission to post it at no cost to you.
    5) If you are unhappy with 64 -80 Micro Seconds, I can change the program and test the over current 4 or 6 times in the main loop. Now it is measured only twice in the main loop.
    6) I have to figure out a way to limit the voltage doubler 2 x 24 Volt and in view the MOSfet sits in the plus line, the gate is not allowed to get more than 20 Volt ABOVE the 24 Volt plus line, preferable 10 – 12 Volt above the 24 Volt. But I have a few ideas how to do it.

    Bert
     
  12. BertKu
    Joined: May 2009
    Posts: 2,478
    Likes: 42, Points: 58, Legacy Rep: 223
    Location: South Africa Little Brak River

    BertKu Senior Member

    Hi Porta, I am considering to place a 12 Volt zener-diode between the diode and the electrolytic capacitor (that should lower the voltage to 12 Volt on top of the 24 Volt. ) . I just have to try to get a 1 or 2 watt zener-diode, to handle the influx current to the capacitor. I cannot place a resistor in series, otherwise we are getting a time delay. I have a major problem with my Internet service provider and am on and of and on and off etc again and also the weather does not suits me. Need to make first the pcb's then we can communicate how we solve your dual. You have to give me some days. Bert
     
  13. BertKu
    Joined: May 2009
    Posts: 2,478
    Likes: 42, Points: 58, Legacy Rep: 223
    Location: South Africa Little Brak River

    BertKu Senior Member

    Yes that is done by the software. However you need a product to connect the USB or serial port from the computer/laptop to the IC or IC with build up board and download the software directly to your build up printed circuit board. I personally do not think, it is worth while for you to purchase a "PICkit 2" or "PIC start Plus" or a " MPLAB ICD 3" or any other platform. Except if you are getting excited and also start programming and solving small problems. In that case it is fun to create programs and make things happening. In the meantime I should wait if I were you and see what I can do for you. Bert
     
  14. portacruise
    Joined: Jun 2009
    Posts: 1,101
    Likes: 29, Points: 48, Legacy Rep: 218
    Location: USA

    portacruise Senior Member

    Thanks, Bert. Your approach is quite clever, and I am interested in how this works, but not in a hurry, so take whatever time you need. It would not make sense to put you through all the work, if your system does not coordinate well with such a low power boat propulsion system as I have. I do have numerous other high power battery projects where such a clever creation would be useful though. Comments posted below.
    PC

     

  15. BertKu
    Joined: May 2009
    Posts: 2,478
    Likes: 42, Points: 58, Legacy Rep: 223
    Location: South Africa Little Brak River

    BertKu Senior Member

    Thank you

    Yes it is Celsius. At higher temperatures, the 8 Ampere has to be reduced. In case like I have made a controller for up to 400 Ampere, I have 20 x 10 Milli-Ohm parallel and 20x in serial. i.e. 1 Milli-Ohm in total. At 100 Ampere it is 100 Milli-Volt and only consumes 10 watt, while the maximum allowed is 28 Watt, good enough to measure and take action. For higher currents, I have to increase the number of parallel/serial resistors.

    All what you have to do is to change the subtraction from the reading in the program. i.e. if you want 6 Ampere, you make it 12 bit ( subwl '00001110' ) and the same resistors. If 4 Ampere, 'subwl '00000100' If 1 Ampere (subwl '00000010'.
    But if you want a higher current, you have to add 10 Milli-Ohm resistors to the pcb. i.e. at 20 Ampere and change the program to a corresponding subtraction value.

    If it is too sensitive, you may have to place a large value capacitor over the 40 Milli-Ohm, corresponding with the expected spike, but you will slow the switching off the motor if you use let say 1 Farad = 40 millisecond instead of 64 Micro second. By 1 uF polycarbonate cap, it is 40 nanosecond. I don't expect spikes, as the spikes will be after the MOSfet and not before. A diode in the opposite direction will cut any spike. i.e. the anode to the plus. Time period of reset is 3 or 4 seconds, to enable to reset the micro processor and start from start. If it comes to the worst, you have post me the uP back and I have to reconfigure it, when you cannot find somebody to help you.
    Bert
     
Loading...
Forum posts represent the experience, opinion, and view of individual users. Boat Design Net does not necessarily endorse nor share the view of each individual post.
When making potentially dangerous or financial decisions, always employ and consult appropriate professionals. Your circumstances or experience may be different.