Priority-based series-connected switches decoding with ADC? - Page 1
Forum section: electronics / projects

author: ricko_uk
author_rank: Super Contributor
timestamp: May 16, 2022, 10:24:54 pm
content: Hi,with reference to the attached schematic, there are three switches which are normally closed for the power stage of this system to work. The voltage can be as high as 24V and the micro is 3V3. The 100K and 10K voltage divider resistors are high vlaue to avoid turning on the solid state relay. The solid state relay's LED trigger current is shown to be 3mA so I assume a current of 0.5mA is low enough to guarantee the OFF state. SSR datasheet is this:https://www.mouser.co.uk/datasheet/2/408/TLP241A_datasheet_en_20200217-1075431.pdfBut for safety reasons and also to provide user feedback, I need to monitor the status of each switch from a micro. Because they are in series - unless I am missing something - it is not possible to monitor every combination. First question is, is that correct? Or perhaps by adding high value resistors across the switches (as shown) that can be achieved?But by assigning priority whereby the switches have decreasing priority from left to right (with reference to the schematic) so that if a higher priority switch is open then the status of the other ones does not matter, then an acceptable compromise can be achieved.My second question, question is about resistor values with the compromise above. To spread the reading of the various combinations relatively wide apart for clear reading by the ADC even with large tolerances of the resistors, how would you choose the resistor values? Perhaps some exponential relationship?thank you

author: Someone
author_rank: Super Contributor
timestamp: May 16, 2022, 11:05:47 pm
content: Quote from: ricko_uk on May 16, 2022, 10:24:54 pmIs that a specified minimum turn on current in the data sheet? Most opto couplers are highly variable over batch/life/drive conditions.

author: ricko_uk
author_rank: Super Contributor
timestamp: May 16, 2022, 11:47:33 pm
content: Thank you Someone,it is actually a solid state relay (I corrected the wording in the OP). In the datasheet's (https://www.mouser.co.uk/datasheet/2/408/TLP241A_datasheet_en_20200217-1075431.pdf) first page it says trigger current is 3mA so my assumption is that 0.5mA is low enough to be off.I cannot see any other infos about it. Is my assumption correct?Thank you

author: Someone
author_rank: Super Contributor
timestamp: May 17, 2022, 12:27:44 am
content: Quote from: ricko_uk on May 16, 2022, 11:47:33 pmBack to school for you:QuoteWhich for those parts is lower than your (best case!) bleed. But those parameters depend on the load too, optos are a long way from "ideal" or easy to use.

author: ricko_uk
author_rank: Super Contributor
timestamp: May 17, 2022, 11:43:47 am
content: Got it now. Thank you

author: ricko_uk
author_rank: Super Contributor
timestamp: May 17, 2022, 11:46:44 am
content: Any suggestions on how to do it? Increasing the resistances to much higher values might make it too prone to noise. Any ideas/suggestions on how to implement the monitoring fo all switches as mentioned in the OP?One way would be to use op-amps (high input impedance). Any other options?Thank you

author: Terry Bites
author_rank: Super Contributor
timestamp: May 17, 2022, 03:53:30 pm
content: I think a redesign is in order. What does D8 do?The SSR is on or it isn't so you need a simple logical decode of the switch settings and probably an NPN to drive its LED."Isn't there a chip for that?" SNx4HC148 CD4532 etc?

author: free_electron
author_rank: Super Contributor
timestamp: May 17, 2022, 04:01:52 pm
content: use weighted resistor in a 1-2-4 ratio. then you can simply feed this into an adc.make a simply 0.5 mA current source that drives current into 1k-2k-4k (4k02) the switches short one resistor each.so you get 3 bits.0.5 volt = 1k open1 volt = 2k open1.5 volt = 1 and 2 open2 volt 3 open2.5 volt ... you get the drill.

author: T3sl4co1l
author_rank: Super Contributor
timestamp: May 17, 2022, 08:05:55 pm
content: Easy enough to increase Ioff by putting a shunt resistor across the LED.Tim

author: ricko_uk
author_rank: Super Contributor
timestamp: May 18, 2022, 08:17:11 pm
content: Thank you all!@Tim,yes, simple solution for the I@free_electron,yes with those numbers it works nicely@TerryBites,yes, but I was trying to keep as few components as possible at the front end to decrease potential failure points