Wiring 12v photo switch

This is kind of a continuation of this thread that is now locked from replies.

Quoting @jman4747 post #6 of that thread.

Would the attached schematic be valid?



I got into a discussion with a fellow mentor and I’m now unsure what the correct wiring diagram should be.

In the diagram above I see the power ground of the sensor coming out the bottom of the sensor. Obeously it should be connected to the VRM ground. Should the bottom of R2 be connected to VRM Ground and/or the roboRIO DIO ground?

Edit: I don’t see a difference between the 2 diagrams. Is there one?

I would use the Rio ground, however, academically, it doesn’t matter. since it a signal going to the Rio, it make sense to use that ground, however if you meter it, both ports should be electrically connected. I think the best choice would be to have it connected at both points.

This would become an issue if the DIO ports were isolated from the main power, however generally on the robot ground is ground.

It would be good practice to connect it to the Roborio Ground since the sensing circuit in the Roborio uses the Roborio Ground as it’s reference point.

While the VRM Return and the Roborio Return (and PCM Return, the Battery Return, the Motor Controller Returns) are connected together. They will appear connected when checked with a DVM set to Ohms. There is still a non-zero resistance and inductance between them. When real currents flow in all the return paths, the resistance/inductance of the paths will cause voltage across those resistances/inductances. This is often called “Ground Bounce”. The magnitude, polarity and spectral content of the Ground Bounce depends on the magnitude, polarity and spectral content of the currents flowing in them. If R2 is connected to the VRM Return, the Roborio can sense a false signal if the voltage differential between the two returns is sufficiently large. In reality, there should not be any significant ground bounce since there shouldn’t be any large currents flowing in either of those two return paths, but it is still good practice to terminate at the sensing circuit.

So what our team does is that we connect it to both and there is also 2 ground wires one goes to the rio dio ground and the other goes to the vrm ground. This is so that we know that the rio has a ground reference. we also use r1 being a value of 3.2K and r2 being a value of 2.2k because that is what we have at our build site.

I believe that’s how we executed a voltage divider for our photo sensors.

The Roborio already has a reference through the return (black) wire to the PDP.

I mean yea this is just what we do and you can then have two connectors on the rio’s pins so it holds more securly