Discussion forum for the BasicX family of microcontroller chips.
|
I need to be able to generate a beep sound for certain situations in my app. I'd like to use one of those small piezoelectric transducers, about 1/2" diameter and 1/4" or so high. Has anyone done this? If so, did you generate the tone using FreqOut () or perhaps an external gated oscillator? I see that some of them simply require a DC voltage, apparently they're fixed frequency units. Also, does anyone know of a good source for inexpensive units? Don in Portland, OR |
|
--- In , "don_kinzer" <dkinzer@e...> wrote: > I need to be able to generate a beep sound for certain situations in > my app. I'd like to use one of those small piezoelectric > transducers, about 1/2" diameter and 1/4" or so high. > > Has anyone done this? If so, did you generate the tone using FreqOut > () or perhaps an external gated oscillator? I see that some of them > simply require a DC voltage, apparently they're fixed frequency units. > > Also, does anyone know of a good source for inexpensive units? > > Don in Portland, OR Hi Don, Did you ever figured out how to do this? I'm trying to do the same thing. I have a BasicX-24 development board, I've wired the transducer to Pin 10, and have tried various frequencies on the FreqOut procedure. I finally settled on 4000Hz, which is supposed to be the loudest (85dB at 10cm). I don't even know if that is more than barely audible, but I imagine it should be fairly loud. I have set Pin 10 to Output High (5 volts), and I get a tone, but it is not nearly loud enough. When I measure the voltage at the transducer, I get maybe 0.5 volts... I am a complete newbie, by the way, and have zero training in electronics, so please keep your answer simple. Tx, George |
|
--- In , "George Alvarez" <george.alvarez@g...> wrote: > > Did you ever figured out how to do this? I'm trying to do > the same thing. I ended up using a piezo audio indicator which I got from DigiKey. Here is a link to the supplier's site: http://www.cui.com/adtemplate.asp?invky=6810 It's easy to use. Just apply a DC voltage and it makes the sound. Initially, I was switching it on and off using a transistor driven by the BX-24. Later, I changed to using a 555 timer (wired in monostable mode) to switch it. That way, I only have to provide a trigger pulse to the 555 and it handles the timing of the pulse that enables the sound. Don |
|
--- In , "Don Kinzer" <dkinzer@e...> wrote: > > --- In , "George Alvarez" <george.alvarez@g...> > wrote: > > > Did you ever figured out how to do this? I'm trying to do > > the same thing. > > I ended up using a piezo audio indicator which I got from DigiKey. > Here is a link to the supplier's site: > http://www.cui.com/adtemplate.asp?invky=6810 > > It's easy to use. Just apply a DC voltage and it makes the sound. > Initially, I was switching it on and off using a transistor driven by > the BX-24. Later, I changed to using a 555 timer (wired in > monostable mode) to switch it. That way, I only have to provide a > trigger pulse to the 555 and it handles the timing of the pulse that > enables the sound. > > Don Don, thanks for the reply... if I can push you a little more.... I need to use a much smaller transducer, 5mm^2, the manufacturer is www.starmicronics.com, not sure yet where I can get it, but I don't think that will be a problem. For the following, please recall my complete ignorance about the subject matter. Basically, according to Chris at BasicX, my inaudible problem is caused by not being able to supply enough mA to the transducer. it needs 90mA, and it's only getting 10mA, hence the quiet response. He told me to get an NPN transistor, the 2N222 available at Radio Shack. I would connect this between the transducer - and ground, and the base would connect to pin 10. The transducer + would also connect to 5V+. This transistor would operate as a switch, and the direct connect to the voltage would allow for higher mA to get to the transducer. So, like this: 5V+.....+Transducer-....(C)Transistor(E)......Ground (B) Pin THEN he told me that I need a resistor too, but ended the conversation with an instruction to go to the web to try and find a circuit and figure it out, rather than explaining it to me outright ... All the circuits that I saw had either no or multiple resistors and at least one transistor. I found nothing that had exactly what I'm looking for. So, here's what I came up with - The purpose of the resistor is to ensure that I don't blow out the transducer with too much current. It should be connected between the 5V+ and the transducer +. I would need a resistor with a 40 ohm rating, which I calculate as 5V+/0.125A that I measure when I put a meter directly on the Development board + and - holes. So, like this: 5V+...>40_Ohm_R>....+Transducer-....(C)Transistor(E)....Ground (B) Pin Can you correct me wherever it is that I've gone wrong? In the interim, I'm going to go find out what a 555 timer is. Tx, George |
|
--- In , "George Alvarez" <george.alvarez@g...> wrote: > > --- In , "Don Kinzer" <dkinzer@e...> wrote: > > > > --- In , "George Alvarez" > <george.alvarez@g...> > > wrote: > > > > Did you ever figured out how to do this? I'm trying to do > > > the same thing. > > > > I ended up using a piezo audio indicator which I got from > DigiKey. > > Here is a link to the supplier's site: > > http://www.cui.com/adtemplate.asp?invky=6810 > > > > It's easy to use. Just apply a DC voltage and it makes the > sound. > > Initially, I was switching it on and off using a transistor driven > by > > the BX-24. Later, I changed to using a 555 timer (wired in > > monostable mode) to switch it. That way, I only have to provide a > > trigger pulse to the 555 and it handles the timing of the pulse > that > > enables the sound. > > > > Don > > Don, thanks for the reply... if I can push you a little more.... > > I need to use a much smaller transducer, 5mm^2, the manufacturer is > www.starmicronics.com, not sure yet where I can get it, but I don't > think that will be a problem. > > For the following, please recall my complete ignorance about the > subject matter. > > Basically, according to Chris at BasicX, my inaudible problem is > caused by not being able to supply enough mA to the transducer. it > needs 90mA, and it's only getting 10mA, hence the quiet response. > > He told me to get an NPN transistor, the 2N222 available at Radio > Shack. I would connect this between the transducer - and ground, > and the base would connect to pin 10. The transducer + would also > connect to 5V+. This transistor would operate as a switch, and the > direct connect to the voltage would allow for higher mA to get to > the transducer. > > So, like this: > > 5V+.....+Transducer-....(C)Transistor(E)......Ground > (B) > Pin > > THEN he told me that I need a resistor too, but ended the > conversation with an instruction to go to the web to try and find a > circuit and figure it out, rather than explaining it to me > outright ... All the circuits that I saw had either no or multiple > resistors and at least one transistor. I found nothing that had > exactly what I'm looking for. So, here's what I came up with - > > The purpose of the resistor is to ensure that I don't blow out the > transducer with too much current. It should be connected between > the 5V+ and the transducer +. I would need a resistor with a 40 ohm > rating, which I calculate as 5V+/0.125A that I measure when I put a > meter directly on the Development board + and - holes. > > So, like this: > > 5V+...>40_Ohm_R>....+Transducer-....(C)Transistor(E)....Ground > (B) > Pin > Can you correct me wherever it is that I've gone wrong? > > In the interim, I'm going to go find out what a 555 timer is. > > Tx, > > George Don, The Pin and (B) go directly under the Transistor, it is not evident in the final post, but it is in the reply... also, the 555 is an IC, and I don't want to use one of those. So, I'm sticking with my questions regarding transistor and resistor. Thanks |
|
|
|
> ... questions regarding transistor and resistor... George, I think I'd choose another tranducer. The spec shows 70dB sound output @ 30cm, at 12VDC; well, that's not at all loud - and you're feeding it less than half that voltage. I think the only way you'll get what you want from that device is to switch a much higher voltage to it. Tom Tom Becker --... ...-- www.RighTime.com The RighTime Clock Company, Inc., Cape Coral, Florida USA +1239 540 5700 |
|
|
|
--- In , "Tom Becker" <gtbecker@r...> wrote: > > ... questions regarding transistor and resistor... > > George, I think I'd choose another tranducer. The spec shows 70dB sound > output @ 30cm, at 12VDC; well, that's not at all loud - and you're > feeding it less than half that voltage. > > I think the only way you'll get what you want from that device is to > switch a much higher voltage to it. > Tom > > Tom Becker > --... ...-- > GTBecker@R... www.RighTime.com > The RighTime Clock Company, Inc., Cape Coral, Florida USA > +1239 540 5700 Hi Tom, thanks... Actually the transducer I'm using is 80dB @ 3V, and you're right, this is a test to see if we can hear it. It needs to be as loud as a watch chime, no more. My real constraint is the size, mine is 5mm^2... those are hard to find. Tx, George |
|
--- In , "George Alvarez" <george.alvarez@g...> wrote: > > So, like this: > > 5V+.....+Transducer-....(C)Transistor(E)......Ground > (B) > Pin Yes, there should be a resistor, too. Some people would put it directly between the BX-24 pin and the base lead of the transistor. My preference is to connect one end of the resistor to +5 and the other end to the base of the transistor which is also connected to the BX-24 pin. There are some differences between these two approaches. In the first, you need to output a logic 1 to switch the transistor on, causing it to energize the load (the transducer). When the BX-24 starts up, the pin that you're using will be an input and won't energize the transistor. In the second method, you output a logic zero to switch the transistor off (because it robs the transistor of the current that it needs to switch on). When the BX-24 starts up, since the pin will be in the input mode it can't keep the transistor off so you'll get a peep out of it when the system starts up. This may or may not be desirable. In either case, you need to calculate the value of the base resistor. Essentially you need to be able to supply the base of the transistor with enough current so that it can conduct the desired amount of current from its collector to its emitter. Transistors have a "gain" figure called Beta or hFE which tells you by what factor the base current will be multiplied, resulting in collector current. If you need 100ma of collector current and your chosen transistor has a gain of 100 (not unusual) you need to supply at least 1ma of base current. Using Ohm's law, the voltage drop across a resistor is equal to the current through it multiplied by the resistance. Roughly speaking, there will be about 4.4V dropped across the resistor (because the base-emitter voltage will be about 0.6 volts) so this indicates a 4.4K ohm resistor (4.4V/1ma). This is not a standard value so I would choose a 3.9K. A 1/4 Watt resistor is plenty big enough. By the way, the transistor that Chris mentioned is most likely a 2N2222A but any general purpose transistor will work. Another common one is the 2N3904 which I prefer because the 2N2222A usually comes in a metal case while the 2N3904 is usually in a plastic case. Another alternative is to wire up the transistor like you indicated (including with the base resistor) but instead of connecting the positive lead of the transducer to +5V connect it instead to +12V. This will give you more audio power. The base resistor should still be connected to either +5 or the BX pin. DO NOT connect it to +12! Here is a page that may be helpful: http://www.kpsec.freeuk.com/trancirc.htm |
|
--- In , "Don Kinzer" <dkinzer@e...> wrote: > > --- In , "George Alvarez" <george.alvarez@g...> > wrote: > > > So, like this: > > > > 5V+.....+Transducer-....(C)Transistor(E)......Ground > > (B) > > Pin > > Yes, there should be a resistor, too. Some people would put it > directly between the BX-24 pin and the base lead of the transistor. > My preference is to connect one end of the resistor to +5 and the > other end to the base of the transistor which is also connected to > the BX-24 pin. > > There are some differences between these two approaches. In the > first, you need to output a logic 1 to switch the transistor on, > causing it to energize the load (the transducer). When the BX-24 > starts up, the pin that you're using will be an input and won't > energize the transistor. > > In the second method, you output a logic zero to switch the > transistor off (because it robs the transistor of the current that it > needs to switch on). When the BX-24 starts up, since the pin will be > in the input mode it can't keep the transistor off so you'll get a > peep out of it when the system starts up. This may or may not be > desirable. > > In either case, you need to calculate the value of the base > resistor. Essentially you need to be able to supply the base of the > transistor with enough current so that it can conduct the desired > amount of current from its collector to its emitter. Transistors > have a "gain" figure called Beta or hFE which tells you by what > factor the base current will be multiplied, resulting in collector > current. If you need 100ma of collector current and your chosen > transistor has a gain of 100 (not unusual) you need to supply at > least 1ma of base current. Using Ohm's law, the voltage drop across > a resistor is equal to the current through it multiplied by the > resistance. Roughly speaking, there will be about 4.4V dropped > across the resistor (because the base-emitter voltage will be about > 0.6 volts) so this indicates a 4.4K ohm resistor (4.4V/1ma). This is > not a standard value so I would choose a 3.9K. A 1/4 Watt resistor > is plenty big enough. > > By the way, the transistor that Chris mentioned is most likely a > 2N2222A but any general purpose transistor will work. Another common > one is the 2N3904 which I prefer because the 2N2222A usually comes in > a metal case while the 2N3904 is usually in a plastic case. > > Another alternative is to wire up the transistor like you indicated > (including with the base resistor) but instead of connecting the > positive lead of the transducer to +5V connect it instead to +12V. > This will give you more audio power. The base resistor should still > be connected to either +5 or the BX pin. DO NOT connect it to +12! > > Here is a page that may be helpful: > http://www.kpsec.freeuk.com/trancirc.htm Don, I'm keeping the whole thread because it helps me... You wrote: >you need to supply at least 1ma of base current. When I measure the mA coming out of the pin, it is more like 7mA, which is close to the docs' claim of 10mA... Following your math to the gory end gets me to about 630 ohms, not 4400 ohms.. then to watts, well, I am simply unable to follow the logic that gets me from 4400 or 3900 ohms to 1/4 watt. Is my 7mA measurement wrong? Or is this what your recommended resistor will accomplish? Or do I look for another resistor? I'm missing something here, Thanks again. George |
|
--- In , "George Alvarez" <george.alvarez@g...> wrote: > When I measure the mA coming out of the pin, it is more like 7mA, > which is close to the docs' claim of 10mA... That depends on what you're measuring. Do you already have the transistor? If so, here's the scoop on an NPN transistor (the type that we've been discussing so far). Current flows into the base lead of the transistor. This current is multiplied by the transistor's Beta value (typically 100-200 for the one's that we've mentioned) and causes that multiple of the base current to flow into the collector lead. Those two currents combine and flow out of the emitter. This simple discussion makes a number of simplifying assumptions that are probably beyond the scope of the discussion. One thing that I'm assuming is that the load (connected between a + supply and the collector) will conduct current in the range that the transistor is able to conduct. > Following your math to the gory end gets me to about 630 ohms, not > 4400 ohms.. then to watts, well, I am simply unable to follow the > logic that gets me from 4400 or 3900 ohms to 1/4 watt. I didn't compute a 1/4W. That happens to be a very common size. There are also 1/8W, 1/2W, 1W, 2W, etc. All you have to do is check that the power dissipation is less than the wattage rating of the resistor. For DC (direct current which we're using here) the power dissipation is the current squared times the resistance or, optionally, the voltage squared divided by the resistance. Even if you dropped the entire 5 volts across a 3.9K resistor that would only be 6.4mW (25/3.9K), much less than the limit of 250mW of a 1/4 watt resistor. > Is my 7mA measurement wrong? Or is this what your recommended > resistor will accomplish? Or do I look for another resistor? I'm > missing something here, Review the discussion again. If your transducer will draw 90mA that's the collector current that you need to design for. Let's call it 100mA to make it easy. Let's say that the transistor's gain is 100 (again, to make it easy - it's probably around 150 or so). That means that in order to get the transistor to conduct 100mA from collector to emitter you have to be able to supply 1mA into the base. The current out of the emitter to ground will be 101mA. With a resistor connected from a 5 volt source to the base, and assuming a 0.6 volt drop from base to emitter, that leaves 4.4 volts across the resistor. If you need 1mA to flow through the resistor, you can't have the resistance any higher than 4.4K ohms. Although there are 4.3K ohm resistors, I would pick 3.9K because that's what I have in my parts boxes. (Besides, I'm color blind and it's easier to user a smaller set of resistor.) As long as you don't exceed the limits of what the parts can handle, everything will adjust the point where everybody is happy. Don |
|
Thanks, Don, you've been patient with me. They say that there are no such things as stupid questions, but I generally disagree. The reason I can't understand what you've plainly tried to answer twice is below, my stupid question stands in the way of understanding. I'll try to explain. You wrote (twice): >Let's call > it 100mA to make it easy. Let's say that the transistor's gain is > 100 (again, to make it easy - it's probably around 150 or so). >That > means that in order to get the transistor to conduct 100mA from > collector to emitter you have to be able to supply 1mA into the > base. The current out of the emitter to ground will be 101mA. I'm getting stuck on (emphasis added) " you HAVE TO be able to supply 1mA".... You talk about 1mA. I talk about 7mA. I CANNOT supply 1mA. I can supply AT LEAST 1mA, but I CANNOT supply ONLY 1mA. If that is the requirement, then I need more resistance. BTW, what does a resistor resist? Current or voltage? Here is my fear: 7mA X 100 gain = 700mA + 7mA = 707mA out of the emitter to the ground, which is way over what the transducer can handle, way over what I want. The fact that you do not respond to this makes me think it must be unimportant (ie, stupid question), but I cannot make assumptions if I am to learn. So what I'm asking is do you mean ONLY 1mA, or do you mean AT LEAST 1mA? Thanks again for your patience. Tx, George --- In , "Don Kinzer" <dkinzer@e...> wrote: > > --- In , "George Alvarez" <george.alvarez@g...> > wrote: > > When I measure the mA coming out of the pin, it is more like 7mA, > > which is close to the docs' claim of 10mA... > > That depends on what you're measuring. Do you already have the > transistor? If so, here's the scoop on an NPN transistor (the type > that we've been discussing so far). Current flows into the base lead > of the transistor. This current is multiplied by the transistor's > Beta value (typically 100-200 for the one's that we've mentioned) and > causes that multiple of the base current to flow into the collector > lead. Those two currents combine and flow out of the emitter. This > simple discussion makes a number of simplifying assumptions that are > probably beyond the scope of the discussion. One thing that I'm > assuming is that the load (connected between a + supply and the > collector) will conduct current in the range that the transistor is > able to conduct. > > > Following your math to the gory end gets me to about 630 ohms, not > > 4400 ohms.. then to watts, well, I am simply unable to follow the > > logic that gets me from 4400 or 3900 ohms to 1/4 watt. > > I didn't compute a 1/4W. That happens to be a very common size. > There are also 1/8W, 1/2W, 1W, 2W, etc. All you have to do is check > that the power dissipation is less than the wattage rating of the > resistor. For DC (direct current which we're using here) the power > dissipation is the current squared times the resistance or, > optionally, the voltage squared divided by the resistance. Even if > you dropped the entire 5 volts across a 3.9K resistor that would only > be 6.4mW (25/3.9K), much less than the limit of 250mW of a 1/4 watt > resistor. > > > Is my 7mA measurement wrong? Or is this what your recommended > > resistor will accomplish? Or do I look for another resistor? I'm > > missing something here, > > Review the discussion again. If your transducer will draw 90mA > that's the collector current that you need to design for. Let's call > it 100mA to make it easy. Let's say that the transistor's gain is > 100 (again, to make it easy - it's probably around 150 or so). That > means that in order to get the transistor to conduct 100mA from > collector to emitter you have to be able to supply 1mA into the > base. The current out of the emitter to ground will be 101mA. > > With a resistor connected from a 5 volt source to the base, and > assuming a 0.6 volt drop from base to emitter, that leaves 4.4 volts > across the resistor. If you need 1mA to flow through the resistor, > you can't have the resistance any higher than 4.4K ohms. Although > there are 4.3K ohm resistors, I would pick 3.9K because that's what I > have in my parts boxes. (Besides, I'm color blind and it's easier to > user a smaller set of resistor.) > > As long as you don't exceed the limits of what the parts can handle, > everything will adjust the point where everybody is happy. > > Don |
|
Don, you wrote: >With a resistor connected from a 5 volt source to the base, and >assuming a 0.6 volt drop from base to emitter, that leaves 4.4 volts >across the resistor. If you need 1mA to flow through the resistor, >you can't have the resistance any higher than 4.4K ohms. Aha! The resistor resists current. The 7mA will drop to some smaller value depending on the resistance value of the resistor. With little resistance (~0 Ohms), I get 7mA... with more resistance (~4400 Ohms) I get less current, ie, 1mA. With humongous resistance, I can essentially stop the flow of current. The voltage of the circuit must be taken in its entirety, which is the really confusing part for me. The 5V coming directly from the battery seems like it should be added to the 0.6V coming from the PIN, as these two voltages appear to be independent. But, I guess, because they ultimately come from the same power source, the power is not additive... there's still only 5V out there, distributed between the pin and the positive connector on the board. I've got a 5V circuit, not a 5.6V, and 4.4V "coming across" the resistor...whatever the current, Ohms law dictates what the resistance MUST be to get to the 1mA current on the other end of the resistor. Is that it? Thanks for all your help. Now I'll try it. Tx, George --- In , "Don Kinzer" <dkinzer@e...> wrote: > > --- In , "George Alvarez" <george.alvarez@g...> > wrote: > > When I measure the mA coming out of the pin, it is more like 7mA, > > which is close to the docs' claim of 10mA... > > That depends on what you're measuring. Do you already have the > transistor? If so, here's the scoop on an NPN transistor (the type > that we've been discussing so far). Current flows into the base lead > of the transistor. This current is multiplied by the transistor's > Beta value (typically 100-200 for the one's that we've mentioned) and > causes that multiple of the base current to flow into the collector > lead. Those two currents combine and flow out of the emitter. This > simple discussion makes a number of simplifying assumptions that are > probably beyond the scope of the discussion. One thing that I'm > assuming is that the load (connected between a + supply and the > collector) will conduct current in the range that the transistor is > able to conduct. > > > Following your math to the gory end gets me to about 630 ohms, not > > 4400 ohms.. then to watts, well, I am simply unable to follow the > > logic that gets me from 4400 or 3900 ohms to 1/4 watt. > > I didn't compute a 1/4W. That happens to be a very common size. > There are also 1/8W, 1/2W, 1W, 2W, etc. All you have to do is check > that the power dissipation is less than the wattage rating of the > resistor. For DC (direct current which we're using here) the power > dissipation is the current squared times the resistance or, > optionally, the voltage squared divided by the resistance. Even if > you dropped the entire 5 volts across a 3.9K resistor that would only > be 6.4mW (25/3.9K), much less than the limit of 250mW of a 1/4 watt > resistor. > > > Is my 7mA measurement wrong? Or is this what your recommended > > resistor will accomplish? Or do I look for another resistor? I'm > > missing something here, > > Review the discussion again. If your transducer will draw 90mA > that's the collector current that you need to design for. Let's call > it 100mA to make it easy. Let's say that the transistor's gain is > 100 (again, to make it easy - it's probably around 150 or so). That > means that in order to get the transistor to conduct 100mA from > collector to emitter you have to be able to supply 1mA into the > base. The current out of the emitter to ground will be 101mA. > > With a resistor connected from a 5 volt source to the base, and > assuming a 0.6 volt drop from base to emitter, that leaves 4.4 volts > across the resistor. If you need 1mA to flow through the resistor, > you can't have the resistance any higher than 4.4K ohms. Although > there are 4.3K ohm resistors, I would pick 3.9K because that's what I > have in my parts boxes. (Besides, I'm color blind and it's easier to > user a smaller set of resistor.) > > As long as you don't exceed the limits of what the parts can handle, > everything will adjust the point where everybody is happy. > > Don |
|
--- In , "George Alvarez" <george.alvarez@g...> wrote: > I'm getting stuck on (emphasis added) " you HAVE TO be able to > supply 1mA".... You talk about 1mA. I talk about 7mA. > > I CANNOT supply 1mA. I can supply AT LEAST 1mA, but I CANNOT > supply ONLY 1mA. If that is the requirement, then I need more > resistance. First a little digression. A transistor has three regions in which it can operate. The first is the cutoff region which means that too little current is being supplied to the base so no current flows from the collector to the emitter. This is useful as the Off state of a switch. The second operating region is the active region or linear region. This is only useful if you're designing analog circuits like audio amplifiers and the like. For digital circuits, it is important to AVOID this region. We like our transistors to operate like switches - On or Off. That brings us to the third operating region called saturation. In this region, there is so much current flowing into the base that that the collector-emitter "channel" becomes very low resistance - just like a switch in the On position. So, with that in mind, it is perhaps a little clearer that to use a transistor like a swith we need to 1) ensure that no current (or very little current) flows into the base to get the Off state or 2) ensure that enough current flows into the base to fully saturate the transistor to get the On state. It is usually sufficient to determine, first, how much collector current you will need to handle. You do this by looking at the spec sheet for the device that will be the "load" on the transistor - the transducer in your case. The specification that you're interested in is how much current the device needs at the voltage that you're going to operate it at. For the purposes of this determination, you can usually ignore the fact that when the transistor is fully on there will still be a small voltage between the collector and emitter. So if one end of the load is connected to 5 volts, the other end to the collector of the NPN transistor and the emitter is connected to ground, we need to know how much current the device (transducer) will draw at 5 volts. Again, let's say that that is 100mA. OK, so how can we ensure that the transistor will conduct 100mA? Answer, design the base driving circuit so that at least 100mA divided by Beta goes into the base. Let's say that the "typical" Beta from the transistor's data sheet is 200. Just to make sure, we'll use 100 instead; that'll make sure that the transistor is fully on. So 100ma/100 = 1ma. Alright, 1ma will work. What happens if, instead, we allow 2ma to flow into the base. Not a big deal. Everything will still work just as we want it to - it's just overkill. If you were concerned about power consumption, you may want to dial it back but I'm assuming that that's not an issue here. Is 7ma OK? Probably. Just more overkill. > BTW, what does a resistor resist? Current or voltage? It resists current flow. The voltage across the resistor is a manifestation of the current flowing through it. Sometimes, however, it is useful to think of it the other way around. I want I mA and I have R ohms. How many volts to I need to get that to happen. Answer: V = I * R. > Here is my fear: 7mA X 100 gain = 700mA + 7mA = 707mA out of the > emitter to the ground, which is way over what the transducer can > handle, way over what I want. The fact that you do not respond to > this makes me think it must be unimportant (ie, stupid question), > but I cannot make assumptions if I am to learn. Have no fear. The tranducer will only allow a certain amount of current to flow through it at a given voltage. Think about removing the transistor completely and connecting the negative lead of the transducer to ground. That's the most current that you're ever going to get through the transducer. The transistor just needs to be able to conduct that much current. It can't suck more current through the transducer that the transducer will allow. When using the transistor in the fully saturated mode, the gain automatically ajusts to what is needed. The gain figure only applies in a proportional way when the transistor is operating in the linear region - the one that we digital engineers avoid. Again, saturation means that you're driving it so hard that it's out of the linear region so the linear rules no longer apply. We just use the rules of the linear region to make sure we're not in it. I can take a transistor with a typical gain of 100 and shoot 1mA into the base to switch on a load of 1mA. That's gross overkill but it won't hurt anything. By the way, the gain of a transistor varies depending on collector current. The data sheet will give you several gain figures at different collector currentl levels. I just checked the datasheet of the 2N3904 again. At a collector current of 1mA the minimum guaranteed gain is 100 but at 100mA it's only 30. The actual gain at 100ma collector current of any particular transistor is probably higher than that. 30 is what they guarantee. > So what I'm asking is do you mean ONLY 1mA, or do you mean AT LEAST > 1mA? It's probably clear from the above discussion that I meant at least 1mA. However, using the new gain figure of 30, you'd need 3.3ma of base current to guarantee saturation with a collector current of 100mA. Working backward from that - 4.4 volts divided by 3.3mA is 1.3K ohms. I'd probably use a 1K resistor. > Tx, > > George > > --- In , "Don Kinzer" <dkinzer@e...> wrote: > > > > --- In , "George Alvarez" > <george.alvarez@g...> > > wrote: > > > When I measure the mA coming out of the pin, it is more like > 7mA, > > > which is close to the docs' claim of 10mA... > > > > That depends on what you're measuring. Do you already have the > > transistor? If so, here's the scoop on an NPN transistor (the > type > > that we've been discussing so far). Current flows into the base > lead > > of the transistor. This current is multiplied by the transistor's > > Beta value (typically 100-200 for the one's that we've mentioned) > and > > causes that multiple of the base current to flow into the > collector > > lead. Those two currents combine and flow out of the emitter. > This > > simple discussion makes a number of simplifying assumptions that > are > > probably beyond the scope of the discussion. One thing that I'm > > assuming is that the load (connected between a + supply and the > > collector) will conduct current in the range that the transistor > is > > able to conduct. > > > > > Following your math to the gory end gets me to about 630 ohms, > not > > > 4400 ohms.. then to watts, well, I am simply unable to follow > the > > > logic that gets me from 4400 or 3900 ohms to 1/4 watt. > > > > I didn't compute a 1/4W. That happens to be a very common size. > > There are also 1/8W, 1/2W, 1W, 2W, etc. All you have to do is > check > > that the power dissipation is less than the wattage rating of the > > resistor. For DC (direct current which we're using here) the > power > > dissipation is the current squared times the resistance or, > > optionally, the voltage squared divided by the resistance. Even > if > > you dropped the entire 5 volts across a 3.9K resistor that would > only > > be 6.4mW (25/3.9K), much less than the limit of 250mW of a 1/4 > watt > > resistor. > > > > > Is my 7mA measurement wrong? Or is this what your recommended > > > resistor will accomplish? Or do I look for another resistor? > I'm > > > missing something here, > > > > Review the discussion again. If your transducer will draw 90mA > > that's the collector current that you need to design for. Let's > call > > it 100mA to make it easy. Let's say that the transistor's gain is > > 100 (again, to make it easy - it's probably around 150 or so). > That > > means that in order to get the transistor to conduct 100mA from > > collector to emitter you have to be able to supply 1mA into the > > base. The current out of the emitter to ground will be 101mA. > > > > With a resistor connected from a 5 volt source to the base, and > > assuming a 0.6 volt drop from base to emitter, that leaves 4.4 > volts > > across the resistor. If you need 1mA to flow through the > resistor, > > you can't have the resistance any higher than 4.4K ohms. Although > > there are 4.3K ohm resistors, I would pick 3.9K because that's > what I > > have in my parts boxes. (Besides, I'm color blind and it's easier > to > > user a smaller set of resistor.) > > > > As long as you don't exceed the limits of what the parts can > handle, > > everything will adjust the point where everybody is happy. > > > > Don |
|
--- In , "George Alvarez" <george.alvarez@g...> wrote: > Is that it? That's pretty much it. There are a couple of other "laws" that are helpful. One is Kirchoff's voltage law which says that the sum of the voltages across each of the components forming a loop must be zero. If you have a 5V battery, a resistor going to the base of a transistor with the emitter connected to the negative of the battery you have loop. The 5V of the battery must be offset by the other voltages around the loop. About 0.6 volts or so for the base-emitter voltage leaves only 4.4V for the resistor. Some transistors have higher and some have lower Vbe figures (that's the voltage from base to emitter then the transistor is conducting). If it were 0.65V, that would only leave 4.35 for the resistor. The other law is Kirchoff's current law. It says that the sum of all currents into a "node" must be zero. A node could be the leads of two or more components or it could be a "magic box" like a transistor. In any event, the sum of all currents going in must be equal to the sum of all currents going out. In the case of the transistor that is "On" the sum of the base and collector currents (those going in) equals the emitter current (the only one going out). > Thanks for all your help. Now I'll try it. > > Tx, > > George > --- In , "Don Kinzer" <dkinzer@e...> wrote: > > > > --- In , "George Alvarez" > <george.alvarez@g...> > > wrote: > > > When I measure the mA coming out of the pin, it is more like > 7mA, > > > which is close to the docs' claim of 10mA... > > > > That depends on what you're measuring. Do you already have the > > transistor? If so, here's the scoop on an NPN transistor (the > type > > that we've been discussing so far). Current flows into the base > lead > > of the transistor. This current is multiplied by the transistor's > > Beta value (typically 100-200 for the one's that we've mentioned) > and > > causes that multiple of the base current to flow into the > collector > > lead. Those two currents combine and flow out of the emitter. > This > > simple discussion makes a number of simplifying assumptions that > are > > probably beyond the scope of the discussion. One thing that I'm > > assuming is that the load (connected between a + supply and the > > collector) will conduct current in the range that the transistor > is > > able to conduct. > > > > > Following your math to the gory end gets me to about 630 ohms, > not > > > 4400 ohms.. then to watts, well, I am simply unable to follow > the > > > logic that gets me from 4400 or 3900 ohms to 1/4 watt. > > > > I didn't compute a 1/4W. That happens to be a very common size. > > There are also 1/8W, 1/2W, 1W, 2W, etc. All you have to do is > check > > that the power dissipation is less than the wattage rating of the > > resistor. For DC (direct current which we're using here) the > power > > dissipation is the current squared times the resistance or, > > optionally, the voltage squared divided by the resistance. Even > if > > you dropped the entire 5 volts across a 3.9K resistor that would > only > > be 6.4mW (25/3.9K), much less than the limit of 250mW of a 1/4 > watt > > resistor. > > > > > Is my 7mA measurement wrong? Or is this what your recommended > > > resistor will accomplish? Or do I look for another resistor? > I'm > > > missing something here, > > > > Review the discussion again. If your transducer will draw 90mA > > that's the collector current that you need to design for. Let's > call > > it 100mA to make it easy. Let's say that the transistor's gain is > > 100 (again, to make it easy - it's probably around 150 or so). > That > > means that in order to get the transistor to conduct 100mA from > > collector to emitter you have to be able to supply 1mA into the > > base. The current out of the emitter to ground will be 101mA. > > > > With a resistor connected from a 5 volt source to the base, and > > assuming a 0.6 volt drop from base to emitter, that leaves 4.4 > volts > > across the resistor. If you need 1mA to flow through the > resistor, > > you can't have the resistance any higher than 4.4K ohms. Although > > there are 4.3K ohm resistors, I would pick 3.9K because that's > what I > > have in my parts boxes. (Besides, I'm color blind and it's easier > to > > user a smaller set of resistor.) > > > > As long as you don't exceed the limits of what the parts can > handle, > > everything will adjust the point where everybody is happy. > > > > Don |
|
Hi Don, This is hopefully my last post. You've been a great and patient teacher, I appreciate your tutelage. We'll see if I need a remedial course, or if I've got the hang of this... You forwarded me a link, http://www.kpsec.freeuk.com/trancirc.htm and so I've read, and it has a little section on how to pick the right transistor to be used as a switch and also estimate required resistor values at the base. I went through the steps, and I come up with a significantly(?) different estimate of the resistance. The difference originates from the LOAD RESISTANCE, which I understand to mean the resistance of the transducer, and also the "rule of thumb" that is used in the calculations. Here's my work on their 4 step procedure, 1) The transistor's maximum collector current IC(max) must be greater than the load current IC. load current IC = supply voltage Vs / load resistance RL X = 5V / 20 ohms (from the transducer documentation) X = .25 = 250mA 2) The transistor's minimum current gain hFE(min) must be at least five times the load current IC divided by the maximum output current from the chip. hFE(min) > 5 × load current IC / max. chip current Y > 5 * (250mA/10mA) Y > 125 3) Choose a transistor which meets these requirements and make a note of its properties: IC(max) and hFE(min). TRANS Ic(max) hFE(min) EVAL CALC'd 250mA , 125 gain, > Both? 2N2222 800mA , 100 gain, no <--- might do in a pinch 2N3904 200mA , 100 gain, no C9014 600mA , 200 gain, YES <--- this one will work 4) Calculate an approximate value for the base resistor: RB = 0.2 × RL × hFE RB = 0.2 X 20 ohms X 125 RB = 500 ohms <--- vs. your 4400 ohms My graduate dissertation of the difference in approaches is this: Applying 500 ohms (calc'd) vs. 4400/3900 ohms(yours)resistance will result in a louder sound, because less resistance will mean more current, yielding more sound. In the calcs, I use 10mA as the "maximum current from the pin"... I'm beginning to guess that "maximum" is more of a term of art; maybe "desired" is better... in other words, if I only want 100mA out, my "maximum" base current should be 1mA. If I want as much current as possible, 10mA is the value to use, clearly too much for the transducer if multiplied by the gain... If I substitute 1mA for 10mA in the formulas below, then the gain becomes impossibly high, but again, this is based on the max RL... to acheive some comfortable middle, then it is almost as if I need another resistor between the transistor and the ground to "soak up" the excess current that I never intend to use, and divert it from the transducer. That doesn't make much sense, so I finally must conclude that by using a resistor with higher resistance than the calcs, I am in effect limiting the maximum performance of the transducer to somewhere below its absolute maximum to achieve a desired effect. I may have to adjust the resistance, depending on what I hear at your estimated values, too loud, add more resistance, too soft, apply less. So, how'd I do? I'm going to Radio Shack now, and I guess I'll field test the results... I'm sure its a good thing I've got 5 of these transducers. :-D Thanks again. Tx, George --- In , "Don Kinzer" <dkinzer@e...> wrote: > > --- In , "George Alvarez" <george.alvarez@g...> > wrote: > > Is that it? > > That's pretty much it. > > There are a couple of other "laws" that are helpful. One is > Kirchoff's voltage law which says that the sum of the voltages across > each of the components forming a loop must be zero. > > If you have a 5V battery, a resistor going to the base of a > transistor with the emitter connected to the negative of the battery > you have loop. The 5V of the battery must be offset by the other > voltages around the loop. About 0.6 volts or so for the base- emitter > voltage leaves only 4.4V for the resistor. Some transistors have > higher and some have lower Vbe figures (that's the voltage from base > to emitter then the transistor is conducting). If it were 0.65V, > that would only leave 4.35 for the resistor. > > The other law is Kirchoff's current law. It says that the sum of all > currents into a "node" must be zero. A node could be the leads of > two or more components or it could be a "magic box" like a > transistor. In any event, the sum of all currents going in must be > equal to the sum of all currents going out. In the case of the > transistor that is "On" the sum of the base and collector currents > (those going in) equals the emitter current (the only one going out). > > > > > Thanks for all your help. Now I'll try it. > > > > Tx, > > > > George > > > > > > --- In , "Don Kinzer" <dkinzer@e...> wrote: > > > > > > --- In , "George Alvarez" > > <george.alvarez@g...> > > > wrote: > > > > When I measure the mA coming out of the pin, it is more like > > 7mA, > > > > which is close to the docs' claim of 10mA... > > > > > > That depends on what you're measuring. Do you already have the > > > transistor? If so, here's the scoop on an NPN transistor (the > > type > > > that we've been discussing so far). Current flows into the base > > lead > > > of the transistor. This current is multiplied by the > transistor's > > > Beta value (typically 100-200 for the one's that we've mentioned) > > and > > > causes that multiple of the base current to flow into the > > collector > > > lead. Those two currents combine and flow out of the emitter. > > This > > > simple discussion makes a number of simplifying assumptions that > > are > > > probably beyond the scope of the discussion. One thing that I'm > > > assuming is that the load (connected between a + supply and the > > > collector) will conduct current in the range that the transistor > > is > > > able to conduct. > > > > > > > Following your math to the gory end gets me to about 630 ohms, > > not > > > > 4400 ohms.. then to watts, well, I am simply unable to follow > > the > > > > logic that gets me from 4400 or 3900 ohms to 1/4 watt. > > > > > > I didn't compute a 1/4W. That happens to be a very common size. > > > There are also 1/8W, 1/2W, 1W, 2W, etc. All you have to do is > > check > > > that the power dissipation is less than the wattage rating of the > > > resistor. For DC (direct current which we're using here) the > > power > > > dissipation is the current squared times the resistance or, > > > optionally, the voltage squared divided by the resistance. Even > > if > > > you dropped the entire 5 volts across a 3.9K resistor that would > > only > > > be 6.4mW (25/3.9K), much less than the limit of 250mW of a 1/4 > > watt > > > resistor. > > > > > > > Is my 7mA measurement wrong? Or is this what your recommended > > > > resistor will accomplish? Or do I look for another resistor? > > I'm > > > > missing something here, > > > > > > Review the discussion again. If your transducer will draw 90mA > > > that's the collector current that you need to design for. Let's > > call > > > it 100mA to make it easy. Let's say that the transistor's gain > is > > > 100 (again, to make it easy - it's probably around 150 or so). > > That > > > means that in order to get the transistor to conduct 100mA from > > > collector to emitter you have to be able to supply 1mA into the > > > base. The current out of the emitter to ground will be 101mA. > > > > > > With a resistor connected from a 5 volt source to the base, and > > > assuming a 0.6 volt drop from base to emitter, that leaves 4.4 > > volts > > > across the resistor. If you need 1mA to flow through the > > resistor, > > > you can't have the resistance any higher than 4.4K ohms. > Although > > > there are 4.3K ohm resistors, I would pick 3.9K because that's > > what I > > > have in my parts boxes. (Besides, I'm color blind and it's > easier > > to > > > user a smaller set of resistor.) > > > > > > As long as you don't exceed the limits of what the parts can > > handle, > > > everything will adjust the point where everybody is happy. > > > > > > Don |
|
--- In , "George Alvarez" <george.alvarez@g...> wrote: > RB = 500 ohms <--- vs. your 4400 ohms My calculation was for a lot less collector current. I was under the impression that the transducer would draw 100mA when connected between +5 and ground. If this is not the case then the calculations that I offered are wrong. > [...] if I only want 100mA out, my "maximum" base current should > be 1mA. Perhaps. However, you don't want the transistor operating in the linear region. You want it either fully on or fully off. The problem is power dissipation. In the linear region it will have a significant voltage across it and a significant current through it. It'll probably get very warm if not hot. Final analysis - you want the transistor to turn on fully. Provide enough base current so that at the minimum the product of that gain times that base current exceeds the desired collecor current. Remember, the collector current really won't be equal to that product. We just need to make sure that that product exceeds the current we need. Also, remember that the minimum gain varies with collector current so you'll want to use the gain spec for the desired collector current. |
|
Hi George, Wow, what a thread. I would like to offer a few observations. My experience suggests the key to successful BX-24 projects is to fully understand the characteristics of the device to be interfaced to, and then design the interface and then connect it to the appropriate BX-24 pin(s). So far I haven't been able to tell exactly what transducer you are trying to use. Does it require a DC voltage or an external AC drive? What is the voltage spec? What is the current spec? How loud is it? 80 db is pretty loud compared to a wrist watch beep. For example, if the transducer you have is spec'd at 5 VDC at 50 mA, you could wire a simple test circuit with three 1.5 VDC alkaline batteries (4.65 VDC is close enough to test) and actually hear what it sounds like. You could also insert various series resistors to see if reducing the current and lowering the voltage gives the desired reduced sound effect. You may have to mechanically muffle to get the desired effect. In any case you need to come up with the nominal operating characteristics of voltage and current of the device, as you want it to sound. Assuming that the transducer you have operates on a DC voltage and does not require an AC voltage drive, then basically all you need is an on and off switch (interface) that is controlled by the BX-24. But wait, if the current required to operate your device is more than 75 mA, you have a small problem. NetMedia says that the BX-24 development board +5VDC and GND breadboard area power supply rails can only supply up to 75 mA. Using current over 75 mA will overstress the BX-24 onboard voltage regulator. If you require more current you will have to add an additional power supply. But wait, If the transducer requires more that 5 VDC to operate you would need to add another higher voltage power supply to meet that requirement. This is why it is important to know what your "load" characteristics are. The I/O (input/output) pins of a BX-24, when configured as output pins can "source" up to, but not exceeding 10 mA each, or "sink" up to, but not exceeding 20 mA each. But wait, the "Combined maximum current load allowed across all I/Os" is "80 mA sink or source". So even if you tied all of the pins together (bad idea) you should not exceed 80 mA total. This limitation on maximum current per pin and total is the reason experienced BX-24 users use "in series current limiting resistors" to connect directly to the pin. A NPN silicon transistor like a 2N3904 in a TO-92 plastic package will serve as a good on/off switch for currents up to 100 mA, a 2N4401 is good up to around 500 mA. Both can be used in circuits up to 40 VDC. The transistor switch is wired in series with the load, in other words, the load circuit goes like this, the plus terminal of the transducer connects to the + positive voltage supply (+5VDC) that is capable of suppling the required amount of current. The minus terminal of the transducer connects to the Collector terminal of the transistor. The Emitter terminal of the transistor connects to the GND (ground or 0 VDC point of the power supply) to complete the circuit path. The Base terminal of the transistor is now the control point of the interface. Connect one end of a series current limiting resistor to the Base terminal and connect the other end to the BX-24 pin that you have chosen to provide the logical control to the power control interface. Use a 1000 ohm 1/8 or 1/4 watt resistor. This limits the pin current to around 5 mA. 5 mA of base current is plenty to cause the transistor to turn on (saturate). (When all 16 I/O pins are being used as outputs and have 1K resistors, the max 80 mA isn't exceeded. handy number.) This is an example of a very simple interface and it should work well for your application. Simple is better, Best Regards, Eric |
|
Hi Eric, --- In , "ericserdahl" <eserdahl@p...> wrote: > > Hi George, > > Wow, what a thread. I would like to offer a few observations. > My experience suggests the key to successful BX-24 projects is to > fully understand the characteristics of the device to be interfaced > to, and then design the interface and then connect it to the > appropriate BX-24 pin(s). Yes, Don, primarily has been very patient, explanatory and helpful. I have trouble keeping up, but I do try and understand all he says. > So far I haven't been able to tell exactly what transducer you are > trying to use. Does it require a DC voltage or an external AC drive? DC > What is the voltage spec? What is the current spec? How loud is it? Rated 3V, Max 4V. "Mean" max is 90mA, "Peak" max is 270mA Typical is 80db, Min is 74... I can tell you from experience if you only feed it 10mA, it is barely audible. > 80 db is pretty loud compared to a wrist watch beep. Good! > For example, if the transducer you have is spec'd at 5 VDC at 50 mA, > you could wire a simple test circuit with three 1.5 VDC alkaline > batteries (4.65 VDC is close enough to test) and actually hear what > it sounds like. You could also insert various series resistors to see > if reducing the current and lowering the voltage gives the desired > reduced sound effect. You may have to mechanically muffle to get the > desired effect. In any case you need to come up with the nominal > operating characteristics of voltage and current of the device, as > you want it to sound. I'll try that tonight. I got two potentiometers, one for 1K Ohms, another for 10K Ohms, I will see if they do what I think they do. > Assuming that the transducer you have operates on a DC voltage and > does not require an AC voltage drive, then basically all you need is > an on and off switch (interface) that is controlled by the BX-24. > > But wait, if the current required to operate your device is more than > 75 mA, you have a small problem. NetMedia says that the BX-24 > development board +5VDC and GND breadboard area power supply rails > can only supply up to 75 mA. Using current over 75 mA will overstress > the BX-24 onboard voltage regulator. If you require more current you > will have to add an additional power supply. If I don't need to get to 80db, then I should be OK.... we'll see. But wait, If the > transducer requires more that 5 VDC to operate you would need to add > another higher voltage power supply to meet that requirement. This is > why it is important to know what your "load" characteristics are. Understood. I think we've covered them in this reply. > The I/O (input/output) pins of a BX-24, when configured as output > pins can "source" up to, but not exceeding 10 mA each, or "sink" up > to, but not exceeding 20 mA each. "Source" meaning OUTPUT and "sink" meaning RECEIVE? But wait, the "Combined maximum > current load allowed across all I/Os" is "80 mA sink or source". So > even if you tied all of the pins together (bad idea) you should not > exceed 80 mA total. OK, well, I wouldn't have even thought of that bad idea! >This limitation on maximum current per pin and > total is the reason experienced BX-24 users use "in series current > limiting resistors" to connect directly to the pin. "In-series Current Limiting" sounds like it would be useful for making sure a pin does not receive too much current. If the pins can only output 10mA, then it does not follow (for me at least) that you'd need to protect the pins from delivering too much current. Perhaps this is a naive/ignorant way to look at it. > A NPN silicon transistor like a 2N3904 in a TO-92 plastic package > will serve as a good on/off switch for currents up to 100 mA, a > 2N4401 is good up to around 500 mA. Both can be used in circuits up > to 40 VDC. OK, I got the 2N3904, can can certainly find the other >The transistor switch is wired in series with the load, in > other words, the load circuit goes like this, the plus terminal of > the transducer connects to the + positive voltage supply (+5VDC) that > is capable of suppling the required amount of current. This is where that 75mA max spec becomes important then? > The minus > terminal of the transducer connects to the Collector terminal of the > transistor. The Emitter terminal of the transistor connects to the > GND (ground or 0 VDC point of the power supply) to complete the > circuit path. The Base terminal of the transistor is now the control > point of the interface. Connect one end of a series current limiting > resistor to the Base terminal and connect the other end to the BX- 24 > pin that you have chosen to provide the logical control to the power > control interface. So far, so good. >Use a 1000 ohm 1/8 or 1/4 watt resistor. This > limits the pin current to around 5 mA. 5 mA of base current is plenty > to cause the transistor to turn on (saturate). (When all 16 I/O pins > are being used as outputs and have 1K resistors, the max 80 mA isn't > exceeded. handy number.) 5mA of base current then, has what effect on the current supplied to the transducer? This is precisely where Don loses me too! 5mA X his assumed 100 gain, puts me at 500mA through the transducer... way too much... Don's estimate of 4000 ohms limits the pin to 1mA output (I think), X 100 gain puts me in the ballpark... except for the part that 100mA is greater than what the BX-24 can deliver (75). So, I conclude that I need more resistance to live within the confines of the board. Is that right? Thanks, George > This is an example of a very simple interface and it should work well > for your application. Simple is better, Amen! Thanks again > > Best Regards, Eric |
|
Hello everybody, I wired the following circuit: 5V+...ohmmeter...transducer....collector....base....emitter...GND The potentiometer was connected to the base, of course. It was a 10K Ohm potentiometer, rated at 50V DC, 0.1W. The wiper turned a little over 180 degrees from one extreme to the other. I assume this could also be called a variable resistor. Yes? The transistor was a 2N3904, Hfe 100, Ic 200mA, Vebo 6V. The transducer specs are, again, 3V to 4V max, 90mA "Mean" max, 270mA "Peak" max. At 90mA, you get 85dB. So, at what I assume is LEAST RESISTANCE, I got 18mA of current, and a slightly louder sound than when the transducer was connected directly. We'll call this 6 O'Clock for reference purposes, is assume this potentiometer has a linear variance, it did not say "audio". At 4:30, I got 19mA of current and a little louder sound. At 3:00, I got 21mA of current and even louder sound. At 1:30, I got 24mA of current and even louder sound. At 12:05, I got 26mA of current and loudest sound. Sound volume was still not loud enough. At 12:00 and beyond, the current diminished slowly, and volume reduced. So, am I to conclude that the 26mA of current was caused by the most resistance, 10K ohms? Does this mean that to get say, 50 mA of current, I either need double the gain or double the resistance, or some combination of the two? If I can't find that particular resistor, can I simply add another pot? Tx, George --- In , "George Alvarez" <george.alvarez@g...> wrote: > > Hi Eric, > > --- In , "ericserdahl" <eserdahl@p...> wrote: > > > > Hi George, > > > > Wow, what a thread. I would like to offer a few observations. > > My experience suggests the key to successful BX-24 projects is to > > fully understand the characteristics of the device to be > interfaced > > to, and then design the interface and then connect it to the > > appropriate BX-24 pin(s). > > Yes, Don, primarily has been very patient, explanatory and helpful. > I have trouble keeping up, but I do try and understand all he says. > > > > > So far I haven't been able to tell exactly what transducer you are > > trying to use. Does it require a DC voltage or an external AC > drive? > > DC > > > What is the voltage spec? What is the current spec? How loud is > it? > > Rated 3V, Max 4V. > "Mean" max is 90mA, "Peak" max is 270mA > Typical is 80db, Min is 74... I can tell you from experience if you > only feed it 10mA, it is barely audible. > > > 80 db is pretty loud compared to a wrist watch beep. > > Good! > > > For example, if the transducer you have is spec'd at 5 VDC at 50 > mA, > > you could wire a simple test circuit with three 1.5 VDC alkaline > > batteries (4.65 VDC is close enough to test) and actually hear > what > > it sounds like. You could also insert various series resistors to > see > > if reducing the current and lowering the voltage gives the desired > > reduced sound effect. You may have to mechanically muffle to get > the > > desired effect. In any case you need to come up with the nominal > > operating characteristics of voltage and current of the device, as > > you want it to sound. > > I'll try that tonight. I got two potentiometers, one for 1K Ohms, > another for 10K Ohms, I will see if they do what I think they do. > > > > > Assuming that the transducer you have operates on a DC voltage and > > does not require an AC voltage drive, then basically all you need > is > > an on and off switch (interface) that is controlled by the BX-24. > > > > But wait, if the current required to operate your device is more > than > > 75 mA, you have a small problem. NetMedia says that the BX-24 > > development board +5VDC and GND breadboard area power supply rails > > can only supply up to 75 mA. Using current over 75 mA will > overstress > > the BX-24 onboard voltage regulator. If you require more current > you > > will have to add an additional power supply. > > If I don't need to get to 80db, then I should be OK.... we'll see. > > But wait, If the > > transducer requires more that 5 VDC to operate you would need to > add > > another higher voltage power supply to meet that requirement. This > is > > why it is important to know what your "load" characteristics are. > > > > Understood. I think we've covered them in this reply. > > > The I/O (input/output) pins of a BX-24, when configured as output > > pins can "source" up to, but not exceeding 10 mA each, or "sink" > up > > to, but not exceeding 20 mA each. > > "Source" meaning OUTPUT and "sink" meaning RECEIVE? > > But wait, the "Combined maximum > > current load allowed across all I/Os" is "80 mA sink or source". > So > > even if you tied all of the pins together (bad idea) you should > not > > exceed 80 mA total. > > OK, well, I wouldn't have even thought of that bad idea! > >This limitation on maximum current per pin and > > total is the reason experienced BX-24 users use "in series current > > limiting resistors" to connect directly to the pin. > > > > "In-series Current Limiting" sounds like it would be useful for > making sure a pin does not receive too much current. If the pins > can only output 10mA, then it does not follow (for me at least) that > you'd need to protect the pins from delivering too much current. > Perhaps this is a naive/ignorant way to look at it. > > A NPN silicon transistor like a 2N3904 in a TO-92 plastic package > > will serve as a good on/off switch for currents up to 100 mA, a > > 2N4401 is good up to around 500 mA. Both can be used in circuits > up > > to 40 VDC. > > OK, I got the 2N3904, can can certainly find the other > >The transistor switch is wired in series with the load, in > > other words, the load circuit goes like this, the plus terminal of > > the transducer connects to the + positive voltage supply (+5VDC) > that > > is capable of suppling the required amount of current. > > This is where that 75mA max spec becomes important then? > > The minus > > terminal of the transducer connects to the Collector terminal of > the > > transistor. The Emitter terminal of the transistor connects to the > > GND (ground or 0 VDC point of the power supply) to complete the > > circuit path. The Base terminal of the transistor is now the > control > > point of the interface. Connect one end of a series current > limiting > > resistor to the Base terminal and connect the other end to the BX- > 24 > > pin that you have chosen to provide the logical control to the > power > > control interface. > > So far, so good. > > >Use a 1000 ohm 1/8 or 1/4 watt resistor. This > > limits the pin current to around 5 mA. 5 mA of base current is > plenty > > to cause the transistor to turn on (saturate). (When all 16 I/O > pins > > are being used as outputs and have 1K resistors, the max 80 mA > isn't > > exceeded. handy number.) > > > > 5mA of base current then, has what effect on the current supplied to > the transducer? This is precisely where Don loses me too! > > 5mA X his assumed 100 gain, puts me at 500mA through the > transducer... way too much... > > Don's estimate of 4000 ohms limits the pin to 1mA output (I think), > X 100 gain puts me in the ballpark... > > except for the part that 100mA is greater than what the BX-24 can > deliver (75). > > So, I conclude that I need more resistance to live within the > confines of the board. > > Is that right? > > Thanks, > > George > > > This is an example of a very simple interface and it should work > well > > for your application. Simple is better, > > Amen! Thanks again > > > > Best Regards, Eric |
|
Whose bot's photo is that? You're steering an IR distance sensor with the stepper? Tom Tom Becker --... ...-- www.RighTime.com The RighTime Clock Company, Inc., Cape Coral, Florida USA +1239 540 5700 [Non-text portions of this message have been removed] |
|
OurBot is mine, ( well... my son's and mine hence the "Our" ) and yes
you are right. We are using a stepper to turn the IR back and forth. It takes 17 distance readings ( 5 steps ), Multitasking to do so, and Multitasking to run the modifies servos at the same time. When first turned on, it centers the IR by hitting a stop behind the IR, then going forward to center. It has since also bee changed to run backwards with edge or line detection on the back. I should have been running with the caster at the back the whole time, but learned that too late. Now it does both. GK ----- Original Message ----- From: "Tom Becker" <> To: <> Sent: Thursday, March 24, 2005 10:44 PM Subject: [BasicX] OurBot photo > > Whose bot's photo is that? You're steering an IR distance sensor with > the stepper? > > Tom > > Tom Becker > --... ...-- > www.RighTime.com > The RighTime Clock Company, Inc., Cape Coral, Florida USA > +1239 540 5700 > > > [Non-text portions of this message have been removed] > > > Yahoo! Groups Links |
|
|
|
> ... We are using a stepper to turn the IR back and forth. It takes 17 distance readings ... What do you do with that data? Do you map the foreground and choose a path or just avoid apparent obstacles? Tom Tom Becker --... ...-- www.RighTime.com The RighTime Clock Company, Inc., Cape Coral, Florida USA +1239 540 5700 |
|
I save it in an array called Range. It goes to 10 both ways, but I don't use some of them anymore. Public Range(-10 to 10) As integer I just thought 0 being center was cool and easier to visualize too. to answer your question why -10 to 10 then in the main loop I do this... Left = 0 Right = 0 Center = 0 '----------------------------------------------------------------- 'Check Right Side --------------------------------------------------------------- If Range(8) > Avoid_Distance Then Right = Right + 1 ElseIf Range(7) > Avoid_Distance Then Right = Right + 1 ElseIf Range(6) > Avoid_Distance Then Right = Right + 1 ElseIf Range(5) > Avoid_Distance Then Right = Right + 1 ElseIf Range(4) > Avoid_Distance Then Right = Right + 1 ElseIf Range(3) > Avoid_Distance Then Right = Right + 1 '----------------------------------------------------------------- ' Check Center '----------------------------------------------------------------- ElseIf Range(2) > Avoid_Distance Then Center = Center + 1 ElseIf Range(1) > Avoid_Distance Then Center = Center + 1 ElseIf Range(0) > Avoid_Distance Then Center = Center + 1 ElseIf Range(-1) > Avoid_Distance Then Center = Center + 1 ElseIf Range(-2) > Avoid_Distance Then Center = Center + 1 ----------------------------------------------------------------- ' Check Left Side '----------------------------------------------------------------- ElseIf Range(-3) > Avoid_Distance Then Left = Left + 1 ElseIf Range(-4) > Avoid_Distance Then Left = Left + 1 ElseIf Range(-5) > Avoid_Distance Then Left = Left + 1 ElseIf Range(-6) > Avoid_Distance Then Left = Left + 1 ElseIf Range(-7) > Avoid_Distance Then Left = Left + 1 ElseIf Range(-8) > Avoid_Distance Then Left = Left + 1 End If '----------------------------------------------------------------- ' obstacle avoidance '----------------------------------------------------------------- If Center > 0 Then Servos_Reverse Call Sleep( Turning_Duration ) Randomize Rand = Rnd * 100.00 If Rand > 50.00 then Servos_Turn_Left Call Sleep( Turning_Duration ) else Servos_Turn_Right Call Sleep( Turning_Duration ) End If ElseIf Right > 0 Then Servos_Turn_Left ElseIf Left > 0 Then Servos_Turn_Right Else Servos_Forward_Fast End If I Randomized the turning from center cause we could tell what it was about to do all the time. it took something away from it being a real "robot". Any suggestions would be welcomed, like the name says, I'm new at this !! GK ----- Original Message ----- From: "Tom Becker" <> To: <> Sent: Friday, March 25, 2005 1:05 PM Subject: RE: [BasicX] OurBot photo > > > ... We are using a stepper to turn the IR back and forth. It takes 17 > distance readings ... > > What do you do with that data? Do you map the foreground and choose a > path or just avoid apparent obstacles? > Tom > > Tom Becker > --... ...-- > www.RighTime.com > The RighTime Clock Company, Inc., Cape Coral, Florida USA > +1239 540 5700 > > > Yahoo! Groups Links |
|
Gerald, I have done something similar with my bot. I use an ultrasonic ranger. That sensor I find to be a little squirrely. I guess it has such a long range and wide view that it sees obstacles when they are not really there. Since the field of view is pretty wide, I just pivoted the servo and checked far left/left/center/right/far right. I would love to do mapping but I have not figured out how to make a good 2 dimensional array within the memory constraints of a BX-24 (I will buy one of the new model when if comes out) Because of this I have not thought-out the math of the radial to rectangular conversion, and I have not even decided that such a conversion is necessary. Ultimately, I want to build a little rover that interfaces to my hand-held GPS and can follow the orders to "go home". I can put it down somewhere in my neighborhood and avoid obstacles and get home. I have the Rover body and wheels assembled. I found that, to my surprise, it can clear 10+" curbs without much difficulty. It stands about 8" tall, with 4 wheel drive on 4" (I think)soft tires. I want it to be able to map distant obstacles and then calculate the "best" path to take. I have been keeping the question of a "goodness" algorithm in the back if my mind for months. If home is "that" way, and avoiding the obstacle takes me that many degrees off that track for that much of a distance, then how much do I like that route? As a practical exercise, I think I would like IT to determine the overall best "goodness" algorithm (or at least the weighting of the factors) as judged by the success of approaching the target.. It is fun to try to make these bots do their things, isn't it? I am just waiting for the new version of the BX-24, if it materializes. Maybe I could do something with a larger EEPROM retrofit.... -Tony --- In , "new" <gerald.klein@3...> wrote: > I save it in an array called Range. It goes to 10 both ways, but I don't use > some of them anymore. > > Public Range(-10 to 10) As integer > > I just thought 0 being center was cool and easier to visualize too. to > answer your question why -10 to 10 > > then in the main loop I do this... > > Left = 0 > Right = 0 > Center = 0 > '----------------------------------------------------------------- > 'Check Right Side > --------------------------------------------------------------- > If Range(8) > Avoid_Distance Then > Right = Right + 1 > ElseIf Range(7) > Avoid_Distance Then > Right = Right + 1 > ElseIf Range(6) > Avoid_Distance Then > Right = Right + 1 > ElseIf Range(5) > Avoid_Distance Then > Right = Right + 1 > ElseIf Range(4) > Avoid_Distance Then > Right = Right + 1 > ElseIf Range(3) > Avoid_Distance Then > Right = Right + 1 > '----------------------------------------------------------------- > ' Check Center > '----------------------------------------------------------------- > ElseIf Range(2) > Avoid_Distance Then > Center = Center + 1 > ElseIf Range(1) > Avoid_Distance Then > Center = Center + 1 > ElseIf Range(0) > Avoid_Distance Then > Center = Center + 1 > ElseIf Range(-1) > Avoid_Distance Then > Center = Center + 1 > ElseIf Range(-2) > Avoid_Distance Then > Center = Center + 1 > ----------------------------------------------------------------- > ' Check Left Side > '----------------------------------------------------------------- > ElseIf Range(-3) > Avoid_Distance Then > Left = Left + 1 > ElseIf Range(-4) > Avoid_Distance Then > Left = Left + 1 > ElseIf Range(-5) > Avoid_Distance Then > Left = Left + 1 > ElseIf Range(-6) > Avoid_Distance Then > Left = Left + 1 > ElseIf Range(-7) > Avoid_Distance Then > Left = Left + 1 > ElseIf Range(-8) > Avoid_Distance Then > Left = Left + 1 > End If > > '----------------------------------------------------------------- > ' obstacle avoidance > '----------------------------------------------------------------- > If Center > 0 Then > Servos_Reverse > Call Sleep( Turning_Duration ) > > Randomize > Rand = Rnd * 100.00 > > If Rand > 50.00 then > Servos_Turn_Left > Call Sleep( Turning_Duration ) > else > Servos_Turn_Right > Call Sleep( Turning_Duration ) > End If > > ElseIf Right > 0 Then > Servos_Turn_Left > ElseIf Left > 0 Then > Servos_Turn_Right > > Else > Servos_Forward_Fast > End If > I Randomized the turning from center cause we could tell what it was about > to do all the time. it took something away from it being a real "robot". > > Any suggestions would be welcomed, like the name says, I'm new at this !! > > GK > > ----- Original Message ----- > From: "Tom Becker" <gtbecker@r...> > To: <> > Sent: Friday, March 25, 2005 1:05 PM > Subject: RE: [BasicX] OurBot photo > > > > > ... We are using a stepper to turn the IR back and forth. It takes 17 > > distance readings ... > > > > What do you do with that data? Do you map the foreground and choose a > > path or just avoid apparent obstacles? > > > > > > Tom > > > > > > > > Tom Becker > > --... ...-- > > GTBecker@R... www.RighTime.com > > The RighTime Clock Company, Inc., Cape Coral, Florida USA > > +1239 540 5700 > > > > > > > > > > Yahoo! Groups Links > > > > > > > > > > > > > |
|
Tony: Wow, You've taken it way farther than I ever thought of. The GPS idea sounds really cool. Upload some pictures, I'd love to see them A 10" curb no problem. Like I said pictures !!!! You're right, it is fun. I just wish my wife could see it through my eyes. She just doesn't get it, and thinks its a complete waste of time and money. It make it more difficult to buy parts, so I have to scavenge parts allot, which is also cool. especially when the guys at work ask about the parts I use. Now they give me all sorts of broken toys. Again, my wife gets in the way. something about bringing garbage home, blah blah blah.... I stopped listening a while ago. I started this with an Ultra Sonic Ranger, but found it too slow. Now I use a Sharp IR. Fast and easy to interface with. I was going to buy more, and have them attached to the Bot, but then... well re-read above. so I used a old stepper motor I had laying around to turn it left and right. Things worked out just how I wanted. Lucky I guess. I'm going to look into the 2 dimensional array too. Mapping sound like a good challenge. Have you seen the homemade 64k EEPROM addition to the BX-24 in the picture section of the message board !!! ----- Original Message ----- From: "arhodes19044" <> To: <> Sent: Friday, March 25, 2005 1:57 PM Subject: [BasicX] Re: OurBot photo > > > Gerald, I have done something similar with my bot. I use an > ultrasonic ranger. That sensor I find to be a little squirrely. I > guess it has such a long range and wide view that it sees obstacles > when they are not really there. Since the field of view is pretty > wide, I just pivoted the servo and checked far > left/left/center/right/far right. I would love to do mapping but I > have not figured out how to make a good 2 dimensional array within > the memory constraints of a BX-24 (I will buy one of the new model > when if comes out) Because of this I have not thought-out the math > of the radial to rectangular conversion, and I have not even decided > that such a conversion is necessary. > > Ultimately, I want to build a little rover that interfaces to my > hand-held GPS and can follow the orders to "go home". I can put it > down somewhere in my neighborhood and avoid obstacles and get home. > > I have the Rover body and wheels assembled. I found that, to my > surprise, it can clear 10+" curbs without much difficulty. It > stands about 8" tall, with 4 wheel drive on 4" (I think)soft tires. > > I want it to be able to map distant obstacles and then calculate > the "best" path to take. I have been keeping the question of > a "goodness" algorithm in the back if my mind for months. If home > is "that" way, and avoiding the obstacle takes me that many degrees > off that track for that much of a distance, then how much do I like > that route? As a practical exercise, I think I would like IT to > determine the overall best "goodness" algorithm (or at least the > weighting of the factors) as judged by the success of approaching > the target.. > > It is fun to try to make these bots do their things, isn't it? I am > just waiting for the new version of the BX-24, if it materializes. > Maybe I could do something with a larger EEPROM retrofit.... > > -Tony > --- In , "new" <gerald.klein@3...> wrote: > > I save it in an array called Range. It goes to 10 both ways, but I > don't use > > some of them anymore. > > > > Public Range(-10 to 10) As integer > > > > I just thought 0 being center was cool and easier to visualize > too. to > > answer your question why -10 to 10 > > > > then in the main loop I do this... > > > > Left = 0 > > Right = 0 > > Center = 0 > > '----------------------------------------------------------------- > > 'Check Right Side > > --------------------------------------------------------------- > > If Range(8) > Avoid_Distance Then > > Right = Right + 1 > > ElseIf Range(7) > Avoid_Distance Then > > Right = Right + 1 > > ElseIf Range(6) > Avoid_Distance Then > > Right = Right + 1 > > ElseIf Range(5) > Avoid_Distance Then > > Right = Right + 1 > > ElseIf Range(4) > Avoid_Distance Then > > Right = Right + 1 > > ElseIf Range(3) > Avoid_Distance Then > > Right = Right + 1 > > '----------------------------------------------------------------- > > ' Check Center > > '----------------------------------------------------------------- > > ElseIf Range(2) > Avoid_Distance Then > > Center = Center + 1 > > ElseIf Range(1) > Avoid_Distance Then > > Center = Center + 1 > > ElseIf Range(0) > Avoid_Distance Then > > Center = Center + 1 > > ElseIf Range(-1) > Avoid_Distance Then > > Center = Center + 1 > > ElseIf Range(-2) > Avoid_Distance Then > > Center = Center + 1 > > ----------------------------------------------------------------- > > ' Check Left Side > > '----------------------------------------------------------------- > > ElseIf Range(-3) > Avoid_Distance Then > > Left = Left + 1 > > ElseIf Range(-4) > Avoid_Distance Then > > Left = Left + 1 > > ElseIf Range(-5) > Avoid_Distance Then > > Left = Left + 1 > > ElseIf Range(-6) > Avoid_Distance Then > > Left = Left + 1 > > ElseIf Range(-7) > Avoid_Distance Then > > Left = Left + 1 > > ElseIf Range(-8) > Avoid_Distance Then > > Left = Left + 1 > > End If > > > > '----------------------------------------------------------------- > > ' obstacle avoidance > > '----------------------------------------------------------------- > > If Center > 0 Then > > Servos_Reverse > > Call Sleep( Turning_Duration ) > > > > Randomize > > Rand = Rnd * 100.00 > > > > If Rand > 50.00 then > > Servos_Turn_Left > > Call Sleep( Turning_Duration ) > > else > > Servos_Turn_Right > > Call Sleep( Turning_Duration ) > > End If > > > > ElseIf Right > 0 Then > > Servos_Turn_Left > > ElseIf Left > 0 Then > > Servos_Turn_Right > > > > Else > > Servos_Forward_Fast > > End If > > > > > > I Randomized the turning from center cause we could tell what it > was about > > to do all the time. it took something away from it being a > real "robot". > > > > Any suggestions would be welcomed, like the name says, I'm new at > this !! > > > > GK > > > > > > > > ----- Original Message ----- > > From: "Tom Becker" <gtbecker@r...> > > To: <> > > Sent: Friday, March 25, 2005 1:05 PM > > Subject: RE: [BasicX] OurBot photo > > > > > > > > > > > ... We are using a stepper to turn the IR back and forth. It > takes 17 > > > distance readings ... > > > > > > What do you do with that data? Do you map the foreground and > choose a > > > path or just avoid apparent obstacles? > > > > > > > > > Tom > > > > > > > > > > > > Tom Becker > > > --... ...-- > > > GTBecker@R... www.RighTime.com > > > The RighTime Clock Company, Inc., Cape Coral, Florida USA > > > +1239 540 5700 > > > > > > > > > > > > > > > Yahoo! Groups Links > > > > > > > > > > > > > > > > > > > > > > Yahoo! Groups Links |