2
\$\begingroup\$

I have a signal from another system that changes between 0-1V. the resolution of measuring will be 3mv. the custom board that I need to design include uC of ST that sample the voltage from adc and compare it to some margin and if its above the margin I need to switch off some other safety system (with relay that control by GPIO from ST), and it should cut the other system 25mSec(maximum) when the over range is detected - for example if the software define the value 0.748V , when the signal equal to 0.751V I need to close the switch within 25mSec from it.

  • how many bits I need? 12bit is not a risk ?
  • I need to amplify the signal before the ADC?
  • how to choose sample rate if?
  • how to calculate the time it take to end of convertion ?
\$\endgroup\$
10
  • 2
    \$\begingroup\$ Instead of an ADC, a possibly simpler approach would be a comparator and a DAC, because the "DAC" voltage can be generated by PWMing a pin of the MCU. \$\endgroup\$
    – tobalt
    Aug 25 at 11:30
  • 1
    \$\begingroup\$ These are pretty basic requirements, almost any ADC will do. However, I can't comment on the safety aspect. Does it really need to be an ADC+uC and not a comparator? If you use an ADC+uC, does that mean someone will die if the software crashes? \$\endgroup\$
    – user253751
    Aug 25 at 13:41
  • 3
    \$\begingroup\$ Do look up Therac-25: a software bug killed 4 people and maimed another 2. There is lots of information about this, not just the Wikipedia page which is quite short. And that's why we don't like using software to keep people alive. \$\endgroup\$
    – user253751
    Aug 25 at 15:12
  • 3
    \$\begingroup\$ Safety-critical systems should be properly reviewed by someone qualified, to make sure there are enough safety mechanisms and they are reliable enough. I, a random Internet person, am not responsible if your product makes someone go blind. \$\endgroup\$
    – user253751
    Aug 25 at 15:13
  • 1
    \$\begingroup\$ I would not be using a microprocessor for this, no matter how clever I think I am. The formal functional safety process needed to ensure the necessary level of safety is beyond whatever you can do at the moment. Forget about it. Your boss has no clue about any of it, and I worry the company's products will injure someone. Talk to someone qualified, and do the simplest fail-safe analog design you can come up with. At least you'll be able to reason about it yourself. Just reading the standards that govern functional safety of software will take you months. \$\endgroup\$ Aug 26 at 0:34

3 Answers 3

4
\$\begingroup\$

Your requirements are not very high. Almost any ADC could handle this task.

However, you are asking about a so-called safety interlock. You want to make a circuit that stops the machine if the machine becomes unsafe (specifically - if the laser is stronger than it should be). If the laser is too strong and the safety interlock doesn't work, someone could go blind. Therefore, you want to be really sure the safety interlock will work.

This requires a level of assurance that is not appropriate to a random Internet Q&A site. Sure, we can offer suggestions, like making the interlock out of hardware so it still works even if the software crashes, but they are just suggestions. If your device fails and makes someone blind, your company - or you - could be sued for millions of dollars.

If you've never heard of Therac-25 then click that and read about it. Therac-25 was a hospital machine designed to kill cancer by focusing radiation at it. And it was controlled by a computer, and the program had a bug - a race condition - if the operator entered commands too quickly, the software could get confused and the machine could send way too much radiation. This killed four people. You do not want to be the person who designed the machine that killed four people.

The previous version of the machine (the Therac-20) had hardware interlocks, so if the operator did this, it blew a fuse (on purpose). This is a good thing. Blowing a fuse is better than killing someone. In the Therac-25, they saved money by taking out the hardware interlock and relying on the software interlock. But the software was buggy. And people died.

And that is why you need to make sure someone who is properly qualified looks over your design and makes sure it is good enough. And why safety-critical software needs to be taken seriously. If you can't prove the software never crashes, then better not to make the software get involved at all. Your laser probably won't kill anyone, but it could make them blind, and that's nearly as bad.

\$\endgroup\$
1
\$\begingroup\$

You did not specify what kind of"system" you need.

... close the switch within 25mSec from it ...

And before, you should know "how many time" you need for closing the switch itself.

how many bits I need? 12bit is not a risk?

10 bits should be enough like an Arduino ADC or others.

I need to amplify the signal before the ADC?

If you want, yes. It would be a good idea (gain needed 3 or 5, as Vsupply). It will be "more" easy to compare "sample" data with a defined "limit". Be aware of "drifting" problem about samples ...

how to choose sample rate if?

ADC Arduino can take at a sample rate like 1 kHz ... every ms. You have the time to test the value (or some samples for averaging) and take a "digital" decision (only a digital comparison). What Arduino can do, ST can do it.

how to calculate the time it take to end of convertion ?

Arduino can take a sample in some 120 us (for example, but some micros controllers are faster). Your ST32G030 does it in 0.4 us.

\$\endgroup\$
4
  • 1
    \$\begingroup\$ Why you talk about arduino ? Its ST uC STM32G030. how to calcaulte the time to see if it will be under 25mSec? there is convertion time also no ? why Its prefer to amplify the signal ? thx. \$\endgroup\$
    – Knowledge
    Aug 25 at 10:08
  • 1
    \$\begingroup\$ As an example I know, Arduino is only a "low" device. An ST is much faster ... so it is ok. I check the ST32G030 to see conversion time, it is like "0.4us" ... at least 250 times faster. \$\endgroup\$
    – Antonio51
    Aug 25 at 10:23
  • \$\begingroup\$ what is the advantage to amplify signal before ADC input? should I do it ? \$\endgroup\$
    – Knowledge
    Aug 25 at 10:24
  • \$\begingroup\$ I think it is better to meet the full scale of the ADC (if you take more than one sample, it is better to calculate a mean, some "noise" spikes may always occur). But this is up to you. \$\endgroup\$
    – Antonio51
    Aug 25 at 10:28
-1
\$\begingroup\$

3mV in 1V is 1 part in 333 so that’s a little over 8 bits, so a 10 or 12 bit ADC would probably suffice, but read the datasheet to confirm the device’s accuracy and linearity. It’s up to you whether you want to use a discrete ADC or a micro with an in-board ADC (which I would tend to do).

\$\endgroup\$
9
  • \$\begingroup\$ An MCU would need programming though, while a discrete ADC doesn't. Why would you incur dev/manf/support costs and overheads with no return on that spend? \$\endgroup\$
    – TonyM
    Aug 25 at 10:25
  • 2
    \$\begingroup\$ @TonyM A comparator doesn't need programming; a discrete ADC isn't useful for much unless you wire it up to a more complicated logic circuit. \$\endgroup\$
    – user253751
    Aug 25 at 13:46
  • \$\begingroup\$ @user253751, you've gone off at some tangent... \$\endgroup\$
    – TonyM
    Aug 25 at 13:53
  • 2
    \$\begingroup\$ @TonyM can you explain how you would use an ADC here without programming? \$\endgroup\$
    – user253751
    Aug 25 at 13:56
  • 2
    \$\begingroup\$ @TonyM Reading by what? \$\endgroup\$
    – user253751
    Aug 25 at 17:16

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.