2

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:

puredigi

I want this type of digital signal output:

digiwithn

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.

Also read this:

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)
per1234
  • 4,088
  • 2
  • 22
  • 42
gaganyaan
  • 195
  • 1
  • 4
  • 8

1 Answers1

4

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 :

enter image description here

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.

Marla
  • 600
  • 1
  • 4
  • 11
  • Just to clarify, you are talking about a 10V wall-wart, right? – Nick Gammon Jan 31 '16 at 22:06
  • Talking about OP's existing 5 volt, and an additional 5 volt wall wart to create the new -5 volts. – Marla Jan 31 '16 at 23:08
  • 1
    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? – Nick Gammon Feb 01 '16 at 04:13
  • @nickgammon. Yes , correct – Marla Feb 01 '16 at 04:14
  • @NickGammon I edited the answer with more description about the power supplies (which is what I think you were encouraging me to do) – Marla Feb 01 '16 at 12:44