Hi/Low input from 1.3V and 1.7V

Hi,

I am kind of new to electronics, but am trying out some home made up projects. This is my first arduino project.

I want to count the pulses from an old rotary phone. The pulse go between 1.3V and 1.7V. So I want my Arduino UNO R3 to read the 1.3V as low and the 1.7V as high.

Any suggestions on how to acheive this? Obviously (?) I want to use the “read input pin hi/low” command if possible. I was thinking maybe a zener diode could be used to filter away the lower voltage part but then I don’t know how to raise the remainder to above 3V or whatever is needed to create high signal. If that would even work, I have never actually used a zener diode but remember them from school. Anyway I am sure there are other ways.

Thanks in advance.

Use the on board analog comparator, with the threshold set at 1.5V. Short tutorial here.

Alternatively, use analogRead() to simply measure the input voltage (about 10,000 times per second in a tight loop).

Or use a comparator with some hysteresis to have a low output for <1.5V and high for >1.5V.
Look at the LM358 that triggers at 3.3V on the Uno power select circuit as an example.

jremington:
Use the on board analog comparator, with the threshold set at 1.5V. Short tutorial here.

Alternatively, use analogRead() to simply measure the input voltage (about 10,000 times per second in a tight loop).

Thanks, was not aware of the on board comparator! I’ll try that.

CrossRoads:
Or use a comparator with some hysteresis to have a low output for <1.5V and high for >1.5V.
Look at the LM358 that triggers at 3.3V on the Uno power select circuit as an example.

Can you please elaborate a bit on the solution with the LM358? That sentence is not clear to me…
I don’t know if you saw the picture I originally attached from my oscilloscope., but I think the signal already has a kind of hysteresis since it is not a pure sine wave - would you agree?

The "hysteresis" would be in the sensing circuitry. Explained here.

The LM339 quad comparator chip is very cheap and easily sourced...

MarkT:
The LM339 quad comparator chip is very cheap and easily sourced...

This sounded interesting, so ordered some LM339N and tried the below setup to check my understanding. The input is at 3.3V (red, yellow) and the wire between the variable resistors is set to 1.6V (blue). With 3.3V on pin 5 and 1.6V on pin 4 I expected to get an output on pin 2 (since 3.3>1.6), but there is nothing. Also tried switching the yellow and blue wires to switch the comparison, but with same result. What am I doing wrong?

Lm339 pins.jpg

Lm339 pins.jpg

There are several rules to follow when using a chip like that on a breadboard, otherwise it is unlikely to work.

(0) Check component polarity and orientation.
(1) Install a 0.1 uF ceramic capacitor between Vcc and GND, as close as possible to the chip.
(2) Connect all unused inputs to GND, otherwise the unused gates may oscillate.
(3) Double check all continuity. Breadboards have unreliable connectors.
(4) Check voltages on the chip pins, using your multimeter.

The old rotary dial phones open the switch for each pulse. Your trace picture shows you have some unknown circuitry and power attached to the switch. What is the circuit? To use an Arduino, you just need to assign a digital pin as input-pullup and connect the pin to one side of the phone switch and other side of the switch to the Arduino ground.
Paul

Paul_KD7HB:
The old rotary dial phones open the switch for each pulse. Your trace picture shows you have some unknown circuitry and power attached to the switch. What is the circuit? To use an Arduino, you just need to assign a digital pin as input-pullup and connect the pin to one side of the phone switch and other side of the switch to the Arduino ground.
Paul

Thanks for the hint, I will investigate that. I just powered the wire I thought most likely with 5V via a LED+resistor and then to ground. Then I get that signal, but I realize I am measuring in a crazy position, just after the LED. But the principle remains the same I guess - the voltage does not go to zero. But I'll lab some more if I don't get this other method to work.

jremington:
There are several rules to follow when using a chip like that on a breadboard, otherwise it is unlikely to work.

(0) Check component polarity and orientation.
(1) Install a 0.1 uF ceramic capacitor between Vcc and GND, as close as possible to the chip.
(2) Connect all unused inputs to GND, otherwise the unused gates may oscillate.
(3) Double check all continuity. Breadboards have unreliable connectors.
(4) Check voltages on the chip pins, using your multimeter.

Thanks, I forgot about the grounding of the inputs. Have followed all your advice now, but still no success.

Is my understanding of the LM339 is correct, that I should get a signal on pin 2 if I have 1.6V on pin 4 and 3.3V on pin 5?

Have you cleaned the phone switch contacts? They are designed for at least 48 volts dc where the arc/spark keeps the contacts clean.
Paul

Did you add a pull-up resistor on the output of the LM339? Either an external one, or by using the INPUT_PULLUP function of the Arduino's input pins.

These outputs are open collector so without the pull-up you won't measure anything...

The Lm339 circuit is not connected to the Arduino yet, everything is in the picture. Trying to get the led to light up at this stage.

EDIT: Still appreciate answers to whether my understanding of the LM339N principle is correct - is there anything wrong with comparing 1.6V and 3.3V as in above connection?

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.