Although we're not finished with this part of the project yet we're going to release it unfinished for those who are following along.
We've decided to use the power window motors found in vehicles to move our solar panel array because the motors are 12 volts DC like the batteries the panels will be charging, the motors are strong, they have built in gear reduction and they're even reasonably cheap because they can be bough out of a car recycling yard. We like the power window drive motors from the older model vehicles because they're a little bit bigger and they have nice steel gears that'll stand up to some real work like pushing and pulling an array of solar panels.
Our projects uses six relays that we'll control with 3 I/O channels on the Basic Stamp 2 from Parallax Incorporated. We'll use 4 of the relays to switch the polarity of the electricity going to the motors and two of them as on/off switches. Each motor will need three relays for us to achieve multidirectional control. Since we'll only be moving in one direction at a time we can use the same polarity switching I/O channel for both motors.
Project Requirements
- All the Requirements of Sun Tracker for Your Solar Panels - Part 1
- 6 - 5 volt coil Compact Relays (We used the RAS-0510 from Steren Electronics)
- 2 - 12 volt Vehicle Power Window Motors
- 6 - NPN Transistors (Part #MPS2222A)
- 6 - Diodes (Part #1N4004)
- 6 - 220 ohm Resistors
- Miscellaneous Amounts of Wire
The Electronics
We're going to built 2 circuits that incorporate 3 relays, both of the circuits are exactly the same. One circuit will be used for up and down movement and the other circuit will be used for left to right movement.
A relay is an electrically activated switch. Our relays have a 5 volt coil so they will need 5 volts sent to the coil to make the relay switch to its' other position. We started by checking the relays' initial position by seeing if there was continuity between the switching poles and then marking each relay on the bottom with a felt pen to show the normal relay position.
Two of the relays will be used to change the polarity of the electricity going to the motor to get forward and reverse direction and the third relay in each circuit will be used as a basic switch. If needed we will send a signal to change the polarity, there will be a short pause and then the program will turn on the motors. The process will be reversed when we turn it off. The short pause is just a safety measure so that we are absolutely sure there is no electricity going to the relay until after the polarity is changed.
The Program for the Basic Stamp 2
The program that sends the signal and closes the switches for the motors to move the solar panel is very simple. We did add a short delay for protection when we switch the polarity in the parts of the program where we re-use the I/O channel. We used 1/2 second pulses on the motors but we may need to make corrections to this later when we've finished building the panel supporting hardware.
UP: 'Step Up (P4 is on switch)
DEBUG "UP", CR
HIGH 4
PAUSE 500
LOW 4
RETURN
DN: 'Step Down (P6 is polarity swtich & P4 is on switch)
DEBUG "DN", CR
HIGH 6
PAUSE 250
HIGH 4
PAUSE 500
LOW 4
PAUSE 250
LOW 6
RETURN
LE: 'Step Left (P5 is on switch)
DEBUG "LE", CR
HIGH 5
PAUSE 500
LOW 5
RETURN
RI: ' Step Right (P6 is polarity switch & P5 is on switch)
DEBUG "RI", CR
HIGH 6
PAUSE 250
HIGH 5
PAUSE 500
LOW 5
PAUSE 250
LOW 6
RETURN
You can try that out while we design the circuit boards and print them up.
| Attachment | Size |
|---|---|
| SunTracker.bs2 | 1.67 KB |
| motor-control.jpg | 153.75 KB |



Submitted by shy-but-green on February 9, 2011 - 10:23pm.
Instead of using relays, you could use what is called a H-Bridge, which gives you digital control over the rotation direction of an electric motor. A nice example can be found here:
http://www.bobblick.com/techref/projects/hbridge/hbridge.html
Submitted by shy-but-green on November 21, 2009 - 11:39pm.
You wouldn't happen to have a schematic of the motor control circuit that you would be willing to share, would you?
Submitted by cactii on November 22, 2009 - 12:20am.
I really need to get back to this project and finish it. What I've done for the time being though is attached my BS2 file to this article and a schematic of how I've arranged the three relays.
Remember, you're only controlling the relay coils with the BS2 and the motors will require an external power source.
You can see that you only need 3 I/O channels for the motor control. Since the program will only move one corrective direction for each loop of the program we can switch the polarity on both motors with I/O P6 without any problems before we turn one of the motors on with either I/O P4 or P5.
Be sure to have a fuse on both lines to each of your motor in case the amperage draw becomes too much for the relays.
If you can't see the attached files as a non-authenticated user just create an account and you'll be able to see them.
Submitted by shy-but-green on November 22, 2009 - 4:46pm.
I can see the files with no problem, thanks for posting back so quick. This will help me out greatly. If you like i can fire off some pictures when i complete the project which is going to control a 1 175Watt panel as well as 3 5watt panels to hopefully gain at least 20% greater eff. when tracking properly.
Submitted by cactii on November 22, 2009 - 6:48pm.
That would be really great. I'd appreciate any pictures. You can send them to me at cactii@being...this domain.com. Sorry I had to do that with the email. Address harvesting bots are really bad these days.
Post new comment