Automatically change user role after membership expiration


Say, I've got 2 membership (Free and Premium) both with custom roles and capabilities.
New users create their Free account whith custom role. They can signup for premium account to get additional capabilities for plugin usage.

I'd like to know how to automatically change the user role after Premium membership expires. I'd like Premium membership to change to Free membership (downgrade the user) automatically if the Premium membership expires.

How could I do it with the use of any of your plugin? or users must be downgrade manually?