Hi everyone,i’m working on my project.My work is about Electric Vehicle Supply Equipment,so my professor give me a pratice work that is generate +-12 v 1kHz PWM from arduino.I just only know that arduino have some PWM port to generate square wave,but the output will have only 5 v.I think that it should connect to an external circuit.Someone please help me how to increase 5 V to +-12V and change frequency from 490Hz to 1KHz.Thank you for all of help and sorry for my bad English.I’m from Thailand
PWM pin 5 and 6 of an Uno/Nano are already about 1kHz (~980Hz).
Is that close enough?
An opamp on a bipolar 15volt supply could be used to amplify 0-5volt to -12volt to +12volt.
Question is what you need to drive with that 24volt peak/peak signal.
Leo..
Just send that +-12 v to a dip switch that is connect with some resistor.And i will measure the voltage that change from varying resistor.Example as when i change resistor and voltage drop to 9 v.I will use voltage divider circuit to change 9 v back to the range of 0-5v, so that arduino can measured it
(deleted)
Not sure what you mean with that.
Analogue pins can't measure PWM (positive or negative), and can't measure negative voltages.
It seems you want to change 5volt PWM to 0-12volt DC (not +12volt -12volt PWM),
and measure that DC voltage, through a voltage divider with dip switches, with an analogue pin.
For that you need an RC filter, to smoothen 0-5volt PWM to 0-5volt DC.
Followed by an opamp circuit with a gain of 2.4
I think you should ask your professor for help.
He's the one getting paid for that.
Leo..
Just connect to a npn transistor switch , that has a resistor connected from its collector to +12v. Base connected to the PWM pin on the Arduino via say 1k, and emitter to 0v.
When the Arduino output switches on/off , the transistor collector will switch 0-12v.
-
OP seems to want DC, not PWM (measuring it with an analogue pin).
-
The output of a single transistor circuit is influenced by it's load (OP talks about variable loads with DIP switches).
Leo..
Thank you very much everyone for answering me.