Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »
Q&A

Post History

66%
+2 −0
Q&A How to change the polarity of an input using a single switch?

I have an mcu pin and I want to sense a voltage up to 24V to 36V. I want to connect some outputs on the board I'm designing and I don't know whether those outputs will provide a voltage or will be...

1 answer  ·  posted 11mo ago by DeadMouse‭  ·  edited 9mo ago by Lorenzo Donati‭

Question microcontroller BJT
#10: Post edited by user avatar Lorenzo Donati‭ · 2023-08-10T11:21:44Z (9 months ago)
Retagged.
#9: Post edited by user avatar DeadMouse‭ · 2023-06-15T18:49:10Z (11 months ago)
  • I have an mcu pin and I want to sense a voltage up to 24V to 36V.
  • I want to connect some outputs on the board I'm designing and I don't know whether those outputs will provide a voltage or will be open collector outputs.
  • Also, some outputs will be just relays and the other terminal will be at GND or just at the main voltage (supply rail). For this reason, I want to provide some selections like switches or jumpers to give the ability in the circuit to be modified.
  • Example below:
  • To be able to connect an mcu to a high voltage I'm using a simple level translator.
  • This can be done with a simple NPN.
  • ![Image](https://electrical.codidact.com/uploads/htfa4bhwyys0hy3cqgy69kkmmf83)
  • This circuit gives me the following output:
  • LOW: For any voltage above 8.2V
  • HIGH: When the line is floating or when the line is grounded.
  • I want to add a switch or a jumper to modify this circuit on the fly and change its behaviour as following:
  • LOW: When the line is grounded.
  • HIGH: For any voltage above 8.2V or when the line is floating.
  • Note: voltage below 8.2V is considered as "input is floating".
  • This is the truth table
  • | Selection | Voltage | Floating | Ground |
  • |-----------|---------|----------|--------|
  • |Option 1| LOW | HIGH | HIGH |
  • |Option 2| HIGH | HIGH | LOW |
  • I have an mcu pin and I want to sense a voltage up to 24V to 36V.
  • I want to connect some outputs on the board I'm designing and I don't know whether those outputs will provide a voltage or will be open collector outputs.
  • Also, some outputs will be just relays and the other terminal will be at GND or just at the main voltage (supply rail). For this reason, I want to provide some selections like switches or jumpers to give the ability in the circuit to be modified.
  • Example below:
  • To be able to connect an mcu to a high voltage I'm using a simple level translator.
  • This can be done with a simple NPN.
  • ![Image_alt_text](https://electrical.codidact.com/uploads/zywfk1cabt9it98wr54sw4xfh4ep)
  • This circuit gives me the following output:
  • LOW: For any voltage above 8.2V
  • HIGH: When the line is floating or when the line is grounded.
  • I want to add a switch or a jumper to modify this circuit on the fly and change its behaviour as following:
  • LOW: When the line is grounded.
  • HIGH: For any voltage above 8.2V or when the line is floating.
  • Note: voltage below 8.2V is considered as "input is floating".
  • This is the truth table.
  • For simplicity we will asume that voltage means +24V DC
  • | Selection | Voltage | Floating | Ground |
  • |-----------|---------|----------|--------|
  • |Option 1| LOW | HIGH | HIGH |
  • |Option 2| HIGH | HIGH | LOW |
#8: Post edited by user avatar DeadMouse‭ · 2023-06-15T18:45:19Z (11 months ago)
  • I have an mcu pin and I want to sense a voltage up to 24V to 36V.
  • I want to connect some outputs on the board I'm designing and I don't know whether those outputs will provide a voltage or will be open collector outputs.
  • Also, some outputs will be just relays and the other terminal will be at GND or just at the main voltage (supply rail). For this reason, I want to provide some selections like switches or jumpers to give the ability in the circuit to be modified.
  • Example below:
  • To be able to connect an mcu to a high voltage I'm using a simple level translator.
  • This can be done with a simple NPN.
  • ![Image](https://electrical.codidact.com/uploads/htfa4bhwyys0hy3cqgy69kkmmf83)
  • This circuit gives me the following output:
  • LOW: For any voltage above 8.2V
  • HIGH: When the line is floating or when the line is grounded.
  • I want to add a switch or a jumper to modify this circuit on the fly and change its behaviour as following:
  • LOW: When the line is grounded.
  • HIGH: For any voltage above 8.2V or when the line is floating.
  • This is the truth table
  • | Selection | Voltage | Floating | Ground |
  • |-----------|---------|----------|--------|
  • |Option 1| LOW | HIGH | HIGH |
  • |Option 2| HIGH | HIGH | LOW |
  • I have an mcu pin and I want to sense a voltage up to 24V to 36V.
  • I want to connect some outputs on the board I'm designing and I don't know whether those outputs will provide a voltage or will be open collector outputs.
  • Also, some outputs will be just relays and the other terminal will be at GND or just at the main voltage (supply rail). For this reason, I want to provide some selections like switches or jumpers to give the ability in the circuit to be modified.
  • Example below:
  • To be able to connect an mcu to a high voltage I'm using a simple level translator.
  • This can be done with a simple NPN.
  • ![Image](https://electrical.codidact.com/uploads/htfa4bhwyys0hy3cqgy69kkmmf83)
  • This circuit gives me the following output:
  • LOW: For any voltage above 8.2V
  • HIGH: When the line is floating or when the line is grounded.
  • I want to add a switch or a jumper to modify this circuit on the fly and change its behaviour as following:
  • LOW: When the line is grounded.
  • HIGH: For any voltage above 8.2V or when the line is floating.
  • Note: voltage below 8.2V is considered as "input is floating".
  • This is the truth table
  • | Selection | Voltage | Floating | Ground |
  • |-----------|---------|----------|--------|
  • |Option 1| LOW | HIGH | HIGH |
  • |Option 2| HIGH | HIGH | LOW |
#7: Post edited by user avatar DeadMouse‭ · 2023-06-15T18:43:40Z (11 months ago)
  • I have an mcu pin and I want to sense a voltage up to 24V to 36V.
  • I want to connect some outputs on the board I'm designing and I don't know whether those outputs will provide a voltage or will be open collector outputs.
  • Also, some outputs will be just relays and the other terminal will be at GND or just at the main voltage (supply rail). For this reason, I want to provide some selections like switches or jumpers to give the ability in the circuit to be modified.
  • Example below:
  • To be able to connect an mcu to a high voltage I'm using a simple level translator.
  • This can be done with a simple NPN.
  • ![Schematic](https://electrical.codidact.com/uploads/weoe2idsb7fecs3wsit3p3d7dqi1)
  • This circuit gives me the following output:
  • LOW: For any voltage above 8.2V
  • HIGH: When the line is floating or when the line is grounded.
  • I want to add a switch or a jumper to modify this circuit on the fly and change its behaviour as following:
  • LOW: When the line is grounded.
  • HIGH: For any voltage above 8.2V or when the line is floating.
  • This is the truth table
  • | Selection | Voltage | Floating | Ground |
  • |-----------|---------|----------|--------|
  • |Option 1| LOW | HIGH | HIGH |
  • |Option 2| HIGH | HIGH | LOW |
  • I have an mcu pin and I want to sense a voltage up to 24V to 36V.
  • I want to connect some outputs on the board I'm designing and I don't know whether those outputs will provide a voltage or will be open collector outputs.
  • Also, some outputs will be just relays and the other terminal will be at GND or just at the main voltage (supply rail). For this reason, I want to provide some selections like switches or jumpers to give the ability in the circuit to be modified.
  • Example below:
  • To be able to connect an mcu to a high voltage I'm using a simple level translator.
  • This can be done with a simple NPN.
  • ![Image](https://electrical.codidact.com/uploads/htfa4bhwyys0hy3cqgy69kkmmf83)
  • This circuit gives me the following output:
  • LOW: For any voltage above 8.2V
  • HIGH: When the line is floating or when the line is grounded.
  • I want to add a switch or a jumper to modify this circuit on the fly and change its behaviour as following:
  • LOW: When the line is grounded.
  • HIGH: For any voltage above 8.2V or when the line is floating.
  • This is the truth table
  • | Selection | Voltage | Floating | Ground |
  • |-----------|---------|----------|--------|
  • |Option 1| LOW | HIGH | HIGH |
  • |Option 2| HIGH | HIGH | LOW |
#6: Post edited by user avatar DeadMouse‭ · 2023-06-15T18:40:07Z (11 months ago)
  • I have an mcu pin and I want to sense a voltage up to 24V to 36V.
  • I want to connect some outputs on the board I'm designing and I don't know whether those outputs will provide a voltage or will be open collector outputs.
  • Also, some outputs will be just relays and the other terminal will be at GND or just at the main voltage (supply rail). For this reason, I want to provide some selections like switches or jumpers to give the ability in the circuit to be modified.
  • Example below:
  • To be able to connect an mcu to a high voltage I'm using a simple level translator.
  • This can be done with a simple NPN.
  • ![Schematic](https://electrical.codidact.com/uploads/weoe2idsb7fecs3wsit3p3d7dqi1)
  • This circuit gives me the following output:
  • LOW: For any voltage above 8.2V
  • HIGH: When the line is floating or when the line is grounded.
  • I want to add a switch or a jumper to modify this circuit on the fly and change its behaviour as following:
  • LOW: When the line is grounded.
  • HIGH: For any voltage above 8.2V or when the line is floating.
  • I have an mcu pin and I want to sense a voltage up to 24V to 36V.
  • I want to connect some outputs on the board I'm designing and I don't know whether those outputs will provide a voltage or will be open collector outputs.
  • Also, some outputs will be just relays and the other terminal will be at GND or just at the main voltage (supply rail). For this reason, I want to provide some selections like switches or jumpers to give the ability in the circuit to be modified.
  • Example below:
  • To be able to connect an mcu to a high voltage I'm using a simple level translator.
  • This can be done with a simple NPN.
  • ![Schematic](https://electrical.codidact.com/uploads/weoe2idsb7fecs3wsit3p3d7dqi1)
  • This circuit gives me the following output:
  • LOW: For any voltage above 8.2V
  • HIGH: When the line is floating or when the line is grounded.
  • I want to add a switch or a jumper to modify this circuit on the fly and change its behaviour as following:
  • LOW: When the line is grounded.
  • HIGH: For any voltage above 8.2V or when the line is floating.
  • This is the truth table
  • | Selection | Voltage | Floating | Ground |
  • |-----------|---------|----------|--------|
  • |Option 1| LOW | HIGH | HIGH |
  • |Option 2| HIGH | HIGH | LOW |
#5: Post edited by user avatar DeadMouse‭ · 2023-06-15T18:36:55Z (11 months ago)
  • I have an mcu pin and I want to sense a voltage up to 24V to 36V.
  • I want to connect some outputs on the board I'm designing and I don't know whether those outputs will provide a voltage or will be open collector outputs.
  • Also, some outputs will be just relays and the other terminal will be at GND or just at the main voltage (supply rail). For this reason, I want to provide some selections like switches or jumpers to give the ability in the circuit to be modified.
  • Example below:
  • To be able to connect an mcu to a high voltage I'm using a simple level translator.
  • This can be done with a simple NPN.
  • https://i.imgur.com/nCW7NuQ.png
  • This circuit gives me the following output:
  • LOW: For any voltage above 8.2V
  • HIGH: When the line is floating or when the line is grounded.
  • I want to add a switch or a jumper to modify this circuit on the fly and change its behaviour as following:
  • LOW: When the line is grounded.
  • HIGH: For any voltage above 8.2V or when the line is floating.
  • I have an mcu pin and I want to sense a voltage up to 24V to 36V.
  • I want to connect some outputs on the board I'm designing and I don't know whether those outputs will provide a voltage or will be open collector outputs.
  • Also, some outputs will be just relays and the other terminal will be at GND or just at the main voltage (supply rail). For this reason, I want to provide some selections like switches or jumpers to give the ability in the circuit to be modified.
  • Example below:
  • To be able to connect an mcu to a high voltage I'm using a simple level translator.
  • This can be done with a simple NPN.
  • ![Schematic](https://electrical.codidact.com/uploads/weoe2idsb7fecs3wsit3p3d7dqi1)
  • This circuit gives me the following output:
  • LOW: For any voltage above 8.2V
  • HIGH: When the line is floating or when the line is grounded.
  • I want to add a switch or a jumper to modify this circuit on the fly and change its behaviour as following:
  • LOW: When the line is grounded.
  • HIGH: For any voltage above 8.2V or when the line is floating.
#4: Post edited by user avatar DeadMouse‭ · 2023-06-15T17:06:02Z (11 months ago)
  • I have an mcu pin and I want to sense a voltage up to 24V to 36V.
  • I want to connect some outputs on the board I'm designing and I don't know whether those outputs will provide a voltage or will be open collector outputs.
  • Also, some outputs will be just relays and the other terminal will be at GND or just at the main voltage (supply rail). For this reason, I want to provide some selections like switches or jumpers to give the ability in the circuit to be modified.
  • Anyway, to be able to connect an mcu to a high voltage I'm using a simple level translator.
  • This can be done with a simple NPN.
  • https://i.imgur.com/nCW7NuQ.png
  • This circuit gives me the following output:
  • LOW: For any voltage above 8.2V
  • HIGH: When the line is floating or when the line is grounded.
  • I want to add a switch or a jumper to modify this circuit on the fly and change its behaviour as following:
  • LOW: When the line is grounded.
  • HIGH: For any voltage above 8.2V or when the line is floating.
  • I have an mcu pin and I want to sense a voltage up to 24V to 36V.
  • I want to connect some outputs on the board I'm designing and I don't know whether those outputs will provide a voltage or will be open collector outputs.
  • Also, some outputs will be just relays and the other terminal will be at GND or just at the main voltage (supply rail). For this reason, I want to provide some selections like switches or jumpers to give the ability in the circuit to be modified.
  • Example below:
  • To be able to connect an mcu to a high voltage I'm using a simple level translator.
  • This can be done with a simple NPN.
  • https://i.imgur.com/nCW7NuQ.png
  • This circuit gives me the following output:
  • LOW: For any voltage above 8.2V
  • HIGH: When the line is floating or when the line is grounded.
  • I want to add a switch or a jumper to modify this circuit on the fly and change its behaviour as following:
  • LOW: When the line is grounded.
  • HIGH: For any voltage above 8.2V or when the line is floating.
#3: Post edited by user avatar DeadMouse‭ · 2023-06-15T17:05:31Z (11 months ago)
  • I have an mcu pin and I want to sense a voltage up to 24V to 36V.
  • I want to connect some outputs on the board I'm designing and I don't know whether those outputs will provide a voltage or will be open collector outputs.
  • Also, some outputs will be just relays and the other terminal will be at GND or just at the main voltage (supply rail).
  • Anyway, to be able to connect an mcu to a high voltage I'm using a simple level translator.
  • This can be done with a simple NPN.
  • https://i.imgur.com/nCW7NuQ.png
  • This circuit gives me the following output:
  • LOW: For any voltage above 8.2V
  • HIGH: When the line is floating or when the line is grounded.
  • I want to add a switch or a jumper to modify this circuit on the fly and change its behaviour as following:
  • LOW: When the line is grounded.
  • HIGH: For any voltage above 8.2V or when the line is floating.
  • I have an mcu pin and I want to sense a voltage up to 24V to 36V.
  • I want to connect some outputs on the board I'm designing and I don't know whether those outputs will provide a voltage or will be open collector outputs.
  • Also, some outputs will be just relays and the other terminal will be at GND or just at the main voltage (supply rail). For this reason, I want to provide some selections like switches or jumpers to give the ability in the circuit to be modified.
  • Anyway, to be able to connect an mcu to a high voltage I'm using a simple level translator.
  • This can be done with a simple NPN.
  • https://i.imgur.com/nCW7NuQ.png
  • This circuit gives me the following output:
  • LOW: For any voltage above 8.2V
  • HIGH: When the line is floating or when the line is grounded.
  • I want to add a switch or a jumper to modify this circuit on the fly and change its behaviour as following:
  • LOW: When the line is grounded.
  • HIGH: For any voltage above 8.2V or when the line is floating.
#2: Post edited by user avatar DeadMouse‭ · 2023-06-15T17:02:40Z (11 months ago)
  • I have an mcu pin and I want to sense a voltage up to 24V to 36V.
  • This can be done with a simple NPN.
  • https://i.imgur.com/nCW7NuQ.png
  • This circuit gives me the following output:
  • LOW: For any voltage above 8.2V
  • HIGH: When the line is floating or when the line is grounded.
  • I want to add a switch or a jumper to modify this circuit on the fly and change its behaviour as following:
  • LOW: When the line is grounded.
  • HIGH: For any voltage above 8.2V or when the line is floating.
  • I have an mcu pin and I want to sense a voltage up to 24V to 36V.
  • I want to connect some outputs on the board I'm designing and I don't know whether those outputs will provide a voltage or will be open collector outputs.
  • Also, some outputs will be just relays and the other terminal will be at GND or just at the main voltage (supply rail).
  • Anyway, to be able to connect an mcu to a high voltage I'm using a simple level translator.
  • This can be done with a simple NPN.
  • https://i.imgur.com/nCW7NuQ.png
  • This circuit gives me the following output:
  • LOW: For any voltage above 8.2V
  • HIGH: When the line is floating or when the line is grounded.
  • I want to add a switch or a jumper to modify this circuit on the fly and change its behaviour as following:
  • LOW: When the line is grounded.
  • HIGH: For any voltage above 8.2V or when the line is floating.
#1: Initial revision by user avatar DeadMouse‭ · 2023-06-15T16:59:42Z (11 months ago)
How to change the polarity of an input using a single switch?
I have an mcu pin and I want to sense a voltage up to 24V to 36V.

This can be done with a simple NPN.

https://i.imgur.com/nCW7NuQ.png

This circuit gives me the following output:

LOW: For any voltage above 8.2V  
HIGH: When the line is floating or when the line is grounded.

I want to add a switch or a jumper to modify this circuit on the fly and change its behaviour as following:  

LOW: When the line is grounded.  
HIGH: For any voltage above 8.2V or when the line is floating.