From Concept to Reality – Engineering Innovation
As the firmware engineer (and more) here at Okra, I want to share with you how we built one of the first distributed solar microgrids and the engineering complexities we faced along the way. We are proud of our technical triumphs and engineering innovation, but they aren’t a secret. In the off-grid solar industry, we are open about our challenges and learnings in the hope that more people give feedback, build on our progress, and ultimately join us in our goal of tackling energy poverty worldwide. We welcome your questions and insights, so feel free to reach out!
Single-home charge controllers have been tried and tested, but as global trends demonstrate, a shared-goods economy has many benefits. Single ownership is wasteful in periods of low demand and unreliable during heavy demand; levelizing usage across many users is more efficient. This principle combined with the flexibility of single-home units revealed tremendous opportunity and ultimately inspired our core innovation- decentralized power sharing and grid management across homes. But this very idea was also the root of our biggest hurdles, toughest challenges, and great learnings. In our previous posts we shared baseline data from our pilot village, prior to upgrading our controllers to share power. Having since implemented power sharing, this post recaps our tech journey from concept to reality and presents the data to show it was worth it.
To start, we identified our two greatest technological concerns in building a sharing network, both of which aren’t big concerns with a typical solar home system (SHS). The first problem is power loss, and the second is stability. In a typical SHS’s charge controller, power loss is minimal because the energy generated from the panel doesn’t travel far and only needs to be down regulated about 4 V to charge its battery. Power stability is also straightforward because the output is controlled by a single system, with no external interference. However, for a sharing controller, power loss and stability become mission-critical concerns.
Solving Problem 1: Power Loss
The Okra grids output DC power to lower capital costs (no inverters necessary) and eliminate AC / DC conversion inefficiencies. The downside of DC power in a network is that power loss over distance is large. To address this, we leveraged the fact that power loss is proportional to current squared. When sending over the grid, we boost the voltage up to ~50V which reduces the current by about 4 times, and the power loss is 16 times less as a result.
But, as the laws of engineering seem to dictate, when you solve one problem, you usually incur another. In this case, stepping up the voltage can’t be accomplished with simple linear voltage regulators, and stepping the voltage down by such a huge differential results in unacceptable losses in efficiency. To up the sophistication of our power regulation, switch-mode power supplies (SMPSs) won out as the best option.
In order to compare SMPS regulation, let me first briefly describe linear regulation. Linear regulators work to maintain a constant output voltage by changing their internal resistance. In turn, they dissipate a substantial amount of power in the form of heat. For our application, across large voltage differences, they would result in low efficiencies of 20-30%.
In comparison, SMPS regulators experience almost no power dissipation because the transistor switches are always either completely on or completely off. The switching transistors use pulse width modulation, setting the on/off ratio (a.k.a. duty cycle) such that the average voltage equals the target output. By driving the transistors at very high frequencies, this average voltage is effectively a constant, regulated DC supply. The switching process is more complex and requires more components to smooth and filter the signals, but it can handle larger ranges of input voltage, raise or lower voltage from the same configuration, and achieve 90% efficiency.
Solving Problem 2: Stability
Utilizing SMPS regulation, while not easy, didn’t result in many unforeseen complications. Once the circuit was implemented and the specifications were adjusted, we iterated on the firmware and relatively quickly felt confident in the SMPS performance. The much harder battle was addressing network stability. As power goes between the systems, each system is making different and constantly fluctuating demands on the shared grid. Instead of just one panel interacting with one battery, a sharing network needs to account for many more variables. Each battery’s state of charge, the power consumption at each household, and the power generation from each panel are all variables that constantly alter the grid.
The solution? Feedback control algorithms. Basically, each household tries to maintain certain set points by constantly comparing the target values to its actual values and making the necessary adjustments. Implicitly, these algorithms give each household the ability to react when another household does something that changes the grid, for example someone turning on appliances or a solar panel cutting out. In more technical terms, we implemented Proportional-Integral-Derivative (PID) controls, but going from theory to practice wasn’t straightforward.
The theory behind PID controls is that it combines 3 different methods of reacting to errors between actual and desired values. In combination, the P, I, and D components in the algorithm help the system reach the target value quickly, settle at the right steady state, and anticipate future error, respectively. Figuring out the values of the P, I, and D constants in the equations is called tuning. A well-tuned controller responds to a disturbance quickly, eliminating error without causing excessive fluctuations. There are mathematical equations to calculate precise, theoretical values and simulations to help predict how an ideal controller would behave based on the parameters. But given that all the non-ideal aspects of each component in the system, as well as well as the external inputs to the system, all effect the controller’s behavior, the theoretical methods can’t provide an accurate enough solution.
Trial and error, albeit tedious, is the most effective. We designed a way to cascade several PID loops, prioritizing which variables needed to respond the fastest and making sure all the variables were represented in the equations. It wasn’t easy to wrap our heads around how the components would be controlled with respect to each other, but even after writing these control loops into the firmware, grid stability felt out of reach. Improper PID values resulted in wild oscillations and spiking voltages. Systems errored and shutdown. Tuning was the critical, and daunting, last step.
We anticipated the act of tuning to be the challenge. Instead, the complexity of designing a reliable testing configuration and systematic testing strategy caught us by surprise. With so many PID loops operating in response to each other, not only within one device but also across multiple, figuring out how to isolate, tune, and monitor each separate loop ended up being a mind-numbing challenge. After months of battling this out, the engineers got together and spent 5 days held up in a room, determined to overcome these issues. We ironed out the details of the algorithms (what circumstances should respond fast, what responses should be driving the grid vs. reacting, etc…) and developed a way to monitor the stability of our algorithms, running at microsecond speeds, and adjust the PID parameters until the best outcomes could be achieved, all in real time without interference.
With these algorithms working, the rest of our technical challenges, while not insignificant, would pale in comparison. We deployed these updates to our pilot site and immediately started collecting data on the real, not predicted, benefits of sharing power. As the data came in, our predictions and tremendous hard work were validated. Below is a look at how previously wasted solar generation is now shared across the network, providing households with a cheaper and more reliable source of energy.
We are proud of this achievement, but the technology is just one piece of the puzzle. We look forward to continue sharing our journeys, from many different aspects of the company!
Firmware EngineerMy lens on the project is from the technology perspective, everything from cutting edge design, the painful process of debugging, and the gratifying feeling of seeing first-hand as our product empowers users and changes lives.