Home Made Model of Electronic Bat by Using Arduino Uno | Do it Yourself Project

Hi hello Electronics Lovers, today I bring something new and interesting for you guys. In this tutorial, I will show you how to make an Electronic Bat by Using Arduino ide and development software tool for coding known as Processing. This is a “do it yourself project” I have explained everything in a clear and easy way.

“The theme of this project is to detect objects in space or ground for surveillance purposes. Whenever an object is detected by ultrasonic sensors, it will make an alert sound and will display distance and angle of the targeted object right on your Computer screen.” 

Novelty in this project:

  • Used two Ultrasonic Sensors at the same time to cover the whole area (360 Degrees).
  • Successfully added a Real-time Target Alert sound. 
  • New Model has been Designed 


Hopefully, everyone who is reading this article right now must be aware of how SONAR and Radar works, if you are new and don’t know anything about radar then must read basics of radar here. 

Components and Softwares needed for this Arduino Project:

  • Two Ultrasonic sensor HC- SR04                         
  • One Servo Motor
  • Arduino Board ( Uno, pro, nano, mega )
  • Wire Board 
  • Jumper Wires
  • Led 
  • Wood stick
  • Arduino IDE ( software )
  • Processing ( Software ) 

Building the device:

I have shown everything carefully in the video, Kindly watch the video for better understanding.

Circuit Schematics:

As you people can see that I have connected Trigger pins of the two attached Ultrasonic Sensors to the Pin No 10 of the Arduino Uno Board. Echo Pins of the Distance sensors have been connected to the pin No 11 of the Arduino Board. 
I have connected Control wire (yellow) of the Servomotor to the Pin No 12 of the Arduino Board.  

External Power for Arduino:

As we can see that this project is truly based on serial communication between Arduino IDE and Processing Code software. For serial communication, we will connect our Arduino Board to the PC through USB cable. Yes everyone knows that we can give power to our Arduino Board directly from the PC through the USB cable without using an external power supply. This is perfect but in this case, you are using servo motor and of course, it will require more current to operate accurately.
First, you need to Turn on your Arduino board by using your pc but if you found that the movement of the servo motor is slow or laggy or irregular then use an external power supply to the jack of the Arduino or Vin pin (Do not unplug USB cable). I am going to clear one thing, many students and hobbyists are still confused and think that their Arduino board will blow away if they use the External power supply at the same time when Arduino board is connected to the pc through USB cable. This statement is totally wrong, you can give power to the Arduino board by using both sources at the same time and Arduino board is intelligent device it will choose the best input power having more current as compared to the other one. 

Source code:

Before going to get a copy of a source code for this project, first, you need to Download a Processing Code development software. Processing Code development Software is a free and open source programming tool, everyone can download and use it for free for their projects and research related to computer science or Electrical and Electronic Engineering. From past few years, Processing interface with Arduino is a hot topic in the technology domain. Processing software helps us to show our serial data in a real-time right on our PC screen with different graphics simulations. In this Project, Processing Software will receive data from the two Ultrasonic Sensors with the help of serial communication. A radar Graphical Simulation will appear on your screen to display Distance and angle of the target. 
Download Processing Code and paste on processing window. Before going to press Run button you need to save your sketch first and it will create a folder like sketch0123. Download required font, Once you download font go and paste that font file in your sketch folder. Remember It will show an error until you didn’t paste the right font file inside sketch folder. 

Audion Libray for Processing for Arduino Ide: 

First, you need to Download Audio Library for Processing or update your processing libraries online. Minim is the most popular sound library for processing. I have used Minim Library for Target alert sound. You can change Sound of target alert easily by changing few words in code, even you can add your own voice too. 

Don’t worry I am here to answer all of your questions related to this project.

Related posts

Arduino Opta PLC Pros & Cons

Breakthrough of Ardino-Pro Opta: Micro-PLC with industrial IoT proficiency

Top Arduino sensors – the ultimate list 2021


Ahmed Mubarak November 2, 2017 - 10:44 pm

What is the name of program use on lap top to know there is some thing near ultra sonic ?!

zozo April 10, 2022 - 9:15 am

the website containing the codes is not working for me

Add Comment