You have identified a major theme of this excellent play. Clearly the conflict between the security of the community and individual freedom runs throughout the play. Salem was a community which felt under demonic siege, threatened by the dangers of the wilderness, the possible corrupting influences of other Christian sects, and a genuine fear of the devil. The play also has obvious parallels with the McCarthy investigations, which were proceeding when it was first produced.
One way of viewing the play is as an allegory of the abuse of state power by those who persecuted and denounced people who were thought to be undermining the American way of life. Just as in Salem, any who opposed McCarthy's investigations were treated as enemies of the state.
Against the Machiavellian manoeuvres of people in the play like the Putnams, who deliberately sweep up a crowd frenzy for their own purposes, it is the place of the few to stand up against the madness of their society and maintain the truth. Unfortunately, in the play, this normally brings a sad fate upon these characters. The best examples, and ones you will want to investigate further, are Rebecca Nurse, Elizabeth Proctor, Giles Corey and, at the end, John Proctor, who only finds peace when he paradoxically goes to his death.