About: We are a team of IoT & Embedded Systems developers. We are working in Raspberry Pi and Arduino.

Intro: Plotting-real-time-sound-sensor-data-from-Arduino-using-Python

Introduction to Project:

In this Project we are going to interface sound sensor to Arduino. and then we are going to plot the graph of those analog values using python. For that purpose we have connected our Arduino to Raspberry pi. So here Arduino is throwing data to raspberry pi through it's serial port and we are using one python script in raspberry pi to plot the graph of those analog values.

Step 1: Installation of All Software

1) Raspbian OS:

This is the recommended os for raspberry pi. You can also installed other OS from third party. Raspbian OS is debian based OS. We can install it from noobs installer. you can Download here

2) Python idle:

This is the software we get in raspbian os. For this project we have used python script.

3) Arduino IDE:

You can download the latest Arduino IDE from this link:

Step 2: Component Used

1) Raspberry pi 3

2) Arduino UNO

3) Sound Sensor

4) Jumper Wire

1) Raspberry pi 3:

This is the latest version of raspberry pi. In this we have inbuilt Bluetooth and wi-fi, unlike previously we have to use Wi-Fi dongle in one of its usb port. There are total 40 pins in RPI3. Of the 40 pins, 26 are GPIO pins and the others are power or ground pins (plus two ID EEPROM pins.)There are 4 USB Port and 1 Ethernet slot, one HDMI port, 1 audio output port and 1 micro usb port and also many other things you can see the diagram on right side. And also we have one micro sd card slot wherein we have to installed the recommended Operating system on micro sd card. There are two ways to interact with your raspberry pi. Either you can interact directly through HDMI port by connecting HDMI to VGA cable, and keyboard and mouse or else you can interact from any system through SSH(Secure Shell). (For example in windows you can interact from putty ssh.) Figure is given above.

2) Arduino UNO:

Arduino/Genuino Uno is a microcontroller board based on the ATmega328P (datasheet). It has 14 digital input/output pins (of which 6 can be used as PWM outputs), 6 analog inputs, a 16 MHz quartz crystal, a USB connection, a power jack, an ICSP header and a reset button.

3) Sound Sensor:

Sound Sensor can detect the sound intensity of the environment. The main component of the module is a simple microphone, which is based on electret microphone. This module’s output is analog and can be easily sampled and tested.

Step 3: Circuit Diagram

Circuit Diagram of this project is given above.

Here are the connections of our First figure

Arduino Sound Sensor


3.5 v-----------Vcc


In second figure Arduino directly connected with Raspberry Pi

Step 4: Working of Plot

Here are the command to install graph plot on raspberry pi:

sudo apt-get install python-matplotlib
sudo apt-get install python-pip

sudo pip install drawnow

sudo pip install pyserial

After installation you can run python script i.e

you run that file and get the output like above figure

Step 5: Code for Project

We already posted our source code of this project in github

we've given our level of best to make you understand this project. Still if you have any doubt feel free comment us below
So finally if all things will go well. Definitely you will enjoy this also mail us on

Thanks & Regards,

Deligence Technologies



    • Audio Contest 2018

      Audio Contest 2018
    • Fix It! Contest

      Fix It! Contest
    • Furniture Contest 2018

      Furniture Contest 2018

    2 Discussions


    1 year ago

    Hi friends,

    Help please. It doesn´t work for me.

    pi@raspberrypi:~ $ sudo pip install drawnow
    Collecting drawnow
    Downloading drawnow-0.71.3.tar.gz
    Collecting matplotlib>=1.5 (from drawnow)
    Downloading matplotlib-2.0.2.tar.gz (53.9MB)
    99% |████████████████████████████████| 53.9MB 464kB/s eta 0:00:01Exception:
    Traceback (most recent call last):
    File "/usr/local/lib/python2.7/dist-packages/pip/", line 215, in main
    status =, args)
    File "/usr/local/lib/python2.7/dist-packages/pip/commands/", line 335, in run
    File "/usr/local/lib/python2.7/dist-packages/pip/", line 749, in build
    File "/usr/local/lib/python2.7/dist-packages/pip/req/", line 380, in prepare_files
    File "/usr/local/lib/python2.7/dist-packages/pip/req/", line 620, in _prepare_file
    session=self.session, hashes=hashes)
    File "/usr/local/lib/python2.7/dist-packages/pip/", line 821, in unpack_url
    File "/usr/local/lib/python2.7/dist-packages/pip/", line 659, in unpack_http_url
    File "/usr/local/lib/python2.7/dist-packages/pip/", line 882, in _download_http_url
    _download_url(resp, link, content_file, hashes)
    File "/usr/local/lib/python2.7/dist-packages/pip/", line 603, in _download_url
    File "/usr/local/lib/python2.7/dist-packages/pip/utils/", line 46, in check_against_chunks
    for chunk in chunks:
    File "/usr/local/lib/python2.7/dist-packages/pip/", line 571, in written_chunks
    for chunk in chunks:
    File "/usr/local/lib/python2.7/dist-packages/pip/utils/", line 139, in iter
    for x in it:
    File "/usr/local/lib/python2.7/dist-packages/pip/", line 560, in resp_read
    File "/usr/local/lib/python2.7/dist-packages/pip/_vendor/requests/packages/urllib3/", line 357, in stream
    data =, decode_content=decode_content)
    File "/usr/local/lib/python2.7/dist-packages/pip/_vendor/requests/packages/urllib3/", line 314, in read
    data =
    File "/usr/local/lib/python2.7/dist-packages/pip/_vendor/cachecontrol/", line 63, in read
    File "/usr/local/lib/python2.7/dist-packages/pip/_vendor/cachecontrol/", line 50, in _close
    File "/usr/local/lib/python2.7/dist-packages/pip/_vendor/cachecontrol/", line 275, in cache_response
    self.serializer.dumps(request, response, body=body),
    File "/usr/local/lib/python2.7/dist-packages/pip/_vendor/cachecontrol/", line 87, in dumps


    1 year ago

    Nice! In your code on github, sample rate is one reading per second. How fast this approach can actually work? What is its speed limit?