# Reading Spikes of Voltages of -/+50V from other source.

Hi Guys,

Had to make a new account, as couldn't find my old details! (Have been using other IC's for a few years!)

I'm doing a project, and want to communicate manually to my arduino from long distances.

It's essentially working on a project with telephone lines, and I would like to be able to identify when somebody manually sends basic 1/2 second pulses of Negative voltages of more than -12V up to -50v in order to change the state of the arduino.

Am happy with all aspects... except I'm not sure how to read negative voltages of such a magnitude safely without damaging the arduino.

I want to be able to do it with basic simple discrete components - IE Ceramic/Aluminium Capacitors and Resistors.

I don't need an exact measurement, I just want read "on/off".

Essentially if someone "taps 50v x number times" it will then run different programs.

Thank you very much for your ideas!

The Arduino can't read negative voltages at all (it can be damaged by negative voltages or voltages greater than +5V).

But if you can electrically-isolate the Arduino's power supply from the phone line you can flip the wires around and connect the positive phone wire to the Arduino's ground.

Most power supplies are transformer isolated from "everything" and of course a battery is isolated. But, I'd avoid connecting USB at the same time (because the computer may be grounded).

The protection circuit alone should work if "zero is zero", but if you get false triggers you can add another resistor between the Arduino input and Arduino-ground to make a [u]voltage divider[/u] to knock-down the voltage.

DVDdoug:
The Arduino can't read negative voltages at all (it can be damaged by negative voltages or voltages greater than +5V).

But if you can electrically-isolate the Arduino's power supply from the phone line you can flip the wires around and connect the positive phone wire to the Arduino's ground.

Most power supplies are transformer isolated from "everything" and of course a battery is isolated. But, I'd avoid connecting USB at the same time (because the computer may be grounded).

The protection circuit alone should work if "zero is zero", but if you get false triggers you can add another resistor between the Arduino input and Arduino-ground to make a [u]voltage divider[/u] to knock-down the voltage.

I'd like to read the voltage in reference to ground, due to the fact that one of the telephone legs may be disconnected.

Due to the nature of telephone lines, there is only a -50v (or a 0v) potential I can use (in reference to ground). Telephone lines are essentially run by batteries that are continuously "topped up"... So I have no choice but to read the negative voltage.

I think this divider would basically work (Correct me if I’m wrong) but I wondered if there is anything else I should do to protect my Arduino?

Correct me if I'm wrong

You are wrong.

While on the face of it that looks like a good circuit a potential divider of that sort of magnitude of resistor allows little current to actually work with a digital input. Also you can’t guarantee you will get -50V as you said it might be less.

If it is within the USA the standard is a nominal 48vdc supplied by batteries and neither conductor is grounded and should remain so. Connecting either side (tip or ring) to Arduino ground will ground one side of the phone line when the usb interface is connected to a PC which may cause issues with the Arduino, PC and the phone system.

The best interface method would use standard optocouplers. You also have to contend with the ringer voltage which is in excess of 100 volts at 20 Hz.

Grumpy_Mike:
You are wrong.

While on the face of it that looks like a good circuit a potential divider of that sort of magnitude of resistor allows little current to actually work with a digital input. Also you can’t guarantee you will get -50V as you said it might be less.

I probably should have mentioned... I intend to use an analog pin so I can measure voltages closer to 0v than -50v. I'll essentially ask the IC in software to look for >0.5s pulses of >12V.

How much current does the Analog in require to measure? I assumed it would be in the Nano-Amps, looking at other posts?

Are you suggesting this would work, but to use lower R values?

avr_fred:
If it is within the USA the standard is a nominal 48vdc supplied by batteries and neither conductor is grounded and should remain so. Connecting either side (tip or ring) to Arduino ground will ground one side of the phone line when the usb interface is connected to a PC which may cause issues with the Arduino, PC and the phone system.

The best interface method would use standard optocouplers. You also have to contend with the ringer voltage which is in excess of 100 volts at 20 Hz.

You're correct, and I've not used Optocouplers but they do look very interesting- I was hoping to avoid a solution like this in order to keep things as basic as possible.

I thought I'd use an analog input, using the circuit I posted, to measure voltages up to 50V.

I didn't think of the ringer voltage, perhaps I could use a larger divider and design it to divide 100V down to 5V (IE halve the top resistor value).

Another component commonly used with phone lines is a full wave bridge rectifier. This provides the proper output polarity regardless of how you connect the line.

An optocoupler will allow you to read any voltage from 12V to 100V with a digital output. The main issue is the ringer which would be AC, so this needs a protection diode on the optocoupler. This should work:

R1 limits the current through the optocoupler (other optocouplers may need a different value), D1 protects against reverse voltage (the ringer - which will produce a 20 Hz block wave output).
Optocoupler is chosen based on what I happen to have in my parts box - no particular reason to go with this one instead of one of the many others.

I too would use an opto isolator - it’s really the only way to take such a signal
Into the Arduino , stops noise spikes , gives power supply isolation and adds a bit of safety

But that schematic will not measure negitave voltages, only block them.

If the only voltages you get are negative, you could connect the GND (0V) to connector pin 1, and the negative signal to pin 2. After all -50V between conductor 1 and 2 is the same as +50V between conductor 2 and 1.

OP is a bit ambiguous but does state:

TAJS-C:
basic 1/2 second pulses of Negative voltages of more than -12V up to -50v

This what I based my circuit on: converting a 0/12-50V digital signal into a 0/5V digital signal for use by an Arduino. It would work the same for a 3.3V Arduino, by the way.

If you have a signal that goes from -50V all the way to +50V indeed you need a different circuit. A second optocoupler (which goes in place of the diode) could give you two digital outs (one for a negative signal, the other for a positive one), or if you want to be able to measure any voltage in that range you need a voltage divider + offset type circuit to go to a 0-5V analog signal.

wvmarle:
If the only voltages you get are negative, you could connect the GND (0V) to connector pin 1, and the negative signal to pin 2. After all -50V between conductor 1 and 2 is the same as +50V between conductor 2 and 1.

OP is a bit ambiguous but does state:This what I based my circuit on: converting a 0/12-50V digital signal into a 0/5V digital signal for use by an Arduino. It would work the same for a 3.3V Arduino, by the way.

If you have a signal that goes from -50V all the way to +50V indeed you need a different circuit. A second optocoupler (which goes in place of the diode) could give you two digital outs (one for a negative signal, the other for a positive one), or if you want to be able to measure any voltage in that range you need a voltage divider + offset type circuit to go to a 0-5V analog signal.

This solution sounds good.

Would this work whether or not the Arduino had a common ground? (IE, if it's powered by battery, or via transformer)

After some testing, I understand what the previous posts mean about common grounds now- my basic resistor circuit will only work if the Arduino, or the -ve input, is powered by an isolated ground- IE an isolated battery.

The resistor divider type of circuit as you proposed before actually requires the Arduino and the car to share grounds.

The optocoupler circuit that I posted is meant for an Arduino that's by and large separated from the car battery - e.g. via its own battery, or via a car power supply that produces a stable 5V from the unstable 12V battery supply. This separation makes it much safer, especially as you're keeping the car ground (the chassis usually) away from the Arduino.

Would this work whether or not the Arduino had a common ground?

Unless you use an isolator ( optical isolators are most the usual type ) you need a common ground between the Arduino and your voltage source.

That is not what a common ground means, those conditions are nothing to do with a common ground or not.

A bridge rectifier as mentioned above followed by an optoisolator would provide what you need.

The good 'ole POTS (plain old telephone system) used a 25Hz ac ringtone, and had a capacitor in series with the bell so that the circuit took no current with a steady +/-48vdc applied . You could try that too.

Allan

Google for “telephone busy indicator circuit” to see a number of designs.

wvmarle:
An optocoupler will allow you to read any voltage from 12V to 100V with a digital output. The main issue is the ringer which would be AC, so this needs a protection diode on the optocoupler. This should work:

R1 limits the current through the optocoupler (other optocouplers may need a different value), D1 protects against reverse voltage (the ringer - which will produce a 20 Hz block wave output).
Optocoupler is chosen based on what I happen to have in my parts box - no particular reason to go with this one instead of one of the many others.

I’ve tried this, and it should work (tested with breadboard and multimeter).

I measured current draw across the resistor (which I swapped out for a 5K6, for now, first one I found in box) and found it as 11ma for 60 volts.

What I didn’t expect was the ridiculous amount of heat it gave of!

Burnt my fingers touching the damned thing, haha!

This doesn’t seem normal for a 10ma draw, what am I doing wrong?

Also… sorry to be a pest… any suggestions for the protection diode? I don’t want to end up ordering the wrong thing!

TAJS-C:
I've tried this, and it should work (tested with breadboard and multimeter).

I measured current draw across the resistor (which I swapped out for a 5K6, for now, first one I found in box) and found it as 11ma for 60 volts.

What I didn't expect was the ridiculous amount of heat it gave of!

Burnt my fingers touching the damned thing, haha!

This doesn't seem normal for a 10ma draw, what am I doing wrong?

Also.... sorry to be a pest.... any suggestions for the protection diode? I don't want to end up ordering the wrong thing!

Scrap that bit... thought my resistors were 0.5w, but were 0.25w.

Will try and get a >3w one.

But, still not 100% on what type of diode I'll need, as will need to reject +100v.