Skip to content

LEDs in the SEAL Kit

Andres Torres edited this page Jun 30, 2021 · 10 revisions

How Do We Control the LEDs?

The LEDs are controlled via digital channel 0 on Port 0 — also referred to as Line 0 — in the USB 6008 board (see the schematic for reference — Line 0 is denoted by P0.0 in the schematic). Recall that digital channels can either be activated (meaning the channel is emitting 5V) or deactivated (meaning the channel is not emitting any voltage – 0V). When Line 0 is activated the LEDs do not flash (see below for how to activate Line 0). When Line 0 is deactivated the LEDs begin to flash indefinitely until Line 0 is reactivated again (see below for how to deactivate Line 0).

Activating Line 0

task.write(True)

Deactivating Line 0

task.write(False)

How Does LED Flashing Work?

Once the LEDs are activated they begin to flash in predetermined pattern that lasts roughly one minute long — throughout this document this phenomenon will be referred to as a "cycle." A cycle can be initiated by deactivating Line 0 (which is usually activated by default). Once a cycle begins nothing short of unplugging the LEDs can stop the cycle. After a cycle is completed the LED board checks Line 0 to determine whether or not another cycle should be started. As outlined earlier, if Line 0 is deactivated (emitting 0V) then another cycle will begin and if Line 0 is activated (emitting 5V) then the LEDs will stop flashing only AFTER the previous cycle has completed.

Another important aspect in how the LED flashing works is what LEDs flash in each cycle and in what order. Here's what I've learned so far. There are two cycles in total. When the LEDs first receive the signal to begin flashing the first cycle, which will be referred to as Cycle 1, will initiate. Cycle 1 can only ever be initiated once, as the first cycle. After Cycle 1 is initiated it can never be initiated again, unless the internal computer in LED box is reset; this can be done by unplugging the LED box. After Cycle 1 has completed (and assuming the signal to stop flash has been sent before the initiation of the second cycle) the second cycle, which will be referred to as Cycle 2, will be initiated once the signal to activate the flashing has been sent. Cycle 2 is the only cycle that occurs after Cycle 1 is completed.

Consider this code to better understand how the cycles work:

import nidaqmx
import time

# Assuming the LED box computer has been reset this is an accurate representation of how the cycles would occur
with nidaqmx.Task() as task:
    task.do_channels.add_do_chan('Dev1/port0/line0')
    task.write(False) # Initiate **Cycle 1**
    task.write(True) # Do not continue with another cycle once **Cycle 1** is completed
  
    time.sleep(70) # Wait until **Cycle 1** is done

    task.write(False) # Initiate **Cycle 2**, from here on out we can only activate **Cycle 2** unless we reset the LED computer
    task.write(True) # Do not continue with another cycle once **Cycle 2** is completed

    time.sleep(70) # Wait until **Cycle 2** is done

    task.write(False) # Initiate **Cycle 2**
    task.write(True) # Do not continue with another cycle once **Cycle 2** is completed

It might be useful to know which LEDs flash in each. After some observation and data taking, here are the results:

Cycle 1 Cycle 2
Flash Number Row Column
1. 2 4
2. 2 4
3. 5 4
4. 4 4
5. 3 4
6. 6 4
7. 1 4
8. 8 4
9. 7 8
10. 2 8
11. 5 8
12. 4 8
13. 3 8
14. 6 8
15. 1 8
16. 8 8
17. 7 2
18. 2 2
19. 5 2
20. 4 2
21. 3 2
22. 6 2
23. 1 2
24. 8 2
25. 7 6
26. 2 6
27. 5 6
28. 4 6
29. 3 6
30. 6 6
31. 1 6
32. 8 6
33. 7 7
34. 2 7
35. 5 7
36. 4 7
37. 3 7
38. 6 7
39. 1 7
40. 8 7
41. 7 3
42. 2 3
43. 5 3
44. 4 3
45. 3 3
46. 6 3
47. 1 3
48. 8 3
49. 7 5
50. 2 5
51. 5 5
52. 4 5
53. 3 5
54. 6 5
55. 1 5
56. 8 5
57. 7 1
58. 2 1
59. 5 1
60. 8 5
61. 7 1
62. 6 1
63. 1 1
64. 8 1
Flash Number Row Column
1. 7 4
2. 7 4
3. 2 4
4. 5 4
5. 4 4
6. 3 4
7. 6 4
8. 1 4
9. 8 4
10. 7 8
11. 2 8
12. 5 8
13. 4 8
14. 3 8
15. 6 8
16. 1 8
17. 8 8
18. 7 2
19. 2 2
20. 5 2
21. 4 2
22. 3 2
23. 6 2
24. 1 2
25. 8 2
26. 7 6
27. 2 6
28. 5 6
29. 4 6
30. 3 6
31. 6 6
32. 1 6
33. 8 6
34. 7 7
35. 2 7
36. 5 7
37. 4 7
38. 3 7
39. 6 7
40. 1 7
41. 8 7
42. 7 3
43. 2 3
44. 5 3
45. 4 3
46. 3 3
47. 6 3
48. 1 3
49. 8 3
50. 7 5
51. 2 5
52. 5 5
53. 4 5
54. 3 5
55. 6 5
56. 1 5
57. 8 5
58. 7 1
59. 2 1
60. 5 1
61. 4 1
62. 3 1
63. 6 1
64. 1 1
65. 8 1

The results and discussion above all refer to the process of starting and stopping a single cycle at a time. As mentioned above, if no signal to stop is sent a another cycle will initiate. The results more than likely are the same in either situation but please be aware this has not be observed to be the case yet, as of this writing. Due to time constraints, I will unfortunately be unable to determine whether in fact this is the case.

In addition to knowing the order in which the LEDs flash, it also important to know the delay between each LED flash. The approach which I took in acquiring this data is by filming the flashing LEDs using slow motion. Then I could count the frames between each LED flash to determine the time it took between each flash. I did this measurement twice for Cycle 1 and received different results in each case which made applying the knowledge learned from these observations more difficult to apply, which led to issues, like #2. Unfortunately, I was unable to collect any data for Cycle 2, however it appears that Cycle 1 and Cycle 2 have similar delays between LED flashes.

Trial 1 — 120 Frames Per Seconds (FPS)
Filmed on the OnePlus 2; link to frames
Event Beginning Frame Ending Frame Frames Elapsed Time Elapsed
(seconds)
Flash 1
Row Column
Flash 2
Row Column
From LED activation to Flash 1 132 196 64 0.5333...
2 4
Flash 1 to Flash 2 196 254 58 0.48333...
2 4
2 4
Flash 2 to Flash 3 254 350 96 0.8
2 4
5 4
Flash 3 to Flash 4 350 452 102 0.85
5 4
4 4
Flash 4 to Flash 5 452 556 104 0.8666...
4 4
3 4
Flash 5 to Flash 6 556 660 104 0.8666...
3 4
6 4
Flash 6 to Flash 7 660 764 104 0.8666...
6 4
1 4
Flash 7 to Flash 8 764 868 104 0.8666...
1 4
8 4
Flash 8 to Flash 9 868 972 104 0.8666...
8 4
7 8
Flash 9 to Flash 10 972 1077 105 0.875
7 8
2 8
Flash 10 to Flash 11 1077 1181 104 0.8666...
2 8
5 8
Flash 11 to Flash 12 1181 1285 104 0.8666...
5 8
4 8
Flash 12 to Flash 13 1285 1388 103 0.858333...
4 8
3 8
Flash 13 to Flash 14 1388 1492 104 0.8666...
3 8
6 8
Flash 14 to Flash 15 1492 1596 104 0.8666...
6 8
1 8
Flash 15 to Flash 16 1596 1700 104 0.8666...
1 8
8 8
Flash 16 to Flash 17 1700 1803 103 0.858333...
8 8
7 2
Flash 17 to Flash 18 1803 1907 104 0.8666...
7 2
2 2
Flash 18 to Flash 19 1907 2011 104 0.8666...
2 2
5 2
Flash 19 to Flash 20 2011 2115 104 0.8666...
5 2
4 2
Flash 20 to Flash 21 2115 2218 103 0.858333...
4 2
3 2
Flash 21 to Flash 22 2218 2322 104 0.8666...
3 2
6 2
Flash 22 to Flash 23 2322 2425 103 0.858333...
6 2
1 2
Flash 23 to Flash 24 2425 2529 104 0.8666...
1 2
8 2
Flash 24 to Flash 25 2529 2632 103 0.858333...
8 2
7 6
Flash 25 to Flash 26 2632 2736 104 0.8666...
7 6
2 6
Flash 26 to Flash 27 2736 2839 103 0.858333...
2 6
5 6
Flash 27 to Flash 28 2839 2943 104 0.8666...
5 6
4 6
Flash 28 to Flash 29 2943 3046 103 0.858333...
4 6
3 6
Flash 29 to Flash 30 3046 3149 103 0.858333...
3 6
6 6
Flash 30 to Flash 31 3149 3253 104 0.8666...
6 6
1 6
Flash 31 to Flash 32 3253 3356 103 0.858333...
1 6
8 6
Flash 32 to Flash 33 3356 3458 102 0.85
8 6
7 7
Flash 33 to Flash 34 3458 3561 103 0.858333...
7 7
2 7
Flash 34 to Flash 35 3561 3664 103 0.858333...
2 7
5 7
Flash 35 to Flash 36 3664 3768 104 0.8666...
5 7
4 7
Flash 36 to Flash 37 3768 3871 103 0.858333...
4 7
3 7
Flash 37 to Flash 38 3871 3974 103 0.858333...
3 7
6 7
Flash 38 to Flash 39 3974 4078 104 0.8666....
6 7
1 7
Flash 39 to Flash 40 4078 4181 103 0.858333...
1 7
8 7
Flash 40 to Flash 41 4181 4284 103 0.858333...
8 7
7 3
Flash 41 to Flash 42 4284 4387 103 0.858333...
7 3
2 3
Flash 42 to Flash 43 4387 4490 103 0.858333...
2 3
5 3
Flash 43 to Flash 44 4490 4594 104 0.8666...
5 3
4 3
Flash 44 to Flash 45 4594 4697 103 0.858333...
4 3
3 3
Flash 45 to Flash 46
(not sure what's going on here)
4697 4745 48 0.4
3 3
6 3
Flash 46 to Flash 47 4745 4848 103 0.858333...
6 3
1 3
Flash 47 to Flash 48 4848 4951 103 0.858333...
1 3
8 3
Flash 48 to Flash 49 4951 5054 103 0.858333...
8 3
7 5
Flash 49 to Flash 50 5054 5158 104 0.8666...
7 5
2 5
Flash 50 to Flash 51 5158 5261 103 0.858333...
2 5
5 5
Flash 51 to Flash 52 5261 5364 103 0.858333...
5 5
4 5
Flash 52 to Flash 53 5364 5467 103 0.858333...
4 5
3 5
Flash 53 to Flash 54 5467 5570 103 0.858333...
3 5
6 5
Flash 54 to Flash 55 5570 5673 103 0.858333...
6 5
1 5
Flash 55 to Flash 56 5673 5776 103 0.858333...
1 5
8 5
Flash 56 to Flash 57 5776 5879 103 0.858333...
8 5
7 1
Flash 57 to Flash 58 5879 5983 104 0.8666...
7 1
2 1
Flash 58 to Flash 59 5983 6086 103 0.858333...
2 1
5 1
Flash 59 to Flash 60 6086 6189 103 0.858333...
5 1
4 1
Flash 60 to Flash 61 6189 6292 103 0.858333...
4 1
3 1
Flash 61 to Flash 62 6292 6395 103 0.858333...
3 1
2 1
Flash 62 to Flash 63 6395 6498 103 0.858333...
2 1
1 1
Flash 63 to Flash 64 6498 6601 103 0.858333...
1 1
8 1

(since we are using a 120 FPS camera each measurement above is accurate to within 0.008333... of a second)

Trial 2 — 240 Frames Per Second (FPS)
Filmed on the iPhone SE 2nd Generation; link to frames
Event Beginning Frame Ending Frame Frames Elapsed Time Elapsed
(seconds)
Flash 1
Row Column
Flash 2
Row Column
From LED activation to Flash 1 467 566 99 0.4125
2 4
Flash 1 to Flash 2 566 684 118 0.491666...
2 4
2 4
Flash 2 to Flash 3 684 881 197 0.8208333...
2 4
5 4
Flash 3 to Flash 4 881 1091 210 0.875
5 4
4 4
Flash 4 to Flash 5 1091 1304 213 0.8875
4 4
3 4
Flash 5 to Flash 6 1304 1519 215 0.8958333...
3 4
6 4
Flash 6 to Flash 7 1519 1734 215 0.8958333...
6 4
1 4
Flash 7 to Flash 8 1734 1948 214 0.891666...
1 4
8 4
Flash 8 to Flash 9 1948 2162 214 0.891666...
8 4
7 8
Flash 9 to Flash 10 2162 2377 215 0.8958333...
7 8
2 8
Flash 10 to Flash 11 2377 2591 214 0.891666...
2 8
5 8
Flash 11 to Flash 12 2591 2804 213 0.8875
5 8
4 8
Flash 12 to Flash 13 2804 3018 214 0.891666...
4 8
3 8
Flash 13 to Flash 14 3018 3231 213 0.8875
3 8
6 8
Flash 14 to Flash 15 3231 3445 214 0.891666...
6 8
1 8
Flash 15 to Flash 16 3445 3658 213 0.8875
1 8
8 8
Flash 16 to Flash 17 3658 3872 214 0.891666...
8 8
7 2
Flash 17 to Flash 18 3872 4048 214 0.891666...
7 2
2 2
Flash 18 to Flash 19 4048 4298 214 0.891666...
2 2
5 2
Flash 19 to Flash 20 4298 4511 213 0.8875
5 2
4 2
Flash 20 to Flash 21 4511 4725 214 0.891666...
4 2
3 2
Flash 21 to Flash 22 4725 4937 212 0.88333...
3 2
6 2
Flash 22 to Flash 23 4937 5151 214 0.891666...
6 2
1 2
Flash 23 to Flash 24 5151 5362 211 0.8791666...
1 2
8 2
Flash 24 to Flash 25 5362 5575 213 0.8875
8 2
7 6
Flash 25 to Flash 26 5575 5787 212 0.88333...
7 6
2 6
Flash 26 to Flash 27 5787 6001 214 0.891666...
2 6
5 6
Flash 27 to Flash 28 6001 6214 213 0.8875
5 6
4 6
Flash 28 to Flash 29 6214 6427 213 0.8875
4 6
3 6
Flash 29 to Flash 30 6427 6639 212 0.88333...
3 6
6 6
Flash 30 to Flash 31 6639 6852 213 0.8875
6 6
1 6
Flash 31 to Flash 32 6852 7064 212 0.88333...
1 6
8 6
Flash 32 to Flash 33 7064 7277 213 0.8875
8 6
7 7
Flash 33 to Flash 34 7277 7490 213 0.8875
7 7
2 7
Flash 34 to Flash 35 7490 7702 212 0.88333...
2 7
5 7
Flash 35 to Flash 36 7702 7914 212 0.88333...
5 7
4 7
Flash 36 to Flash 37 7914 8126 212 0.88333...
4 7
3 7
Flash 37 to Flash 38 8126 8339 213 0.8875
3 7
6 7
Flash 38 to Flash 39 8339 8552 213 0.8875
6 7
1 7
Flash 39 to Flash 40 8552 8764 212 0.88333...
1 7
8 7
Flash 40 to Flash 41 8764 8976 212 0.88333...
8 7
7 3
Flash 41 to Flash 42 8976 9188 212 0.88333...
7 3
2 3
Flash 42 to Flash 43 9188 9400 212 0.88333...
2 3
5 3
Flash 43 to Flash 44 9400 9613 213 0.8875
5 3
4 3
Flash 44 to Flash 45 9613 9825 212 0.88333...
4 3
3 3
Flash 45 to Flash 46 9825 10037 212 0.88333...
3 3
6 3
Flash 46 to Flash 47 10037 10250 213 0.8875
6 3
1 3
Flash 47 to Flash 48 10250 10461 211 0.8791666...
1 3
8 3
Flash 48 to Flash 49 10461 10673 212 0.88333...
8 3
7 5
Flash 49 to Flash 50 10673 10885 212 0.88333...
7 5
2 5
Flash 50 to Flash 51 10885 11097 212 0.88333...
2 5
5 5
Flash 51 to Flash 52 11097 11309 212 0.88333...
5 5
4 5
Flash 52 to Flash 53 11309 11522 213 0.8875
4 5
3 5
Flash 53 to Flash 54 11522 11733 211 0.8791666...
3 5
6 5
Flash 54 to Flash 55 117333 11945 212 0.88333...
6 5
1 5
Flash 55 to Flash 56 11945 12157 212 0.88333...
1 5
8 5
Flash 56 to Flash 57 12157 12369 212 0.88333...
8 5
7 1
Flash 57 to Flash 58 12369 12581 212 0.88333...
7 1
2 1
Flash 58 to Flash 59 12581 12793 212 0.88333...
2 1
5 1
Flash 59 to Flash 60 12793 13004 211 0.8791666...
5 1
4 1
Flash 60 to Flash 61 13004 13216 212 0.88333...
4 1
3 1
Flash 61 to Flash 62 13216 13428 212 0.88333...
3 1
2 1
Flash 62 to Flash 63 13428 13640 212 0.88333...
2 1
1 1
Flash 63 to Flash 64 13640 13852 212 0.88333...
1 1
8 1

(since we are using a 240 FPS camera each measurement above is accurate to within 0.0041666... of a second)

Here we can see there is a somewhat noticeable difference between the two trials conducted. Testing with values from each trial it appears values from trial 1 are more likely to work and a slightly modified average of the values in trial 1 is used in the current SEAL kit software (see the on_ok_button_clicked method in pages.py).

Limitations in Controlling the LEDs

As can be deduced from above the current method of activating LEDs is extremely limiting, at least with regards to precise control of each LED. It is not possible to precisely control the LEDs. Currently, we can only start a cycle and prevent a new cycle from starting. However, this limitation might end up being of no concern to us anyway since the cycles are presumably designed specifically with our experiments in mind meaning there is no need for precise control over the LEDs. As time progresses this page will be updated to reflect new developments in our understanding of controlling the LEDs including whether or not precise control over the LEDs is possible.