Diagnosing from here is difficult. The burning rubber/plastic smell is suspect! What you describe makes me tend to think you have a bad ground or intermittent short somewhere. I would start checking wires at the battery and then in to the electrical side panel and then up behind the headlight. Lastly, if the TTR is like a TW I would look at the wires from the engine side cover that go up to the battery. I don't know the TTR but TWs have wires that get pinched when some change the front sprockets. You are searching for melted wires or chaffing where a wire might be touching bare metal. Check all the grounds. If the TTR is like a TW it will have a ground under the tank where the coil is attached.
A bike that runs good sometimes and at other times starts popping and sputtering makes me think electrical rather than carburetor. I would be checking every wire and every connection from one end to the other. Your battery drained and went dead for some reason and when you put a fully charged battery on line you smelled burning. Find the culprit!