In the most general sense possible: if you want to demonstrate perpetual motion (i.e., "free energy") what you must do first to check your work is write down an energy balance for the device. You do this by drawing a dashed line around the device on paper, thereby establishing a control volume around it, and then do the book-keeping sums for all forms of energy that either enter, get stored inside, or exit the control volume.
Any device in which the energy leaving the control volume exceeds that entering it plus what is being stored inside it indicates an error in your analysis. Your homework assignment is then locating that error.