Comparing two input voltages?

5 ビュー (過去 30 日間)
Philip Harris
Philip Harris 2018 年 12 月 13 日
編集済み: Adam Danz 2018 年 12 月 14 日
I'm attempting to build a ride by wire system, I've built a proof of concept in Simulink utilising an Arduino as the controller.
Now I've moved on to real hardware with a RBW throttle, it uses two hall effect sensors to give two voltages. On one it gives a range of 0.9 - 4.4v and the other is 0.4 - 2.2v. I've looked through various blocks but I'm struggling to see a way forward and would appreciate any guidance on this problem.
  5 件のコメント
Philip Harris
Philip Harris 2018 年 12 月 14 日
Implementing the code.
It's almost like a verification. On other throttles the relationship is 0 - 5v and 5 - 0v as you require one signal to verify the other otherwise if it falls out of sync you need to flag an error code as riding the vehicle would become dangerous.
So on mine if signal 1 is 3v then signal 2 should be ~1.5v before then passing signal 1 forwards to operate a servo.
Adam Danz
Adam Danz 2018 年 12 月 14 日
I continued in the answers section now that we're getting closer to understanding the problem. If I'm still off base, I can remove that answer and we can continue here.

サインインしてコメントする。

回答 (1 件)

Adam Danz
Adam Danz 2018 年 12 月 14 日
編集済み: Adam Danz 2018 年 12 月 14 日
"if signal 1 is 3v then signal 2 should be ~1.5v before then passing signal 1 forwards to operate a servo."
If signal 1 is an instantaneous value s1 and signal 2 is an instantaneous value s2, would this work?
s1 = 3.012; %3v + some noise
s2 = 1.490; %1.5v + some noise
tol = 0.05; %Noise tolerance; so s1/s2 must be +/- tol from 2
if abs((s1/s2) - 2) > tol %Test that s2 is 1/2 of s1 within tolerance
%[enter code to stop servo] %system fail
else
%[pass signal to servo] %your system is working
end
The conditional statements would be wrapped in a while-loop or whatever controls your system and receives s1 and s2.
  2 件のコメント
Philip Harris
Philip Harris 2018 年 12 月 14 日
That looks like a plausible solution, thank you. Is there a specific block in which you can input this within Simulink?
Unfortunately I've only used the software recently and it's not well supported at my University.
Adam Danz
Adam Danz 2018 年 12 月 14 日
編集済み: Adam Danz 2018 年 12 月 14 日
I'd put it in whatever block recives the s1 and s2 signals so your system can react to a discrepency right away.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeArduino Hardware についてさらに検索

製品


リリース

R2018b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by