The principle to be tested consists of three parts. The first is the stepper motor-control, second is the photodiode detection of light, and the third is the serial communication with the microcontroller.

For the first test the microcontroller was programmed to emit four square wave signals, each connected to two BJTs, that provided current for a particular wire from the motor. The stepper motor has two windings that generate a magnetic field when a current is passed through. By alternating current through the two windings, the motor can be “stepped” at a desired rate. The microcontroller will be sending waves with a period of half a second. These pulses causes the transistor bases to saturate, causing current to flow to a particular motor winding. At the rate of pulsing the motor should turn one step per half second.

For the second test the photodiode will be connected to one of the ports of the PIC. The port had been assigned as an analog-to-digital port. Whatever value of voltage was present at the pin would be translated as a hexadecimal value by the program. In order to confirm this, a threshold voltage value (70 mV or ~ 4 hex) was programmed, so when the input voltage from the photodiode exceeds this a blue LED would light up. The purpose of this test is to show the a-to-d function of the PIC and how it can convert the analog photodiode signal to a digital one.

For the third test an RS232 cable will be connected to the computer, with the other end stripped and connected to the PIC. There are three important wires in the cable that will be used – ground, output data, and input data. Since there is no information going from the PC to the PIC, the input data line will be grounded. The PIC will send out voltage pulses through the output line and the PC will receive these via a serial monitor. The program is coded with the printf command, and with the help of the RS232 setting, any ASCII word can be transmitted to the PC. The serial monitor used is part of the PICC compiler software package.