Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Question about how to amplify power.

Status
Not open for further replies.
I believe will cover what Mike is getting at. Too oftebn we just assume the circuit will have a bypass cap and never give it a thought. You want a bypass cap (typically .1 uF) just as close as you can get it to your power pin on the u-controller. The link will give you a good overview.

Ron
 
Oh ok, i have seen those on circuits i've built without understanding their function. I've added a .1uF cap between the +V & 0V pins on the microprocessor. The article you linked me to also suggested bypass caps on wire runs. Do you think it I need one before and/or after the wires going to the solenoid?
 

Attachments

  • solenoid_control.jpg
    solenoid_control.jpg
    70 KB · Views: 122
Last edited:
I think there is a new version available that isn't compatible with the old files. You might search out the newer version instead of the one i linked too *shrug*
 
imix500, good catch that I missed. If you drive your transistor with the 5 volt logic from the PICAXE that will be fine. However make sure the 5 volts and 12 volts share the same common. Also, my bad as figure about a 2.2 K Ohm resistor for the base of the 2N2222. I missed that, sorry as my bad.

Ron

Ron, can you explain how you calculated the value of the resistor? The solenoid i'm testing with is likely to be different the one I eventually use. I expect the 12v to remain constant, but the watts required may change.

Also, how many of these solenoids could I control with 1 chip. The specs of the chip i am using say that it can source (or sink) 20mA per pin, with a maximum of 90mA for the chip. Does that mean I am limited to 4 solenoids per chip?

Lastly, would you mind taking a peek at my latest layout to see if I've placed the bypass caps correctly?

Thanks for your time & help,
-Scott
 

Attachments

  • layout.png
    layout.png
    25.3 KB · Views: 146
Solenoid looks fine but... Looks like you are powering your PIC with 12 volts so not good. :) The bypass looks just fine. The trick is as close to your PIC power pin as possible.

As to the base resistor, try giving this link a read. The first few post cover it well. So yes, the load makes a difference.

How many solenoids? That depends on how you configure them. Meaning if you wanted to fire 4 or 6 or whatever all at the same time then you would consider a larger transistor and parallel your loads (solenoids) or likely use a MOSFET as a switch to handle the high load of all the solenoids. However, if you want to fire your solenoids for example sequentially (at different times) from your PIC then you need to figure the base emitter current you draw for your transistor(s) and work from there. I guess we could say it's all about current.

Ron
 
Solenoid looks fine but... Looks like you are powering your PIC with 12 volts so not good. :) The bypass looks just fine. The trick is as close to your PIC power pin as possible.
Wooops... I fixed that on my layout to avoid confusion. Copy/Paste fail! Thanks!

As to the base resistor, try giving this link a read. The first few post cover it well. So yes, the load makes a difference.
I'm trying to wrap my head around the equation offered in that thread. It reads:

Ib = (Vparallelout - Vbe) / Rb

My guess at the variables here:
Ib = Current at base? (20mA from chip?)
Vparallelout = Voltage at collector? (12v?)
Vbe = Vbe (sat) max value on 2N2222 datasheet? (2v?)
Rb = The base resistor value i am looking for?

I don't think that can be right because I don't have any information on the load (solenoid) in there. Can you clarify the variables for me?

How many solenoids? That depends on how you configure them. Meaning if you wanted to fire 4 or 6 or whatever all at the same time then you would consider a larger transistor and parallel your loads (solenoids) or likely use a MOSFET as a switch to handle the high load of all the solenoids. However, if you want to fire your solenoids for example sequentially (at different times) from your PIC then you need to figure the base emitter current you draw for your transistor(s) and work from there. I guess we could say it's all about current.
Well, 5-8 solenoids total, each able to fire at any time. All connected solenoids might be active at the same time. I thought I would need a MOSFET for each solenoid? The attached layout was me working on the assumption that 4 is my max.

EDIT: Note IC1 & IC2 are actually just 1 IC... Picaxe 18M. The software i'm using doesn't support 18 pin ICs so I used two next to each other to simulate 18 pins.

Thanks again for all your help!!
-Scott
 

Attachments

  • 4 Valves.png
    4 Valves.png
    45.9 KB · Views: 121
Last edited:
Now your layout looks good. OK, as to the base resistor thing, maybe give this link a read. I believe it will cover it all.

Pay attention to hFE which is the beta or current gain of a transistor. Remember a transistor is a current amplifier device. It's all about current. The purpose of a base resistor is to limit the base current through the transistor. We want to use the transistor as a switch in this case, so we say we want to drive the transistor into saturation where the collector to emitter is for all simple purposes a straight line with zero resistance. Now the trick in choosing a transistor as a switch is to make sure the emitter collector junction can handle the load current. If our load is a solenoid and @ 12 volts that coil needs 200 mA to operate we have a 200 mA load. That emitter collector current is a key player in figuring out the base resistor. That should become apparent in the link.

So if we have a PIC and want to drive a solenoid we need to shove a transistor in there to turn on the load. The PIC alone (in most cases) will not be able to drive the load by itself. The source current of the PIC is considerably less that the current needed to drive the load so we need a current amplifier and enter the transistor.

Most of this is a little difficult to grasp at first but it does all come together and easy to grasp.

Remember the hFE is really nothing cast in concrete and the base resistor isn't an exacting down to the ohm science. When used as a switch we just want to make sure we drive the transistor well into saturation but do want to limit the base emitter current so we don't cook it.

Ron
 
Ron, thanks man.. that link was great. I have a much better understanding of what is going on now. The link gave this equation for my application:

RB = (Vc × hFE) / (5 x Ic) where Vc = IC supply voltage

The 2N2222 datasheet from fairchild shows the hFE min of 35mA and max of 300mA. So this is the math as i understand it:

RB = (5v * 100) / (5 * 42mA)

RB = 2.38... so the nearest common resistor is 2.2k

Is that correct?

****************************************************

I added a pot to my circuit that controls the sensitivity of the capacitance sensor (penny whistle). I assume the IC pin connected to the pot is "sinking" current. When calculating how much my IC can handle do I need to count this input as the maximum 20mA? And what about the pin that the whistle (capacitance sensor) is connected to?

Here's the most recent schematic. I removed the 0v connection from the sensor & put in a 10pf cap to ground instead. Everything is working great so far! My test solenoid should be here soon!
 

Attachments

  • 1 Valve.png
    1 Valve.png
    24.9 KB · Views: 133
Thar you go! :)

That should work out for you.

Ron
 
Status
Not open for further replies.

New Articles From Microcontroller Tips

Back
Top