Using Picaxe With MOSFET To Turn On/Off Relay

j0563

New Member
I am using an 08M in conjunction with an IRF610 to send power to a 12v automotive-type relay. This works fine, only when I add an LED in with it, the LED and relay together pull too much current and the relay will not kick on.

Does someone have any suggestions as to what I should use to give me enough power to handle the relay and an LED from one pin on my 08M?

Do you think it would help if I used a logic level IRL510 instead?

- thanks in advance for your help.
 

Janne

Senior Member
Hi,

Do you have a resistor in series with the led? Without the resistor, the led would pull too much current from the picaxe, and cause the voltage on the output to stay too low for the mosfet to switch on the relay.
 

j0563

New Member
Hi,

Do you have a resistor in series with the led? Without the resistor, the led would pull too much current from the picaxe, and cause the voltage on the output to stay too low for the mosfet to switch on the relay.
Yes, I have a 560ohm LED in place. Sorry I didn't mention that.
 

boriz

Senior Member
FET gate uses no DC current. Has no effect on the Picaxe output.

We need a circuit diagram really.
 

BeanieBots

Moderator
The LED is loading the PICAXE output below the FET threshold.
You could try increasing the R to 1k8. It won't have a massive effect on the LED brightness but might solve the problem.
You really should get a logic level FET for use with logic signals.
 

j0563

New Member
The LED is loading the PICAXE output below the FET threshold.
You could try increasing the R to 1k8. It won't have a massive effect on the LED brightness but might solve the problem.
You really should get a logic level FET for use with logic signals.
So you think an IRL510 will work??
 

boriz

Senior Member
IRF610:

Datasheet says threshold is between 2v and 4v. Sounds ok for logic, but...

Datasheet also says Rds is over 1 ohm for Vds of 10v. Which sounds NOT ok for logic.


IRL510:

Datasheet says threshold is between 1v and 2v. Ideal for logic.

Datasheet also says Rds is < 1 ohm for Vds of 4v. Again, ideal for logic.
 

Dippy

Moderator
People really need to get to grips with MOSFETs.

This 'threshold' is a tiny figure, forget about it if you are dealing with relays and power devices.

I wish BB would write and post a tutorial on MOSFET choice.

MOSFETs are not magic switches.

Take the IRF610.
Ooooh, it says Rds(on) of 1.5 Ohms. Yes, thats just right for my circuit... isn't it?
Well, it might be for some designs but NOT ideal for your logic level (5V logic of course).

Read further:
Rds(on) 1.5Ohms Vgs=10V, Id=2.0Amps.

Now, go down the data sheet and find the graph of Id vs Vgs. Traditionally Fig1 in MOSFET data sheets.
Find the Vgs=10V line. Find Id= 2 amps for that line (remember it's log).
Blow me down, where the line crosses Id=2 we can see its Vds=~3V.
Calc R. Hey, guess what.

Now go to the line for 5V, assuming 5V and perfect PIC and assuming the res+LED has no effect.

Just for a laugh, have a look at the maximum amount of current the MOSFET can pass with Vgs=5V and in reality it'll be < 5V esp with LED load.
Oh dear, not a lot eh?
Then find a point on the graph which ties up with your ciruit specs.

The authors circuit probably worked more through luck than judgement.
i.e. it just about works for a baby relay, but no chance on something big and hairy.

Another example of "It's posted on the Internet so it must be true".

Do the same with the IRF510 and it might make you smile a bit.
 

Janne

Senior Member
Also, at least to me it seems that many times people use a fet, when a simple bipolar transistor would do the job easier. For example, in this case putting a bc547 in series with the led - resistor string would produce a satisfying result.

Fets are good whenever a fast switching of large load is required, ie. pwm applicatios, or solid state switching of large loads.
 

Dippy

Moderator
That's nice MFB.
But I was thinking more along the lines of an Application Note....
e.g. How to use?
And with a nod to Janne's comments above, Where to Use? and Why to Use?
And why not too.

I'm not too old that I can't remember getting it all wrong too. (And bearded designers tut-tutting at my early efforts).

Anyway, it'll never happen and the question will come around again.
 

MFB

Senior Member
Dippy, I would like to see Rev-Ed produced Application Notes on a range of topics. For example:

Interfacing a range of smart sensors (this would really help sales through their US distributor, SparkFun) and using X1/2 scratchpad memory to handle serial GPS data. Also mass storage SD cards and DataFlash chips.

This is all basic marketing stuff like Parallax has been doing for many years.
 

Dippy

Moderator
Yes, App Notes and "How Do I Use.." would be nice.

A lot of work, but would be a useful thing.
Some basics plus application tips and examples.
Mind you there are some retired engineers/teachers on this forum who must have some spare time....?

A WIBNI that is unlikely to happen. A pity.

Just think though, if it was hosted by Rev-Ed then many non-PICAXErs would link to Rev-Ed website for the App Note and be a free advert....
 

BeanieBots

Moderator
I've often thought about writting a "compendium of PICAXE circuits" aimed at interfacing sensors, using op-amps and FETs.
However, it would be a massive project and not something I'm prepared to do for free.

People don't even read previous posts within the same thread let alone tutorials. Datasheets are rarely understood if read at all.
What are the chances of anyone PAYING for the time and effort required to explain? They just want a quick fix.

Meanwhile, we'll just carry on having a "driving FETs" thread every other week.
 

MFB

Senior Member
Development -v- marketing

Beaniebots and Dippy, good comments. There are a lot of threads that seem to "repeat every couple of weeks" and it should be someone’s job at Rev-Ed to identify these topics. It might result in a surprisingly short list of required Applications Notes. Yes, they would take time to produce but then so does developing PICAXE features and what is the point if potential users poorly understand how to make the most of these new features. I’m not saying anything new here, its just getting the balance right between the developments and marketing effort.
 

fritz42_male

Senior Member
I concur with this. I'm just working on some prop controller setups and am getting to grips with the use of AC load SSRs, DC load SSRs, normal electromech relays and so on.

A couple of data sheets with circuit examples would have cut a lot of this searching short for me (I'm neither lazy nor stupid but VERY rusty & I do work long hours).

So, yep, good idea. Someone please do it!

Mike
 
Last edited:

gengis

New Member
BeanieBots said:
What are the chances of anyone PAYING for the time and effort required to explain? They just want a quick fix.

Meanwhile, we'll just carry on having a "driving FETs" thread every other week.
Add "for free to" that last statement . . .

Sometimes people just need the feeling of security asking questions provides, they need to know the net is there, they aren't in over their heads. Sometimes they are just lazy, and don't understand, or want to understand, that there's going to be some learning involved.
 

Dippy

Moderator
How much would any of you pay for a 200 page book giving basic advice with examples, pictures and snippets?
(Assume no Internet and assume no Forums).
So, how much?
 

D n T

Senior Member
show me the money

I would pay $60.00AUS for a book like that right now and I would make it the text book for my students, total expence: 31 x 60 = $1860.00

I have been scanning the threads for mention of a book or datasheet that willl give me the meanings for all the initials on a datasheet( Vss etc) I mean it would be a useful side text, like a chem data book or log tables book.

By the way, the $1860.00 is only one school, you might want to contact Mr Lincoln and find out how he went with his book, perhaps you could do part 2, don't forget to include the mandatory warnings about using PICAXEs in mission critical situations.
**Remember, on the forum we "do it for the love of it and to advance the PICAXE and PIC electronics"
 

Dippy

Moderator
I couldn't do it - but I know a man who can.
And would make a good job of it too.

It needs clarity, brevity and waffle-free. So that's me and hippy out for a start :)
 

Tim036

Member
I couldn't do it - but I know a man who can.
And would make a good job of it too.

It needs clarity, brevity and waffle-free. So that's me and hippy out for a start :)

Perhaps it could be dedicated to John Marcus and be called 'Trubute to John Marcus Mk3' or something like that !

:D:eek::D

Tim
 

BeanieBots

Moderator
@DnT,
So what would you expect from this 'book' for $60AUS?
An explanation of Vcc, Vdd, Vss, Vee, Ron, Vsat, hfe, and a few graphs would only take up a page, maybe two.

eg (your free sample).
Vcc, normally denotes the possitive supply in 5v systems.
The 'V' standing for the obvious Volts, The cc implying the voltage that is applied to the collectors of transistors within the circuit. When the circuits became chips, the connections to the collectors were brought out to common pins (the power in pin) and adopted the commonly assigned abreviation of "Vcc". The vast majority of early TTL (Transistor-Transistor-Logic) chips were 5v, hence Vcc has become a common reference to "5v supply line" but it actually means voltage to the collective collectors.
 

gerrymcc

New Member
One text book worth knowing about

As has been said, many users want an answer NOW which will work NOW, to solve the immediate problem, before meeting the next one. One good book may be able to help them.

A text book I highly recommend is Howowitz and Hill- "The Art of Electronics". This book has been around for at least 30 years. It does an excellent job of explaining many of the hardware questions I see asked- how to drive devices, interfacing, getting logic to work etc. After 25 years, I still refer to it for ideas, or information on a topic that is oblique to my usual work area. Being a bit old now, it covers all these "simple" topics very well, and does not gloss over them in the rush to get onto what would now be the "modern" stuff.

Maybe referring users to this book could remove some of the repetitions mentioned. (I have no connections to the book- I simply think it is an excellent book which could usefully be on every hands-on design engineer's bookshelf.)
 

Peter M

Senior Member
jo 563 - Getting back to your Question - you said an automotive type relay??...(12v???)...... looking at your circuit, besides whats been said above, you are trying to drive it from a 15 volt regulator with an input voltage of 12/24v specified??? if its 12 to around 18volts your 7815 probably wont supply enough current even if the mosfet did switch properly.
 

j0563

New Member
jo 563 - Getting back to your Question - you said an automotive type relay??...(12v???)...... looking at your circuit, besides whats been said above, you are trying to drive it from a 15 volt regulator with an input voltage of 12/24v specified??? if its 12 to around 18volts your 7815 probably wont supply enough current even if the mosfet did switch properly.
I've got a jumper setting to either use the 7805 or 7815 depending on if you're using 12 or 24v batteries. For 12v, I set the jumper on the 7805.
 

Peter M

Senior Member
I've got a jumper setting to either use the 7805 or 7815 depending on if you're using 12 or 24v batteries. For 12v, I set the jumper on the 7805.
The only jumpers I see dont have any affect on relay voltage??

Your 5 volt reg is also probably droopping with that conditionig circuitry, and given that the LED is on a different pin, that is likely.

you could also drive the LED off the load side of the relay, avoiding the extra load on the PICAXE all together.
 

D n T

Senior Member
$60.00 book

BB, some simple circuit designs to interface common components (MOSFETS etc) and an explanation of their function, construction and use, some circuits to perform common tasks that could be modified to suit the users requirements. Explanation things like analog electronics, it is starting to sound like a PICAXE manual.

The type of book would be within the gap between primary school experiment with electricity type books and the high end brain boiling engineering book, or perhaps a book that would allow a newbie to get into the field and know enough to get into then out of trouble. It would be the type of book you would need if you didn't use this forum.
I know that based on the number oif posts on the forum, the book would have to be 10,000 pages long, but if you didn't include the PICAXE programming problems in this forum that would reduce the number of topics.
The PICAXE manuals deal with the PICAXE chip, programming it and interfacing it with components but the book could cover the circuits components and design that more advanced projects have ( interfacing volume 2 perhaps).

Its just a brain fart and life will go on without the book but like spare cash, it would be handy.
 

Dippy

Moderator
Good link, but a BOOK sits on the shelf waiting for you to dive in....

If Westy had gone on holiday then we'd never have been given that link ;)
 

BeanieBots

Moderator
I'm still a little confused what this 'book' should contain over and above what is already in the set of manuals.
Also, what would be special about the book that would make people READ it if they didn't read the manuals.

Does this come down to a style issue or is it content?
 

westaust55

Moderator
I agree with BB.

Look at this forum. How many ask a question without first doing a search for themselves.

Yet, give them a link at the instant of the question and they happily go and look.

I have written a couple of tutorials already for this forum (eg (1) how to use the advanced search options and (2) the workings, modification and control of Servo motors). Would ultimately be of interest to know how many actually do in fact go back and look at them.

I for one do have a paper copy of the PICAXE manuals in a folder near my desk at home which I read – in fact I prefer to read a paper copy rather than the screen and can take the paper copy to another room. But this is not the modern trend. I see my own typos far more easily on a paper copy than on the screen (hence you see often see an edit done to my posts).
 

inglewoodpete

Senior Member
I don't think there is such a thing as 1 size fits all. A book is something that only a subset of people would read.

From my recent experience, I could write a chapter on interfacing coin identifiers and note validators to a PICAXE but who would read it? On the other hand, if you were about to build a slot machine of some sort, it would be very useful.

A printed book goes out of date very quickly: look at David Lincoln's. The PE has advanced so much is the last 2 years that David's code is very clunky.

Perhaps an EBook is the answer but you will only sell 1 copy of it!
 
Last edited:

Dippy

Moderator
Yes, but a book that describes principles does not go out of date quickly.

Yes, if you write specific code for a specific model processor then that can out of date.

But connecting a microcontroller pin to a MOSFET will be with us for years - so will the questions on how to do it :)

The general 'how do I' of basic transistor connection, Motor Control, Data Logging, handling memory, I2C , SPI, damned MOSFETs etc will be with us for years.
However, if it had a section on How to connect an 18X to a YingTong4356377 Acceleremoter then it is asking for trouble.

I still, now and then, consult my A level physics book. OK, different subject, but it is general and that bit doesn't go out of date (unlike me).

I would support a book.
 

hippy

Ex-Staff (retired)
It's not clear to me exactly what such a proposed book is intended to cover, the extent of its coverage or the level of the audience it is aimed at.

One could argue it should cover 'everything' and through all skill levels, but by implication that means it fails to target any group which wants information pitched at specific levels without the clutter of the rest. And, as more is added, as its size increases and cost rises, more will be deemed irrelevant for particular skill groups, and it becomes less attractive all round.

On the other hand, any book targeted at a specific level is implicitly not targeted at other skill levels and is unattractive to them.

One thing we tend to have relating to PICAXE is an unusual situation where novices are often trying to do something at an advanced level. A boundary crossover which most books do not attempt to cross, and for arguably good reason.

It's also important to consider what an audience is seeking to get from such a book; the knowledge of 'how to' which leads them towards making an informed decision, or simply a 'buy this, that will do the job, connect it like this', or somewhere in between.

Also, people tend to be interested in a particular subject which they may well want described in detail from first principles through to advanced levels and have little interest in other topics which, while the book is in part ideal for them, may make it unattractive overall because of the cost or bulk of including the rest which they are not interested in.

Finally, you need to find authors who are capable of addressing every skill level covered and are knowledgeable in their particular subjects and skilled enough to do so, and to find authors who can cover a wide range of disparate subject matter, with the cohesion a single book needs.

Before commencing any book it's necessary to decide what that book is, what it covers, to what depth, and who it is targeted at. Is it a 'one size fits all' book or is it targeted at groups with particular skills ? Only then can one assess whether it is viable, commercially viable, and whether it will ultimately be useful or not.
 

MFB

Senior Member
Example of good material

Hippy, I certainly agree with your statement about the difficulty of "find authors who are capable of addressing every skill level covered and are knowledgeable in their particular subjects and skilled enough to do so, and to find authors who can cover a wide range of disparate subject matter, with the cohesion a single book needs". That’s probably why Parallax used a number of authors to produce the range of excellent ‘Stamps in Class’ materials. All available to download for free at…

http://www.parallax.com/tabid/768/txtSearch/stamps+in+class/List/0/SortField/4/Default.aspx
 

BeanieBots

Moderator
I think Hippy makes some very good points, particularly about novices trying to do something advanced. Invariably, this is in one specific area of interest.

Also, many of the questions seen here relate either to someone who knows software but struggles with hardware or the other way round. So, perhaps something which can bring those two skills together is what is required.

Having the skill and ability in a particular subject does not however make a good author. Putting across that knowledge is a skill in its own right. With subjects covering software, electronics and control theory, many diagrams will be required. That means that the author also requires artistic abilities. This would be a rare combination to find in one individual necessitating multiple inputs which dramatically reduces any financial viability.

There are a few favourites which keep comming up such as MOSFETs.
These could be covered with a few extra tutorial pdfs but who will put in the time and effort required? Such an article is too small to warrant financial attributes but too large to be undertaken for no reward.

Maybe just one article. An MPPT controller:eek:
How often have we seen that one:rolleyes:
It requires an in depth knowledge of control theory, electronics, magnetics, batteries, mosfet driving, PVs and/or wind turbines as well as the ability to write complex software. It could even cover techniques such as mutiplexing for the display and RF data links for remote monitoring. Maybe couple it up to a remote weather station and I think just about all aspects of hardware, software, and even mechanics could be covered. However, the guy looking for tips on how to log his data is unlikely to look for it under MPPT although it would all be there including the menu system he didn't even know he needed.

I honestly don't know, but this is an interesting topic.
One thing for sure though, there is a gap which needs to be filled.
 

Dippy

Moderator
I don't think it's 100% clear to anyone :)
It is fairly obvious that it should work at various levels.

A bit of market resarch is good, a small group of contributors and reviewers is good, but one thing for sure; don't write it by Forum committee.


The trouble with 'first principles' is that your 'first principles' may be different from mine. I remember First year uni exams writing 4 pages of scrawl to prove Hfe from nitty gritty first principles. That would bore the hell out of someone who just wanted to understand gain and how to use basic calcs in their circit.

IMHO: It should lean towards applicaions and inerface with basic calcs to show how device parameters are used in circuit design.
(The example of my exploding resistor yesterday, shows I need this book rght now!)

Whether or it turns ino a monster tome depends on who wrote. With some people it would be longer than War & Peace .. and that's just the index.

And then sold to every School and Uni Library. And me.

EDIT:
"So, perhaps something which can bring those two skills together is what is required."
- PRECISELY Mon Brave :)
 
Top