Arduino Forum

Using Arduino => Displays => Topic started by: Anastasis_p on Nov 30, 2018, 02:14 pm

Title: Powering up OLEDs with negative PWM
Post by: Anastasis_p on Nov 30, 2018, 02:14 pm
Hello,

I would like to power up some OLEDs using Arduino's PWM function. However, for this project I also need to apply negative pulses (PWM signals that go from 0 to -5 V instead of 0 to 5 V, with the duty cycle behaving in a similar way). I tried using a simple inverter (TL062 operational amplifier) with 10K resistors and a power supply ranging from -15 to 15 V. No matter how hard I tried I couldn't make the circuit work. Is there anything that I may be missing about the PWM signals provided by an Arduino board? Could it be that the signals are oscillating too fast for the inverter? I found some posts mentioning that an RC circuit can be used to smooth the PWM signal and make it "more analogue" but I am worried about the time response, so I would like to avoid it if possible.

Please, excuse my lack of knowledge. I checked online and found some posts about PWM signals but I couldn't find any answer to my question.

Any help would be much appreciated!
Title: Start at the beginning
Post by: Paul__B on Nov 30, 2018, 09:48 pm
You need to explain what you mean by "power up some OLEDs".  Why do you want a negative voltage?
Title: Re: Powering up OLEDs with negative PWM
Post by: Anastasis_p on Dec 02, 2018, 02:03 am
The OLEDs that I am using can work between [-4,4] Volts. I tested with the positive PWMs and everything worked perfectly fine but now I am trying to see how to invert my signal to provide PWMs in the range of [-4.0]. By powering up I mean that I used analogWrite to create PWM signals.
Title: What OLEDs?
Post by: Paul__B on Dec 02, 2018, 02:27 am
Sorry, you need to explain what you mean by "The OLEDs that I am using can work between [-4,4] Volts" - it simply doesn't make sense.

Give us a datasheet?
Title: Re: Powering up OLEDs with negative PWM
Post by: PerryBebbington on Dec 02, 2018, 10:25 am
Post a schematic for the signal inverter you built. 1 op amp and 2 resistors will invert 0V to 5V into 0V to -5V, but I cannot imagine why you would want to.
Title: Re: Powering up OLEDs with negative PWM
Post by: Anastasis_p on Dec 02, 2018, 04:33 pm
This is the schematic for the op amp that I am using. R1=R2=10 KΩ.

(https://www.google.co.uk/search?q=op+amp+schematic&rlz=1C1CHBF_en-GBGB818GB818&source=lnms&tbm=isch&sa=X&ved=0ahUKEwiRneLYuoHfAhVpKcAKHRgNBIUQ_AUIDigB&biw=1366&bih=657#imgrc=56F7n4ShvZykAM:)

As for the datasheet, I cannot provide that as the OLEDs that I am using are not commercially available. I am trying to explain as much as I can. Simply put, if you supply a voltage between -4 to 4 Volts the intensity of the brightness is going to change accordingly. The only difference with the commercially available LEDs is that they can also operate by supplying a negative voltage. What I am trying to do is just get a PWM signal and invert it, without changing its duty cycle. However, the the circuit that I am using (a simple inverter) is not providing me with negative voltages.
Title: Re: Powering up OLEDs with negative PWM
Post by: Anastasis_p on Dec 02, 2018, 04:38 pm
Sorry, this is the schematic of the op amp.
Title: Re: Powering up OLEDs with negative PWM
Post by: PerryBebbington on Dec 02, 2018, 04:59 pm
This is the schematic for the op amp that I am using. R1=R2=10 KΩ.

As for the datasheet, I cannot provide that as the OLEDs that I am using are not commercially available. I am trying to explain as much as I can. Simply put, if you supply a voltage between -4 to 4 Volts the intensity of the brightness is going to change accordingly. The only difference with the commercially available LEDs is that they can also operate by supplying a negative voltage. What I am trying to do is just get a PWM signal and invert it, without changing its duty cycle. However, the the circuit that I am using (a simple inverter) is not providing me with negative voltages.
Your circuit should invert the PWM signal. I had a quick look at the TL06x data sheet and it should be OK. However, what you say you want is not quite what you describe. I would expect the op amp circuit you have shown to change 0V to 5V into 0V to -5V, which is different to the -4V to +4V you want. Am I correct in saying you want to get an analogue -4V to +4V signal from a PWM 0V to 5V? Is that correct?

It doesn't explain why your op amp circuit isn't giving a negative voltage. What are you powering it with? To do what you want needs -5V (or lower) on pin 4 and +5V (or higher) on pin 8, with 0V on pin 3 (non inverting input).
Title: Re: Powering up OLEDs with negative PWM
Post by: Anastasis_p on Dec 02, 2018, 10:46 pm
Your circuit should invert the PWM signal. I had a quick look at the TL06x data sheet and it should be OK. However, what you say you want is not quite what you describe. I would expect the op amp circuit you have shown to change 0V to 5V into 0V to -5V, which is different to the -4V to +4V you want. Am I correct in saying you want to get an analogue -4V to +4V signal from a PWM 0V to 5V? Is that correct?

It doesn't explain why your op amp circuit isn't giving a negative voltage. What are you powering it with? To do what you want needs -5V (or lower) on pin 4 and +5V (or higher) on pin 8, with 0V on pin 3 (non inverting input).
Yes indeed, I would like to invert the signal and keep the duty cycle similar to the originally created PWM. I am using analogWrite(Pin_number,value_between_0_200) to resemble the [0,4] Volts spectrum. So for example, when I want to supply 3 Volts I use analogWrite(Pin_number,150). Is that incorrect as an approach? I supplied -15 Volts on pin 4 and +15 on pin 8 with pin 3 being being connected to the Arduino ground. However, I see no inversion. My signal remains the same. I even tried to use different resistors to check if the amplitude would change and nothing happened. I am going to try with a different op amp but I was wondering if the Arduino board and the PWM is the problem.
Title: Re: Powering up OLEDs with negative PWM
Post by: PerryBebbington on Dec 03, 2018, 12:14 am
Yes indeed, I would like to invert the signal and keep the duty cycle similar to the originally created PWM. I am using analogWrite(Pin_number,value_between_0_200) to resemble the [0,4] Volts spectrum. So for example, when I want to supply 3 Volts I use analogWrite(Pin_number,150). Is that incorrect as an approach? I supplied -15 Volts on pin 4 and +15 on pin 8 with pin 3 being being connected to the Arduino ground. However, I see no inversion. My signal remains the same. I even tried to use different resistors to check if the amplitude would change and nothing happened. I am going to try with a different op amp but I was wondering if the Arduino board and the PWM is the problem.
When you say you see no inversion have you looked on an oscilloscope? Do you see the input to the 10k resistor from the Arduino PWM output as a square wave between 0V and 5V and the output as an identical but inverted square wave between 0V and -5V? That is what I would expect that circuit to do. I can't comment on the other points, I am new to Arduino and have not used its PWM yet, sorry.
Title: Re: Powering up OLEDs with negative PWM
Post by: Anastasis_p on Dec 03, 2018, 01:24 am
Yes, I have checked using an oscilloscope. The input is a square wave between 0 and 5 V but the output is identical to the input, no inversion observed. 
Title: Re: Powering up OLEDs with negative PWM
Post by: PerryBebbington on Dec 03, 2018, 11:20 am
Yes, I have checked using an oscilloscope. The input is a square wave between 0 and 5 V but the output is identical to the input, no inversion observed. 
I can only assume that something isn't wired correctly. For me to help any more please post a complete schematic and photos of your project that clearly show the wiring.
Title: Re: Powering up OLEDs with negative PWM
Post by: floresta on Dec 03, 2018, 02:36 pm
Yes, I have checked using an oscilloscope. The input is a square wave between 0 and 5 V but the output is identical to the input, no inversion observed. 
How experienced are you with oscilloscope triggering?

Don
Title: Re: Powering up OLEDs with negative PWM
Post by: Anastasis_p on Dec 03, 2018, 03:57 pm
I have attached an image of my configuration. This is showing a non-inverting amplifier that should theoretically double the output. However, although the Arduino input is clearly seen in the oscilloscope, the output remains 0 (I have also tried replacing the chip, to make sure it wasn't damaged).Please, let me know if you think something is wrong with the wiring. I haven't attached a schematic but it's again the standard configuration of non-inverting op amp.
Title: Re: Powering up OLEDs with negative PWM
Post by: PerryBebbington on Dec 03, 2018, 04:35 pm
I have attached an image of my configuration. This is showing a non-inverting amplifier that should theoretically double the output. However, although the Arduino input is clearly seen in the oscilloscope, the output remains 0 (I have also tried replacing the chip, to make sure it wasn't damaged).Please, let me know if you think something is wrong with the wiring. I haven't attached a schematic but it's again the standard configuration of non-inverting op amp.
Non inverting? I was under the impression you wanted it to invert.

The photo is a good start but as I don't know where all those wires go I can't really comment. You are going to have to provide me with what I asked for, a schematic, if you want any more help.
Title: Re: Powering up OLEDs with negative PWM
Post by: floresta on Dec 03, 2018, 11:11 pm
. . . However, although the Arduino input is clearly seen in the oscilloscope, the output remains 0 . . .
But it's not clear to us unless I have missed an attachment somewhere.


Quote
. . . Please, let me know if you think something is wrong with the wiring. . . .
I think there is something wrong with the way you are using your oscilloscope as I implied in my previous post.

Don
Title: Tree wrong up barking!
Post by: Paul__B on Dec 04, 2018, 05:42 am
Frankly, I think there is something completely wrong with this whole discussion.  Suggesting an OLED display requires negative voltages or PWM simply makes no sense, and everything else follows.

If you want a negative voltage, you use the part designed for that purpose - an ICL7660/ MAX1044 (https://datasheets.maximintegrated.com/en/ds/ICL7660-MAX1044.pdf), LM2664 (http://www.ti.com/lit/ds/snvs005e/snvs005e.pdf) or LT1026 (https://www.analog.com/media/en/technical-documentation/data-sheets/1026fb.pdf).
Title: Re: Powering up OLEDs with negative PWM
Post by: Anastasis_p on Dec 04, 2018, 09:51 am
Hi,

I tried to use a non-inverting configuration to check if my op amp was working as I was afraid that maybe the power supply was not providing a negative voltage and that was why I couldn't see any inversion in the output. I don't know if I am not using the oscilloscope correctly but I only have issues when I am trying to see the output of the op amp. The Arduino input is always there, even when I change the duty cycle. Considering the fact that the only difference between these two signals should be the amplitude, I cannot imagine why the oscilloscope is the problem. Is there anything that I may be missing? Also, I had checked the charge pump circuits but I wasn't sure if the will work with the PWM function. I thought that an op amp would be much easier to implement and I had used it in the past for filtering without any issues. I think I may need to buy a charge pump circuit and test it. 
Title: Re: Powering up OLEDs with negative PWM
Post by: floresta on Dec 04, 2018, 03:33 pm
Quote
I cannot imagine why the oscilloscope is the problem. Is there anything that I may be missing?
Yes.  You are missing the whole concept of oscilloscope triggering and input coupling and why both are essential if you want to correctly observe the difference in phase and level between two signals. 

You can observe most characteristics of a single signal without knowing much about these concepts but it's a different story when you want to compare two signals.

It is quite possible that your inverter is operating properly but your measurement techniques are leading you to believe that it is not.

Don
Title: Re: Powering up OLEDs with negative PWM
Post by: bodmer on Dec 08, 2018, 10:28 pm
You need to connect the 0V line from the +/-15V power supply to the Arduino 0V, otherwise the circuit will just behave like a 20K resistor connected to the Arduino PWM pin. Add some decoupling near the amplifier fro 0V to each rail.