How lorenzopalaia/arduino-oscilloscope works
Main Components
a. Arduino Firmware:
• Divided across the “avr_common” and “avr_src” directories.
• The “avr_common” directory includes shared source files such as ADC and UART interrupt code, along with configuration (avrdude.conf and avr.mk).
• The “avr_src” directory contains the main firmware (arduino.c) and a Makefile to build/upload the firmware.
• Implements two sampling modes (continuous and buffered) and uses interrupts to time the sampling and communication events.
b. PC Client Application:
• The “client_src” directory contains client.c which is responsible for configuring the serial port, transmitting configuration parameters to Arduino, and receiving ADC samples.
• Handles user input, error checking, serial communication using termios, and writing the received data into output files (located in the “outputs” folder), one per channel.
c. Visualization Component:
• The project uses Gnuplot for graphing the sampled data at client termination.
• The shell script “run.sh” ties the build process and integrates Gnuplot into the workflow.
d. Additional Assets & Configuration:
• The provided LICENSE.txt and README.md serve documentation purposes.
Relationships and Data Flows
a. Interaction between Arduino and Client:
• That parameters (sampling frequency, sample size, selected channels) are sent from the client to the Arduino and ADC values are sent back.
b. Client to Gnuplot:
c. Hardware and External Interactions:
• An “Arduino Hardware” block that connects the firmware implementation to the physical sensors (potentiometer, ADC channels) and to the PC via a USB/serial port.
Architectural Patterns and Design Principles
a. Separation of Concerns:
• That the firmware and client code are neatly split (embedded vs. PC application factors), each with its own build process (Makefiles in “avr_src” and “avr_common”, possibly a separate compile process for “client_src”).
b. Interrupt-driven processing in the firmware: clearly indicate the role of interrupts in managing ADC sampling and communication.
c. Reliable I/O Handling:
• The client application ensures robust file I/O operations and serial communications, including proper error handling and resource cleanup during termination.
d. External Data Visualization:
• Gnuplot integration is a key design choice for real-time graphing, ensuring users can immediately view oscilloscope outputs.
Relevant Technologies & Libraries
• Arduino, AVR C, and use of Makefiles for firmware builds.
• C programming for the client application including termios for handling serial port I/O.
• GNUplot for rendering output graphs.