To interface a sound sensor to Arduino. and plot the graph of those analog values using Python through Arduino to Raspberry Pi. Here Arduino is sending data to Raspberry Pi through a serial port. We are using one Python script in Raspberry Pi to plot the graph of those analog values.
Software Installation- Raspbian OS: This is the recommended OS for Raspberry Pi. You can also install other OS's from a third party. Raspbian OS is Debian-based OS. We can install it from NOOBS installer. You can download it here.
- Python IDLE: This is the software we get in Raspbian OS. For this project we have used Python script.
- Arduino IDE: You can download the latest Arduino IDE from this link: https://www.arduino.cc/en/Main/Software.
- Raspberry pi 3
- Arduino UNO
- Sound Sensor
- Jumper Wire
This is the latest version of Raspberry Pi. We have built in Bluetooth and WiFi. Unlike previously we'd have to use a WiFi dongle in one of its USB ports. There are a 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 ports and 1 Ethernet slot, 1 HDMI port, 1 audio output port and 1 micro USB port and also many other things you can see in the diagram below. We also have one micro SD card slot where we have to install 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 below.
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.
A sound sensor can detect the sound intensity of the environment. The main component of the module is a simple microphone which is based on an electric microphone. This module’s output is analog and can be easily be sampled and tested.
Here are the connections of Arduino and Sound Sensor:
Arduino Sound Sensor
- GND----------GND
- 3.5 v-----------Vcc
- AO-------------OUT
Here are the commands 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 the Python script, i.e. plotArduino.py
You run that file and get the output like the figure below:
Comments