I know that the PWM pins on the Arduino boards only support up to 5v with the analogWrite(0-255).
Is there any way to get a PWM pin up to 12 volts using an external source? Because I know for sure I can't pump 12 volts through that board, that would just be asking for tons of trouble (And popped microcontrollers).
holmes4:
Look at the motor control example in the playground.
Mark
Hi mark!
So you're saying if I use the motor shield, I could potentially use that shield's port (like the stepper motor port?) with an external power supply to supply a 12v PWM? If so - NEAT!
That could be done using a transistor(or mosfet) in a series pass configuration with +12V connected to the collector (or drain)
and the 0 to 12V from the emitter (or source) using a base resistor driven by the pwm pin (no resistor required for N-channel Mosfet). If you have no electronics experience (and it sounds like you don't, do not apply power to anything until you have cleared the wiring (schematic ) with us. (or else you know what...) .
raschemmel:
That could be done using a transistor(or mosfet) in a series pass configuration with +12V connected to the collector (or drain)
and the 0 to 12V from the emitter (or source) using a base resistor driven by the pwm pin (no resistor required for N-channel Mosfet). If you have no electronics experience (and it sounds like you don't, do not apply power to anything until you have cleared the wiring (schematic ) with us. (or else you know what...) .
haha, I actually do have electronics experience, just not in this specific area (yet) with mosfets and the sort, I'm more of a computer scientist than an electrical engineer, but of course I actually love this stuff so as I learn I keep at it.
I'll draft up a schematic as soon as I'm off work. I'd prefer going the mosfet route to save money because the motor shield is an additional cost.
I'm making 12 units for an "interactive lighting system" that uses a sonic distance sensor and computes distance using the speed of sound and then calculates whether or not to change the duty cycle of a PWM pin from 1.5v to 5.0v with a slow transition using a simple for loop.
It works alright, although my LED light could use some more juice for extra brightness because the end goal of this set up is to light art pieces as people walk up to them, and then dim them when they walk away.
whether or not to change the duty cycle of a PWM pin from 1.5v to 5.0v
I don't follow this statement. PWM duty cycle can only be described in units of percent because it is is PWM . There is nothing in between 0v and 5V , since it is either ON or OFF, so 1.5V has no place in a statement regarding PWM duty cycle.
whether or not to change the duty cycle of a PWM pin from 1.5v to 5.0v
I don't follow this statement. PWM duty cycle can only be described in units of percent because it is is PWM . There is nothing in between 0v and 5V , since it is either ON or OFF, so 1.5V has no place in a statement regarding PWM duty cycle.
My apologies you're right. Again, more of a computer scientist than an EE, so I'll goof here and there but I'm learning as I go along
thanks for the correction.
Although my voltmeter can read it in as voltage, but I mixed up the terminology, so if I'm at analogWrite(10) it gives me a lower voltage than that of analogWrite(255) which should be about 5v. It just doesn't read the frequency....
So in regards to duty cycle percentages --
5.8% to 100% duty cycle.
it's 5.8% on idle, when someone is not in front of the sensor's accepted distance and then transitions in steps of 2% (around 1.95%) duty cycle until it reaches 100% with 100ms pauses in between each step.
Your DMM reads RMS and cannot acurately measure a switching PWM signal although you can measure it with an RC LP filter using a 4.7 k ohm resistor and a 1uF to 2.2 uf cap with the output of the RC filter connected to an analog input pin. I have done this many times. You should read up on Series Pass Voltage Regulator design
If you drive the series pass element with a comparator and you use an equal value resistor voltage divider (2.5Vdc) on the -V pin
and your PWM pin on the +V pin, when the voltage rises above the voltage on the +V pin
the output of the comparator will be "1" (+Vcc ) driving the transistor on , passing the +12V .
If the voltage from the PWM pin is < 2.5Vdc, the compartor output will be zero. This is basically a 5V -to 12V PWM voltage converter circuit , which is what your post title indicates you are looking for. The transistor (or mosfet) doesn't need any more current than you need for your application.