ON/OFF RELAY CIRCUIT WITH 30v SUPPLYand 5V supply and two picaxe.

JPU

Senior Member
Hi All

Can someone help me out or point me to some ideas please.

I currently have a 30V battery operated device. The circuit is split into 2 halves, 1 side operates at 22-30V from a battery and the other side of the circuit operates at 5V which takes the power from the 30V supply via a 5 regulator. I have two pic axe chips on the 5v side which deal with output to an LCD (18m2) and control (14m2) a daughter board connected to the 30V side of the circuit which controls a brush less motor. I currently have a 10A 30V rated on/off switch on the DC power from the battery. However I have miniaturised this circuit board and I would like to also now use a smaller power switch, however I can not find anything suitable as there are no suitable small switches which can operate at the required 10amps. SO I have an idea of using a small momentary switch to startup the circuit and then use a relay to keep the circuit live once the momentary switch is released.
Essentially I am after some advice on how this might work or some pointers to known methods. I can understand how I might get the momentary switch to power the circuit as I cold use a spare pin I have on one of the PICs but if anyone could offer a simpler solution or pointers to pit falls then I would be grateful. Space is at a minimum on the PCB and within the container of the electronics. (If using a relay is the best option , can anyone suggest a very small suitable relay.)

Any help appreciated.

Thank you.
 

premelec

Senior Member
Please be more specific than "very small suitable" - what physical size? What peak current etc.. there are small automotive relays that might work for you - nominally 12vdc coil but can be made to work at a lot less...
 

JPU

Senior Member
I have a small area left within the enclosure. The relay would need to be smaller than 15mm x 15mm x 15mm. The peek current is 10Amp.
 

JPU

Senior Member
Does a circuit which can do this type of job have a name or specific reference as id like to look it up on the net to get help on the design and layout. I've tried searching but as an amateur I am not sure what I need to search for?
 

Jeremy Harris

Senior Member
I use ground-side FET switching to switch a few tens of amps using a Picaxe pin. For 10A maximum a single, low Rdson FET would do the switching just fine, something like an IRLB3034 will work well, as it will only drop around 14mV at 10A, and wouldn't need any form of heatsink.

You would need to be able to accept ground-side switching, though. As an example, here's the circuit for an RFID activated power switch that I used to turn an electric bike battery on and off: http://www.picaxeforum.co.uk/showthread.php?21195-Electric-Bike-RFID-Power-Switch that may help.
 
Last edited:

hippy

Technical Support
Staff member
It would be much easier to use an ON-OFF switch as before rather than a momentary switch -

Code:
                   \
                    \
30V >---.--------O   O---> 30V To circuit
        |          :
        O /        :
         /         :
        O          :
        |          :
        `----------.
                   )  Relay
                   )
        .----------'
        |
0V >----^----------------> 0V To circuit
 

JPU

Senior Member
Thanks for you help here. As always I had over thought the problem and I was considering a setup similar to that which Jeremy suggested. Using a similar method would allow me to incorporate "auto off" and a host of other features. I hadn't even considered the simple solution which Hippy suggested which is perfect for my current requirement. Thanks guys.

A quick look on Farnell and I have found this relay

The coil is rated to 48V but would a voltage of 20V be enough to activate the coil? How can I tell this from the technical specifications as I have read a few technical sheets for other relays which give the coil rating but not the minimum activation voltage. The tech sheets often mention release voltage but I assume this is will be much lower than activation voltage?

Any help appreciated.
 

premelec

Senior Member
20 volts on 48 volt coil shouldn't activate the relay... could work on 24v relay ok... release volts often higher than 1/2 operating... give yourself some margin on the contacts rather than just barely handling the current... and voltage...
 

JPU

Senior Member
HI

Ive just noticed it specified a max 75% of rated coil current required to operate relay in the tech doc. However if I use a 24V (coil rating) relay then I will be operating the coil beyond its rated value when my battery is fully charged (approx 30V). Is there a simple work around?
 

premelec

Senior Member
calculate the power dissipation in the relay coil for 24 vs 30 volts... (V^2)/R ... 1.56 x power dissipation in coil from 24 to 30... if relay resistance is 3000 ohms .3 watts at 30v and .19 at 24v - likely not a problem... however if you are worried you can add a series resistor to the relay coil ... educated guesses...
 

premelec

Senior Member
i agree with that if it's not too big for him... and i've seen them less expensive at auto parts store... ;-0
 

JPU

Senior Member
Hi

I have some small relays on order to play around with and test. I have been bread boarding a circuit today with a N channel mosfet. I used a P20NF06L MOSFET. I find it hard to believe this little mosfet can handle 60V at 20A? Am I interpreting that correctly?

I did make up a small circuit initially with a Picaxe to test the principle and using the picaxe I managed to get a momentary switch to send a 5V signal via the picaxe to the fet and it worked. So in theory I can now control the mosfet to sink my 30V device with a push-button momentary switch operating with a picaxe and a secondary supply at 5V.

Question: Could I eliminate the picaxe all together and the 5V supply and somehow use just the mosfet and my 30V supply and a latching switch. The problem I see is that the gate and drain would be at the same voltage. Is this acceptable? It worked on my breadboard but long term, would this work ok?

Thanks for looking and helping.
 
Last edited:

Jeremy Harris

Senior Member
That FET has a pretty high Rdson, at 70 mohms. That's around 50 times the voltage drop of the IRLB3034 I mentioned earlier, at around 700mV at 10A, That means the FET is going to have to dissipate 7 watts at 10A, and so will need a heatsink, whereas the IRLB3034 would only dissipate around 0.14 W at 10 A and wouldn't need a heatsink as it would barely get warm at that current.

Rdson is the critical parameter for FETs used as power switches like this, the lower the better.
 
Last edited:

JPU

Senior Member
Hi Jeremy

I used the P20NF06L MOSFET as I had one in my box of bits. I was just trying to figure out how it all went together and if I could get a picaxe to work with a fet. It did work and so I will take your advice on the suggested fet to use.

Are you able to help with my question, "Question: Could I eliminate the picaxe all together and the 5V supply and somehow use just the mosfet and my 30V supply and a latching switch. The problem I see is that the gate and drain would be at the same voltage. Is this acceptable? It worked on my breadboard but long term, would this work ok?
"

Thanks
 

premelec

Senior Member
You don't need much current at all in the switch in that circuit - however you do need - with some FETs to _limit_ gate voltage and this can be done by putting a resistor in series with the switch and/or a zener diode from the gate to drain. Basically make a voltage divider which still comes up with enough Vgs on. You are switching into a capacitor [the gate capacitance] so the resistors simply need to provide enough current to charge that capacitor [and discharge it ] in acceptable time. Look at the data sheet for acceptable gate voltage range.
 

Jeremy Harris

Senior Member

Jeremy Harris

Senior Member
Hi Jeremy

I used the P20NF06L MOSFET as I had one in my box of bits. I was just trying to figure out how it all went together and if I could get a picaxe to work with a fet. It did work and so I will take your advice on the suggested fet to use.

Are you able to help with my question, "Question: Could I eliminate the picaxe all together and the 5V supply and somehow use just the mosfet and my 30V supply and a latching switch. The problem I see is that the gate and drain would be at the same voltage. Is this acceptable? It worked on my breadboard but long term, would this work ok?"

Thanks
As above, just choose a pair of resistors as a potential divider to drive the gate within it's safe operating voltage range. Aim for around 6 or 7 V at the gate with the switch on and you should be OK. Switching time isn't super-critical, in fact I deliberately slug the switching time down with my electric bike power switch, as there are some big capacitors in the brushless motor driver that draw a great deal of current at switch on, so overall it's better to apply power over a few tens of ms to allow them to charge more slowly and keep the peak current down as the switch operates.
 

Jeremy Harris

Senior Member
What would be the reason for using a zener diode?
It depends how stable your 30V supply is, really. You need to make sure Vgs (the gate to source voltage) is high enough to fully turn on the FET (say, up to about 10V or so) but not too high as to exceed the maximum allowable Vgs (the gate to source voltage from the data sheet).

From the IRLB3034 datasheet, Vgs max is +20V, and to get a decent Rdson (the ON resistance of the FET) you need between 4.5V and 10V at the gate, around 10V would be slightly better. Something as simple as two series resistors of around 10k at the top and 4k7 at the bottom, with one side connected to 0V, the centre point connected to the gate and the upper point connected to the switch which has its other side connected to 30V, should be fine. This will give you around 9.6V at the gate with a 30V supply and to exceed the FET Vgs max rating the supply would need to be over 60V, so there is a large margin of safety. It won't switch the FET very fast, but if you have any capacitance at the load side then this is an advantage.
 

JPU

Senior Member
Thank you for that detailed explanation. I think I understand it now. Ill breadboard this up tonight. Thanks
 

mortifyu

New Member
Hi JPU,

A FET can be considered a "VOLTAGE dependent device" rather than a "CURRENT dependent device" such as a standard NPN or PNP transistor. To switch a FET ON it only requires a voltage to be presented between gate and source. The current drawn by the gate in this case will only ever literally be 100 nano amps MAX.

I see you question if this little device can actually handle such Drain-Source current draw? Absolutely it can, and then some, with no issue. This is simply because the RDS ON resistance being so amazingly low means there is not going to be any heat that requires dissipating. With the FET's junction being turned on so well, one can almost consider it as good as a piece of wire that just happens to be electronically switchable :)

To achieve the lowest possible RDS ON which will allow a FET / any FET to switch it's MAXIMUM rated current, the FET needs to be turned on at vGS MAX, or at least close as possible to it. This is demonstrated for you in the datasheet graphs.

As you are not going anywhere near MAX rated DS current, around 10vGS is well sufficient.


Using a ZENER diode? This would merely provide an absolute ceiling voltage limit between your gate and source, but a voltage divider is much cheaper and easily suitable for your application.



Also, keep in mind that you could switch this FET on and off at your leisure using a picaxe quite simply with something like a BC547 NPN transistor.




LOVE FETs, LOVE technology. Tis all soooo cool and getting better by the day. 100 years from today... the mind can only boggle.


Regards,
Morty.
 

Circuit

Senior Member
Hi

To achieve the lowest possible RDS ON which will allow a FET / any FET to switch it's MAXIMUM rated current, the FET needs to be turned on at vGS MAX, or at least close as possible to it. This is demonstrated for you in the datasheet graphs.
I do not interpret the datasheet graphs in quite the same way; the Vgs MAX is the absolute maximum rating before safe limits are exceeded and damage occurs. Operating conductivity usually occurs well below the Vgs MAX value; in the case of the IRLB3034 the datasheet shows the current pretty well maxing out at a Vgs of 8 volts with a very high workable value at 4.5 volts on the gate. Certainly with a Vgs MAX of 20 volts and a Vgs(threshold) of 1volt (min) and 2.5volts (max) I would not see any advantage to operating this device above 10 volts on the gate. This also corresponds with the absolute maximum drain current of 195 amps which is quoted with a Vgs of 10 volts. This is not a lot different from the datasheet-specified 172 amps at a gate voltage of 4.5 volts.
 

JPU

Senior Member
Hi All

Thanks for all your help on this. Please can you take a look at the circuit included.

I am hoping that when the push button switch is pressed, the Picaxe will startup and then detect the depression of the switch and activate the Mosfet which will then maintain power to the whole circuit.


Would this work in reality or are there obvious errors I have made?

Thank you, (very Nube!)

JPU

picaxe control mosfet cirucit.jpg
 

Attachments

AllyCat

Senior Member
Hi,

Sorry, I don't see how even the embedded diagram (let alone the Thumbnail attachment) can work. When the pushbutton is released, the regulator (and thus the PICaxe) loses any supply of power and everything will switch off (after a brief delay whilst the capacitors discharge).

AFAIK what you want to achive cannot be done with less than a high-side switch (across the pushbutton), isolated (or at least voltage-offset) from the PICaxe. That needs for example a relay, or a PNP + NPN pair of transistors (rated to at least 30 volts each) and a few resistors.

But it seems you have a battery rated for 10 Amps at 30 volts (i.e. 300 watts). Is the 0.6 mA (or less) continuous current drain by a PICaxe (or even the 5 mA of the present LM340 regulator) really significant?

Cheers, Alan.
 

JPU

Senior Member
Hi Alan

Sorry, I wasted your time. I did put the wrong schematic up originally and then I tried to to replace it with another (incorrect) schematic, but I can't believe I even thought for one minute that it would work!!! Embarrassed!

For what its worth (nothing) this was the image I wanted to put up.



I wish I could delete my last post.

Thanks, Ill have another go and be back..
 

Attachments

Jeremy Harris

Senior Member
Choose your FET carefully if only driving it from logic level, it will need to be a logic-level gate threshold FET, as running close to the Vgs minimum for turn on is not good practice. As suggested before, a voltage that's well above Vgs minimum is needed at the gate for lowest Rdson, and generally Vgs doesn't need to be higher than around 1/2 Vgsmax. In the circuit I linked to earlier, I used a simple transistor interface to provide sufficient gate drive voltage, with the transistor driven by a Picaxe pin; that works very reliably.

You also need to ensure that when the FET turns on it turns on the supply to the voltage regulator, as pointed out above, with a push button this won't happen the way you have it at the moment. Finally, you have to consider how to turn the power off again. A Picaxe can commit suicide and turn it's own power supply off, it's what the power switch on my current electric bike BLDC power control does, but to make life easy (i.e. stick with N channel FETs because they have a lower Rdson) it means having the battery negative rail only connected to the Picaxe and switch circuit. A push button to the battery negative can then be used to only connect the Picaxe supply, and the Picaxe turns the FET on as soon as it powers up, so the button can be released and power stays on. This needs some care with design to prevent the push button taking the full load current.

All told, I'd just switch a FET directly with a small switch for your application - simple, few components needed, reliable, no need for any Picaxe code, just a switch, two resistors and a FET.
 

JPU

Senior Member
HI Guys

Im still cringing with embarrassment at my recent post! I have revealed my true colours to be truly a Nube!

Thanks for sticking with me on this and Im going to come up with an alternative circuit, hopefully today, that Ill post up. (taking on board your advice).

I'd like to stick with my chosen method for this device as I am very amateur at electronics and its all about the building it,making mistakes and in the process learning how todo it, for me.

Ive had a quick look at the Picaxe shop and there is some software there called PICAXE VSM. Is this a worthwhile buy for me? Would I be able to construct this circuit using the software and then spot obvious errors before I post them on line?

Thanks.
 

JPU

Senior Member
Ok, I have had another go!!


Looking forward to any help please, Will this work?

The obvious problem I can see is that when pressing the switch for the second time (which should cause the Picaxe to power down by stopping the flow of electricity to the transistor and therefor the FET gate) the circuit will probably restart instantly before the user has time to remove their finger from the button? :confused:

Any advice appreciated?

Thanks
 

Attachments

AllyCat

Senior Member
Hi,

No, sorry that won't work either:

If the FET were "off", then the regulator, PICaxe, etc, would all be pulled by the battery positive terminal to 30 volts. At best, that will switch the FET on (partially) all the time, but more likely will destroy the FET by exceeding its absolute max Vgs rating.

As mentioned above, AFAIK the "simplest" method is a PNP high-side switch (emitter to battery + terminal) with the push-button across its c-e, which applies voltage to the regulator input (and thus the PICaxe, etc.). Its base must also be at 30 volts, so it needs to be driven by a discrete NPN low-side switch (also rated at > 30 volts), driven by a PICaxe output pin. Of course the base drive currents must be limited, the minimal configuration being a single resistor between the emitter of the NPN and ground (an emitter-follower, current-source configuration).

Cheers, Alan.
 

AllyCat

Senior Member
Hi,,

Yes that could work, IF the "PNP" transistor were replaced by a 10 Amp P-channel FET (with a 4k7 resistor across its gate-source terminals). They're not as good or easily available as N-channel, and also you again have the full load current passing (initially) through the pushbutton. Also, note that the PICaxe has no way of "knowing" when the push-button is pressed, only that it was pushed (because the PICaxe is now receiving power).

You could turn the whole circuit "upside down" (which I believe Jeremy described using several pages back) with the PICaxe "hanging down" from a "positive earth rail" and the negative battery terminal feeding a negative supply rail (-30 v). That would allow the use of an N-channel FET, but you would still need a PNP transistor, and now a negative voltage regulator (e.g. a (LM) "7905" is the inverse of the classic "7805" regulator) feeding the earth of the PICaxe.

However, the way I would modify your latest circuit is to connect the positive LOAD terminal directly to the battery + terminal and add the N-channel FET as previoulsy discussed, between the LOAD negative terminal and the battery negative terminal. The gate of the FET could be connected "directly*" to either the present PICaxe output pin or to any other output pin.

* Generally it's recommended to connect a resistor (perhaps 1k in your case) in series with any FET gate, and a high value resistor (perhaps 100k - 1M) across its gate-source (to ensure the FET is off whilst the PICaxe is starting up and it outputs floating).

If the PICaxe needs to "know" when the button is pressed (again) then you will need either another pole on the button, or move the button to a position where it interfaces directly with the NPN tansistor. Perhaps feeding some current into its base, with a second pin of the PICaxe detecting the voltage from the button.

Cheesr, Alan.
 

JPU

Senior Member
Hi

I think I might be getting close now??

If so, what would be the correct way to connect the gate of the FET and the base of the NPN transistor so that I only use one Picaxe pin to control both at the same time. (do I just link them together?)

Can I use the diode in this way so that pressing the switch a second time will signal the Picaxe in pin and thus shut down the circuit.

Thank you
 

Attachments

AllyCat

Senior Member
Hi,

Yes you're getting there. The 1k resistor from the gate can go to the same PICAxe pin as the NPN drive. But I suggest increasing the base resistor to the transistor to around 10k.

HOWEVER, at the moment the pushbutton can apply 30 volts directly to the button-sensing pin, which will probably destroy (or at least damage) the PICaxe. Put quite a large-value resistor (perhaps 100k, and certainly at least 56 k if the pulldown resistor is 10 k) between the pushbutton and the PICaxe pin. Or, the pull-down resistor on that input pin could be smaller; you need the divider chain to have a ratio of at least 5 : 1 to ensure that no more than 5 v reaches the PICaxe pin.

There might be "neater" ways to do it, but yes the diode with the added divider-chain resistor should allow the PIcaxe to include program code which switches off the the power with a second button-press.

Cheers, Alan.
 

AllyCat

Senior Member
Hi,

Yes, that diagram looks ok to me now. I've never used any of those specific transistors, but they all seem very generously rated for the task. Of course one should always breadboard/prototype any new design as far as possible.

As the transistors are in SMD packages, I presume you are planning a PCB? Do beware that 10 Amps is not a trivial current for a PCB. If possible keep the high current path "off" the PCB, e.g. with direct wiring between the battery and Load. But if high current PCB paths are necessary, e.g. between the FET and connectors, then ensure that the tracks are wide enough, and perhaps "tin" their surface with additional solder.

Cheers, Alan.
 

JPU

Senior Member
Hi Alan

I really appreciate all your help as always and everyone else who toke time to reply.

Thanks for the advice on the PCB and Ill get these components ordered to bread board up and test.

Thanks again, Cheers
 
Top