0
\$\begingroup\$

I'm trying to trigger a logic fall signal on my raspberry pin input which is set with a internal pullup resitor (on 3V). The input raw signal I have in actually a 0V which change to -5V during a really short period of time (see below). http://img11.hostingpics.net/pics/288859Screenshotfrom20150919094517.png

Here is the schema I use:

schematic

simulate this circuit – Schematic created using CircuitLab

The problem is my logic input reads always 0 and I guess it's because of the voltage divider which is connected to the ground through R2.

Is it the right approach? How should I do to resolve this issue?

\$\endgroup\$
  • \$\begingroup\$ It's not completely clear what you're trying to do. Are you expecting the uC's digital input to change value when your pulse goes from 0V to -5V? If so, solve for the voltages at the "reader" node and see if you can figure out why it's only ever showing a low input. \$\endgroup\$ – Dan Laks Sep 19 '15 at 8:45
  • \$\begingroup\$ I'm sorry if I was unclear, yes that what I'm expecting: have a low level when the signal occurs. Between R1 and R2 I got the signal but only -600mV when all is connected. The current given by my pullup flees to the ground and don't do his work. Any idea to change the circuit? \$\endgroup\$ – AnomalySmith Sep 19 '15 at 9:07
  • \$\begingroup\$ For your luck, the input of uC has probably two clamping diodes for protection. What you get is diode forward voltage that is connected betwen GND (anode) and input (catode). \$\endgroup\$ – Marko Buršič Sep 19 '15 at 9:44
1
\$\begingroup\$

Have a good understanding of what you are doing, before you do something, and you'll save time, learn something, and speed up the process for the next time.

Before we look at what you did, let's see how the digital input of a raspberry pi works. (You can't add stuff to 'something', without knowing how that 'something' works right ? )

I didn't read the datasheet, I'm too lazy for that, but I found this (you'll have to verify is correctness).

enter image description here

source: http://www.mosaic-industries.com/embedded-systems/microcontroller-projects/raspberry-pi/gpio-pin-electrical-specifications

So when the V_reader > 2.0V, it will register as a HIGH or logic 1. When V_reader < 0.54V, it will register as a LOW or logic 0. Note: That there are 3 values listed on the image that correspond to different ICs on the device. I don't know where you're Reader input is, so you'll have to check the datasheet and confirm what the thresholds actually are.

Also note, the pullup resistor values. This appears to be different than the 1.1kohm you have listed as the internal.

enter image description here

Notice the input has two diodes. Those are protection diodes, and we'll get to that soon. But remember that they are there.

Now let's look at what you did.

You created a voltage divider, such that when when your signal is 0, the output of the divider is 0, and when your signal is -5V, the output is -3.3V. Let's ignore the pullup resistor for now.

So your two input voltages are 0 and -3.3V.

What value gets registered when the voltage coming into the raspberry pi is < 0.54 ? 0. In both cases, because your voltage is less than 0, the raspberry pi would register it as a zero.

Remember those protection diodes from before ? If they were not there, you would have most likely damaged the pin, or damaged the uC itself. Why ? Digitial circuits do not like to go below the 0V or above their Vcc/Vdd.

The reason you are seeing -600mV, is the voltage drop from the conducting diode (which is saving your raspberry pi). Continuous conduction, will heat up the diode, and it may blow, and now you lost your protection.

What to do about it ?

One easy way to correct this is to use an opamp to invert your input signal so that -5 translates to +3.3. This would then feed into your raspberry pi.

Looking at your signal, it seems its a pretty fast signal. So your opamp needs to be able to keep up (slew rate).

schematic

simulate this circuit – Schematic created using CircuitLab

Like the first sentence, its always best to know what you are doing and why before you do it. The protection diodes saved your raspberry pi. Not all ICs will have the, and not all circuits will include protection. Understand what you are doing. If you aren't sure - ask.

\$\endgroup\$
  • \$\begingroup\$ Thank you for your really clear answer, indeed I'm lucky. I wasn't on a good base since the beginning then. \$\endgroup\$ – AnomalySmith Sep 20 '15 at 16:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.