First and foremost, I should mention that I did not come up with the idea, nor the programming of this code. I’m using the program and code from an open source project called xoscillo. Please check out their website here.
With that in mind, there are only few things you need to get started. The most important is of course your Arduino. You also need an audio cable (3.5mm male to male), some jumper wires, crocodile clips, a 500 ohm resistor, a 10k potentiometer to vary the amplitude, a breadboard to build your circuit, and also a computer.
In the video, I connected my computer sound card to the Arduino because I don’t have a function generator. I’m using the sound card to produce different waveforms using a software. If you have your own function generator, it’s better to use that instead of a computer sound card. And if you want to use a software, simply google ‘software function generator’ and you will find a few there.
For those who are using a software and their computer sound card, make sure that you turn off all audio enhancement features. For my sound card, I need to turn off the X-Fi Crystalizer and also the EQ. This is to avoid any signal distortion.
Next, connect a 3.5mm male to male cable to the speaker output of the sound card, and on the other end, use two crocodile clips to connect the ground and left/right channel. You only need one of the channels (left or right) so it’s your choice. The pinout is as follows.
Then connect ground to the ground of the Arduino and left/right signal to either Analog Input 0, 1, 2 or 3. Make sure that the input goes through the resistor and the potentiometer first before going into the Arduino.
The hardware setup is done so let’s turn to the software. Go to the xoscillo website and download their lastest code and program (it will be in a zip file). In the zip file you will find two files, ArduinoOscillo.pde and XOscillo.exe. Extract both files to your desktop for convenience.
The .pde file actually contains the firmware to run your Arduino as an oscilloscope. To upload the firmware, simply open it with the Arduino IDE and click Upload. Note : This firmware does not work on Arduino 1.0, you need to open it with an older version, such as 0022 in my demo video. After uploading is done, simply run the included program called XOscillo.exe. Have fun 🙂
Here are some screenshots.