How to read Standard RC signal
-
I want to read Standard RC PWM input signal on port A (or B, C). Standard RC PWM signal is between 1.5 ms to 2 ms and have timeout at 20 ms. How to do it in UI FLOW.
PS.
Something that similar to "pulseIn" command in arduino? -
@pattiuak said in How to read Standard RC signal:
I want to read Standard RC PWM input signal on port A (or B, C). Standard RC PWM signal is between 1.5 ms to 2 ms and have timeout at 20 ms. How to do it in UI FLOW.
PS.
Something that similar to "pulseIn" command in arduino?there isn't a dedicate pwm read block,( and I am way behind with my experiments,) Have you tried playing with the analogue or digital pin reads?
-
@ajb2k3 As I Know
-
analog read will read voltage input from 0 V. to 5 V. in this case it will pickup either 0 V. or full 5 V. (depend on PWM duty when you read it). So analog read is useless for this case.
-
digital pin read is just get 0 or 1. But if I can get delta time between it change from 0 to 1 and change back from 1 to 0 it will work. But UI FLOW don't have any block that can read processing time. So it impossible to read duty time with digital pin read only.
-
-
@pattiuak said in How to read Standard RC signal:
But if I can get delta time between it change from 0 to 1 and change back from 1 to 0 it will work. But UI FLOW don't have any block that can read processing time. So it impossible to read duty time with digital pin read only.
sorry, uiflow now not support it
-
Hope it supports in the future. I need a similar function to read sbus signal.
-
Is it possible to do it now with the ticks ?
-
Hope you still consider adding sbus blocks to uiflow. It would be very useful with all the servo controller units available for m5stack products.
-
Method 1: As far as I know the pulse goes from 1ms to 2ms (1.5ms is middle position). It should be possible to "analogify" or mathematically say "integrate" the PWM signal using a R-C combination on the input pin and read the voltage from this. But the voltage level will be low due the duty cycle which goes from approx. 1:20 (1ms/20ms) to 1:10 (2ms/20ms). From 5V full scale you read 0.25V to 0.5V. You may add an analog OPAMP amplify it to 5V. This method will slow down the reaction time a little bit
Method 2: Before doing the Method 1 it may be less effort to write it in Arduino and use either a PWM read library or use a interrupt to measure the pulse width. You can also read the low time to determine if the input signal is valid or not eg. to detect signal loss.
Method 3: This is the simple but ugly workaround! Add a small Servo to your signal and drive a potentiometer which ist then read by the M5 analog input.