Earlier this year I started to investigate how I might go about implementing the circuitry and communications between a computer and a micro controller for my long term split-flap display project which seems to have taken over my blog of late!
The setup I finally settled on was to use a simplex (single direction) serial protocol called RS-485, the 'bigger brother' of RS-232 used in almost every computer, commonly known as 'the serial port'. Using RS-485 would require some special circuitry which could convert to a signal that an Arduino could understand so I went about building a converter circuit which I had built up as a small PCB, my first proper PCB, designed by me alone, and it worked first time!
Next I worked on some software which is designed to receive six byte commands from a master control board allowing full control of all modules together or each module individually. The commands are structured as follows:
- STX (Start of text)
Denotes the beginning of a transmission, the ASCII byte 0x02.
A byte representing the intended receivers address. 0x00 addresses all units and 0x01–0xFF are receiver addresses, 255 unique addresses in total.
A byte representing the command:
0x00 – Blank all units (Go to space character).
0x01 – Control status LED on main board (0x00 = off, 0x01 = on).
0x02 – Reset (Clear EEPROM lockout).
0x03 – Store new address in EEPROM.
0x04 – Go to flap.
Depends on command byte.
This byte is the value of all other bytes XORed together, to help ensure the integrity of the received data... STX ^ Address ^ Command ^ Variable ^ ETX = Checksum
- ETX (End of text)
Denotes the end of a transmission, the ASCII byte 0x03.
The next thing to do was hook up both my boards as originally intended and use my command protocol to test the devices, even on just 9600 baud I am able to make the LEDs dance one after the other like a fair ground attraction using the computer as a controller.
You can see in this video the end result which I am very pleased with, to have all three work perfectly and do what I originally intended is absolutely amazing, and really gives me the confidence I need to push on and work on the sensing of flaps passing and homing of the deck then trying to combine the two schematics I have designed with the EasyDriver and a few tweaks to produce an all in one module controller board which hopefully will work as well as the previous two boards. I may look into using SMD parts too!
If you want the schematics I have posted them on GitHub: