Make a 0-5v PWM Square wave into a 0-10v PWM square wave

I have written a basic file for a arduino nano that outputs a square wave on pin D5 that is 0-5v. The signal out i can change the duty fine for what i want in the project. Only problem is that the signal i need to input needs to be going from 0-10v. Have read a bit on using an OPAMP etc.. but i just cant seem to get the actual signal go from 0-5v square to 0-10v square... any help would be great thanks :slight_smile:

Have you considered using a MOSFET and a 10 volt power supply. The Arduino pin will switch the MOSFET on and off and there you have your 10 volt square wave.
Paul

I am using a 12v power supply through a 5v reg for the Arduino.... have thought about using a Mosfet but unsure how to go about it as all the examples i find are the Arduino controlling the Mosfet with the Mosfet's output controlling the GND side of the load.... there is no GND side that i am triggering.. the motor i am using is already powered by 12v+ and 0V and the 3rd wire is signal in which is the square wave

The MOSFET still can be used as a level converter. If you aren't driving a motor load, the MOSFET can be a smaller current rated device.

Please post specifications of this motor - it's clearly non-standard so there won't be any good answers without info.

So there is a GND side indeed. You just call it '0V' but it's the same. They should be connected in any case.

Get a small signal mosfet, connect the gate to the Arduino pin, a resistor (e.g. 10k) from +12V to the drain of the mosfet, also connect the 3rd signal pin of your motor to the mosfet drain, and connect the mosfet source to GND (or 0V, whichever floats your boat...)

1 Like

What is it you are driving? Perhaps you only need a MosFet and not have to generate the 10V. Many devices have an internal pullup that would allow you to use a simple MosFet.

1 Like

its like a steeper motor... but the device is irrelevant ...... reason why i say this is i have a cheap Chinese signal generator which outputs the same signal but is 10v square wave and it works but as said the Arduino only outputs 5v square wave... so its purely needed to step up the exact same signal in to out but from a 0-5v max to a 0-10v max

I will try and give this a go .. seems like a simple solution which hopefully work...

There's a good chance it'll work. Your device sounds like something with a driver integrated into it; I suspect the signal line doesn't sink or source significant current.

1 Like

Excuse the crude drawing but that’s what you are suggesting ? And is a 3LN01M suitable. Sorry for the silly
Questions but I am a nube to this

Arduino GND and motor 0V need to be connected! Otherwise ok.

Took a quick glance at the datasheet; looks perfect at first glance.

1 Like

yes the 0V's will be shared and same with the 12v's etc ...

excellent will give it a go thank you very much for your help

You might also try the same circuit but with the 10k open, to see if there is an internal pullup on your motor.

Actually, it sounds suspiciously like a continuous rotation servo. But I've been led to understand that it is not relevant. So be it.

I’ve had to order the Mosfets and of course I pick the end of life version - so had a bit more of a play and managed to get it to work using a LM324 …. Works perfectly. Thankyou very much for all
Your help.

Great! Well done :slight_smile:

1 Like

You also could use nearly any NPN BJT instead of the MOSFET.

rough idea how to setup with the NPN?

The same as MOSFET (Gate ~ Base, Source ~ Emitter), just add a 1k - 10k resistor between Arduino output and Base.

1 Like

You need to be aware that the circuits suggested invert the signal, so if you set the duty cycle of a PWM pin of the Arduino to say 25%, then the signal to the motor has a duty cycle of 75%.

This isn't a big problem, it can easily be accounted for in your software.

1 Like