DEV Community

Kevin Cox
Kevin Cox

Posted on • Originally published at kevincox.ca on

Pretty Good Extra Utilities Solar Generator Controller

Skip to the Solution

Background

The Extra Utilities Solar Generator is an interesting Minecraft generator. It requires no input and generates power depending on the current sunlight (which is primarily based on the time of day). The aspect that makes it interesting is that when it is collecting sunlight it doesn’t transmit any power. This means that it will charge itself up during the day and will discharge either at night or when manually toggled via a redstone signal. Furthermore switching between the two modes has a transition period where it is nether charging or transmitting.

I assume the intent is that it can get you a decent source of power early on especially for “interactive” uses, but they won’t passively provide huge amounts of power to something like a quarry and aren’t really a great option to spam down for late-game power. Assuming you don’t touch them all all they will fill their buffer during the day, and unload at night. Meaning that you only get 1 buffer of energy (1kRF) per game day. However they take much less than a day to charge so if you want to get maximum power from the generators you need to toggle the discharge during the day.

Early-game it makes sense to just slap a lever on the Solar Generator for on-demand power however it soon makes sense to automate the process. I have seen simple solutions using a light detector. However this is both mostly unnecessary (since they discharge at night anyways) and won’t give you max throughput as it only performs a single charge cycle per day.

I aimed to do something a bit better. It will simply charge until full, discharge until empty, then repeat. The main goal is to continuously do full charge+discharge cycles, minimizing the time wasted in the transition period or by charging when already full. This has a couple of imperfections but it is close enough for me:

  1. Optimally it would go into night with a full charge (assuming we aren’t skipping nights) as there is plenty of time to discharge during the night. So a better system would switch to charging before nightfall even if not completely discharged to maximize collected power during the day. However implementing this properly requires a complicated comparison between the time of day and the charge level and needs to take the fluctuating charge rate into account so I decided to skip this.
  2. If there is nothing pulling power and the stored charge is low it should start charging again. Otherwise it will just sit at low power doing nothing, then when something actually starts to use the power it will only get a small amount before the solar generator flips back into charging. This is very complicated to implement as you would need to track the time since the last change of charge level (charge level is reported in 16 steps). Furthermore since redstone signals degrade with distance it would be very difficult to implement this for the lower charge levels where this feature is most important. However I think many factories pull constant power anyways so this is a lot of effort to improve a minor edge case.

My Solution

My solution is fairly simple, I suspect it could be tweaked to a more compact layout. However the total build cost is quite low.

image of circuit

Extent Detector

image of circuit with extent detector highlighted

The circuit detects when we are at either extent of the battery’s charge. The generator produces a redstone signal between 0 and 15 for the charge level of the internal battery. The left branch detects the zero case and the bottom branch detects the 15 case. By combining these together we can lock the latch for every value but these two extents.

Detect 0

This simply uses a Redstone Repeater to take the 0-15 output and produce 0 for 0 and 15 for anything else. This is then negated with a Redstone Torch to produce 15 for 0 and 0 for everything else.

Detect 15

This is a simple comparator against a redstone torch to produce 0 for 0-14 and 15 for 15.

Latch

image of circuit with latch highlighted

The most important part of the circuit is the latch. This ensures that the state is only changed when the storage is full or empty. This uses a native Minecraft feature where two Redstone Repeaters next to each other form a multi-block flip-flop.

When the latch is unlocked we use the value from the Detect 0 condition to set the output to charge != 0. This way when the charge is 0 we disable transmission (start charging) otherwise we enable transmission (this is always 15).

One important detail is to change the delay of the output repeater to 3 ticks. This ensures that the correct value is latched.

Top comments (0)