Introduction: Sound a Piezo Buzzer With Blynk and XinaBox

Control any 5V element using Blynk and xChips. This project sounds a Piezo Buzzer from my phone.

Step 1: Things Used in This Project

Hardware components

  • XinaBox IP01 x 1
    xChip USB Programmer based on FT232R From FTDI Limited
  • XinaBox CW01 x 1
    xCHIP Wi-Fi Core based on ESP8266 Wi-Fi Module
  • XinaBox OC01 x 1
    xChip High Current DC Switch
  • XinaBox PU01 x 1
    xChip USB (Type A) Power Supply
  • Buzzer x 1
    Any Piezo-electric buzzer would suffice or any element you would like to control
  • Power Bank or Similar x 1

Software apps and online services

Hand tools and fabrication machines

  • Flathead Screwdriver

Step 2: Story

Introduction

This project was built using XinaBox xChips by simply clicking together the different xChips and writing basic code. I could then control a piezo-electric buzzer from my phone using a Blynk Project which I created.

Wireless Piezo Buzzer Control Using Blynk and xChips

Step 3: Setting Up Blynk

Firstly, you need to download Blynk on your iPhone or Android phone from the Apple Store or Google Playstore respectively. Create an account for yourself which is fairly straight forward. Login using your newly created details. Select 'New Project' and then give your project a name. I've named mine Piezo Blynk as illustrated below. Also select the ESP8266 board using the drop down box. Press on Create and your new project will be created. A pop up will appear notifying you that an authentication token was sent to your email; press OK.

Next we need to add our widget to switch the buzzer on or off from our Blynk Project. Select the plus sign (+) in the top right corner. Your Widget Box should appear. Select the 'Button' widget by simply pressing it once. The Button should now appear on your project's work space. Refer to the below screenshots for graphical instructions up to this point.

Creating your Blynk project

Now press on the button which you just added to open up 'Button Settings'. Select 'PIN' and choose 'Virtual' on your left. You may then select any virtual pin on your right side. I've chosen V10 for my project. You may change button labels if you want but that is not necessary. Select 'SWITCH' for better control and leave everything else as is. Press back and you have now completed setting up Blynk. Follow the image below for guidance.

Selecting the settings for your pins

Step 4: Assemble to Program

Connect your IP01 programmer xChip with CW01 using an XC10 bus connector as shown below. Then insert the combination into an available USB port on your computer.

Programming Assembly

Step 5: Programming in Arduino

In order to use the xChips, you'll need to download the following libraries and add them to the Arduino libraries.

Next, Download the code in the Code section or copy and paste it into your Arduino IDE. Enter your WiFi details and copy and paste the authentication token that was emailed to you in Step 1 into their respective fields. See below.

Authentication Token and WiFi details to be entered.

You may now upload the code to your board after you've run a successful compilation.

Step 6: Final Assembly

Once uploaded remove the combination from your computer and replace IP01 with PU01. Place IP01 aside as you will no longer require it. Now assemble your project as per the image below. You may connect the xChips any way you want as long as all the identification names are orientated in the same direction.

Final Assembly

As seen above, the piezo buzzer is screwed into the terminal output which was used in our program; in this case OUT0. You may select any of the four outputs of your choice; just remember to make the changes in your code. You can screw the red wire in the positive terminal and the black wire in the negative terminal as a convention but it doesn't matter since piezo buzzers aren't polarity conscious.

Step 7: Power Up

You may power up your project with your computer or a normal power bank. Insert the project into the power bank. Open up your project which you created earlier on your Blynk application and select the play button in the top right corner. If your project is powered up, a connection will be established. You may now press the widget button you've previously added and the red LED on OUT0 output should light up along with your piezo buzzer sounding. Press the button widget on and off and be fascinated about how you can control a buzzer with your phone.

Wireless Piezo Buzzer Control Using Blynk and xChips

Step 8: Conclusion

This project took about 25min to complete. I simply clicked together the xChips and screwed in the piezo buzzer into the terminals. No soldering and no mess. You can turn on any 5V element over a WiFi connection using your phone.

Step 9: Code

Piezo_Blynk.ino Arduino
Simply enter your WiFi details and the authorization token into their respective fields and you're ready to upload your code to your xChips

#include                   // include core library
#include                   // include high current dc switch libray
#include                   // include ESP8266 library used for wifi
#include                   // include Blynk libary used with ESP8266

// authentication token that was emailed to you // copy and paste the token between double quotes char auth[] = "your authentication token"; // your wifi credentials char WIFI_SSID[] = "your wifi name"; // enter your wifi name between the double quotes char WIFI_PASS[] = "your wifi password"; // enter your wifi password between the double quotes // Blynk function that reads state allows virtual pin readings BLYNK_WRITE(V10) { // call the state selected from your Blynk application int OUT0_State = param.asInt(); // write the state selected on your Blynk application // to OUT0 // 1 = peizo on, 0 = piezo off OC01.write(OUT0, OUT0_State); } void setup() { // put your setup code here, to run once: // start i2c commnication and set pins Wire.begin(2, 14); // start the high current dc switch OC01.begin(); // make unused pins inactive OC01.write(OUT1, LOW); OC01.write(OUT2, LOW); OC01.write(OUT3, LOW); // start Blynk communication Blynk.begin(auth, WIFI_SSID, WIFI_PASS); } void loop() { // put your main code here, to run repeatedly // execute Blnk operations Blynk.run(); }