Timer for Motor Driven
Animations
revised 2-19-09 d. bodnar
| Many animations can be created by utilizing simple
geared DC motors. A PIC based timer can make the movements
realistic by controlling how long the motor runs in one direction and
how long it pauses before reversing and returning to its start position. This timer can be triggered by a NO (normally open) reed or push button switch or by an infrared sensor that notes when a train or other object moves near it. The time that the motor runs and the pause time before reversing can be set by adjusting two potentiometers. LEDs show the status of the system and the time remaining before the next motor event. For motors that do not reliably run at the same rate forward and backward there is an option to stop the motor at a specific point with switches. |

| Design To expedite development of this project the timer will be based on an existing circuit board that is being used for the BARC (Blinking Auto-Reverse Controller) The only major rewiring will be to add an Infrared detecting capability. The unit's relay and other control components will be replaced by three external SPDT relay that will be used to control the motor. In addition there are two pots that can be used to adjust the time. An array of 4 LEDs will be used to show timing and two push button switches will be used during setup. |
| Schematic - original BARC schematic
Revised schematic for Animation timer with PNA44602 sensor & an isolated set of relays.:
|
| Modifications The original BARC circuit has been modified in a number of ways. The most significant change is the use of three external SPDT relays. Two of these relays are wired together to act as a DPDT relay that reverses the polarity of the power that goes to the motor. The other SPDT relay is used to turn power to the motor on or off. The 2N2222 transistors are used to activate the relays. |
Software
|
| Prototype The prototype is shown below. The three relays are at the bottom under the Animation Controller label. The main circuit board is at the top. There are two potentiometers that are used for setting motor run and delay times. The two push button switches to the left and right are used for initial setup and testing. The yellow wires connect to the motor and the white ones to its separate power source. The red/black wires go to a 12 volt DC power source for the circuit. The IR sensor is in the upper right. The START button starts the motor just as the sensor does. Note that the sensor must be plugged in to operate.
Here is a bottom view of the two boards. The relays are on the white board at the bottom.
Here is an inside view of the reflective IR sensor. The IR emitter is at the top of the head, beyond view. The IR detector module is marked B774. The circuit board inverts the output from the unit so that the detector shows a low output when no reflection is noted and high when it reflects.
|
| Operation When turned on the unit will flash out the software version number. It will then flash the 1's, 10's and 100's LEDs as it waits for the IR sensor to be activated or a button to be pressed. The two potentiometers set the time that the motor will be on and the delay time before the motor reverses. To see the current setting of "motor on" time press the Motor button. To adjust that time turn the Motor pot. Similarly the Delay button and Delay pot shows or adjusts the delay time. The time range is from 2 seconds to 255 seconds for both motor on & delay. (Note that there is a switch control option that is described below.) Times are reported by the 1's, 10's and 100's LEDs. A time of 125 seconds would have the 100's LED flash once, the 10's LED twice and the 1's LED five times. -Random When random is active the time for the delay is random. The range of time that is selected is a random number of seconds between 1/2 of the set time and the full set time. For example, if the set time is 150 seconds the random time will be no less than 75 and no more than 150. -During operation -IR Sensor must clear -Using the buttons during operation
Any type of SPST Normally Open switch can be wired in parallel with the MOTOR and DELAY buttons and used to stop the motor;s forward or backward operation. Micro switches and reed switches would be good choices. The Motor timer needs to be set to a time longer than what is needed to trip the switches. Turning the MOTOR pot all the way up is the easiest way to do this. The MOTOR and DELAY buttons cannot be used to show time if one of the external switches is held closed. The software checks to see if one of the switches may be held down and skips the time reporting mode so that the lights don't continuously report time. |
| Latest Revision (2-18-09) The completed unit is shown here
along with the IR sensor. Power is supplied through the red /
black wires in the upper left.
The three switches around the board are Motor, Delay and Start. External switches can be added in parallel with the small switches.
The IR sensor units can be connected directly to the four wire cable that is soldered to the circuit board or an extension can be made using the other end of the cable that is shown here. Just make sure that the red wire goes to the pin on the sensor that is marked "+". The other wires must be connected in the same order that they are in on the cable.
To attach external switches solder in parallel with the switches on the circuit board. In this view of the bottom of the circiut board the START switch is on the bottom edge towards the right, the MOTOR switch is bottom left and the DELAY switch is on the right edge. You can solder to the terminals on the board that are circled. The connections are close together so be sure there are no solder bridges. You can also solder to the unconnected pins (also circled) coming off of the switches.
|