Project was developed for "Sistemi Operativi" class, Ingegneria Informatica e Automatica, Università La Sapienza. The project involves the development of an oscilloscope that samples an adjustable voltage through a potentiometer up to 8 channels.
The oscilloscope samples in two modes, continuous and buffered, according to the other parameters received by the computer which are the sampling frequency, the number of samples and the channels to be sampled. The communication is realized through interrupt and the sent strings are well defined so that they can be tokenized by both devices. The voltage value is sampled in a range between 0 and 1023 by the ADC, associated with the correct channel number and sent to the client on the computer that converts it into a voltage in the range between 0V and 5V.
The client starts searching the Arduino among the serial ports, opens its file descriptor, sets the communication parameters via termios and finally opens the descriptors of the output files. This whole phase is accompanied by a precise error handling. In the main loop, the program asks the user to enter the parameters for sampling, asks for confirmation by showing them and sends them on the serial. The user input phase is also readily managed, this time by macros. The client then puts on hold to receive the samples on the serial and then writes them to the output files, one for each channel. An interrupt manager has been installed to exit the main loop. When this is called, it will execute the functions to terminate the program correctly, taking care to close all the open resources in order to not occur in memory leaks.
A last line is inserted in the shell script which invokes Gnuplot to plot the sampled data at client termination.
The schematic shown uses Arduino Uno but it is possible to extend it to Arduino Mega 2560 reaching up to 16 different channels. For demonstration purposes we use only one potentiometer so the sampled outputs will be the same on all channels
- Clone the repo
git clone https://github.com/lorenzopalaia/Arduino-Oscilloscope.git
- Plug in your Arduino, wire it up, get in the project folder and run
cd Arduino-Oscilloscope sh run.sh
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
Distributed under the MIT License. See LICENSE.txt
for more information.
Lorenzo Palaia - lorenzopalaia53@gmail.com
Project Link: https://github.com/lorenzopalaia/Arduino-Oscilloscope