# Arduino pulsing output

Discussion in 'Embedded Systems and Microcontrollers' started by Alasttt, May 13, 2015.

1. ### Alasttt Thread Starter Member

May 13, 2015
68
0
Hi all,

I want to get a square wave that goes between +2v and -2v. From the arduino outputing HIGH then LOW gives a square wave between 0v and 5v. Any ideas on how I could change the arduino configuration to output different voltages for high and low. or alternatively how to use electronics to convert the 0-5 into -2 to +2

2. ### Papabravo Expert

Feb 24, 2006
11,163
2,186
Sure -- run your [0-5V] signal into a summing amplifier with a constant input of -2.5 volts and a gain of 0.8
(0 - 2.5)*0.8 = -2.00
(5 - 2.5)*0.8 = +2.00

3. ### Alasttt Thread Starter Member

May 13, 2015
68
0
Hi thanks. I have also heard putting a capacitor after it will AC couple it and have the same affect to make it +2 to -2. Would you agree ?. Since this might be easier then a summing amp.

4. ### Papabravo Expert

Feb 24, 2006
11,163
2,186
No. A series, or DC blocking, capacitor will change the square wave into a series of sharp impulses with exponential decay. Not what you are looking for.

5. ### Alasttt Thread Starter Member

May 13, 2015
68
0
Right ok thanks. Please could you tell me where could I get the constant input of 2.5v from ?.

6. ### Papabravo Expert

Feb 24, 2006
11,163
2,186
A voltage divider.

7. ### Alasttt Thread Starter Member

May 13, 2015
68
0
Right thanks. Youve specified gain to be 0.8. Gain is Rf/Rin.

So for the op amp, I connect the - input to +2.5v. connect the + input to the 0-5v square wave via a 10 ohm resistor, and make Rf 8 ohms.
This gives 8/10 which is a gain of 0.8.

Correct?

8. ### MikeML AAC Fanatic!

Oct 2, 2009
5,451
1,071
The best you can do without an opamp. If you use an opamp, remember that you will need a negative power supply, like -5V

9. ### Alasttt Thread Starter Member

May 13, 2015
68
0
Thanks. Do you know if thers a way of changing the arduinos internal ADC voltage reference ?

10. ### MikeML AAC Fanatic!

Oct 2, 2009
5,451
1,071
To what end?

Download and study the ATmega chip data sheet. I'm sure it can be done, but not likely through the Arduino supplied library.

11. ### Potato Pudding Well-Known Member

Jun 11, 2010
684
92

What he said.