So current tracking on the Sun Dragon has been a major problem. It started when I kept blowing up high end operational amplifiers. They would work fine on the breadboard, but fry when I moved the setup to the Sun Dragon. I decided I was tired of the op amps and moved to using a 16-bit serial A/D. Again, this setup worked great on the test system but burned the chips up instantly when they were moved to the Sun Dragon. After some investigation and many replaced parts I made the discovery I didn't like. The charger system uses a common positive and several different grounds. By trying to measure the current I was connecting these grounds together and causing all my problems.
Aside from getting rid of the charger that I don't like, the only way around this problem is to use isolation. So, I ordered an isolated power supply and a synchronous serial bus isolator. My initial order was messed up as I ordered the wrong part. It was an isolator, but designed to be used with several other parts to do the isolation—not what I wanted. The correct parts arrived yesterday and I went about getting them setup.
The basics are simple. I have a microcontroller that talks to some 16-bit A/D chips using an SPI bus. To isolate the A/D chips that are doing the measurements, I need to connect them to an isolated power supply. And to communicate to these chips, I need to go through an SPI isolator.
The isolated power supply is connected to my normal 5 volt power supply, and generates a 5 volt supply for the A/D. Internally there is a high-speed oscillator that turns the 5 volts DC into AC. This goes through a transformer, which isolates the ground, and then converter back to DC. Both the isolated and non-isolated supplies go into the SPI isolator. This device is a high-speed bi-directional optocoupler—light is a pretty good electrical isolator.
My initial attempts to get the system working did not accomplish much. So I set the project down for the night and tried it again the following day. I had an idea, which turned out to be the problem. The isolated side of the SPI bus did not have pull-up resisters on the signals. Normally SPI signals are pull up, and whatever is talking will pull the signal down. This is generally done at the SPI master source. But the isolator keeps the source separated from the rest of the bus. Once I added some 10k pull up resisters, my SPI communications was working just like it should. I let the setup run overnight.
This morning it was time to integrate the isolated setup with the Sun Dragon. This is usually where stuff blows up. This time, however, everything worked as expected. The isolated A/D kept the grounds from being connected and now the Sun Dragon can manage its own current readings. That is a major hurdle for the project—long overdue but now functional.
The only part of the project that remains is the backup power relay. So far this summer I haven't needed to use any backup power, and the Sun Dragon has run for 96 days completely on solar power. However I don't expect that will be the case come winter when days are short and often overcast. I decided to change how this works as well. Rather than simply switch to a separate voltage source, I decided it would be best to also switch on the AC to that voltage source. Wall warts are notoriously inefficient, even when nothing is connected to them. So the ability to leave it without power until it is actually needed would be for the best.