All perfect praise be to Allah, The Lord of the Worlds. I testify that there is none worthy of worship except Allah, and that Muhammad is His slave and Messenger.
It is forbidden for you, dear questioner, to earn forbidden money whether from Riba (interest and/or usury), or any other ill-gotten money.
Your intention to donate it in charity is not a justification for earning forbidden money.
Rather, you are obliged to refrain from earning forbidden money and repent to Allah from it.
With regard to the forbidden money that you had earned before repentance; you should spend it in venues of virtue as a way of getting rid of it and not as charity, because Allah is Tayyib (pure) and only accepts that which is pure.
Getting rid of it is done by giving it to the poor, the destitute, the indebted and other needy people. It can also be given to Quran memorization Centers or for public benefits, such as building mosques, hospitals, schools, bridges and other public benefit.
Allah knows best.