UART Communication

Status
Not open for further replies.

New

New member
I want to use two pressure sensors with two teensy 3.6. At a specific pressure teensy will active a motor. If the pressure sensor broken, uart communicated other teensy should activate the motor with its own pressure sensor. How can i do this? How other teensy understand that the other sensor is broken?
 
How can i do this? How other teensy understand that the other sensor is broken?

Assuming the motor is controlled by a simple on/off digital signal, probably the simplest and (maybe) most reliable way would be to use an "open collector" approach to connect both output signals. If logic high turns on the motor, you would connect a resistor from the pin to GND so it is logic low when neither Teensy drives the pin high. On each Teensy, when the pin is supposed to be low you would use pinMode(pin, INPUT) so that Teensy doesn't drive the signal. The resistor does the work of making the pin low when neither Teensy wants the motor on. When it should be high, use digitalWrite(pin, HIGH) and then pinMode(pin, OUTPUT). If both do this, it is safe because neither tries to actively drive the pin low.

This way you do not need any communication between the 2 boards. You only need to design each so it avoids driving the pin high if the sensor fails. By avoiding communication between the 2 boards, you can have it work properly even if one of the Teensy boards fails, as long as the failure mode doesn't drive the pin high. The only really critical component would then be the resistor, and you could use 2 of those in parallel if you wanted to have a system where every part has a redundant backup.

As for normal serial (UART) communication, here is the page with details.

https://www.pjrc.com/teensy/td_uart.html
 
I don't understand. You question asked "I want to use two pressure sensors with two teensy 3.6".

Now you're saying you only have one Teensy 3.6?
 
Oh sorry, I mean in the project, two teensy must communicate for the broken sensor and activate the motor with its own sensor. I am a beginner. Sorry for my bad explanation.
 
I'm still confused. You have 1 motor. You have 2 Teensy. Do you have 2 sensor or 1 sensor?

I do not understand why the open collector summing of the 2 outputs from the 2 Teensy does not solve your problem.
 
Sorry I was reading this thread and it is very unclear to me, what your setup or desired setup is and what are you trying to solve.

Maybe if you showed a diagram or the like, which sort of shows what pieces are where they are. And your constraints... What is a broken sensor?

I mean for example could this be as simple as having the outputs of each board fed into some form or OR gate (which maybe could be a couple of diodes) to whatever starts the motor (Relay? Motor controller?)

Can the boards have anything in common? Example each has an output pin that feeds to an input pin of the other board? That way each board can look at what the other board says and decide to do something.
Or could be more advanced than simple digital, maybe analog value or Uart or ...

Again no idea of what is failure? If you wish to trigger motor at pressure X like lets say 50... And one thinks it is 55 and other 45 how you know which one is correct... Probably easy to detect complete failure like stuck at 0 or at some high value...

Again sorry I may be missing something obvious here, but not again not sure what you are asking.
 
Status
Not open for further replies.
Back
Top