Miniscope in vivo calcium imaging is a powerful technique to study neuronal dynamics and microcircuits in freely behaving mice. This protocol describes performing brain surgeries to achieve good in vivo calcium imaging using a miniscope.