Flip-Dot Display with Arduino and RS485 Shield
We have two flip dot boards xy5 from alfa zeta and a Arduino uno hooked up to it.
Disclaimer: it is now about 5 years since I last played around with Arduino, and then rarely got past the tutorial stage.
For starters there are a bunch of Dip Switches on the flip dot board. From the documentation alfa zeta provided we get the lay of the land.
At first I started with the lower flip board and set the pins to
speed setting: 1-OFF 2-ON 3 — ON
address : 1 (8 pos dip switch: 1:on 2 -8: off)
this corresponds to a bout rate of 57600
void setup()
{
Serial.begin(57600);
}
And for the address byte we therefore have 0xFF. I will further play around with that when connecting the second flip dot board.
When sending serial messages to the board we have the following bytes to send along:
As header 0x80; as instant command, which we use, 0x85; followed by the address; our message to be displayed; and the end byte 0x8F.
For our messages we have a simple 28 x 7 matrix of dots. Each column represented by one byte.
As example a message with black and white stripes alternating would look like this:
byte black_stripes[] = {0x80, 0x85, 0xFF,
0x00, 0x7F, 0x00, 0x7F, 0x00, 0x7F, 0x00,
0x7F, 0x00, 0x7F, 0x00, 0x7F, 0x00, 0x7F,
0x00, 0x7F, 0x00, 0x7F, 0x00, 0x7F, 0x00,
0x7F, 0x00, 0x7F, 0x00, 0x7F, 0x00, 0x7F,
0x8F};
I had to wrap my head around hexadecimal notation again but went back to zeros and ones later, as it was easer to translate images that way from visual grid to array – for my head at least.
When sending the message, one has to specify the length of the array going through. Playing around with the frame rate varies from message to message depending on how many dots have to be flipped.
void loop() {
Serial.write(black_stripes, 32);
delay(25);
Serial.write(white_stripes, 32);
delay(150);
}
When playing around with a basic equalizer the speed varied quite a lot. To get some consistent refresh rate I had to set it quite slow. The most convincing visual experience I achieved by giving the equalizer a random value range to pick from in addition to the variation we receive from the message dots to refresh.
byte equalizer_values[] {
B0000001, // 01
B0000011, // 02
B0000111, // 03
B0001111, // 04
B0011111, // 05
B0111111, // 06
B1111111, // 07
};
Here I strived away from the hex nataion for a more grapical representation in the code.
void loop(){Serial.write(header);
Serial.write(instant_command);
Serial.write(address);
for (int i = 0; i < rows; i++) {
int n = random(0,7);
Serial.write(equalizer_values[n]);
};
Serial.write(end);
rows ++;
delay(random(50,150));}
The bridge to graphics. Building them straight from my head seemed a bit cumbersome so I just set up a little spreadsheet as visual guidance before translating into byte values.
This then translated to:
byte car[] = {
B0000001, // 01
B0001101, // 02
B0011111, // 03
B1111111, // 04
B1001101, // 05
B1001101, // 06
B1001101, // 07
B0111101, // 08
B0011111, // 09
B0001111, // 10
B0000101, // 11
B0000001, // 12
};byte road[] = {
B0000001, // 01
};
I just used more road to be drawn in order to move the car across the borad.
delay(200);
Serial.write(header);
Serial.write(instant_command);
Serial.write(display_address);
for (int i = count; i < 27; i++) {
Serial.write(road, 1);
};
Serial.write(car, 12);
Serial.write(end);
count ++;
Next up can be a lot of things. I tried writing something and pushing the message through, which in the end is just tedious work defining letters and arranging them. But most likely I will dive into the connection of Arduino with vvvv via firmata. But that’s a story for another day.
These following links helped me along the ride: