Studying Physics, getting to know Python: RC circuit, simple experiments, coding and data analysis with Raspberry Pi
Abstract
Raspberry Pi (RPi) is a well known single-board computer natively equipped with a Linux-based operating system, Raspbian, and a powerful programming language, Python. In this work, we propose an integrated project on physics and computer science exploiting RPi and Python: a set of lab activities, coding, and discussion related to the study of charging and discharging phases of a capacitor in an RC circuit. In our simple experiments, entirely computer-controlled, the RPi and Python scripts are used to: (i) apply a known constant voltage to the circuit at a desired time; (ii) measure the voltage on selected circuit elements as a function of time; (iii) evaluate and analyze experimental data. This approach is based on inexpensive hardware and open source software. It allows a hands-on experience with electric circuits and with dedicated examples of Python coding. The codes involve Python modules such as Numpy, Scipy, and Matplotlib that prove to be easy to use and efficient for our goals, supporting the choice of Python language for further study or research tasks.