18M2 Current rating ?

dgc188

New Member
Hi.

As a newcomer to the world of PICAXE I'm a little baffled as to what is the total current capacity of the 18M2?

I note from the Manual Pt.1 that each pin is capable of 25mA with a maximum current per chip of 90mA. Somehow that doesn't appear to be the full story.

I've had a look at the specification for the PIC16F818/819 which was the 18M chip (I've no idea what chip the 18M2 actually is). Here, in the spec, it says that each pin can source 25mA and/or sink 25mA - OK, so far so good. It goes on to indicate that the maximum current into Vdd is 200mA and out of Vss is 200mA. I'm slightly confused by this.

What I'm trying to setup is 6, maybe 7 output pins, each suppling an LED-pair - source or sink depending on the state of the output pin of around 17mA. Therefore, 17mA x 6 gives a total output pin current of 102mA - over the stated maximum according to the manual.

This is for a model railway project using inputs taken from the position of turnouts to operate an appropriate track signal - it being a red or a green LED lit (red sourcing 17=mA, green sinking 17mA).

Is what I'm looking to achieve, acceptable from a current point of view or am I over the maximum for the 18M2 chip? And how does this relate to other chips in the PICAXE series?

Thanks
Dave
 

hippy

Technical Support
Staff member
Welcome to the PICAXE forum.

There is a section on the main www.picaxe.com site which provides links to the most appropriate datasheet to obtain Microchip information from -

http://www.picaxe.com/What-is-PICAXE/PICAXE-Chip-Labels

The 16F1847 datasheet is the most appropriate for a PICAXE 18M2+ ( firmware D.x ).

There is also a page I created a while ago which summarises the I/O currents for each PICAXE type which should be up to date, but always best to check with the latest datasheet -

http://www.picaxeforum.co.uk/showthread.php?11963-PICAXE-I-O-Current-Capability

For the 18M2+ the maximum ratings, which match with the datasheet, are -

Sourced or sunk through chip : 170mA
Sourced or sunk per pin : 25mA

17mA is below the pin limit, and the total 102mA is well within the 170mA maximum chip rating.

The way the ratings work is that you can draw up to 25mA out of a single pin, but the combined total of all pins must not exceed the chip current limit. It's like a four-way mains extension board; if that's rated at 13A you can plug in a single 13A device, or two 6.5A devices, or up to four devices so long as their total doesn't add up to more than 13A.
 

westaust55

Moderator
What has determined/dictated the 17mA current per LED circuit?
Use this just to keep below say a 20 mA limit?

Often with older/"standard" type LEDs they are considered bright enough at around 12 mA.

Modern high brightness LEDs are often extremely bright with just a few mA current.
Not only for indication, but also with model railways for illumination.
For example in 00 carriages "1.8 mm steam era prototypical white" LEDs at 3 mA are bright enough (with constant current sources). At 5 mA they are way too bright - almost lighting up a large section of the surrounding layout.

Thus, notwithstanding the current limits per output and total chip for the PICAXE, you might wish to review your proposed current per LED.
 

fernando_g

Senior Member
Even though the Picaxe may drive the load, it is good engineering practice NOT to operate a device at its maximum ratings.

Also, think of something else: what happens if there is a short or an overload on the output?
You know, Murphy's law still applies.

My advice:
Use a dual, complementary pair on each output. Transistors are cheap.
 

dgc188

New Member
Thanks Guys, wonderful pieces of information. :)

I did a search for the info I was looking for and nothing relevant turned up, hence the question posted above. Probably my bad search criteria :(

It did seem somewhat strange that the PICAXE manual states a maximum chip current of only 90mA - maybe it's time this document (as wonderfully informative as it is) was updated to refelct the newer chip ratings and that the 90mA figure relates to the 08M (and a couple of others) and is not a blanket figure for ALL the range. But thanks, especially to hippy, for the links to the data.

It doesn't really make that much difference what LED ratings or project I'm wanting to use the device for; it was more to get some clarification on what the maximum current rating was when there appeared to be the difference between the 90mA (in the manual) to the much higher rating on the (outdated 18M chip's) datasheet.

Regarding the 17mA, I had set this as a nominal current for the LEDs....it was just a ball-park figure taken from earlier projects that made use of LEDs and this was a figure that gave me the right amount of light I was looking for (at that time and with the devices available at that time). Since then, as westaust55 says, might brighter LEDs for lower currents have hit the market and, where possible, I shall be making use of these, but also I shall be recycling my old LEDs where possible.

I also agree regarding the don't push the chip to its maximum (or beyond) - but 90mA seemed just way too low a value to be real. Almost doubling the figure to 170mA gives me much greater headroom and is now well within what I'm looking for.

Thanks guys once again for your help and comments.

Dave
 

Goeytex

Senior Member
...but 90mA seemed just way too low a value to be real.
The 90ma maximum rating is quite real on many Picaxe Chips. To me the 170 ma rating for the 18M2 "seems" more unrealistic given that chips such as the 20M2 and 20X2 are rated at 85ma and 95ma respectively. So when I need to know for sure, I go directly to the Microchip Datasheet and do not rely upon the generalized Rev-Ed manuals, or what may seem right or wrong.

What has not been mentioned and what is not clear even in the datasheets, is that as I/0 pin current increases, the voltage across the load will decrease. For example: Given a 5.0V supply, and a 200 Ohm load. There will NOT be 25ma current through the load (due to voltage droop). It will closer to 17ma @ 3.4V.

This can be easily proven. Just connect a 200R resistor between any I/O pin and ground. Then set the pin High in code and measure the voltage directly on the I/O pin. Divide the measured voltage by 200 to get the actual current.
 
Last edited:
Top