-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathreadme
151 lines (104 loc) · 5.85 KB
/
readme
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
---------------------------------------------------------------------------------------------
!! note !!
this repo doesn't contain original blink.csv file because is't unnessesary big.
i have made a slimmed down version using my stripfile.py scipt and reattached the headers.
---------------------------------------------------------------------------------------------
provided is a csv file and a picture of an oscilloscope with logic inputs
connected on a data buss between a raspberry pi and 2 chained matrix boards.
looking at the scope screen i quikly reconize there is some binary counting going on.
i guess this is a adress selection for the led matrix.
bink.csv starts with:
--------------------------------------------------------------------------------
#Model,MDO3014
#Firmware Version,1.26
#
#Waveform Type,DIGITAL,,,,,,,,,,,,,
#Point Format,Y,,,,,,,,,,,,,
#Horizontal Units,s,,,,,,,,,,,,,
#Horizontal Scale,0.004,,,,,,,,,,,,,
#,,,,,,,,,,,,,,
#Sample Interval,4e-09,,,,,,,,,,,,,
#Record Length,1e+07,,,,,,,,,,,,,
#Gating,0.0% to 100.0%,,,,,,,,,,,,,
#,,,,,,,,,,,,,,
#Vertical Units,V,V,V,V,V,V,V,V,V,V,V,V,V,V
#Threshold Used,1.65,1.65,1.65,1.65,1.65,1.65,1.65,1.65,1.65,1.65,1.65,1.65,1.65,1.65
#,,,,,,,,,,,,,,
#,,,,,,,,,,,,,,
#,,,,,,,,,,,,,,
#,,,,,,,,,,,,,,
#,,,,,,,,,,,,,,
#Label,OE,LAT,CLK,E,D,C,B,A,B2,B1,G2,G1,R2,R1
#TIME,D13,D12,D11,D10,D9,D8,D7,D6,D5,D4,D3,D2,D1,D0
-1.0000000e-03,0,0,0,0,1,0,0,0,0,0,0,1,0,1
and that it continues with more than 400Mb of stings like
-1.0000000e-03,0,0,0,0,1,0,0,0,0,0,0,1,0,1
--------------------------------------------------------------------------------
so we can conclude that these are the logged measurements of the oscilloscope
there is some metadata like model number fw vesion settings
awwwwhh, and how sweet even the labels are set and saved to the logfile.
í've worked a lot with digital oscilloscopes in the past so no need to look up any inforation on this,
since it's still in my head.
but the only led matrix i've ever worked with was a home build one made from some cheap xmas-lights
and a ir strobe light for some industial sheet metal inspection line.
so i needed to find some information on the types of data busses they use to speak to rgb matrix boards.
after some googeling i found a nice tutorial on how to connect a led matrix to a arduino.
with some explanation on what each pin is used for.
https://learn.adafruit.com/32x16-32x32-rgb-led-matrix/connecting-with-jumper-wires
and since the labels set in the header of the blink.csv file are the same as the pinnames.
i can conclude that this it the same type of data bus. (if they set the labels right that is)
in the .csv file there is also a time stamp, i choice to ignore this data for now, hoping they kept al
the data in the right sequence.
so we have the following signal:
output enable bit - - to enable output.
latch bit - - to indicate end of data
clock puls - - to tell the board to read new data from the bus
A,B,C,D,E - - to select what line(s) to send the output to.
R1,G1,B1 - - color data for the firs row.
R2,G2,B2 - - color data for the second row.
/------- OUTPUT ENABLE (TURNS ALL LEDS OFF OR ON)
/ /------LATCH (INDICATED END OF DATASTREAM)
/ / /-- CLOCK PULSE
| | / [ select rows ][ blues][greens][reds ]
Label, | OE |LAT|CLK|E |D |C |B |A |B2 |B1 |G2 |G1 |R2 |R1 |
-1.0000000e-03 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 |
the board 'writes' the color data from left to right to the selected line,
latch resets the write postion to the begining of the line.
there are 2 lines writen at the same time
its a 5bit adress so that means the first line is somewere between 0 and 32
and the second is the same as the first +33
looking at the provided picture of the matrix boad that seems to be right.
so now i know what im looking at.
i just need to find a way to reproduce what was displayed on the matrix board.
------------------------------------------------------------------------------
the sample rate of the oscilloscoop is a lot higher that the bus speed.
so there are a lot of mesurements that duplicate data.
i decided to start off by writeing a script remove all the uninteresting lines to reduce file size
i did this by checking if the CLK,LAT or OE was chainged. and writing a line to a new file if it did.
also decided it's probably a bad idea to load the whole thing in memmory,
i already had to reboot once because i opened it in atom and my trusty piece
antique froze up on me.
so i decided to cat the file and pipe to the script.
file: stripfile.py
usage: cat filename | python stripfile.py
note: output filename is hardcoded stripped.csv
--------------------------------------------------------------------------------
while i was writing this script i was brain storming on how to output the data.
sould i use a image libary make a html/css/js interpeter thing.
but i decided that it would look a lot cooler and do some honor to de demo scene
to output it in a terminal window. (sorry i din't respect the 24x80 terminal size)
i knew there is a escape code to move the cursor positon in the terminal
and for the color of the text.
--------------------------------------------------------------------------------
so i continued on writing, using my stripfile.py as base for parser script.
notes on that are as comments in the code...
got stuck for a bit because i thought that the OE needed to be troggled for output
i had some date what looked like text could even pick up some german words.
but i guess they used this bit to select what matrix to write to.
as soon as kicked that bit of code out of my script every thing showed up fine
file: blink.py
usage: cat filename | python blink.py
note: output filename is hardcoded catme.txt
----------------
got a flag
flag is in catme.txt ;-)