E72 Lab #6
The Solar Seeker
|
Before starting this lab, review the lab rules. |
Make sure you read the lab rules about keeping the lab clean. In particular, put away all components, wires and connectors when you are done. If you need to leave a circuit set up on a breadboard, put the breadboard in one of the cabinets or drawers when you leave.
The laboratory this time involves more design than previous labs, and introduces some new concepts and devices. There is a lot of work to do, so don't put it off. Expect to spend some time outside of the normal lab time working on it.
However, the write-up is fairly minimal.
Your task is to design the electronics for a simple device that tracks a light source. This could be used to keep a solar panel (or telescope)
aligned with the sun. You will do it by using two photocells that are facing in
slightly different directions. The cells are connected to a motor, and you will be designing a circuit that reads the output of the photocells and turns the motor in the direction of the brightest light. When the two photocells register the same amount of light, it is pointing directly at the light source.
This is demonstrated below. In the diagram below the PhotoCells are
labeled PC1 and PC2 and are connected to the motor shaft. In the diagram
at left, the light falls predominantly on PC1. The motor responds by
turning counter-clockwise until the amount of light on both photocells is
equalized (diagram at right).
| Light Falling Predominantly on PhotoCell 1 | Motor Turned so Light Falls Equally on both PhotoCells |
![]() |
![]() |
Your strategy for controlling the motor will be simple on-off (or bang-bang) control -- you will turn the motor in one direction, or the other, at full speed to try to equalize the light falling on the two photo-sensors.
The rest of this lab handout is devoted to discussing the new devices that you will be using, and giving you some hints on how to proceed. However, the design will be entirely your own.
New devices:
The CdS photocell
To measure light you will be using a photocell made of a semiconductor called Cadmium Sulfide, or CdS. The CdS is laid out in a long line that zigzags across the surface of the detector. As light hits the CdS it knocks charge carriers loose, and the increased number of carriers decreases the resistance of the device. The schematic symbol for the device is shown.
On your motor, there are two of these devices attached in the circuit shown below. The two 560W resistors (labeled R) are included to limit current so that the photocells can't be easily damaged. The voltage at the middle terminal (Vo) should be about 2.5 volts when the same amount of light falls on both photocells (the resistances of the photo-cells are the same), and will increase and decrease as more or less light falls on one photocell instead of the other.
The MOSFETIn this lab you will be using MOSFETs (Metal Oxide Semiconductor Field Effect Transistors) to drive the motor. MOSFETs are often preferable to bipolar (NPN or PNP) transistors when driving large amounts of current because the inputs are voltage controlled, and require essentially no input current. A good model for the input of a MOSFET is simply a capacitor -- the only current needed is whatever is required to charge and discharge the capacitance.
Just as with bipolar transistors, there are two flavors of MOSFETs, n-channel and p-channel. A diagram of the two types of transistor is shown.
N-Channel HexFet P-Channel HexFet G = Gate S = Source
D = Drain
There are several things to notice about these devices. The most important is that there are three terminals: the gate (the input), the source (source of charge carriers) and the drain (drains charge carriers). The voltage between the gate and source determine whether the transistor is on or off. In the n-channel device when the gate voltage is sufficiently greater than the source voltage the resistance between source and drain becomes small, allowing current to flow between them (for large gate-source voltage this resistance can be very small). For the p-channel device, the current flows between source to drain when the gate voltage is sufficiently lower than the source voltage. There is a diode between the source and drain on both devices, which is important when switching inductive loads (because you can't stop current flow rapidly without a large change in voltage -- the diode prevents this large, and potentially damaging, voltage). We won't worry about the diode, and if you hook up your circuit properly you won't really notice it is there. Subsequent circuit drawings won't include the diode. The devices are called HexFets because the gate is laid out in a hexagonal pattern on the silicon. They are manufactured by International Rectifier.
For the devices that we will be using the resistance between the drain and source is much less than 1 ohm when the gate voltage is at least 2 to 4 volts above the source voltage for the n-channel device, and the gate voltage is at least 2 to 4 volts below the source voltage for the p-channel device. The n-channel device has the part number IRFZ14 and the p-channel device has the part number IRF9Z14. The pinouts for the two devices is identical and is shown at right. These transistors can handle up to about 10 amps and up to 60 volts.
Though the transistors can handle considerable power when in a circuit, they are static sensitive and can be destroyed by being improperly handled. When handling them always ground yourself first (either on the oscilloscope ground, or on the metal case surrounding the outlet box).
The H-Bridge
To control the motor you will be using a circuit configuration called an H-bridge (it physically looks like the letter H). To get current to flow from left to right through the motor you set the gate of P2 low (to turn it onr) and you set the gate of N2 high (to turn on that transistor). You must make sure that the gate of N1 is low and that the gate of P1 is high (to make sure that those transistors are off). If either N1 or P1 is on there is a direct path for current to go to ground, and something will blow.
To make current flow in the opposite direction (and make the motor turn in the opposite direction) make P1 low, N1 high, P2 high and N2 low. The potential for disaster arises in this case because if you drive P2 low and N1 high simultaneously you have a direct connection between 12 volts and ground, and something will go (hopefully the fuse on your board).
To turn the motor off simply turn of all 4 transistors (gate of P1 and P2 high, gate of N1 and N2 low).,
Before you apply power to your circuit, check your connections very carefully (and then re-check them). Make sure all signals going into the transistors are at the proper levels before you connect them to the transistors.
Open-collector TTL Logic
The discussion above assumed that you had a circuit that output 12 volts for a high and 0 volts for low. Unfortunately standard TTL (Transistor-Transistor Logic; a common and robust family of logic gates) uses logic levels of about 3.5 volts and 0 volts. TTL gates can be found in the cabinet at the back of Hicks 310. You could simply put the output of each gate through a comparator, but the wiring gets messy. Another option is to use what is called open-collector TTL. With these devices, the output is simply the collector of a transistor (as with the 311). A low output is still zero volts, but for a high output the transistor is in cutoff so the output is effectively an open circuit. If you connect a resistor between the collector and 12 volts, the high output would be 12 volts. To get standard logic levels use 5 volts instead of 12 volts (the chip can take up to 30 volts). The resistor should be in the neighborhood of 1kW. An open-collector invertor is the 7406. A buffer is the 7407. The use of the buffer in a circuit is shown below: You could also use a 311 comparator, which also has open collector output -- but you will need two of them, versus 1 buffer chip (which contains 6 buffers). The choice is yours.
Note that we have been assuming that the 12V supply will be at 12V. However, the wall-mounted transformers are rated 12V at 1A - but the supply is unregulated. When there is no current, the voltage may be substantially higher than 12V. So... don't use the 12V from the big breadboard for pull-up (if the gate voltage is substantially lower than the source voltage on the PMOS, they may be on when you mean them to be off). Instead use the separate (high-power) supply that is connected to the transistors.
![]()
7406 (OC Invertor) 7407 (OC Buffer) Vcc for the 7406 and 7407 should be 5 volts.
A Block Diagram
To help solidify your thinking here is a block diagram. It shows the major components as well as the signal levels that pass between them. Note that this whole system is a negative feedback system - any change in the input from "zero" (light falling more on one sensor than the other) results in an output (motor turning) that drives the input back to "zero" (equal light on both sensors). You should set this "zero" value from the web browser interface; the CdS cells are not exactly equal, so a "zero" value will not be at exactly 2.5 volts.. You should drive the OC TTL to control the transistors with the same outputs that are tied to the LED's, that way you can tell if the circuit is operating properly.
Implement two control strategies, one where the motor coasts (with all transistors off) when you want them to stop, and also use a strategy in which you short out leads by turning on N-channel and turning off P-channel. Why does one work better than the other? Hint: this is the same mechanism that is used for regenerative breaking in electric vehicles.
If you choose to, you can implement the system without the microcontroller, using only the logic gates and/or comparators. If you use the logic gates you must make sure that the inputs to the gates remain between 0 and 5 volts even though the output goes from 0 to 12 volts. If you elect to go without the microcontroller, you needn't implement the second control strategy.
![]()
The CdS sensors, motors, breadboards and 12 V (high current) supplies are all in the blue cabinets under the workbench at the back of the lab/ You build everything else.
The Lab (Read this thoroughly before starting)

Some hints:
To do:
Apparatus:
You should find in the lab:
- The CdS sensors, motors, breadboards and 12 V (high current) supplies are all in the blue cabinets under the workbench at the back of the lab/ You build everything else.
- A small breadboard to put your MOSFETs on. We are using these little breadboards in case something gets hot. That way we won't destroy one of the large boards. You've probably noticed melted spots on some of the breadboards - and may have created some yourself. This lab, with the large currents and high voltages (and hence, high power) being switched is more than likely to cause such meltdowns. The transistors will fit in the breadboard if you gently force (oxymoron?) them into the holes.
- A 12 volt, 1 amp supply to drive your H-Bridge. This plugs into the small breadboard, and has a fuse in line with it. This fuse should blow if you inadvertently short power and ground by simultaneously enabling two transistors on one side of the motor.
- A Motor with two photocells mounted and a 5 position terminal strip. Two of the connections drive the motor and the other three connect to the photocell circuit. The red wire from the photocell circuit represents the connection in the middle, between the two photocells.
The transistors are static sensitive. When handling them always ground yourself first (either on the oscilloscope ground, or on the metal case surrounding the outlet box).
For your report.
The report this week is very brief
- Demonstrate to me your working design.
- Include a copy of your original schematic and program. I will look for this when grading.
- Include a well written, but concise, description of how your circuit works, describe the design decisions that you made, and include design equations (if there were any).
- Describe any problems you encountered, and how you overcame them.
- Describe how you verified that the circuit worked properly.
- Include a well-documented copy of your final program and/or schematic.
- Compare your two control strategies (coasting and dynamic breaking).
← Comments or Questions?