Академический Документы
Профессиональный Документы
Культура Документы
1
Contents
1. Introduction
2. Microcontrollers
2.1 Introduction
2.2 Microcontrollers vs. microprocessors
2.3 Types of microcontrollers
3. Arduino Electronics Platform
3.1 Introduction
3.2 Pin diagram
3.3 Pin configuration
3.4 Memory General Pin functions
3.5 Properties of Pins
4. Ultrasonic sensor
4.1 Introduction
4.2 HC-SR04 Ultrasonic Sensor
4.3Source Codes
5. Servo Motor SG-90
5.1 Selecting Servo Motor
5.2 Wire Configuration
5.3 Servo Motor Operation
6. Circuit Design
7. Advantages of the Arduino Radar Sensor
8. Disadvantages and Limitations
9. Conclusions
10. References
2
1. Introduction
While radar and ultrasonic sensors can be used for some of the same
purposes, sound-based sensors are readily available—they can be had for just a
couple dollars in some cases—and in certain situations, they may detect objects
more effectively than radar. For instance, while radar, or even light-based sensors,
have a difficult time correctly processing clear plastic, ultrasonic sensors have no
problem with this. In fact, they’re unaffected by the color of the material they are
sensing. On the other hand, if an object is made out of a material that absorbs
sound or is shaped in such a way that it reflects the sound waves away from the
receiver, readings will be unreliable.
3
The Arduino Radar Project is more of a visual project than it is a circuit
implementation. Hardware components like Arduino UNO, HC-SR04 Ultrasonic
Sensor and a Servo Motor are used to present the visual representation in the
Processing Application. Based on the information received from the Ultrasonic
Sensor with the help of Arduino and the details are passed and processed where a
simple Graphics application is implemented to mimic a Radar Screen.
4
2. Microcontrollers
2.1 Introduction
A microcontroller is a compact integrated circuit designed to govern a specific
operation in an embedded system. A typical microcontroller includes a processor,
memory and input/output (I/O) peripherals on a single chip.
Microcontroller features
5
instruction are separate, allowing for simultaneous transfers. With a Von Neumann
architecture, one bus is used for both data and instructions.
Overview of microcontrollers
MCUs feature input and output pins to implement peripheral functions. Such
functions include analog-to-digital converters, liquid crystal display (LCD)
controllers, real-time clock (RTC), synchronous/asynchronous receiver transmitter
(USART), timers, universal asynchronous receiver transmitter (UART) and universal
serial bus (USB) connectivity. Sensors gathering data related to humidity and
temperature among others are also often attached to microcontrollers.
6
Microcontroller applications
The distinction between microcontrollers and microprocessors has gotten less clear
as chip density and complexity has become relatively cheap to manufacture and
microcontrollers have thus integrated more "general computer" types of
7
functionality. On the whole, though, microcontrollers can be said to function
usefully on their own, with direct connection to sensors and actuators, where
microprocessors are designed to maximize compute power on the chip, with
internal bus connections (rather than direct I/O) to supporting hardware such as
RAM and serial ports. Simply put, coffee makers use microcontrollers; desktop
computers use microprocessors.
Microcontrollers are less expensive and use less power than microprocessors.
Microprocessors do not have built in RAM, read-only memory (ROM) or other
peripherals on the chip, but rather attach to these with their pins. A microprocessor
can be considered the heart of a computer system, whereas a microcontroller can
be considered the heart of an embedded system.
8
Different type of microcontrollers
1.MSP430 Launchpad
2.Nanode
Nanode is designed to work like an Arduino, but is made specifically for Internet-
connected projects. It features the same ATmega328 processor that the Arduino
Uno uses, and you can program it with the Arduino IDE. Nanode uses the open-data
API Cosm to connect to the Web for tasks including sending data to the cloud,
9
following online feeds, or acting as the server for a small, simple website. It makes
a good development tool for Web-connected sensors, monitors, or controls. The
Nanode RF sells for Rs.5000, a higher price than Arduino. And some assembly is
required, so get your soldering iron ready.
3.Pinguino PIC32
This is a solid prototyping tool originally designed for art students. The Pinguino
is the same size and shape as the Arduino Uno, and like Arduino, Pinguino has
open-source hardware to run an open-source IDE. Despite the similarities,
though, Arduino and the Arduino forums do not provide support for Pinguino,
and the company advises buyers that Pinguino may not work with Arduino
libraries or sketches. Pinguino sells for Rs.2500, but the company recommends
that buyers ensure they are experienced and comfortable with the technology
first—Pinguino is not a microcontroller for beginners.
10
4.5STM32 Discovery
STM32 Discovery from STMicroelectronics is another low-cost alternative; it
sells for about Rs.1000. This one packs a bit more power than the other budget
microcontroller on our list, however; Discovery features a 32-bit ARM Cortex
M3 core running at 24 MHz with 8 kB of RAM. Be prepared for a smaller user
community and less documentation to help you along, however.
11
5.Teensy 2.0
Teensy 2.0 and its counterpart, Teensy++ 2.0, run Arduino software and can
support Arduino libraries and sketches, making them a good fit for experienced
users who are making a transition from Arduino. Speaking of fit, the Teensy
microcontrollers live up to their names; Teensy 2.0 is roughly the size of a
quarter, with 25 I/O pins, and Teensy++ 2.0 is only slightly larger.
12
3. Arduino Electronics Platform
3.1 introduction
Over the years Arduino has been the brain of thousands of projects, from everyday
objects to complex scientific instruments. A worldwide community of makers -
students, hobbyists, artists, programmers, and professionals - has gathered around
this open-source platform, their contributions have added up to an incredible
amount of accessible knowledge that can be of great help to novices and experts
alike.
Arduino was born at the Ivrea Interaction Design Institute as an easy tool for fast
prototyping, aimed at students without a background in electronics and
programming. As soon as it reached a wider community, the Arduino board started
changing to adapt to new needs and challenges, differentiating its offer from simple
8-bit boards to products for IoT applications, wearable, 3D printing, and embedded
13
environments. All Arduino boards are completely open-source, empowering users
to build them independently and eventually adapt them to their particular needs.
The software, too, is open-source, and it is growing through the contributions of
users worldwide.
Thanks to its simple and accessible user experience, Arduino has been used in
thousands of different projects and applications. The Arduino software is easy-
touse for beginners, yet flexible enough for advanced users. It runs on Mac,
Windows, and Linux. Teachers and students use it to build low cost scientific
instruments, to prove chemistry and physics principles, or to get started with
programming and robotics. Designers and architects build interactive prototypes,
musicians and artists use it for installations and to experiment with new musical
instruments. Makers, of course, use it to build many of the projects exhibited at the
Maker Faire, for example. Arduino is a key tool to learn new things. Anyone -
children, hobbyists, artists, programmers - can start tinkering just following the
14
step by step instructions of a kit, or sharing ideas online with other members of the
Arduino community. There are many other microcontrollers and microcontroller
platforms available for physical computing. Parallax Basic Stamp, Net media’s BX-
24, Phidgets, MIT's Handyboard, and many others offer similar functionality. All of
these tools take the messy details of microcontroller programming nd wrap it up in
an easy-touse package. Arduino also simplifies the process of working with
microcontrollers, but it offers some advantage for teachers, students, and
interested amateurs over other systems:
• Open source and extensible software - The Arduino software is published as open
source tools, available for extension by experienced programmers. The language
can be expanded through C++ libraries, and people wanting to understand the
technical details can make the leap from Arduino to the AVR C programming
15
language on which it's based. Similarly, you can add AVR-C code directly into your
Arduino programs if you want to.
Open source and extensible hardware - The plans of the Arduino boards are
published under a Creative Commons license, so experienced circuit designers can
make their own version of the module, extending it and improving it. Even relatively
inexperienced users can build the breadboard version of the module in order to
understand how it works and save money.
16
3.3 Pin configuration
Serial 0(Rx), 1(Tx) Used to receive and transmit TTL serial data.
10 (SS), 11 (MOSI), 12
SPI Used for SPI communication.
(MISO) and 13 (SCK)
17
3.4 Memory General Pin functions
LED: There is a built-in LED driven by digital pin 13. When the pin is HIGH value,
the LED is on, when the pin is LOW, it's off.
VIN: The input voltage to the Arduino/Genuino board when it's using an external
power source (as opposed to 5 volts from the USB connection or other regulated
power source). You can supply voltage through this pin, or, if supplying voltage
via the power jack, access it through this pin.
5V: This pin outputs a regulated 5V from the regulator on the board. The board
can be supplied with power either from the DC power jack (7 - 20V), the USB
connector (5V), or the VIN pin of the board (7-20V). Supplying voltage via the 5V
or 3.3V pins bypasses the regulator, and can damage the board.
3V3: A 3.3 volt supply generated by the on-board regulator. Maximum current
draw is 50 mA.
GND: Ground pins.
IOREF: This pin on the Arduino/Genuino board provides the voltage reference
with which the microcontroller operates. A properly configured shield can read
the IOREF pin voltage and select the appropriate power source or enable voltage
translators on the outputs to work with the 5V or 3.3V.
Reset: Typically used to add a reset button to shields which block the one on the
board.
18
3.5 Properties of pins
Input Pins
Arduino (Atmega) pins default to inputs, so they don't need to be explicitly
declared as inputs with pin Mode () when you're using them as inputs. Pins
configured this way are said to be in a high-impedance state. Input pins
make extremely small demands on the circuit that they are sampling,
equivalent to a series resistor of 100 megohm in front of the pin. This means
that it takes very little current to move the input pin from one state to
another and can make the pins useful for such tasks as implementing a
capacitive touch sensor, reading an LED as a photodiode, or reading an
analog sensor with a scheme such as RCTime. This also means however, that
pins configured as pinMode (pin, INPUT) with nothing connected to them,
or with wires connected to them that are not connected to other circuits,
will report seemingly random changes in pin state, picking up electrical
noise from the environment, or capacitive coupling the state of a nearby
pin.
20
4. Ultrasonic Sensor
4.1 Introduction
21
The HC-SR04 Module has 4 pins, Ground, VCC, Trig and Echo. The Ground and
the VCC pins of the module needs to be connected to the Ground and the 5 volts
pins on the Arduino Board respectively and the trig and echo pins to any Digital I/O
pin on the Arduino Board.
In order to generate the ultrasound you need to set the Trig on a High State for
10 µs. That will send out an 8 cycle sonic burst which will travel at the speed sound
and it will be received in the Echo pin. The Echo pin will output the time in
microseconds the sound wave travelled.
Picture
First the Trig and Echo pins are defined. In this case they are the pins number 9 and
10 on the Arduino Board and they are named trigPin and echoPin. Then a Long
variable, named “duration” for the travel time that will be got from the sensor and
an integer variable for the distance.
In the setup we have to define the trigPin as an output and the echoPin as an Input
and also start the serial communication for showing the results on the serial
monitor.
In the loop first we have to make sure that the trigPin is clear so you have to set
that pin on a LOW State for just 2 µs. Now for generating the Ultra sound wave we
have to set the trigPin on HIGH State for 10 µs. Using the pulseIn() function you
22
have to read the travel time and put that value into the variable “duration”. This
function has 2 parameters, the first one is the name of the echo pin and for the
second one you can write either HIGH or LOW. In this case, HIGH means that the
pulsIn() function will wait for the pin to go HIGH caused by the bounced sound wave
and it will start timing, then it will wait for the pin to go LOW when the sound wave
will end which will stop the timing. At the end the function will return the length of
the pulse in microseconds. For getting the distance we will multiply the duration by
0.034 and divide it by 2 as we explained this equation previously. At the end we
will print the value of the distance on the Serial Monitor.
1. /*
2. * Ultrasonic Sensor HC-SR04 and Arduino Tutorial
3. *
4. * by Dejan Nedelkovski,
5. * www.HowToMechatronics.com
6. *
7. */
8.
9. // defines pins numbers
10. const int trigPin = 9;
11. const int echoPin = 10;
12.
13. // defines variables
14. long duration;
15. int distance;
16.
17. void setup() {
18. pinMode(trigPin, OUTPUT); // Sets the trigPin as an Output
19. pinMode(echoPin, INPUT); // Sets the echoPin as an Input
20. Serial.begin(9600); // Starts the serial communication
21. }
22.
23. void loop() {
24. // Clears the trigPin
25. digitalWrite(trigPin, LOW);
26. delayMicroseconds(2);
27.
28. // Sets the trigPin on HIGH state for 10 micro seconds
29. digitalWrite(trigPin, HIGH);
30. delayMicroseconds(10);
31. digitalWrite(trigPin, LOW);
32.
33. // Reads the echoPin, returns the sound wave travel time in microseconds
23
34. duration = pulseIn(echoPin, HIGH);
35.
36. // Calculating the distance
37. distance= duration*0.034/2;
38.
39. // Prints the distance on the Serial Monitor
40. Serial.print("Distance: ");
41. Serial.println(distance);
To display the results from the HC-SR04 Ultrasonic Sensor on an LCD we can use
the following source code:
/*
24
35. distanceInch = duration*0.0133/2;
36.
37. lcd.setCursor(0,0); // Sets the location at which subsequent text written to the LCD will be displayed
38. lcd.print("Distance: "); // Prints string "Distance" on the LCD
39. lcd.print(distanceCm); // Prints the distance value from the sensor
40. lcd.print(" cm");
41. delay(10);
42. lcd.setCursor(0,1);
43. lcd.print("Distance: ");
44. lcd.print(distanceInch);
45. lcd.print(" inch");
46. delay(10);
47. }
25
5. Servo Motor SG-90
5.1 Selecting Servo Motor
There are lots of servo motors available in the market and each one has its
own speciality and applications. Most of the hobby Servo motors operates from
4.8V to 6.5V, the higher the voltage higher the torque we can achieve, but most
commonly they are operated at +5V. Almost all hobby servo motors can rotate
only from 0° to 180° due to their gear arrangement so make sure you project can
live with the half circle if no, you can prefer for a 0° to 360° motor or modify the
motor to make a full circle. The gears in the motors are easily subjected to wear
and tear, so if your application requires stronger and long running motors you can
go with metal gears or just stick with normal plastic gear. The torque at which the
motor operates is another important parameter. Based on the load which you use
in the project you can select the motor with proper torque.
Torque: 2.5kg/cm
Rotation : 0°-180°
26
5.2 Wire Configuration
Wire Wire
Number Colour
Description
3 Orange PWM signal is given in through this wire to drive the motor
To make this motor rotate, we have to power the motor with +5V using the Red
and Brown wire and send PWM signals to the Orange colour wire. Hence we need
something that could generate PWM signals to make this motor work. This has
been done with Arduino Platform
PWM signal produced should have a frequency of 50Hz that is the PWM
period should be 20ms. Out of which the On-Time can vary from 1ms to 2ms. So
when the on-time is 1ms the motor will be in 0° and when 1.5ms the motor will be
90°, similarly when it is 2ms it will be 180°. So, by varying the on-time from 1ms to
2ms the motor can be controlled from 0° to 180°.
27
28
6. Circuit Design
The design of the circuit for this project is very simple. The control pin of the
servo is connected to Pin 11 of the Arduino while the TRIG and ECHO Pins of the
Ultrasonic Sensor are connected to Pins 9 & 10 of Arduino respectively. A separate
5V power supply (with common GND) is given to the Servo Motor and the
Ultrasonic Sensor.
Code
There are two codes for this project: one for the Arduino UNO and the other for
the Processing.
Working
Initially, upload the code to Arduino after making the connections.
You can observe the servo sweeping from 00 to 1800 and again back to 00.
29
Since the Ultrasonic Sensor is mounted over the Servo, it will also
participate in the sweeping action.
Now, open the processing application and paste the above given
sketch. In the Processing Sketch, make necessary changes in the COM Port
selection and replace it with the COM Port number to which your Arduino
is connected to.
If you note the Processing Sketch, I have used the output display size
as 1280×720 (assuming almost all computers now-a-days have a minimum
resolution of 1366×768) and made calculation with respect to this
resolution.
In the future, I will upload a new Processing sketch where you can
enter the desired resolution (like 1920×1080) and all the calculations will be
automatically adjusted to this resolution.
Now, run the sketch in the Processing and if everything goes well, a
new Processing window opens up like the one shown below.
30
7.Advantages of the Arduino Radar Sensor
3. Easy to design and low price. The ultrasonic sensors are available at the
market with very cheap price.
4. It has high frequency, high sensitivity, therefore, it can easily detect the
external or deep objects.
5. This radar sensor is not affected by dust, rain, snow, and many more.
7. The Arduino Radar Sensor is easy to use. Also, it is completely safe during
the operation to nearby objects, human or equipment.
8. The Ultrasonic sensor can easily interface with any types of the
microcontroller.
31
8. Disadvantages and Limitations
1. The Arduino Radar Sensor conduct sound to continue the work. So, it is
not working in a vacuum as there is no air for the sound to travel through.
2. A very soft fabric can absorb more sound waves. Therefore, it is hard to
detect objects which are covered with soft fabric.
5. While the radar using for inspection purpose, make sure it should be
water resistive. Otherwise highly chances of damage.
32
9. Conclusion
33
10. References
1. https://howtomechatronics.com/projects/arduino-radar-project/
2. https://i.ytimg.com/vi/RSAj_ydbg48/maxresdefault.jpg
3.https://hackster.imgix.net/uploads/attachments/208605/radar.jpg?auto
=compress%2Cformat& w=900&h=675&fit=min
4.https://www.engineersgarage.com/sites/default/files/styles/normalimag
es/public/circuitdiagra m/UDM-and-arduino-Radar.jpg?itok=lqbDNALF
5.https://www.arrow.com/en/research-and-events/articles/ultrasonic-
sensors-how-they-work-and-how-to-use-them-with-arduino
6.https://howtomechatronics.com/tutorials/arduino/ultrasonic-sensor-hc-
sr04/
7.https://components101.com/servo-motor-basics-pinout-datasheet
8.https://www.maxbotix.com/articles/how-ultrasonic-sensors-work.htm
34