1Part 1: Getting started
Want to build one of these chargers? Great! This project profits from feedback I get from people like you who build their own and point out where something is unclear or what could be improved. Cool to have you on board.
This project mainly uses 0805 size resistors and capacitors which is large by today's standards and fairly easy to solder. Also, many of the ICs have a large 1.27mm (50mil) pitch but there are also some smaller ones as well with 0.8mm and even 0.65mm pitch. Don't be afraid of SMD components. With just a bit of practice, they are faster and easier to solder than conventional through-hole components.
That said, you should bring at least some experience with soldering SMD components. You can build this thing the old fashioned way with a conventional soldering iron and strain solder or with solder paste and reflow soldering. Both ways work just fine but you should have done it before. If you're entirely new to SMD components, start with something simpler and hopefully return to this project after that.
The workflows for the main board and the user interface are identical so the following sections apply to both of them. If you'd like to get an impression, check out the following making-of videos on youtube.
2Part 2: Ordering the boards and components
The first step is to get the boards and components. As some of you might be new to ordering custom boards, I quickly walk you through the process.
Many of us hobbyists get their boards from dirtypcbs.com and that's where I get mine, too. Ordering is super simple if you have the Gerber files ready. And those files can be downloaded from this project's Files section. They are named SolarCharger_RevF_Gerbers.zip and UserInterface_RevC_Gerbers.zip and can be submitted to dirtypcbs.com just as they are.
Then there are plenty of options to chose from. You will need size=10x10, material=FR4, layers=2, coating=HASL and copper=1oz. Industry standard thickness is 1.6mm and that's how I order mine. But some seem to like them thinner, typically 1.2mm. Up to you. Color is entirely up to you, of course. Mine are typically blue but choose whatever you like. If you want to use solder paste, order a steel stencil, otherwise you won't need one. Typically, you will go for a so-called protopack which means about 10 pieces, plus or minus.
The bills of material is available from the Files section of this project and are named SolarCharger_RevF_BOM.xlsx and UserInterface_RevC_BOM, respectively. I tried to use only components that are readily available. Unfortunately, what's readily available sometimes changes without prior notice. I am confident, that all components are currently available from Farnell and others like Digikey or Mouser. If you're having trouble finding a certain chip or other part, just contact me, I can typically help you out.
3Part 3: Soldering
Now comes the real work, namely soldering the boards. There are great soldering tutorials on youtube so I won't go into technical details here. My favourite tutorials are those by Dave Jones, google for something like "EEVBlog soldering tutorial".
Only so much: If you're soldering the boards the conventional way, I recommend you use a thin, chisel type tip and thin (e.g. 0.8mm) strain solder.
Having large printouts ready when soldering speeds up the process considerably. Eagle makes it easy to make such printouts: Open the board -> File -> Print and then set Scale Factor to something large while setting Page Limit to 1. This way you get a printout as large as your paper size can accommodate. Another option is to have Eagle open so you can zoom in and out as needed.
Always start with the SMD components. I typically place the ICs first, followed components like diodes or crystals. After that I solder the large number of resistors and capacitors. The last SMD components I solder are MOSFETs and inductors. The two large inductors are chunky and tend to get in the way if you solder them earlier. Be careful with the MOSFET: They are super-sensitive to electrostatic discharge so make sure you touch something grounded before touching them. I typically touch the tip of my soldering iron (which is grounded) with the tweezers I use to place the components to get rid of any electrical charge that may have built up.
It's easy if not almost unavoidable to short a few pins here and there. Solder wick then does a great job in soaking up the extra solder.
Once you're done with the SMD components you can solder the few through-hole components. There is no particular order I can recommend here. This step usually doesn't pose any special challenges.
4Part 4: Powering on
When first powering on the charger, don't do so with a powerful battery or other powerful power supply. There's always a chance that there is a short circuit somewhere and connecting something like a car battery can immediately destroy your newly built toy.
Ideally, start with a lab power supply set to something like 3.5 volts and a tight current limit of maybe 30mA. That voltage won't immediately kill anything, even if it reaches the microcontroller directly for some reason. And the current limit will make sure you don't fry up any traces on the PCB in case of a short.
Observe what happens and then increase the voltage gradually. With the pic unprogrammed, the onboard voltage should stabilize at about 2.3 volts. The board should never pull more than, say, 20mA at 12V or so. If you get to the point where you can supply 12 volts without current exceeding 10 or 20 mA, you can rule out the most catastrophic faults and can proceed with programming.
If you don't have a lab power supply, your best option may be to power the board via USB. Connect the board to your computer via USB just like you would with any other device. Don't expect your computer to recognize the charger (remember, the microcontroller is yet to be programmed) but USB will provide 5 volts with hopefully moderate current capability.
5Part 5: Programming
First of all, the user interface doesn't need any programming.
For the main board you need to program it with the bootloader, not the SolarCharger firmware. For that, you will need some sort of programmer that allows you to connect your computer to the solar charger. I use the PicKit3 from Microchip but there seems to be a new PicKit4 on the market as well now. I haven't used the latter yet but if you have to buy one anyway, why not going for the latest model. They are relatively inexpensive, but if you're on a particularly tight budget there are also some clones, ask google.
The bootloader code is on github: https://github.com/soldernerd/PIC18_USB_Bootloader. Unlike you want to compile the code yourself (which you may but don't have to), you only need the file USB_Bootloader.production.hex located in the ./dist/default/production/ subdirectory.
The programmer is connected to the ICSP (in-circuit serial programming) header. The pinout matches the PicKit3 and probably also the PicKit4.
Once you have programmed the PIC with the bootloader, you no longer need the programmer unless you want to update the bootloader. The bootloader will then take care of programming or updating the actual SolarCharger firmware. All you need to do is to connect your charger to a computer via USB. Your computer may run any operating system as long as it recognizes USB. The solar charger will then appear to your computer like a regular USB drive with 4MB of storage.
Again, you need a .hex file containing the firmware. And again it's on github: https://github.com/soldernerd/SolarChargerRevE_Software. The file you need this time is named SolarCharger_RevE.production.hex and is located in the ./dist/default/production/ subdirectory. Copy this file to the charger's USB drive and rename it FIRMWARE.HEX (yes, all upper-case).
Here's a video of how you program or update the firmware:
6Part 6: Connect your charger to the outside world
There are only two mandatory connections: To the solar panel and to a battery. They are located at the top right of the board as part of the large 12-pin screw header. The labelling on the board is quite self-explanatory:
- Pan stands for panel. That's where you connect the solar panel
- Bat stands for battery. Connect your battery here.
- Out1 to Out4 are the 4 power outputs. Connect whatever loads here. Careful: if you're connecting inductive loads like motors, fans or relays, be sure to provide a free-wheeling diode or you may destroy the output transistor.
- Temperature 1 and 2 are inputs intended for external Texas LMT86 temperature sensors.
- Fan is a temperature controlled fan output. A freewheeling diode is already present on the board.
For all the above, mind the plus and minus (+/-) signs.
- The I2C header allows you to communicate to the device via I2C.
- The SPI header allows you to communicate to the device via SPI.
- The ICSP header is only used to program the bootloader.
- There are 2 USB charging ports. They work just like any other USB charger.
- The remaining USB connector connects to a computer. It is used to program and update the firmware, read the log files and to connect to the SolarChargerApp.
7Part 7: Use the SolarCharger App
You can download the SolarCharger App from github: https://github.com/soldernerd/SolarChargerApp. There are only 2 files you really need: HidUtilityNugget.dll and SolarChargerApp.exe, both located in the .SolarChargerApp/bin/ subdirectory.
The program does not need to be installed but the 2 files need to reside in the same directory. You then just double-click SolarChargerApp.exe to start the program.
Of course, the charger needs to be connected via USB for the app to communicate to your charger.