I finally received the PCB for this design. And in general it turned out okay. There were a couple of shortcoming in my design that will force me to to re-spin the PCB, so it’ll be a while before I can finish everything up. But having the PCB gives me the ability to debug my firmware and test the overall concept for this solar panel tracker.
Here’s the general concept of this design… the board will have two motor controllers and an accelerometer for feedback. It also has 6 buttons for a user interface, as well as a USB port for programming the system.
The user will program a start and stop position for the X and Y axis of the tracker by manually positioning the motor and pressing specific buttons (or via the software). The positions come from the accelerometer’s 3-axis analog output signals (I’m using the Analog Devices ADXL335, which I also used in the Disco Bike Light project). This requires that the accelerometer be located with the solar panel so it can provide movement feedback. When in tracking mode the tracker will execute movements in sequence at programmed intervals slowly following calculated points from the start to the end positions for the X axis and Y axis.
When the tracker reaches the end positions it will stop moving and wait until a light sensor indicates it is night time. Then it will slew to the X and Y start positions and wait for daylight to begin the process again. Here’s a flow chart to make the process easier to visualize (click for a larger version).
In my flow chart the ovals are groups of subroutines associated with specific functions. For example program mode has the device waiting for button presses and allows the user to control the motors via the buttons (or with software via the USB interface). Using this interface the user can move the solar panel so it points to the location where the sun rises, and then they can press a button to store the start positions. Then they point it to a location where the sun sets and store the end positions. When night falls the tracker will go to the start positions and wait for daylight. When the sun comes up the controller will start moving through a series of calculated positions at regular intervals. When it reaches the end points it will stop. When the sun falls its returns to its start positions and waits for morning to begin the process again.
There are some issues with this control method. First, it doesn’t account for seasonal changes in sun position. Second, I’m not sure yet if I’ll try to make it smart enough to calculate the position change intervals based on timing from sunrise to sunset, or just make it a constant (like every 30 minutes). And lastly, its not really tracking the sun, so much as tracking the programmed accelerometer positions.
But there are some benefits. We’re replacing encoders and potentiometers that might normally be used for an application like this. In fact, on the dual axis solar panel tracker/controller we built a few years ago a potentiometer has already failed (on the linear actuator). We’ve also seen designs that use linear actuators for both the X and Y axis. With a simple controller it is more feasible for people to build their own mechanical setup. You could also use this controller for single axis solar panels.
As far as firmware goes I’ve just about got the user interface and software interface completed. Including a software interface in my designs is something I always try to do. It’s not much work since I reuse serial protocol firmware from other microcontroller projects as and source code from other Visual Basic projects. Software gives me a near-real time window into device operation and allows me to chart various register contents.
In fact, it was during the software debugging that I ran into one of the problems with my design. When charting the ADXL335’s analog outputs I realized that the voltage change when I moved the board around was too small. I’m using the analog outputs of this accelerometer as feedback for PID filters to control motor position. The X axis had a span of 700mV. Y and Z were a little better with a ~1100mV span. My microcontroller has a 12-bit analog-to-digital converter (ADC), so I’m using about a quarter of the available resolution. This may be fine. But… if you don’t take care with your analog design most resolution below 8-bits gets lost in noise. If I plan for worst case I may only have a few hundred millivolts of analog range to set my position values using the existing circuit design.
So I’ve begun to re-design the PCB to address this problem. The solution to this requires several changes to my schematic. First, if I use an accurate 4.096V external voltage reference for my microcontroller’s ADC I can have better accuracy and resolution of my measurements. Second, if I add some filter caps to the analog outputs of the ADXL335 I can reduce digital noise in those signals. Third, if I use a ferrite bead to feed the 3.3V supply of the ADXL335 I can further reduce digital noise. And finally, I need to feed the outputs of the ADXL through differential non-inverting op-amp amplifiers. Using a 1.024V reference my op-amps would output… Vout = (Vin-1.024V)*(4.02K/1.0K) for each axis. This gets me a little closer to using the full resolution of my ADC. There is a possibility that I could clip the low end of the Y or Z axis output if it goes below 1.024V, but I can address that during testing if it becomes an issue.
Oh, and there were three other changes to the PCB that I wanted to make. The terminal blocks I used to interface power supplies and motors to the motor controllers on the PCB were too small. I need some that accept larger gage wires. I also used a space saving 0.05” pitch header to interface to a PICKit3 debugger programmer. This connection will be too weak to plug the debugger into the PCB when its attached to the solar panel mount (possibly upside down). I’ve changed that to a 0.1” pitch header. And the last thing; I need to use a vertical USB connector. I don’t know of the mounting method allows me side access to the PCB, so I should plan for vertical access.
However, at this point, I think I can go ahead and complete the firmware design with what I’ve got. So I’ll move ahead with the project until I reach the point that I find more PCB shortcomings, or I’m ready to update the PCB for the final project design.