Firstly, Hello to all, I am trying to design a circuit for automotive application that circuit will read positive and negative input signals in the same pin via selecting the type of input in the software. I designed a prototype circuit to do it.You can see it in this picture.

Software Configuable Input Read Circuit

I refered a digikey article. Link of the article is here Protecting Inputs in Digital Electronics. When I want to read positive signal (9 V - 32 V). I will set internal pull-down resistor and input will be active high. When I want to read negative signal (0 V) I will set internal pull-up resistor and input will be active low. Internal pull-up and pull-down resistor value of the STM32F042C6 vary between 25k to 55k but typical value is 40k. Do you have any recommendation to improve design of the circuit ?

Edited: If I don't use pull down resistor.While reading positive signal.The capacitor(C1) will not be discharged after I switch(SW1) from positive signal to floating(not connected) and I will still read it as a high input.In this pictureProblem to discharge capacitor you can see that the input of the mcu is hanging arround 2.96V when the input not connected and the pull down resistor not selected.Is there any way to solve this problem without using pull down resistor?

  • \$\begingroup\$ I have studied the schematic but see no evidence of a negative voltage source. Do you mean that you want to (not "wanna") read positive and zero-volt input signals? \$\endgroup\$ – Transistor Mar 17 '20 at 20:32
  • \$\begingroup\$ I meant to read positive and zero volt input signals.@Transistor \$\endgroup\$ – mrt Mar 18 '20 at 11:57

From the schematic it appears that you want to monitor the status of a signal that switches between +9 to +32 V and GND (0 V).

Switching pull-up to pull-down is an unusual approach and not necessary.

  • With R2 = 40 kΩ you will easily detect a 'high' on the input.
  • With SW1 grounded R2, R4 and R1 form a potential divider on the input. The input voltage will be given by \$ V_i = \frac {1.01}{40 + 1.01}3.3 = 81 \ \text {mV} \$. This should be well below your logic low minimum allowable voltage.

You don't need to use pull-down.

  • \$\begingroup\$ It appears to me there is a third 'no pulling' state, given by the 3 position switch. To read 3 different position of a switch like that would need the software configuration they ask about. \$\endgroup\$ – ambitiose_sed_ineptum Mar 17 '20 at 21:14
  • \$\begingroup\$ The thought had crossed my mind but it wasn't stated in the question. Let's see what the OP says. \$\endgroup\$ – Transistor Mar 17 '20 at 21:17
  • \$\begingroup\$ I used 3 position switch to demonstrate that the input pin can be in three different position.First position connected to positive signal. Second position left open.Third position connected to ground.@ambitiose_sed_ineptum \$\endgroup\$ – mrt Mar 18 '20 at 12:05

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.