I have an UNO R3 powered thru the barrel jack with 12v. I am also using the Proto-Screwshield with a L293D driving 2 (12v) motors, and I am driving the Large Piezo Element with digital pins 2 (-) and 3 (+) to play an alarm sound. All works great except volume.
My question is how do I utilize the 12v power from VIN to drive the Piezo instead of the 5v from pin 3?
How to drive Large Piezo Element with 12v VIN on UNO
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
-
- Posts: 23
- Joined: Mon Nov 02, 2015 6:39 pm
- dastels
- Posts: 15670
- Joined: Tue Oct 20, 2015 3:22 pm
Re: How to drive Large Piezo Element with 12v VIN on UNO
Assuming the Piezo can handle 12v, a transistor (and biasing resistor) should do the job. See https://learn.adafruit.com/transistors-101 for more info. Specifically the example of driving a 12v LED strip from a 3.3v board should be of use: https://learn.adafruit.com/transistors- ... -3001921-1.
Dave
Dave
-
- Posts: 23
- Joined: Mon Nov 02, 2015 6:39 pm
Re: How to drive Large Piezo Element with 12v VIN on UNO
Thanks for the quick response dastels. Yes the Piezo can handle 12v. That's why it isn't loud enough currently being driven by only 5v from the digital pin.
I am not really interested in getting more voltage out of the 5v pin I am currently using, I'm wondering how I can divert some of the 12v VIN supply I already have supplying a L293D, a motor and an actuator from the Proto-Screwshield (stacked on the UNO). Which has lots of space to add a couple of components, as you suggested, but I'd rather utilize the generous 12v supply I already have than triple the amperage the Piezo uses from pin 3. This project is going to be used in the Arizona heat, up to 115° in full sun, for hours on end. Although everything is rated for 150°, the less heat the better.
I suspect digital pin 3 is using PWM to generate the "tones" I am using from the TONE() advanced I/O function. I was wondering if there is a way to "effectively" create a 12v PWM pin for the function to use. Or am I going to have to spring for some sort of a sound board to get there?
I am not really interested in getting more voltage out of the 5v pin I am currently using, I'm wondering how I can divert some of the 12v VIN supply I already have supplying a L293D, a motor and an actuator from the Proto-Screwshield (stacked on the UNO). Which has lots of space to add a couple of components, as you suggested, but I'd rather utilize the generous 12v supply I already have than triple the amperage the Piezo uses from pin 3. This project is going to be used in the Arizona heat, up to 115° in full sun, for hours on end. Although everything is rated for 150°, the less heat the better.
I suspect digital pin 3 is using PWM to generate the "tones" I am using from the TONE() advanced I/O function. I was wondering if there is a way to "effectively" create a 12v PWM pin for the function to use. Or am I going to have to spring for some sort of a sound board to get there?
- dastels
- Posts: 15670
- Joined: Tue Oct 20, 2015 3:22 pm
Re: How to drive Large Piezo Element with 12v VIN on UNO
You use the 5v logic signal from the GPIO pin to control a transistor that switches the 12v to the piezo. Read the guide I linked.
Dave
Dave
-
- Posts: 23
- Joined: Mon Nov 02, 2015 6:39 pm
Re: How to drive Large Piezo Element with 12v VIN on UNO
Having read through the guide front to back in one sitting, my non-electrical-engineer 70yo brain is in pain. However, I think I learned something.
If I am understanding this properly, I can supply 12v to one end of the TIP120, the other end plugged into the Piezo, drive it with digital pin 3 and the Piezo will be non-the-wiser.
Am I close?
If I am understanding this properly, I can supply 12v to one end of the TIP120, the other end plugged into the Piezo, drive it with digital pin 3 and the Piezo will be non-the-wiser.
Am I close?
- dastels
- Posts: 15670
- Joined: Tue Oct 20, 2015 3:22 pm
Re: How to drive Large Piezo Element with 12v VIN on UNO
In a manner of speaking, yes. Think of it as hydrolics... a little bit of force controls a large amount of force. In this case, a little bit of current (the voltage is immaterial as long as it's at least 1.6v; the bias resistor takes care of that detail) can control a different/more voltage/current. The transistor here is acting like a switch that's controllable with a small signal (e.g. from a MCU pin).
There's a more detailed (i.e. inner workings) article I did for HackSpace Magazine issue 13 https://hackspace.raspberrypi.org/downl ... eMag13.pdf
Dave
There's a more detailed (i.e. inner workings) article I did for HackSpace Magazine issue 13 https://hackspace.raspberrypi.org/downl ... eMag13.pdf
Dave
-
- Posts: 23
- Joined: Mon Nov 02, 2015 6:39 pm
Please be positive and constructive with your questions and comments.