r/CreateMod • • Aug 17 '26

Build I made a program that automatically turns solar panels from Power Grid towards the sun

In theory this should work even if you unload the chunk, as I save the difference between the panel angle and swivel angle, but there is a CLI tool to correct the error if anything goes wrong. It is not perfect, but I have wattage approximate to the peak through the day.

The panels only turn from -90 to 90 degrees, at 6:00 to 18:00 ingame. The setup uses a speed controller and a 1/20 gear ratio. The swivel bearing is used for error correction, as the solar panel bearing doesn't have the angle information on it.

You can in theory attach as many panels as you want, but I haven't really tested what happens if only one chunk is unloaded.

Pastebin for ComputerCraft: https://pastebin.com/1h5jtqSL

257 Upvotes

34 comments sorted by

33

u/Big-Uzi-Hert Aug 17 '26

Is there battery packs to store power for when it’s dark? I just downloaded this mod yesterday but have been too sick to play

19

u/Bright-Historian-216 Aug 17 '26

there are batteries, but i have no idea how to pull electricity out of them. i might just be stupid though

3

u/IdkIWhyIHaveAReddit Aug 17 '26

If it is anything like real life try reverse the input and output of the battery to get power out instead of in. Idk i never tried the kod

2

u/Bright-Historian-216 Aug 17 '26

oh, that must be it! thanks!

7

u/Big-Uzi-Hert Aug 17 '26

Interesting… I’ve been watching some tutorials on YouTube and this seems like a difficult mod to use and understand. I’ve got my limited electrical license after completing my gas fitting license and a lot of this stuff doesn’t make sense to me lol. Cudos to you for figuring this out. In the video I was watching I was wondering if you could automate to track the sun like you did. This answers my question I had last night lol

2

u/Born-Loss-5576 Aug 18 '26 edited Aug 18 '26

Create craft & addition have accumulator which store FE and act exactly like battery, very pricy but fair. Create connected have SU battery where it store SU for future uses. I think there's also accumulator-like block in TFMG, but never explore it as I don't really like TFMG, personal opinion.

Edit: I also forgot the fact that power grid itself have battery itself lol, I don't understand how to recharge it tho. I just think accumulator is just superior and easily applicable to any appliances, again, personal opinion.

6

u/Lonely_Agency_5058 Aug 17 '26

Wonderful work! How do you think, is it possible to build some similar to this without Computer Craft?

5

u/Bright-Historian-216 Aug 17 '26

it is possible with just create and powergrid if you never sleep and never unload the chunk

4

u/Quiet-Upstairs6594 Aug 17 '26

daylight sensors could be used to reset a timer, hopefully making a less "complex" algorythm

3

u/Bright-Historian-216 Aug 17 '26

os.time always returns the in game time, there are no timers used in the code

1

u/Quiet-Upstairs6594 Aug 18 '26

talking about a method of never needing to use CC in any way

1

u/Lonely_Agency_5058 Aug 17 '26

Pity that you have to be sleep deprived for this to work, but there are mods to have a chunk always loaded, so, I guess that's a good start

1

u/Bright-Historian-216 Aug 17 '26

maybe you could make this work with the torsion spring from aero though?

1

u/Lonely_Agency_5058 Aug 17 '26

Probably, idk yet ¯_(ツ)_/¯

2

u/Bright-Historian-216 Aug 17 '26

in theory you could attach a daylight sensor to a gearshift then feed that to the torsion spring. the spring will wind up at night and slowly move during the day

2

u/IAmTheStarkye Aug 17 '26

Clockwork bearing

1

u/Bright-Historian-216 Aug 17 '26

unfortunately panels need their own bearing, and i don't think you can put a bearing on a bearing.

1

u/IAmTheStarkye Aug 17 '26

Ah, that is true, it would need something like aeronautics to work ig

1

u/Bright-Historian-216 Aug 17 '26

even if you put it on a swivel i don't think you can connect wires between sublevels

1

u/IAmTheStarkye Aug 17 '26

Wasnt the mod compatible with aeronautics?

2

u/Bright-Historian-216 Aug 17 '26

i just tried that, and indeed it is possible! the wires have a fixed size though, and there isn't enough wiggle room really

1

u/IAmTheStarkye Aug 17 '26

Ah, sounds like its more trouble than using CC, tho as another non-cc alternative that doesnt use other mods it should be possible to use citcuits to make a PID controller for it. (It would be easier to use CC too lol)

2

u/totallymarc Aug 17 '26

Damn, and I’m over here just happy I can turn my lights on without blowing up my generator (and even then I screw up sometimes when I add devices lol). Maybe I’ll try to make a circuit / redstone version of this once my hydroelectric dam is no longer enough.

1

u/Bright-Historian-216 Aug 17 '26

i blew two resistors and a device connector when connecting the rotor in my survival world

1

u/totallymarc Aug 17 '26

Man I’ve lost track of how many devices I’ve blown up so far. Electric motors, device connectors, generator coils, rheostats, bulbs… it’s a miracle I haven’t died to electrocution yet.

1

u/Novel_Emu_8191 Sep 23 '26

The computer keeps saying the ‘c’ is a nil value (line 23). How do I fix that?
Also how did you get it all wired up? I can’t figure it out

2

u/Bright-Historian-216 Sep 23 '26

the first few lines after the large comment are the constants that the program uses. c is the rotation speed controller. modify the code so that c points to the correct peripheral id.

the wiring involves a 1/20 rotation ratio. i don't remember precisely, but i think the analog lever powering the adjustable chain drive (or whatever it's called) is set to 3, and everything else is just basic cogwheel division by two.

1

u/lalalarix0 Aug 17 '26

tan seme a la sina kepeken sitelen pona lon musi Manka 😭
sina alasa e ijo kepeken lipu pi jan sewi kepeken nasin seme??
sina sona ala sona e nimi pi ijo ale lon musi Manka?

2

u/Bright-Historian-216 Aug 17 '26

mi alasa e ijo kepeken ilo Ajemi. mi sona ala e nimi ijo la mi pana e nimi Inli ona tawa ilo JEI

1

u/lalalarix0 Aug 17 '26

aaaa sona, mi weka sona e ken pi ilo JEI

1

u/Terrible_Cellist6417 Sep 22 '26

i was just planning on doing this out myself :0 thank you for saving me some time :>

-2

u/vivoxti Aug 17 '26

Which mod are these solar panels from?

13

u/Bright-Historian-216 Aug 17 '26

"solar panels from Power Grid" 🫩✌️

5

u/Xenometan Aug 17 '26

Bro, the mod name is sometimes either in the title or in the description. Please read.