# Simplest circuit to provide a 0 or 1 TTL signal to a device

Please excuse the naivity of this question, I am not an electrical engineer. I need a quick solution, and don't have time to ask our electrical engineer to help. A supplier will bring a device they want to show me, and I would like to see it in action. They will not have a cable to connect it (yes, strange). So they told me, if I can improvise a required cable, I can see the device working.

It is about an optical fibre switch: light comes in via an input fiber and leaves via one of the few output fibres. The switch is powered has one D-sub 25 connector. Power requirements are 5 V, 150 mA. The output is selected by providing a TTL signal on 4 pins in the connector. I want to use only the 1st and the 2nd outputs, for which the codes are 0 and 1. Here is the instruction they sent me:

So I wonder, will the following trivial circuit do what I want?

I hope that in switch position 1, it outputs a TTL code 0000, and in switch position 2, it outputs 0001, according to the table above. I also hope that by connecting things like this I have zero chance of burning the device. As the power supply, I am planning to use a simple prototype board power supply circuit powered via USB (from a phone charger).

• a SPDT switch may, or may not work ... it is unknown what would happen when the input floats between contact closures ... perhaps a SPST switch and a pullup resistor (or pulldown resistor) would work Commented Nov 12, 2022 at 19:59
• @jsotola, I think I only have an DPDT ON-ON switch lying around. Was going to use it a SPDT. How is it different, in terms of floating a contact during switching, from an SPST switch? Would a 1 MΩ resistor between pin 2 and ground be a good idea? Commented Nov 12, 2022 at 20:17
• try 10 kΩ ... pin 2 to ground or pin 2 to +5 V Commented Nov 12, 2022 at 20:32
• Tried it today (with 47k resistor), it worked like charm, thanks for your help @jsotola Commented Nov 15, 2022 at 19:18