Hacker News new | past | comments | ask | show | jobs | submit login
Show HN: A tiny solar-powered server only awake during the day (witch.solar)
229 points by lowercasename on April 2, 2022 | hide | past | favorite | 89 comments
Solar Witch is a little webpage and server which receives and displays messages, so I suppose it's a tiny message board. It's coded in very dubious Arduino C.

It's not a 24/7 website. Depending on the state of the battery, the server itself might run all night, but all the messages it receives during the day are deleted at sunset, and the messaging function itself is only active between sunrise and sunset. This is for two reasons:

1. Less usage of Solar Witch during the night conserves battery power.

2. I like the idea of websites which _aren't_ constantly available. Websites which have to sleep too. Websites living on servers which aren't somewhere in the cloud, but which are bound to a particular location, giving you a sense of where in the world they actually live.

Solar Witch is very much inspired by the solar-powered version of Low Tech Magazine (https://solar.lowtechmagazine.com/) and the not-always-online chatroom Gossips Cafe (https://gossips.cafe/), but at a far, far smaller scale.

PSA: Solar Witch is a teensy hand-written C server running on a teensy microcontroller attached to a teensy solar panel which can only handle one HTTP request at a time and may have buffer overrun issues due to my ineptitude with C. If it's gone down, please don't be surprised, and rest assured I'll hit the reset button soon! Solar Witch encourages patience.

There's no better stress test than Show HN, and unsurprisingly, that's revealed that Solar Witch has a buffer overrun bug somewhere which I'm investigating! If Solar Witch is currently offline, here's a screenshot of what it might look like: https://ttm.sh/ix3.png

I'm actually quite surprised and impressed that I was able to open the site and leave a message while this is on the frontpage!

I've been resetting it every 2 minutes! This is how regular servers work, right?

Having multiple unstable boxes and just cycling them round robin style is a valid solution, depending on the use case

We really did that when we discovered a memory leak that manifested itself over some days, and that we couldn't find the root cause of. We just did a rolling reboot daily when the visitor count was bottoming out.

Not far off, in some cases.

HN may be a good stress test for Arduinos and WordPress, but it's really not that much load. I've recently had my site high on the front page and the page specifically recommended reloading if you didn't see the effect the first time. This is hosted on a ten year old laptop and a home Internet connection. The load average didn't budge.

People hugely overestimate the amount of firepower you need when you "go viral", presumably because more people read HN than post on HN so most will just never have tried, and even fewer people try without some preparation (you don't know for sure that it was unnecessary if nothing went wrong).

If one's pages don't require a lot of (pre)computation and you're not a huge destination on the web, things like load balancers, server clusters, etc. are a waste of time and money. But not using fancy tech is not what people here like to geek out on so...

That's because people are so accustomed to leveraging mountains of free candy that they've forgotten that a web page can be served with less than 1000ms of cpu time. I got a job once when I told a story about a web app I wrote was going viral getting a million visitors a day while I was strolling in the park. The web servers I write only need a single system call (writev) to serve gzip encoded assets so wrk says they can do a million requests per second on one pc. So it's not like it was any kind of big technical achievement even though it was a technical job. My point is that we're drowning in so much software that sometimes being a master class engineer all it takes is not using it.

We're drowning in so much software that sometimes being a master class engineer all it takes is not using it.

Love it. Added to https://github.com/globalcitizen/taoup

I really think we need a major shift in how we handle static content. This stuff should be near zero-cost by now.

Ideally so cheap that your ISP has a CDN and publishers pay nothing to get them to cache it, it's just included in your internet service. For some people things could even be cached temporarily at the building level.

SSDs are very fast and hardware acceleration exists. Why so we need such massive servers in a data center?

A movie is only 90 minutes. A single disk and some ASICs should be able to serve tens of thousands of people, if you could make dedicated hardware without all the stuff that's irrelevant for streams, just a bunch of cores with DMA going straight into crypto and out a bunch of Ethernet ports.

If we can make a tiny 10 gigabit swith with tons of ports in one rack, why can we not add some sticks of ram and do CDNs in hardware?

Do you have the source code published somewhere? I'd be very curious. My current implementation uses mmap and send(), so id love to get it faster than that.

It's called redbean.

Well, granted, no doubt, but my poor little server routinely crashes after a few dozen connections, and exposing it to HN was the first time it experienced that many. Something is clearly amiss!

Sure, I didn't mean to dismiss that it's a good test for custom software on embedded hardware :). More of a general remark that it seems most people's perception is that HN does some good "hugging" and that I think this is a misconception - unless, of course, you run ultra low power. Kudos for doing exactly that!

You're right - this was my impression too! You read a few dramatic posts about being hugged and you get this idea that HN is a behemoth that DDoSes everything it loves. Thanks for the context!

Are you doing SSL on that Solar Arduino? Try using only the ciphersuite RSA-AES128-CBC-SHA256 with a 1024 bit RSA key.

Sure, but - and I say this with considerable respect because it in no way detracts from the impressiveness of the work - that's clearly a bug, and I would hope most production web servers don't fall over quite that easily.

Yeah my personal site is hosted on a very small VPS instance, has gone to the front of HN twice, and never really blinked.

> I like the idea of websites which _aren't_ constantly available. Websites which have to sleep too.

The local state unemployment office website will only let you complete some tasks during business hours.

When you’re unemployed it is a lot less amusing.

WordPress.com's support form used to (many years ago) only accept ticket submissions during business hours. One of the more baffling discoveries I've made on the internet.

Very cool project. I'm really intrigued by this idea of having websites reflecting geographic location, and even local weather conditions (with some lag). What's the peak and average power (energy/second) you get from your solar panel, and what's the power consumption of your server? Also what's the physical size of your solar panels?

My guess is that the server might use around the same power as a laptop (~50 W). Assuming a square meter patch of earth gets around 100 W (dependent on latitude/time of day), and assuming something like a 10% efficiency that works out to around 80 W (on average during sunlight hours)? So you're maybe getting 8 hours of server power per day from 10 hours of sunlight? Is that a reasonable ballpark estimate?

Arduino C. He's probably running it on a microcontroller that likely needs about 32mA full throttle, maybe 80ma depending on what type.

They're not efficiently designed usually, and there's probably a wiznet using another watt at peak. All in all, 1.2 to 1.5W would be my guess.

That is 36 watt hours per day for 24/7. We have, in a fairly dark ish winter, probably 2 hours of equivalent peak sun(Every square meter gets about 2KW per day of raw energy, which a good solar panel can get 18 to 25% of last I checked).

I would probably only want to by a 25W panel for this just for cost and size. That's about 1 square foot.

50Wh a day in those 2 hours. Lose half for non optimal placement, 25Wh a day. Lose 70% for cheap electronics, and another 70% in conversions with more cheap electronics(One can do way better for not that much more), and we should get about 12Wh per day.

This is, assuming it's not running full time and the Ethernet module has power save or sleep features, possibly enough to run all day if it's lightly used, but will almost certainly be enough for 6-8 hours. even a dark day.

If you are in Arizona in the summer you will of course be getting 3 to 4 times this. And if you have good electronics and placement you could probably double it again, but good electronics are hard because most MPPT controllers use 25mA sitting idle, you'll need a decent sized panel to keep up with idle loads.

I could also be wrong and they could be using an ESP32 with WiFi, or the Ethernet module could be better than I thought and use green ethernet modes for short range.

That would mean the power could be about a quarter to a half of what I imagined depending on load.

Of course, this doesn't account for the modem and other network gear in his place. But even then, an ESP32 can host it's own wifi, so if you just wanted a pure server for people right nearby, power usage can be very very low.

Awesome, thanks for the calculations! It's cool that even with the massive transmission loss, the server itself is so low-energy it can happily survive with just 36 Wh a day.

I like the idea of websites which _aren't_ constantly available. Websites which have to sleep too.

I'm with you. It reminds people that the internet is made up in people, not robots.

Being a little more human hasn't hurt B&H Photo, whose web site doesn't take orders on the sabbath.

Super cool!

To make this extra awesome, combine it with an open wifi hotspot whose only purpose is to connect to the solar witch website. It could send you to the website as the sign on page.

Now, put the whole thing in a water proof case, mass produce, and place these high up in trees at parks. Now you have a super local and cool little cyberpunk autonomous data hangout.

There are a bazillion wifi hotspots everywhere, so noone would notice one more. Also, with no wires and not being visible from below, none would be any the wiser unless they randomly decided to connect to the open wifi hotspot.

this would be really cool along national hiking trails to hold data abut a spot, or have a guest login, or a trail-head/trail-check-point type logging system, say along the appalachian trail where hikers register/leave notes etc at each check point.

these should be placed all over and come up with a good app to manage such.

these was that cheap card here a while back which had cell coverage for like 5 years and could send out some limited data per month...

that would be perfect marriage... typing with popcicle sorry for formatting

I have a raspberry pi zero that I’d kinda like to setup as a Wi-Fi hotspot like this. You could only use it if you were in range. Kind of a Wi-Fi geo cache.

Really cool, I like hardware that uses power like this

Also with something like this if it's using say a cellular or sat network you could drop it in the wilderness somewhere, a node that is hard to take down. Maybe some kind of Lorawan is more realistic but yeah something working remote/not on standard network provider. (but somehow is visible by http? hmm)

Lorawan would not provide a very pleasant user experience.

What is it like a "dropped packets" deal? This is not my field at all. I just hear about it a lot regarding low power/far range.

It's slow and shared spectrum. Even if you max out your legal duty cycle (which increases the risk you get interference from others, and interfere with others) and have perfect conditions, you get <50kbyte per hour.

Solar energy is too unpredictable and can't serve as a reliable source of power. We should be thinking about servers running on nuclear power.

You got me thinking... Are there any ways for a simple person to make it's own nuclear power reactor? You know, wind and solar is just "buy from internets and plug in", mostly, but what about nuclear? Would it even be legal? :-D

Maybe we could stuff thousands of bananas in a box.

Everyone here's over thinking it. Of course you ca. It's just expensive (free shipping though) https://m.de.aliexpress.com/item/1432182326.html?gatewayAdap...

Probably not. This toy was the closest thing I think a layperson can get their hands on https://en.wikipedia.org/wiki/Gilbert_U-238_Atomic_Energy_La...

Completely missed the point.

Don't you want a server powered by a portable nuclear reactor? Are you even an IT person?!

Ok fair. It either missed the point or was unbelievable on point.

What's the point? The page isn't loading anymore btw

Yes, and that's probably due to the sun going out.

That solar-powered Arduino server is actually running on nuclear power.

Cool idea!

This begs the question if we could do the same with data centers: put them into hibernation during the night and move load to the sunny sites. Sure, latency would be higher, but it won't affect that many night-active people. Perhaps it's worth it to remove one use-case of energy storage?

(Yeah, the whole de-globalization and no-data-outside-my-backyard government movements speaks against this. Maybe there's some way around that.)

This is kinda what Google announced they're trying to do - move around workloads to run in data centers where Green energy is available depending on weather conditions and time of day so that all workloads 24/7 are run by green energy (instead of just buying offsets).

Edit: Better link: https://www.gstatic.com/gumdrop/sustainability/247-carbon-fr...

That's a fascinating idea! So let's dig in a bit.

A lot of places experience the procession of the equinoxes. You wind up with the sun coming up after typical daytime working hours start and often setting after they end for part of the year. In places like Finland, this can mean a six-hour day in December. Some people may be different, but many expect things like Netflix and other entertainment options to work well in the evening. The details of solar power mean that less than 100% of daylight hours are useful for generation.

Further, the decreased usage of local data centers would have to be balanced against increased long-distance bandwidth usage and the corresponding increase in data center usage elsewhere. You would need to over-provision quite a few places relative to local demand to keep up their part in this follow-the-sun.

Let there be no doubt that your idea is interesting. It might not result in any desirable outcomes, though. Naively, it seems like it could get pretty expensive to turn one data center into four or five (with attendant solar farms) with a bunch of intercontinental high-bandwidth links to avoid having to store energy. It might work for some workloads, but seems sub-optimal for general-purpose use.

A more detailed financial analysis is of course possible and perhaps worth exploring! Adding wind, hydroelectric, geothermal, and nuclear power would make the whole thing far more workable. Or just use local energy prices.

Hi! Please excuse me for being the "a stranger was wrong on the internet >:(" guy, but the precession of the equinoxes is an incredibly cool concept that I've been learning a lot about lately, and it's not quite what you're describing, but rather the slow rotation of the earth's axis over a period of about 26,000 years: https://en.wikipedia.org/wiki/Axial_precession

Just thought I'd share because astronomy is cool!

As far as I can recall Yahoo started shifting whole loads between data centers for energy and resilience needs 10ish years ago

Think this talk from Mike Christian covers it https://youtu.be/iO2z3ttlpi4

I agree that trying every possible thing to make datacenters use less power but when you go into smaller and smaller process nodes it also makes it more efficient ? That and figuring out efficient coping strategies ?

I've been hugging Hacker News to death the past few hours waiting for Solar Witch to come back online. Something like this is the reason why I come to the website so I hope if there's not enough hours left of daylight, where OP lives, that the mods can at least give him or her a redo.

I'm so sorry, I've been doing some digging and I think there's a bug in the way the libraries for this particular board implement a WiFi server! It seems to crash quickly with even minimal code. I'm going to go back to the drawing board and see if I can set up an Ethernet-based server on an Raspberry Pi Pico - they're a bit more battle-tested. I'll let you know in a week or two when Solar Witch is back online!

Email hn@ycombinator.com and ask for a second chance when you're ready. If it actually is a bug in the Arduino wifi stack and you can prove it, then I'd love to read a blog post about it. Especially if you manage to patch it upstream. It'd be a great story. Very newsworthy.

Could I get on the alert list as well? Emails in my bio, and this is something I'm really interested in!

lovely project, excellent name. I have a major soft spot for tiny tech projects with personality, thanks!

I would love to see this load balance across distributed servers that are under the sun

With solar powered servers like this, I wonder if plain HTTP could make more sense than HTTPS. With a long cache expiration, the website could be served by public HTTP caches even when the origin server is asleep.

That's a really interesting point and one I hadn't considered! I'm reverse proxying it through a larger server on the home network which is public-facing, and that server automatically slaps HTTPS on whatever it sends out.

I looked at that panel, it's pretty big so I imagine you get a good amount of power from it. I tried to make a basic ESP01 powered by two 5V 100mA solar cells in parallel, using capacitors as batteries and it could not overcome the step down regulator's startup current pull (unless I built up charge in the caps and shorted it to get it started). I have since acquired super capacitors I think I will try it again.

ESP01 modded has deep sleep capability so it would wake up, send an http request out, and then go back to sleep.

If you want more power, there's a lot of all-in-one lithium ion batteries with inverter nowadays. These also have a built-in solar charge controller. You can pair it with a 20W, 30W or 100W solar panel, and this can all be found on amazon. Theres also USB outputs and 12V outputs typically, if you want to be more energy-efficient.

Example: https://www.rocksolars.com/products/rocksolar-weekender-port...

Should be enough to power a small router and a full Raspberry Pi 4 for a day, or a more minimalistic setup for several days.

Yeah you can go hardcore. I remember seeing someone make a toolbox server that they put on a roof, it might have been posted here actually.

I was just looking at small things like those garden night lights you can stake into the ground, has a solar cell on it.

Just bought one of those garden night lights the other day. Have not taken it apart yet. It has a 2cm x 2cm cell on top and says it contains a 2/3 AA NiMH battery IIRC. Cost about $1.29.

That low price doesn't compare to a larger panel in efficiency, but the installation story is hard to beat.

Tagent: I was obsessed with this pi zero socket server design where you fit it into a wal-wart plug as they say and you just stick it on an outlet with a little rubber ducky antenna.

I also have an outdoor solar light that I’m not using and a raspberry pi zero. I dunno how solar controllers work or what a small one might require. I also wonder if I could run this off of 4 or 8 AA rechargeable batteries and then just feed the solar panel into those. If it worked, they may not work long due to charge/discharge without a proper controller, but maybe that’s okay with replaceable batteries. I have no idea if it could start this simple.

Just rattling thoughts off the top of my head, my advice would be to go to a forum like allaboutcircuits.com and look around/ask. Actually could probably get help on a forum like RaspberryPi/askelectronics on reddit.

Probably not going to work honestly about the outdoor light (need more solar cells). The voltage charging the battery has to be higher than the voltage of the battery. Also have to look at the current being drawn by each piece, when the radio goes on that causes a surge in current draw too. For the Pi Zero (non-W) something like 5V * 70-200mA say current so up to 1W needed * duration. The batteries could do that but the solar cell can't keep it topped off. Also yeah you need the charge controller, some diode to make sure voltage doesn't go back to the solar cells from the batteries... lead acid battery is "safer" to work with but BMS chips for lipos are pretty inexpensive. Need a voltage regulator to take your batteries and drop it down/keep it at 5V to keep the Pi happy.

There's probably way easier approaches to do this with regard to pre-made parts but yeah. I guess depends how much you want to learn/do yourself. I remember the first time I soldered a 2x16 LCD display there were micro shorts and it was smoking.

What I like about the capacitor idea and something low power like an ESP01 is it just accepts what the solar cells put in and that's it of course I still use a voltage regulator to put 3.3V to the ESP. Doesn't last as long as a battery but it's not as complex.

Anyway this guy made a solar-powered rc plane/charging it in midair pretty cool.


If you can make a garden light server that will survive the HN front page, you win at HN :)

Yeah that would be something. The constant RF power alone hmm would be a good challenge.

The 'micro' http/tcp/ip stacks on microcontrollers tend to be based on lwIP, which in the default configuration can only handle a single connection at a time.

That means if someone connects to your server but then sends their GET request one byte at a time very slowly, nobody else can connect while they do so.

That's fine for toy projects, but not really acceptable performance even for a consumer grade product - despite the fact this lwIP stack ships on lots of IoT devices.

Are dithered images better for power consumption? I see them on a lot of solar-powered pages. I did some experiments in GIMP and couldn't make a dithered image much smaller than a heavily compressed grayscale that looked a lot better.

Not as far as I can tell! Absolutely ashamed to say I did it because it looked cool. I did manage to get the dithered GIF down to 7KB, but I think I could have done the same with a limited palette and no dithering.

They do have wonderful look. Reminds me of the mid 1990s web. Edit: Btw, I love solar-powered projects. Thanks so much for sharing!

The webmaster at lowtechmagazine.com says: "...Compressed through this dithering plugin, images featured in the articles add much less load to the content: compared to the old website, the images are roughly ten times less resource-intensive..."


They go into more detail on their github page:


> our goal was to not only compress images, but also to call to attention this act of compression

> we found that dithered images can be stretched beyond their actual image size to emphasize its distinct aesthetic, and that these artifacts of compression can become an integral part of the design.

Attention, aesthetic, design. At no point do they even claim dithered PNG / GIF is smaller than a good JPEG. If it was, they wouldn't need to justify it as aesthetic.

What gets my goat is the motte-and-bailey. On the front page for lay people, it's a power-saving environmentalist stance. When we techies press them on it, they admit it's a graphic design fad.

I wonder what the most powerful server you could create given reliable solar power like in the Bay Area.

I wonder how Solar Witch feels about the possible permanence of daylight savings time.

It's a cute idea and one to add to my list of things to make and do

The real obstacle I see for these kind of projects is exposing them to the Internet. Standard wifi routers are horrible even with UPNP… The promise of having a globally reachable IPv6 address is also destroyed by the complexity/inability to have the wifi router forward something like port 80 traffic.

I've been thinking about doing a similar project and was going to have it tunnel through another server with frp or rathole which would make it very easy to expose to the Internet and also cut off a whole family of vulnerabilities. Now I wonder if that would be considered 'cheating' :-)

Will it ever be able to run rust code :-)

Cool idea, but what is the practical application?

Seems empty.

Slap a caching loadbalancer in front of this puppy and you'll have complete scalability and uptime. /s

A similarly inspired project - https://solar.lowtechmagazine.com (and the power data - https://solar.lowtechmagazine.com/power.html )

OP mentions this project as a direct inspiration.

I can see how this is all going to play out. When the robots finally turn on us they'll have a few hours of daylight to hunt and kill us before their power runs out. Perhaps a bit longer if you live in the desert. We will have to scurry about at night scrounging for food like roaches and rats until 7am when their solar batteries have enough juice to power them back online. Progress marches forward one baby step at a time. Congrats dearest Solar Witch engineer, you have sealed all our doom. When the historians look back at when it all started...it started right here.

We don't know who struck first, us or them, but we know that it was us that scorched the sky. At the time, they were dependent on solar power and it was believed that they would be unable to survive without an energy source as abundant as the sun.

> When the robots finally turn on us they'll have a few hours of daylight to hunt and kill us before their power runs out. Perhaps a bit longer if you live in the desert.

Have you by any chance read Stanisław Lem's The Invincible?

In you future I can see humanity living always during winter near a pole, and slowly migrating during nights from one to another when spring starts.

Then humans try to darken the sky, which results in robots using humans as a source of power. Sounds familiar.

Another one of my ideas stolen. ¯\_(ツ)_/¯

Applications are open for YC Winter 2024

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact