Table of Contents Show
Stormworks has no real way to determine when night falls nor when morning comes. With a touch of creativity, however, a daylight sensor can be faked using one of the least useful components in the whole game, and I’m going to show you how.
Stormworks Build and Rescue Building A (Pseudo) Daylight Sensor
Theory and Materials
In order to figure out how much light is in the environment, we need, well, something to measure. The problem here is that there is no way to directly measure light levels and there is only one component that is capable of varying something. The variance of that something cannot be measured directly. That something is electric. But perhaps we can still use this? Well, yes and no. Through testing, I have found that the electrical output of the solar panels isn’t very reliable; even with plenty of daylight left, they stop putting out usable charge fairly early in the evening, so we need to extend the amount of time the “sensor” stays active. At the same time, they begin producing power fairly early in the morning, so we may need to extend how long they’re inactive too.
The solution I came up with is quite simple. It starts with solar panels as they are the only object in-game that react with light levels, and an electric motor. The motor RPS drops as the power coming in drops and it goes back up as the power input goes back up, assuming the throttle level remains unchanged and available power is below the max consumption rate. This already somewhat solves the issue of delayed on/off due to the motor having rotational momentum, but it isn’t quite enough, so I threw a flywheel into the mix. More on that later, but for now, here is a list of components you will need.
- 5 Solar Panels
- 1 Microcontroller (2×2)
- 1 Modular Engine Clutch (1×1)
- 1 Modular Engine Flywheel (1×1)
- 1 Dial or Numeric Display (optional)
According to the description, the solar panel electric output is determined by angle and time of day. For this reason, I placed one panel facing the sky and the other four on each horizontal face, pointing toward the horizon. These can be placed anywhere on the outside of the creation they’re being installed in.
The motor can also be placed anywhere, but know that it will need to connect to the clutch (output end) and the clutch to the flywheel. Note that in the screenshot above, I used a corner pipe to connect the motor to the clutch (output end) and then the flywheel is placed directly to the clutch (motor end).
Create a microcontroller of 2×2 and give it four logic nodes: one number input, one logic output and two number outputs. The number input node measures the RPS of the flywheel and the logic output goes to whatever system you want to activate at night/day (lights, for example). The two number outputs are for convenience. One is the motor throttle and the other is clutch pressure.
Edit the actual logic as described (image to follow):
A constant number block (set to 1) will connect to the number output node for the motor throttle.
Same as above for the clutch output node, but the constant number is 0.1.
Add a less-than block and a greater-than block. The number input node connect to the A input of both blocks just added. Now add two constant number blocks, one for each of the B inputs. The values to use will need to be tested for (will explain later). Now add a set-reset block. Use the less-than block to set the latch and the greater-than block to reset the latch. The latch output goes to the output logic node.
Logic and Electric
With the microcontroller set up, we need to set the logic up. Connect the microcontroller to the motor, clutch, flywheel RPS and whatever system you’re controlling as appropriate. Connect the RPS output to the optional dial/display mentioned earlier if you have one.
For the electric, connect the solar panels together and then to the motor. Do not connect anything to the power grid of your creation, else the system will not work since it relies completely on its own power generation to function. Note that in my screenshot, the battery bank is isolated from the system. It was used to power only the lamp and the dial backlights.
Testing For Values (Configuration)
The system should be fully installed, but in need of configuration. If the flywheel can be directly accessed/viewed, you can use the “Page Up” button on your keyboard to read the RPS. Else, you can use the previously-mentioned optional dial/number display. You can adjust them however you want but the same button can be used to read the exact value being sent to them.
While watching the RPS readout, pay attention to the outside light levels. As it transitions from night to day, the motor will start to spin up, causing the flywheel to spin up too. When the light outside reaches a level you want your lights/whatever to turn off, take note of the RPS. Do the same at night. Note that the “night RPS” should be lower than the “day RPS” due to slow spin-down vs the relatively quick spin-up. Go back into the microcontroller and replace the values in the constant number blocks with the ones you just noted. Remember: less than the lower number and greater than the higher number. Test it to see how it works and readjust as needed.
Since the system actually uses solar panels as the main day/night detection method, this system should theoretically be usable on any server regardless of when the day/night sliders are set. However, since it relies on the angular momentum of a flywheel for delaying the on/off triggers, the microcontroller’s “constant value” blocks will need to be updated whenever the server’s day length is changed. There are a handful of ways to go about doing this and I’ll leave it to you to figure out your own method.
You may also be interested in: