LED Persistence of Vision Display
In order to time the display properly to achieve persistence of vision, the PIC needs to record the time between successive rotations. To do this in our project, we investigated various magnetic sensors. In the end, we decided to control timing with a reed switch and magnet (we were originally using a Hall effect sensor). The Hall effect sensor was so sensitive to the magnet that it was susceptible to noise and showed an oscillating signal when we measured it with an oscilloscope. The reed switch is slower, so the signal was smooth and without noise. Nevertheless, we encountered issues potentially due to contact bounce which interfered with the performance of the switch. We put the magnet onto an L-connector on one side of the mechanical system and soldered the reed switch onto the PCB so that once every rotation it passed underneath the magnet. When the magnet is above the reed switch, the two leads inside it connect, and voltage can briefly pass through the switch to port RB0 on the PIC.
In order to control 40 LEDs with a single PIC 18F2455 microcontroller, we broke the LEDs into a system of four columns containing 10 LED rows. Each of the 10 LEDs in a column was connected to a pin on the PIC. The grounds of all LEDs in a column were connected, with ground controlled by a n-type MOSFET transistor. Only when the input to the transistor was set high was a given column of LEDs grounded; we were able to achieve the semblance of a constant display by quickly cycling between which LED posts are controlled. The circuit diagram is shown above.
To ensure that the electrical system was sturdy, we designed and ordered a PCB for the circuitry from Express PCB. The layout is shown below, with component IDs correlating with those in the schematic above.