Etherled is remote controlled, programable stroboscopic image projector using an 8051-family microcontroller.
The image is projected based in the eye delay to recognize the light. It draws a virtual led matrix using a single led column, which shows each column of the matrix at the time with a relative high frequency, fast enough to make it look like a blinking column of leds when it’s still. When the viewer moves his sight away from the leds column, the image is suddenly projected.
It has a simple image editor that can send and receive images (pixel matrix) from the device using a compact binary protocol (called ELP, Etherled Protocol) over a small and simplified ethernet/IP/UDP stack.
The firmware is divided in 2 modules: networking and led projection.
The networking module runs in the main thread, while the led projection is interrupt-driven (using a timer to trigger the interruption).
The led projection is simple: when the timer expires, the next column is printed using the leds. The next column is calculated using modulo number of columns so when the matrix it’s fully printed, it starts again from the beginning.
This module is written in assembly.
This module is more complex and it runs as the main thread of the firmware, in an infinite loop that polls the network adapter to see if a new frame arrived (we had problems using interrupts for this too, which is the ideal). When a new frame arrives, it’s parsed to see if it’s an ARP or IP packet. If it’s ARP, it’s answered with the device IP. If it’s IP, it’s parsed to see if it’s UDP. If it is, it’s parsed again to see if it’s a valid ELP packet, and if it is, the get or set action is performed. If any of the parsing fails or other type of packet is detected, it’s dropped silently.
A simple locking mechanism was used to prevent the matrix to advance to the next column when the column is being set (to avoid the projection of an inconsistent image). The lock was simple, stop the timer while writing the new matrix into memory.
This module is written in C.
The NE2000 driver was based on uIP + 8051 integration project, but that driver had a lot of bugs and was very poor so the driver was almost rewritten to fix the bugs, make it modular, splitting the send, receive and buffer management into different modules, and using the adapter buffers as external memory to minimize the lack of RAM memory in the microcontroller. This improvements were possible thanks to similar project using a PIC instead of a microcontroller and the Linux DP8390 driver.
There is a client application to create and edit images (as a led matrix) and to store them in the device via network. Both CLI and GUI are provided. The CLI can be used to set some other device parameters (like the refresh frequency) or send commands to it (like turn of the leds).