I think the first thing you have to "get" to do this is that "phones" refer to actual pronunciation, and "phonemes" refer to the grammatical "starting point" of those phones. For example, English has a phone "m", and very often it comes from a phoneme /m/, but in a few cases it comes from something else, for example /n/ in im-possible (compare il-legal, in-audible). There is a common teaching position that people don't perceive phones, they perceive phonemes, but this is such a vast over-simplification that I argue that it is false and confusing. Therefore I would urge you to not think of phonemes in terms of perception. Instead, phones are the pronounced outputs, and phonemes are the mental symbols that underlie phones.
When a phoneme changes to something else, this is the result of some rule. In English, we generally claim that there is a phoneme /p/ which has three (or more) physical realizations, [p pʰ p̚]. The choice depends on the phonological context (syllable-finally, foot-initially and "elsewhere" which is where you get [p]). There are no cases of underlying /pʰ/ or /p̚/ in English – all instances of [pʰ p̚] are the result of applying a rule (an "allophonic" rule) to the single phoneme /p/.
"Free variation" refers to physical variation that does not come from applying an obligatory phonological rule in some context. Sometimes words just have two pronunciations ([i, ɛ] in the first syllable of "economic"), and this can apply to phrases as well – "Jack is leaving" vs "Jack's leaving". Sociolinguists like to point out that these variants are conditioned by some social feature, like speaker attitude, register, etc. From the phonological perspective, these are "free" i.e. not conditioned by anything in the grammar, they are conditioned by something outside of grammar.
In your example, the question of two phonemes vs. one phoneme has to be answered with reference to the question "do you have both things underlyingly?". We say in English that [pʰ p̚] are not phonemes because every instance of those sounds can be reduced to one phoneme /p/ plus the application of certain rules. But /t/ and /d/ are separate phonemes (there are two phonemes), for reasons that I assume are clear. While we therefore reason that [tʰ t̪ t̚ ɾ ʔ] are all allophones of something and are not phonemes, we can't always determine which phoneme [ɾ] is an allophone of (it can be /t/ or /d/).
FYI, post-consonantal occlusion – β → b / N__ – is very common in Bantu languages.