DiscoHAT for Raspberry Pi is a HAT board that has 8 isolated input switches, an isolated DMX output connection and LED strip control for individual LEDs like ws2801. DiscoHAT was developed to be used together with QLC+, an Open Source light and sound control software that is absolutely AMAZING. The DiscoHAT board can be used by itself as a simple DMX controller. Just plug in your 3-pin DMX cable on the board and use it. But the DiscoHAT is so much more. With a little tinkering you can add buttons and switches. A few lines of Python programming can then let your DiscoHAT trigger lights, and special effects in the QLC+ software.
Raspberry Pi has a specification for HAT compatible devices. The form of a HAT needs to be exactly like DiscoHAT. There are 4 screws connecting it to Raspberry Pi and there is cut-outs for the camera cable and the DSI display cable.
Another important thing is the EEPROM on board. It tells the Linux kernel to set up the used GPIO pins in the Device Tree and it also tells which kernel modules to load. It does not matter if you don't know what it means. It means that the HAT boards are plug-and-play devices for Raspberry Pi.
Raspberry Pi has a built-in serial TX device called UART. The DiscoHAT uses this pin of the raspberry to send out information to all DMX devices at a mind boggling speed of 250 kbits/second. The DMX light system protocol is actually a BREAK signal followed by 512 bytes. A single byte can have values 0..255. If you buy a LED DMX beamer with RGB leds then you may need three bytes to set the color.
In this case the DMX device takes up three channels. The DiscoHAT can control 512 channels. Electrically you can connect up to 32 DMX devices on the cable. The cable is daisy-chained. Every DMX device has one input and one output. If the cable is short you do not need to put a termination plug at the output connector of the last device in the chain. But if the system starts to flicker you need to buy a terminator contact also. They are really cheap.
Another problem with real lighting is that the cables may be very long and there may be spikes on these wires that could break the Raspberry Pi. The electric signal on this wire is also RS485 which is something the Raspberry Pi cannot output.
But the DiscoHAT takes care of these issues. It has optical isolation protecting the Raspberry Pi and it also has RS485 format output.
The DiscoHAT has two Ethernet cables. There is 4 cable pairs in one Ethernet cable. If you cut the cable you can see the cable pairs. One pair can be connected to one button. When the cable ends are shorted (the button is pressed) then the DiscoHAT is relaying the information to Raspberry Pi.
The DiscoHAT supports 8 buttons.
In reality you can connect the wires directly the the Raspberry Pi if you want. But the DiscoHAT has optic isolation and ESD protection on every GPIO pin so there is less chance to fry to Raspberry Pi because of static electricity,
Static electricity can easily build up on stage due to plastic surfaces, dry air blowing and nylon clothing.
Here is a description of the buttons as a schematic for experts.
The confusing pin numbers
The wiringPi numbers 2, 3, 7, 5, 21, 22, 26, 27 is the simple way of using DiscoHAT. But sometimes you also need to access the pins by the GPIO pin numbers. Please note that the four last pins are only found on the 40 pin Raspberry Pi connector. Here is a table of what the numbers mean.
Unfortunately the BCM GPIO numbers changed between the Raspberry Pi revisions. In revision 1 (R1) and revision 2 (R2) you have different pin numbers for the GPIO pin. So for revision independent programming it may be good to use wiringPi. Or do some program magic to find it out.
import RPi.GPIO as GPIO
Why do the pins jump like this? Well, the answer is that Pi enthusiasts may use pins for other purposes also. (It also tells something about the hardware designers. What have they been smoking?) DiscoHAT chooses the pins that are less likely being used by anything else. In this way you can add your own stuff easier without breaking DiscoHAT functionality.
Currently you can buy chained coloured LEDs where every LED can be controlled individually. The DiscoHAT will automatically load in the proper spi drivers in the kernel for using LED strips.
If you have more than just a few LEDs you need to feed enough power separately to the LED strip and only connect ground, clock and serial data to the first LED. The LED strip interface is not isolated on this board. I planned to use the LED strips to simulate lighting at home on a miniature model of the theater. It allows me to try out the sync between the lights and the music at home.