DEV Community

Cover image for I'm 17 in Ghana. I built a solar-sizing tool on my phone — here's the code and every bug I hit.
Collins7-code
Collins7-code

Posted on

I'm 17 in Ghana. I built a solar-sizing tool on my phone — here's the code and every bug I hit.

Ghana sits under some of the strongest sunshine on earth. Solar supplies
about 1–3% of our grid electricity. The gap isn't desire — it's guesswork.
Families want solar, but nobody can tell them plainly: what size? what cost?
will it pay for itself?

So I built the answer. On a phone. Between classes.

What it does

A Streamlit app that lets any household:

  • Enter their real appliances (fridge, TV, fans, pump…)
  • Get a sized system: panels (kW), battery (kWh), inverter (kW), using load math + region-aware peak sun hours
  • See an estimated cost in cedis
  • See the payback computed from their real ECG bill (bill ÷ kWh = true tariff — no invented numbers)
  • Request a professional quote → the sized lead is emailed to me

🔗 Live app: https://ghana-solar-tool-pli6auappdapghergd2rfz.streamlit.app
📂 Code: https://github.com/collins7-code/ghana-solar-tool

The bugs (an honest post-mortem, because that's the real lesson)

1. The form that crashed on submit.
I pasted my lead-capture form above the sizing code. It rendered fine
(empty boxes need no math) — and threw NameError: daily_kwh is not defined
the moment someone submitted. Lesson: test the submit path, not just the
render path.

2. "Make sure you open this page through a web server."
FormSubmit expects browser calls with Origin/Referer headers. My app
posts server-to-server, so it looked like a local HTML file and got refused.
Fix: attach the live app URL as Origin + Referer headers.

3. The silent activation step.
First submission to a new email only triggers a one-time activation email.
Until you click it, leads are accepted but never delivered. I chased a
"broken" pipeline that was just waiting for one click.

What real users taught me

My first real user (a friend) left the appliance table at its defaults
so her quote wasn't truly hers. Real hands > my assumptions. That's now an
open UX issue: nudge users to personalise the table.

What's next — and where you come in

This project is built in the open. Open issues include: real ECG tariff
bands, measured irradiance data, Twi localization, and mobile UX.

I'm also opening an open-data track with real Ghana infrastructure data.
To show you why it matters: in 2010 Ghana spent US$171M on road
maintenance — yet 58% of the 68,053 km network was still rated fair or
poor. Where should the next cedi go? That's the kind of question this
track will explore, roads first, then energy.

Grab a good first issue. Read CONTRIBUTING.md. Come build with me.

One line for the road

I lost version 1 of this project when my phone broke. I rebuilt it better.
The builder survived. ⚡

Top comments (1)

Collapse
 
officialmailkr profile image
오피셜메일

렌더링 경로는 통과했지만 제출 순간에 daily_kwh가 정의되지 않아 깨졌다는 부분이 특히 좋았습니다. 입력값을 비워둔 초기 화면만 보는 테스트와 실제 제출 경로 테스트를 분리해 둬야 한다는 교훈이 명확하네요. 기본 appliance 값 때문에 첫 사용자의 견적이 개인화되지 않았다는 관찰도 중요해서, 결과 계산 전에 사용자가 최소 한 항목을 수정했는지 확인하는 단계가 도움이 될 것 같습니다.