I don’t like to be discouraging, but what I see is another in a long line of attempts at a perpetual motion machine. Ask yourself this: where is the energy coming from? In your first sketch, the energy is stored in the gravitational potential of the mass. Once you have let the mass go and recovered the energy from it in the form of electricity, you will have to winch it back up in order to let it fall again. The energy comes from the muscles of the person doing the winching.
In your second sketch, the energy is stored in the gravitational potential of the pendulum at the top of its arc. Let’s say you can extract 50% of the gravitational potential energy each time it swings. At the end of the first swing, the pendulum will have 50% of its energy left and will therefore have risen half as high on the other side. Then at the end of the second swing it will have 50% of that remaining energy left and will rise half as high again - 1/4 of the original height. In other words, it will very quickly run down unless you keep putting more energy in by pushing the pendulum or lifting it back up again. As before, the energy comes from whatever mechanism you use to push the pendulum. There ain’t no such thing as a free lunch (and no free energy either - except for Solar,and even that will run out in a few billion years)