# Generating digital positive (+5 V) and negative (-5 V) signal?

Problem in getting -5 V with Arduino.

``````void setup() {
pinMode(13, OUTPUT);
}

void loop() {
digitalWrite(13, HIGH);
delay(20);
digitalWrite(13, LOW);
delay(20);
}
``````

Above code is generating below digital signal:

I want this type of digital signal output:

I read this for generating negative -5 V signal:

https://electronics.stackexchange.com/questions/10322/what-is-negative-voltage

but not able to understand very well WRT Arduino.

Negative voltage: How do I scale a 0 to 5 V signal to -10 V to +10 V?

seems to much complicated circuit diagram with TL802.

My questions:

1. How do I get above digital signal?
2. I was wondering if we can use some 1 microF capacitor or transistor to generate negative signal? (simplest way)
• You need to define (specify) what you will be connecting your +5/-5 signal to. That will determine how much current the negative 5 volts will need to supply. Then we can answer how to make a -5 volt supply for you. Also, a level converter will be necessary to change 0-5 into -5 and +5. Jan 30, 2016 at 15:28
• You can also easily make a -5 supply using a Wall wart 5 volt supply. The +5 of the Wall wart would go to board ground, and then the negative lead is your -5 volts. If this is satisfactory, I will provide an answer on how to do the level changer. Jan 30, 2016 at 15:31
• @Marla This is no good if the 0V rail from the supply is tied to Earth; you'll just end up shorting the supply. It will work in some cases, but cannot be relied on as a solution. Jan 30, 2016 at 15:49
• @CharlieHanson I will specify in my answer that the wall wart shall be isolated. Thank you Jan 30, 2016 at 15:53

It is not so easy to create a -5v power supply using a capacitor or transistor.

A very easy way is to use an additional Wall wart power supply to create -5 volts (while still using your original +5 volt power supply).

For the additional (new -5 volts power supply), use the two wires (positive and negative to create your -5 volts). The positive lead goes to your board ground, and the negative lead becomes your -5 volts.

EDIT 1 : Make certain that the Wall wart that you use is isolated from the mains voltage (line voltage you plug it into). Most Wall warts are isolated, but check to be sure.

Then you need level translation, which can be done with an op-amp and a couple of resistors :

You have not mentioned what frequency (data rate) you need. This circuit is not fast, so for high frequency or high data rates, the circuit could be improved.

• Just to clarify, you are talking about a 10V wall-wart, right? Jan 31, 2016 at 22:06
• Talking about OP's existing 5 volt, and an additional 5 volt wall wart to create the new -5 volts. Jan 31, 2016 at 23:08
• Oh, OK. So use +5V in the usual way. Then use a 5V wall-wart, connecting the + side to ground, and the - side to the op-amp "negative" power supply. That's what you are suggesting, right? Feb 1, 2016 at 4:13
• @nickgammon. Yes , correct Feb 1, 2016 at 4:14
• @NickGammon I edited the answer with more description about the power supplies (which is what I think you were encouraging me to do) Feb 1, 2016 at 12:44