Solar Tracker Cap

Caps have been around for thousands of years, offering a stylish way to shield our faces from the sun. But what about our necks? A cap’s fixed visor can’t guard against sunlight from every angle — or can it? Introducing: the solar tracker cap.
Supplies
Tools
- 3D-Printer (must be compatible with both PLA and TPU)
- Screwdriver (for 3M screws)
- Pliers
- Soldering Iron (and any other soldering equipment as desired)
- Solder
- Multimeter
- USB Cable (for Arduino)
- Sewing Needle
- Scissors
Materials
Mechanical
- PLA filament
- TPU filament
- 3M Self-Threading Screws (of varying sizes)
- 1 Ultra-Low-Profile Socket Head Screw (1/4"-20 thread size, 1-1/4" long)
- 1 V-Groove Track Wheel (24mm diameter, 11mm thickness)
- 1 Locknut, 1/4"-20 thread size
Electrical
- 2 Solar Panels (5V, 1W)
- 1 Perfboard (70mm x 30mm)
- 2 10k Ohms Resistors
- 1 L293D module (H-Bridge)
- 1 N20 Mini Speed Reduction Motor (120RPM)
- 1 Arduino Nano
- 2 Photoresistors
- Jumper Wires
Miscellaneous
- 1 Visorless cap
- Thin Sewing Thread
Concept Design



As far as I’m aware, this is a completely novel idea. As its name suggests, the sun tracker cap is equipped with a visor that rotates around its "base", providing constant shade regardless of the sun’s position with respect to the user. This is achieved by motorizing the visor and having it move along the circumference of the base using a customized track to guide it around. The pictures above are early sketches of the system.
Furthermore, the motor is powered using solar energy where the solar panels are mounted on the visor to cover surface area. The perfboard is also located on the visor to allow accessible connections between the power source and the loads. Finally, an Arduino, two photoresistors and some other electronics are wired together to determine the location of the sun.
The brilliance behind this invention lies in its inherent function. Solar-powered systems are usually limited by their reliance on the sun - but not the solar tracking cap. If the sun isn’t present, there is no reason to actuate the visor in the first place! It can simply be used as a regular cap, or just leave it at home.
Mechanical CAD Design




Note: All CAD models were designed by myself using SolidWorks.
Choosing a Motion System
The primary challenge of the project was to design the rotary motion system. I debated the best mechanism for this application and ultimately settled on a rack and pinion system because of my previous experience designing gears and its advantage of no slipping compared to friction wheels.
Circular Rack
The circular rack is designed using linear racks from McMaster-Carr as reference. In short, I used the wrap function in SolidWorks to project the gear path along a circular path instead of a linear one. I then modified the gear path to accommodate a carrier that follows the path along with the visor. Needless to say, the rack went through numerous design iterations given its unorthodox shape.
I initially printed the circular racks using PLA, but they were difficult to design to fit my head. After testing different cross-sectional designs and head shapes, I concluded that PLA was not a good option for my project. Instead, I pivoted to TPU, which is more flexible and comfortable for the user. Unfortunately, my 3D printer couldn’t print the whole rack in one go, so I had to be creative in splitting it into three parts and assembling them later.
Other modifications included changing the screw mounting hole locations to clear the pinion path, reducing volume, minimizing friction between the pinion and the rack, and more.
Visor
The visor was designed to be compatible with the perfboard and solar panels. It has sockets where the components can slide in, and screws are used to prevent them from slipping out. This was much easier to design and only went through a couple of iterations.
Motor Carrier
The motor carrier was designed to reduce friction between the visor and the rack. It also went through numerous iterations, often to accommodate mounting tabs and reduce friction or mechanical interferences between it and the circular rack. It is designed so that the motor fits tightly into the customized slot, and a cover is fastened to fix the motor completely.
3D-Printing
.jpg)
I didn't employ any special printing settings to manufacture the parts. Default slicer settings should be fine for both the PLA and TPU parts, as long as support is enabled when appropriate.
Note: TPU can be tricky to print because of its flexibility, so make sure that your printer is sophisticated enough for the job. I recommend printing out a filament tower or purchasing a filament dryer to improve results.
Here are the parts required to be printed in PLA and TPU:
PLA
- 1 Carrier
- 1 Carrier Cover
- 1 Gear
- 1 Visor
TPU
- 3 Circular Racks (one third)
Mechanical Assembly
The assembly steps after step 2 might be easier to complete after soldering everything together. Feel free to do so, or complete the full assembly first if desired.
- Start by assembling the three circular rack parts together by screwing the mounting tabs together. Because TPU is flexible, you can bend the parts a bit so that your screwdriver can access the tabs and complete the fastening. Once completed, you should have the circular rack pieced together.
- Slide the solar panels and the perfboard inside the slots of the visor, and use six M3 X 5mm screws to prevent them from falling out. It doesn't matter whether you fasten from the top or bottom of the visor
- Push the DC motor into the carrier slot. The motor should only be able to enter the component from the inside where the slot is rectangular.
- Locate the carrier cover onto the carrier and fasten them together using two M3 X 10mm screws. Then, insert the gear into the shaft until you can't push it further.
- Place the carrier on top of the visor's middle tab such that the mounting holes align. Fasten two M3 X 14mm screws to fix the carrier onto the visor.
- Screw the socket head screw into the carrier from the outside until its head is coincident with the surface. Place the V-groove wheel so that it's hanging from the edge of the screw and concentric to it.
- Bring the visor and carrier subassembly onto the circular rack such that the gear meshes with the teeth of the rack and the V-groove wheel sits on the guiding path on top.
- Complete the assembly by tightening the lock nut onto the socket head screw, preventing the V-groove wheel from falling off.
When complete, the assembly shouldn't have any loose parts. Make sure that all the screws are nicely tightened.
Sewing the Cap


I took Becky Stern's advice and decided to try sewing the 3D-printed circular rack onto the visorless cap. After all, how else can you connect TPU and fabric together?
First, we need holes in the rack to allow the thread to hold it in place. I used my soldering iron to puncture six pairs of small, roughly 1mm diameter holes equally spaced around the circumference of the rack.
- Attach a piece of thread to the needle and create a tail knot.
- Starting from the inside of the cap, pierce through the cap and then through one of the holes in the circular rack. Make sure the rack is initially positioned near the base of the cap.
- Then, have the needle go through the other hole from the outside and back into the fabric.
- Pull the thread so the tail knot rests on the surface of the cap, and create a finishing knot.
- Cut the excess thread with scissors.
- Complete steps 1-5 five more times around the base of the hat
Upon completion, the cap should be fixed with respect to the rest of the assembly.
Circuit Design

Fortunately, the circuitry is straightforward. There are three goals that need to be accomplished: provide adequate power to each load, connect the H-bridge to the microcontroller and motor, and ensure that the Arduino can read both photoresistors.
I initially connected one solar panel to the Arduino and the other to the H-bridge, but learned that the motor wasn’t supplying enough torque. To solve this issue, I connected the solar panels in parallel instead and provided this new power to both the H-bridge and microcontroller. Since the microcontroller doesn’t need much current, most of it went to the motor. I also replaced my motor with a higher torque-rated one to ensure the torque supplied exceeded the friction forces between the gear and the rack.
The L293D module is a dual H-bridge, meaning it contains two H-bridges and can be used to control two motors. In our case, we just use one side, and it’s simply a matter of connecting each pin to the correct node. You can learn more about the inner workings of the module here: In-Depth: Control DC Motors with L293D Motor Driver IC & Arduino.
Finally, to read values from the photoresistors, a voltage divider setup is created. This allows the microcontroller to read the change in voltage caused by the varying resistance of the LDRs. We do this for both sensors and attach each to a separate analog pin.
The circuit is shown in the image above.
Soldering


With the circuit finalized, all that was left was to solder the components onto the perfboard. This was my first time prototyping using a perfboard, and I made various mistakes. Firstly, in order to fit all the components onto the board, I decided to place the Arduino on one side and the L293D module on the other, in a way that they would overlap and save space. This backfired, rendering the pins of the L293D inaccessible, as they were hidden by the microcontroller. I also had little experience with soldering and found myself hunting down and repairing short circuits for hours.
In any case, I have attached photos of the completed version, which, as of this moment, does not have any connection issues. However, it is advised to place all the components on a single side of the perfboard.
Coding and Sensor Calibration

Sensor Calibration
Prior to writing the code for the solar tracking cap, the photoresistors need to be tuned. Out in the sunlight, take your computer, cap and USB cable with you. Make sure that both sensors are receiving an equal amount of sunlight. Download and run the "ldr_comparator_script.ino" code attached below to notice that despite having two sensors of the same model, they display different values. This is due to small variances in the LDR themselves and the resistor values.
To resolve this issue, determine the multiplier difference between the average of the two values. That is, if you see that LDR1 averages a value of 500 and LDR2 outputs around 650, then the multiplier would be 500/650 = 0.769. This will be used for the actual solar tracking code.
Solar Tracker Code
In brief, the microcontroller needs to compare the photoresistor values and adjust the current direction sent to the motor. Moreover, if the visor is already at its ideal position, the photoresistor values should be the same and the motor should be at rest. Upload the code "solar_tracker_script.ino" onto the Arduino nano to get the solar tracker cap running!
Final Result
Overall, the cap works… decently. The visor moves around the cap as intended, and the electronics and code work well too. Unfortunately, I was unable to calibrate the photoresistors to the level I wanted in time. I can show that the visor moves along the path, but I’d be lying if I said the cap accurately tracked the sun in its current state. That being said, I’m confident that with a bit of tweaking in the code, the cap can achieve its intended purpose.
Retrospective
In hindsight, there are a lot of things I would have done differently. For example, I should have found a larger 3D printer to reduce issues with aligning the circular rack assembly. The perfboard could have been neater, and I could have implemented a way to remove the perfboard even when components are soldered to it. There are also a lot of mechanical design changes I would make, like reducing the space between the visor and the cap, adding more stability between them, and making the assembly more appealing in general.
With all that being said, I’m happy that I was able to develop this proof of concept — in one month’s time, at that. Designing mechatronic systems is always challenging, even when they aren’t so technically complicated. I’m glad to have explored the challenges of designing wearables and to have gained more knowledge in soldering, CAD design, TPU filament, and even sewing. I’m excited to continue refining my prototype until it reaches its full potential.