I don't get the basic physics premise of this gizmo. If the shaft and cams at the right have to lift the levers with the blocks, this will put potential energy into the system. When the blocks fall, this is converted into kinetic energy. There is no net gain - you can not get more energy out than the mechanical energy you put in, via the cam shaft at right. In fact having the fall motion be transferred to the generator through multiple spur gears, bearings etc there will be further significant efficiency and friction losses. Forget about Arduinos or other sophisticated control methods - the basic physics are not there for generating electric power reasonably efficiently with this thing.
Now if you had something naturally gravity driven, like falling water, or a windmill to lift the blocks and spin a generator with a lower friction more efficient power transmission method, that would be a better starting point.
Or better yet, eliminate the transmission and use falling water or waves / tides to direct drive a generator. Boring, and it's been done, but it works, and has a lot more energy density than other natural energy sources like wind or photons from the sun.