Go Down

Topic: Arduino Mega - How to lower current voltage and intensity of digital pin output? (Read 612 times) previous topic - next topic

kaisbensalah

A driver is something that supplies the voltage or current to a device which is controlled by typically a micro processor that has limited voltage / current capabilities. A driver is a circuit that bridges that gap.
Understood, Thanks ;)

Conceptually it is more or less the same thing, a driver program is a code piece that knows how to talk to something (like an ethernet board or a serial port) and presents an API to the programmer.

In electronics a driver (as in "LED driver") is a component or circuit that knows how to talk to something and presents you with a way to tell him what you want to do.
In this case the transistor is a driver because it gives you an interface (the base pin) that you just have to switch HIGH or LOW, when you switch that pin HIGH the transistor will switch on and current will flow trough the buzzer, when you switch that pin LOW the transistor will switch off.

So, you don't need to worry if your Mega sends 3.3 or 5 V, the driver circuit will provide the correct voltage to the device. Of course that in this case of a very simple driver you'll have to build it yourself making sure that it will provide the voltage that your device need, so, in Electronics, the final user will have to know more about the device it is working with than a programmer that's only using an API.
Understood, thanks for the great explanation.

kaisbensalah

//Edit
overlooked the 3V, you might need a dedicated power source for that but the buzzer might survive 3.3V.
I think that the 50mA intensity generated by the 3.3V power pin, is too high for the buzzer (in the specs the maximum supported intensity is 35mA). Do you think that 50mA can cause damage to the buzzer?

sterretje

Your power pin does not "push out" 50 mA. It delivers as much as is needed which in this case will be 35 mA.

Think of it this way. The electricity system in your house can deliver 16A (@230V). If you connect a 60W lightbulb (roughly 0.25A), does it blow up?
If you understand an example, use it.
If you don't understand an example, don't use it.

Electronics engineer by trade, software engineer by profession. Trying to get back into electronics after 15 years absence.

kaisbensalah

Your power pin does not "push out" 50 mA. It delivers as much as is needed which in this case will be 35 mA.

Think of it this way. The electricity system in your house can deliver 16A (@230V). If you connect a 60W lightbulb (roughly 0.25A), does it blow up?
Understood. Thanks.

kaisbensalah

The transistor is controlled by a IO pin, the power for the buzzer can (or can not) be supplied by the 3.3V pin. Below the idea.


I've already tried to implement this buzzer driver, using UNO, BC547 transistor, 2K ohm resistor and an active buzzer (different buzzer).

This is the schematic I used for the implementation:



I'm pretty sure that the new buzzer works under 3.3V (I tested it).

However after connecting the buzzer to the board using the driver described above, no current gets flowed to the buzzer. And of course, I can't hear any beep.

I'm really stuck at this point - I can't know what's causing the problem ..

Do you have any idea?

According to schematics the red pin of the buzzer should go to +3.3v, you have connected it to the same place as the black pin.
--
You never learn anything by doing it right.

Paul__B

You need to realise that as that diagram is oriented, all five sockets (holes) in each vertical column on each side of the centre furrow are the same connection.

Here is what it looks like with the backing peeled off:


kaisbensalah

According to schematics the red pin of the buzzer should go to +3.3v, you have connected it to the same place as the black pin.
I think you're absolutely right.

But even with the updated schematics below



I'm still having the same problem.

What I'm still missing?

There's always the possibility that the pin out of the transistor is not what you think it is or somehow the transistor is busted, a cheap transistor tester from ebay will help you at this (it's much more than a transistor tester, but the name stucks). Double check that you did not connected the transistor backwards (been there done that, busted a mosfet ans spent days trying to find out why it was not working, the transistor tester showed that it was not being identified as a mosfet any more).
But assuming the transistor is ok, show us the code.

Change the number for the pin you're using, 13 is just an example.

It should be something in the lines of

Code: [Select]

#define mypin 13

setup()
{
    pinMode(mypin, OUTPUT);
}

loop()
{
    digitalWrite(mypin, HIGH);
    wait(5000);
    digitalWrite(mypin, LOW);
    wait(5000);
}
--
You never learn anything by doing it right.

arduarn

Another thing to be aware of, if your diagram exactly matches your physical configuration, is that some of those long breadboards have a break in the middle of the top and bottom power rails.  You need a bridge in the middle to make them into full length rails. Depends on your exact breadboard, but worth checking.

kaisbensalah

But assuming the transistor is ok, show us the code.
Thanks for the hint ;), my mistake was the code .. I forgot to update the setup loop, adding pinMode(4, OUTPUT) for the signal going to the transistor base.

Grumpy_Mike

Quote
According to schematics the red pin of the buzzer should go to +3.3v,
With regard to reply #22 you have now connected the black wire to +3V3 not the red wire.

Wawa

Small unrelated correction.
According to the mega spec, you can draw 50 mA from the 3.3V pin.
The 3.3volt specs for the Uno/Mega are wrong. Seems this has been taken from an older version board.
Currently the Uno/Mega boards have a dedicated 3.3volt regulator that can supply 150mA max.
Leo..

sterretje

Small unrelated correction.The 3.3volt specs for the Uno/Mega are wrong. Seems this has been taken from an older version board.
Currently the Uno/Mega boards have a dedicated 3.3volt regulator that can supply 150mA max.
Leo..
Thanks for that; will try to keep it in mind.
If you understand an example, use it.
If you don't understand an example, don't use it.

Electronics engineer by trade, software engineer by profession. Trying to get back into electronics after 15 years absence.

polymorph

You don't use the tone library with a buzzer. The buzzer makes noise when power is supplied.

Unless you are just using the tone library to make the buzzer turn on and off at a relatively slow rate.

By the way, we say 35mA current, not intensity.
Steve Greenfield AE7HD
Drawing Schematics: tinyurl.com/23mo9pf - tinyurl.com/o97ysyx - https://tinyurl.com/Technote8
Multitasking: forum.arduino.cc/index.php?topic=223286.0
gammon.com.au/blink - gammon.com.au/serial - gammon.com.au/interrupts

Go Up