Sunday, August 12, 2018

Getting started with Raspberry Pi 3B+ , Arduino and Active / Passive Buzzer



Hi,

 I like to share my experience connecting Raspberry Pi 3 B+ , Arduino Uno , Active Buzzer ( KY-012)   /  Passive Buzzer ( KY-006) 


I.Things Needed :

 1. Raspberry Pi 3 Model B+


 2. Arduino Board

           

 3. Solderless board

 4. 3 Male to Male Jumper wires.


5. Active Buzzer ( KY-012)






or  Passive Buzzer ( KY 006)



6. USB A to USB B Connector ( to connect Raspberry Pi 3 B+ with Arduino )






II.  Install necessary packages :

a) Install Arduino IDE in Raspberry Pi 3 B+ with :

sudo apt-get install arduino
After installation, you will see the Arduino IDE as follows in Raspberry desktop :

                    
b) Connect Arduino and Raspberry Pi using USB A to USB B Cable :



You will be seeing board light blinking in Arduino board.



III.  Circuit Completion

Complete  the circuit has shown below : 




                 Arduino Pin connection 
Buzzer S  Pin ( Signal)  :  to  Arduino : Pin 8

Buzzer  ve Pin : to   Arduino  Ground Pin


Please note that both Active / Passive Buzzer have the same circuit diagram 

Completed circuit :






   
IV. Tone Melody program

a)  Go to Arduino IDE, Choose the type of Arduino board : go to Tools > Board > Arduino Uno.

b) Select the port the Arduino is connected to, look under Serial Port under the Tools menu ( serial port in the raspberry Pi will be like /dev/ttyACM0). 


c) Go to File >  Examples > Digital > toneMelody



d) Ensure  the pin number in the Program is Pin 8 in the function tone() :

                  tone(8
                             

e) Compile the tone Melody program by clicking the tick button( left most button in IDE )

f) Click the upload button to upload the blink program.


IV. Executing the blink program

a) Output will appear as shown below :





b) Now disconnect  USB cable connecting Raspberry Pi , Arduino.

Now connect the USB cable to any Mobile USB charger.  Press the Reset button in Arduino. You will get the buzzer playing the tone.

Now , you have successfully connected Raspberry Pi , Arduino and Active / Passive Buzzer.

Kindly share your comments to improve my posting.








No comments:

Post a Comment

Mastering IoT Development

Hi, Before reading this post, I would recommend to read the post : https://johnsylvester-johnsylvester.blogspot.com/2018/09/iot-key-co...