2022-02-15 12:48 AM
Hello,
I have to design a circuit and I need help.
There are two external devices, which the third device with MCU STM32F105 has to find out which of them is connected to it.
Two external devices have signals:
- 24v or non-connected
- Ground
I can maybe use a voltage divider, but the issue is "non-connected" signal.
Anyone can help me?
Thank you.
Solved! Go to Solution.
2022-02-15 02:23 AM
If I understand correctly, the external devices each have two connections/wires. One is connected to GND, the other is either open or connected to 24V - right?
If that's the case, your only chance is to check the connection to GND of the external devices. So that we don't get confused here, we rename signal GND to the first external device at the connector to GNDext1.
You disconnect GNDext1 from the GND of the STM32 board at the connector.
Then you connect GNDext1:
The source of the MOSFET then needs to be connected to GND of the STM32 board and the gate is controlled by a GPIO the STM32.
By disabling the MOSFET (gate = low) and measuring the ADC voltage, there are then two possibilities:
For the normal state, simply switch the MOSFET back on.
Of course you have to do the same with the 2nd channel, i.e. GNDext2.
Does it answer your question?
Good luck!
Regards
/Peter
2022-02-15 02:23 AM
If I understand correctly, the external devices each have two connections/wires. One is connected to GND, the other is either open or connected to 24V - right?
If that's the case, your only chance is to check the connection to GND of the external devices. So that we don't get confused here, we rename signal GND to the first external device at the connector to GNDext1.
You disconnect GNDext1 from the GND of the STM32 board at the connector.
Then you connect GNDext1:
The source of the MOSFET then needs to be connected to GND of the STM32 board and the gate is controlled by a GPIO the STM32.
By disabling the MOSFET (gate = low) and measuring the ADC voltage, there are then two possibilities:
For the normal state, simply switch the MOSFET back on.
Of course you have to do the same with the 2nd channel, i.e. GNDext2.
Does it answer your question?
Good luck!
Regards
/Peter
2022-02-15 04:04 AM
Thank you @Peter BENSCH
Thank you for your answer. Please correct me if I didn't understand you answer.
Is it the circuit you suggest?
Lets assume that there is one device (Device1) and the device (STM32) has to find out which signal is connected to it.
Would you please look at the follow circuit and let me know if it will work.
Thank you.
2022-02-15 05:01 AM
Picture 1 is what I described, based on your first description.
In picture 2 you have tried to clarify your constellation a little, but it is still not clear.
Is the GPIO part of Device 1 or part of an independent device?
Do you want the GPIO to detect:
Picture 3 definitely does not work:
Please make a drawing where the possible cases are clearly visible.
Regards
/Peter
2022-02-15 05:17 AM
Picture 3 is wrong, my fault.
The GPIO is part of Device 1.
I want the GPIO to detect:
Please see if this picture makes sense.
2022-02-15 05:38 AM
You can determine this with two measurements:
For both measurements you need either two ADC inputs or an external analogue multiplexer.
Good luck!
Regards
/Peter
2022-02-15 05:40 AM
Thank you @Peter BENSCH