This code uses a new firmware feature which is not available in PSLab v5; trigger on non-sampled channel. However, it may be possible to get this to work with the v5 hardware.
There is significant cross-talk between adjacent analog inputs for high frequency signals. This is normally a bad thing, but in this case it should be possible to use it to our advantage. Connect the sensor to the PSLab as follows:
fM -> SQ1
SH -> SQ2
ICG -> SQ3 -> CH2
OS -> CH1
Then, run this code:
from pslab.external.tcd1304 import TCD1304
tcd = TCD1304
tcd.start_clocks()
x, y = tcd.read(analogin="CH1", trigger="CH1")
The idea is to start sampling when the ICG clock line goes high, since that is when the TCD1304 starts putting its pixel values on its analog output. Notice that we are both sampling and triggering on CH1, even though the ICG line is connected to CH2. This is because the fast rise-time of the ICG PWM-signal has a very high frequency content, which will manifest as a noise spike in CH1 due to the cross talk issue mentioned above. This noise spike will cross the trigger threshold and cause the oscilloscope to start sampling.
This code uses a new firmware feature which is not available in PSLab v5; trigger on non-sampled channel. However, it may be possible to get this to work with the v5 hardware.
There is significant cross-talk between adjacent analog inputs for high frequency signals. This is normally a bad thing, but in this case it should be possible to use it to our advantage. Connect the sensor to the PSLab as follows:
fM -> SQ1 SH -> SQ2 ICG -> SQ3 -> CH2 OS -> CH1
Then, run this code:
The idea is to start sampling when the ICG clock line goes high, since that is when the TCD1304 starts putting its pixel values on its analog output. Notice that we are both sampling and triggering on CH1, even though the ICG line is connected to CH2. This is because the fast rise-time of the ICG PWM-signal has a very high frequency content, which will manifest as a noise spike in CH1 due to the cross talk issue mentioned above. This noise spike will cross the trigger threshold and cause the oscilloscope to start sampling.