Hello everyone,
I'm working on an MIT App Inventor 2 application called "Mobile" with two main screens: a Modulator and a Demodulator.
On the Modulator screen:
- The binary sequence is transmitted via light pulses from the phone's flash (200 ms ON or OFF per bit).
On the Demodulator screen:
- I use the light sensor to receive these light pulses.
- The received light signal is converted back into a binary sequence (0s and 1s)
The Problem:
The data received by the Demodulator is inconsistent with the data sent by the Modulator. the issue lies in the synchronization between the transmission rate of the Modulator and the detection rate of the Demodulator.
Current Settings:
- Modulator Transmission Rate: Approximately 200 milliseconds per bit (duration of each flash pulse).
- Demodulator Reading Rate: Currently set to read the light sensor every 800 milliseconds.
My Suspicion:
I suspect the 800 ms reading interval on the Demodulator is too slow and is causing it to miss bits or misinterpret the light signals. I'm aiming for the Demodulator to reliably capture one representative light level for each transmitted bit, ideally without being affected by the transitions (on/off) of the flash.
My Question to the Forum:
Given this setup, what would be the optimal configuration for the Demodulator's light sensor reading interval (Clock.TimerInterval
and potentially LightSensor.MinimumInterval
) to ensure consistent and accurate reception of the 200 ms light pulses from the Modulator?
Should the Demodulator's reading interval match the Modulator's bit duration (200 ms)? If so, how can I ensure the reading occurs at a stable point within each bit's duration and isn't affected by the flash turning on or off?
Alternatively, is there a better approach to ensure reliable communication, perhaps involving a different reading rate or a specific logic for interpreting the light sensor data?
I'm open to any suggestions and best practices for achieving reliable light-based communication in MIT App Inventor 2.
Thank you in advance for your help!