• Stars
    star
    132
  • Rank 274,205 (Top 6 %)
  • Language
    C
  • License
    GNU General Publi...
  • Created almost 11 years ago
  • Updated about 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Show text and gifs on mate crates. Uses C code orchestrated from Python via ctypes.

Mate Light

A matelight at 32C3. Foto: Rebecca Husemann / Make Magazin.

Foto: Rebecca Husemann / Make Magazin. Link

Transform a bunch of empty mate crates to a huge display using a 15 year old laptop, a 13US$ microcontroller board and a couple of cheap chinese christmas lights.

Hardware Setup

Each bottle contains a LED with a WS2801 driver. Each crate contains a chain of 20 LEDs with a 9 pin SUB-D connector. A wiring harness connects 8 crates in series to a TI Stellaris Launchpad. The Launchpad has four hardware SPI interfaces which can control one wiring harness each. The controller board is connected to a ThinkPad T22 running the control program via USB.

matelight detail. Foto: Rebecca Husemann / Make Magazin.

Foto: Rebecca Husemann / Make Magazin. Link

  1. Take a mate bottle and wrap it in aluminum foil

  2. Poke a 12mm hole in the lid

  3. Put it in a crate

  4. Repeat from step 1

  5. Stick a loop of LEDs through the lids of the bottles like this:

          (seen from back, upβ†₯)
          ┏━━━━━━━━━━━━━━━━━━━┓
     {in}→┃ β—‹ β†’ β—‹ β†’ β—‹ β†’ β—‹ β†’ β—‹ ┃
          ┃                 ↓ ┃
    {out}←┃ β—‹   β—‹ ← β—‹ ← β—‹ ← β—‹ ┃
          ┃ ↑   ↓             ┃
          ┃ β—‹   β—‹ β†’ β—‹ β†’ β—‹ β†’ β—‹ ┃
          ┃ ↑               ↓ ┃
          ┃ β—‹ ← β—‹ ← β—‹ ← β—‹ ← β—‹ ┃
          ┗━━━━━━━━━━━━━━━━━━━┛
                 (down↧)
    
  6. Repeat from step 1

  7. Stack up a bunch of these crates and tie them together with zip ties and straps

  8. Connect all the wires together (mis-)using wonderful XLR connectors

  9. ???

  10. PROFIT!!

Software

The control software is a Python script accepting framebuffer data via UDP and text via TCP. Since it is run on a 900MHz Pentium 3, the two most time-critical pieces, pixel font rendering for scrolling text and USB communication are written in C and called from the Python script via ctypes.

Architecture

The server listens on TCP and UDP ports 1337. Any text arriving through TCP is rendered as a marquee, interpreting ANSI escape sequences (colors, blink etc.). The TCP interface accepts one line per connection queuing lines in times of high demand. If there is no more text to render, the system defaults to a list of lines to scroll that is read from the text file default.lines. When the end of that list has been reached, the file is automatically reloaded enabling run-time configuration.

The UDP port accepts CRAP, our Custom advanced video stReAming Protocol. A CRAP packet contains three bytes of RGB data per pixel in 16 rows of 40 columns (i.e. [R0,0 G0,0 B0,0 R0,1 G0,1 B0,1 ... R0,39 G0,39 B0,39 R1,0 G1,0 B1,0 ... R15,39 G15,39 B15,39]). A CRC-32 can optionally be added at the end of the packet. A CRAP connection is considered terminated when no packets are received for an interval of by default 3 seconds. CRAP has precedence over text scrolling, any text scrolling when a CRAP connection is initiated is paused and incoming text during a CRAP connection is put into a queue. When multiple CRAP clients are connected, the system by default rotates every 30 seconds to a random new client.

Utilities

As written before, some parts of these utilities have been factored out into C code. In order to run the utilities requiring these parts (which would otherwise terminate with a python OSError mentioning some .so file), you must first build the C backend libraries by running make inside the host directory.

server.py

The matelight server application lives in server.py. If you just run this, a matelight server including TCP and UDP/CRAP interfaces is started. The server application supports forwarding the displayed image (including not only incoming CRAP but also scrolled text) via CRAP to the network or localhost. This is configured with crap_fw_addr and crap_fw_port in the server config file. If no matelight is connected to your machine, a warning is printed, but the server is left running since this monitoring feature can be used for local testing.

viewer.py

The viewer is a short python script rendering CRAP on your terminal using Unicode and the extended terminal color palette introduced by xterm. This is useful e.g. when diagnosing a running matelight server over the network (through its monitoring port) or when developing CRAP clients. This tool can be run directly with a CRAP client or with the matelight server in between (e.g. if you want to play with marquee rendering, which is done by the matelight server).

If you try this utility and don't see any colors or reduced on your terminal, have a close look at anything supposed to pass through this tool's output to your terminal such as ssh, cat and tmux. Some of these tools will filter/downconvert these extended color sequences depending on the $SHELL environment variable they encounter.

gifstream.py

This utility reads a bunch of CRAP, e.g. from a running matelight server's monitoring port and converts it to a GIF stream (yes, you read that correctly) that is served over a built-in HTTP server (by default running on port 5000). This GIF stream can be viewed with most browsers.

gifserver.py

This utility launches a local webserver (by default running on port 5000) presenting an upload form where one may upload a GIF file. An uploaded GIF file is read and streamed to a matelight via CRAP. If a GIF is uploaded while another is already being played, the currently played one is interrupted and replaced by the new one. To prevent a very easy DOS attack, GIF frame durations are capped at 10s.

Build your own

Spitting out TCP and UDP is pretty much trivial in any programming environment, still there is a bunch of examples below. In case you're using python, you can find one possible CRAP client/server implementation in host/crap.py.

TODO

It would be neat to have a somewhat saner config system using e.g. python's configparser module with defaults for most things. Also it would be useful to have command line switches to override some of these settings. Pull requests are appreciated!

Related Projects

As featured on…

More Repositories

1

python-mpv

Python interface to the awesome mpv media player
Python
524
star
2

lolcat

High-performance implementation of https://github.com/busyloop/lolcat
C
362
star
3

gerbolyze

Directly render SVG overlays into Gerber and Excellon files
C++
345
star
4

Model-M

cad files for model M keyboard key caps
80
star
5

ffi

A Foreign Function Call Through the TIOBE Top 20 and some
C++
47
star
6

pixelterm

Render pixel images (including animated GIFs) on 256-color ANSI terminals
Python
17
star
7

i3lock

My fork of git://code.i3wm.org/i3lock , the screen locker (not only) of the i3 window manager
C
15
star
8

openmind

An open source Brain-Computer-Interface hardware design
Prolog
12
star
9

sticker

10
star
10

cerebrum

RPC framework for interaction with c firmware from python host applications
C
9
star
11

python-lmap

A ldap object mapper for python, also containing a very minimal python ldap interface based on the openldap-libldap
Python
8
star
12

Better-XTrLock

This is a mod of xtrlock not displaying the blue lock but instead completely hiding the cursor.
C
8
star
13

tachibana_talk

7
star
14

infiray_irg

A simple python module to read Infiray C200 IRG thermal image files
Python
7
star
15

kimesh

KiMesh is a KiCad plugin that automatically generates security meshes
Python
6
star
16

gerbonara

Pythonic library for reading/modifying/writing Gerber/Excellon/IPC-356 files. docs: https://gerbolyze.gitlab.io/gerbonara
C++
6
star
17

espressif-esp8266-sdk

Espressif's SDK for the ESP8266 wifi chip, with some fixes applied.
C
5
star
18

openmind-viewer

A gnuradio-based viewer for brain waves captured with openmind hardware
C
5
star
19

openmind-firmware

The firmware of the OpenMind hardware. Note: This is still work in progress!
C
5
star
20

nyanping

Python
5
star
21

scripts

Small scripts I use for general housekeeping and other tasks
Shell
4
star
22

c-mote

Wire-bound sensor mote for c-base and AfRA
C++
4
star
23

gogs

Go
4
star
24

ips-announce

The announcement server for the indoor positioning system we develop at global android dev camp 2012
JavaScript
4
star
25

perceptron

This is a ruby implementation of a perceptron with stochastic gradien descent (for centered data). It is course work for a cognitive algorithms course at TU Berlin.
Python
4
star
26

kicad-xilinx

Here go any components I create for KiCAD
3
star
27

clippy

Clippy as a service
Python
3
star
28

altium_svg

Hacky script to import svg into altium
Python
3
star
29

pdp-6-frontpanel

C
3
star
30

OpenStep

One Step Beyond
C
3
star
31

locc-firmware

C
3
star
32

bitcoin_resource_calculation

A back-of-the-envelope calculation of Bitcoin's ecological footprint
Jupyter Notebook
3
star
33

openmind-first-protoype

This is the first prototype of an open source EEG front-end based on the Texas Instruments ADS1194/ADS1294 and an ATMega8L-8-bit microcontroller. It can be battery powered and (hopefully) is small enough to be worn like a mp3-player.
Prolog
3
star
34

cerebrum-firmware

The arduino/avr-firmware for cerebrum-control. Allows the control of a load of switches, LEDs and analog meters via a serial port.
C
3
star
35

Internetinformation

just school stuff...
2
star
36

loccctrl

An LDAP-connected door lock written in python
Python
2
star
37

dazhbog

Various high-performance LED strip drivers
HTML
2
star
38

misc

2
star
39

Graf-Zahl

The first arithmantic programming language ever!
Ruby
2
star
40

rgbulb-arduino

An arduino mega-based 16 bit rgb dimmer controllable via USB
Arduino
2
star
41

archstrap

Bootstrap remote-unlockable encrypted-root arch installation over ssh using ansible
Shell
2
star
42

heartbeat

Ruby
2
star
43

avr-uip

C
2
star
44

arduino-mega-pwm16

Java
2
star
45

Hausaufgaben

Altes Zeug fΓΌr's Studium
Shell
2
star
46

polyIO

A board containing an embeedded linux module with wifi and ethernet and two FPGAs I want to use to control a lot of switches and LEDs
Prolog
2
star
47

Vintage-System-Monitor

I outfit two really old multimeters with new scales to display system stats (CPU/MEM/NET). They will be interfaced by some AVR which talks to the computer via software USB.
2
star
48

wsdiff

wsdiff: Produce pretty, single-file HTML-formatted diffs with a css-only adaptive inline/side-by-side layout
Python
2
star
49

kantinen

Scripts to access the menus of the various places providing food on TU Berlin's campus
Python
1
star
50

cerebrum-control

A server to control leds, analog meters and switches on old control panels through a certain series of tubes.
JavaScript
1
star
51

flipdot

mΓΆΓΆp
HTML
1
star
52

openstep2

KiCad Layout
1
star
53

RGBulb

Ruby
1
star
54

BUZ2-Master

1
star
55

usb-lamp

An atmega32u4-based soft-usb controllable 16-bit pwm led lamp with fading functionality (including linux driver)
Shell
1
star
56

Taskforce-Belegarbeit

1
star
57

qubes-intro-talk

1
star
58

servotest

C
1
star
59

Computer-Room-Network-Documentation

yeah, as said above.
1
star
60

k-chenschild

1
star
61

bt-lamp

C
1
star
62

physik-einf-hrungspraktikum

Ruby
1
star
63

OpenMind-colloquium

The presentation I used to replace a written abitur exam
1
star
64

python-jmdict

Python
1
star
65

bikelights

IDL
1
star
66

TheSwitch

The source code for the oversized evil mad scientist-type switch at c-base which is used to control the music server in severe motivational emergencies
Python
1
star
67

Taskforce

JavaScript
1
star
68

klingel

C
1
star
69

bvgflip

C
1
star
70

dussmann-ubiquity

An ubiquity command to access RCS order systems.
1
star
71

Arduino-CCD

An attempt at reverse-engineering a scanner CCD PCB and using it with an arduino
C
1
star
72

OpenMind-shield

An arduino shield to connect OpenMind electrodes.
1
star
73

cabinet

Work in progress
C
1
star
74

VFD-Hardware

My attempt at reverse engineering an old VFD I found.
1
star
75

avr-capacitive

1
star
76

DasTelefon

AVR sources (arduino-compatible) to connect an old rotary phone to an arduino
C
1
star
77

Relays

At c-base, we equipped 100 huge east-german relays with RGB leds. This is the software and hardware to control all this.
Prolog
1
star
78

wofs

FUSE Write-only Filesystem. The original is to be found at http://lordikc.free.fr/wordpress/?p=802
C++
1
star
79

Sharp-Stereo-Aux

An aux input for my sharp XL-40 stereo
C
1
star
80

RCActuator

1
star
81

cerebrum-control-python

A server to control LEDs, switches and analog meters from old control panels with an arduino via various interfaces (so far: REST, JSON-RPC)
Python
1
star
82

fish-config

My personal fish shell config
Shell
1
star
83

Penta

C
1
star
84

usbrng

An USB hardware random number generator (draft)
C
1
star
85

taep

taep: Print pictures as collages of label tape
Python
1
star
86

Buspirate-SPI-Sniffer

This is a variant of the original v0.3 code I use to output debug messages from an AVR microcontroller via SPI.
C
1
star