wireless controlled robotic car
TRANSCRIPT
-
7/28/2019 wireless controlled robotic car
1/57
Wirelessly Robotic Car Control
System using Touch Screen
Habib Ullah
M Raza ShahM ASIF
ASIF FEROZ
-
7/28/2019 wireless controlled robotic car
2/57
-
7/28/2019 wireless controlled robotic car
3/57
Approval CertificateThis is to certify that the Thesis submitted by Mr. HabibUllah, and Mr.
Raza Shah is of sufficient standard to justify its acceptance by the Department
of Electrical Engineering, University of Engineering and Technology, UET
Peshawar Pakistan.
-
7/28/2019 wireless controlled robotic car
4/57
Abstract
-
7/28/2019 wireless controlled robotic car
5/57
AcknowledgementWe would like to express our deep and sincere gratitude to our honorable teacher and project
supervisor, Engr. Sahibzada Fahim whose guidance and encouragement enabled us to
complete our project and thesis.
We would also like to thank our parents for their support and encouragement throughout
our educational careers. We would also like to thank our all respected teachers for helping us
throughout our Engineering Career.
-
7/28/2019 wireless controlled robotic car
6/57
TABLE OF CONTENTSTITLE PAGE
APPROVAL SHEET ... i
LIST OF ABBREVIATIONS . iiABSTRACT iii
ACKNOWLEDGEMENTS v
TABLE OF CONTENTS .... vi
LIST OF FIGURES . ix
Chapter 1: Introduction 1
1.1. Robotic System ...... .................. 3
1.2. Touch Screens ....................... 3
1.2. Wireless Links........................ 3
1.2. BasicOperation ......................... 3
Chapter 2: Nuts and Bolts 1
1.1. Sainsmart 3.2 TFT Display ..... .................. 3
1.2. 27 MHZ transmitter ....................... 3
1.2. PIC MCUs ........................ 3
1.2. MPLABX ......................... 3
1.2. Roboic Toy Car ......................... 31.2. Embedded Tool ......................... 3
Chapter 3: Implementation 1
1.1. Touch Display Operation ..... .................. 3
1.2. Touch Screen Reading ....................... 3
1.2. Commands Transmission ........................ 3
1.2. Robot Moment ......................... 3
1.2. Code ......................... 3
Chapter 4: Application 1
1.1. App. In Mining Engg...... .................. 3
1.2. Security System ....................... 3
1.2.National Geographics ........................ 3
1.2. Robot Moment ......................... 3
-
7/28/2019 wireless controlled robotic car
7/57
CHAPATER-1
Introduction
ROBOTIC SYSTEMrobot, any automatically operatedmachinethat replaces human effort,
though it may not resemble human beings in appearance or perform
functions in a humanlike manner. By extension,roboticsis the engineering
discipline dealing with the design, construction, and operation of robots.
The word robotcomes from the Slavic word robota, which means labor. The
play begins in a factory that makes artificial people called robots, creatures
who can be mistaken for humans
The word robotics first appeared inIsaac Asimovs science-fiction story
Runaround (1942). Along with Asimovs later robot stories, it set a new
standard of plausibility about the likely difficulty of developing intelligent
robots and the technical and social problems that might result. Runaround
also contained Asimovs famous Three Laws of Robotics:
1. A robot may not injure a human being, or, through inaction, allow a
human being to come to harm.
2. A robot must obey the orders given it by human beings exceptwhere such orders would conflict with the First Law.
3. A robot must protect its own existence as long as such protection
does not conflict with the First or Second Law.
Robotics is the branch oftechnologythat deals with the design,construction, operation, and application ofrobots,
[1]as well as computer
systems for their control, sensory feedback, and information processing.These technologies deal with automated machines that can take the
place of humans in dangerous environments or manufacturingprocesses, or resemble humans in appearance, behavior, and/or
http://www.britannica.com/EBchecked/topic/354611/machinehttp://www.britannica.com/EBchecked/topic/354611/machinehttp://www.britannica.com/EBchecked/topic/354611/machinehttp://www.britannica.com/EBchecked/topic/1384950/roboticshttp://www.britannica.com/EBchecked/topic/1384950/roboticshttp://www.britannica.com/EBchecked/topic/1384950/roboticshttp://www.britannica.com/EBchecked/topic/38699/Isaac-Asimovhttp://www.britannica.com/EBchecked/topic/38699/Isaac-Asimovhttp://www.britannica.com/EBchecked/topic/38699/Isaac-Asimovhttp://en.wikipedia.org/wiki/Technologyhttp://en.wikipedia.org/wiki/Technologyhttp://en.wikipedia.org/wiki/Technologyhttp://en.wikipedia.org/wiki/Robothttp://en.wikipedia.org/wiki/Robothttp://en.wikipedia.org/wiki/Robotics#cite_note-OED-1http://en.wikipedia.org/wiki/Robotics#cite_note-OED-1http://en.wikipedia.org/wiki/Robotics#cite_note-OED-1http://en.wikipedia.org/wiki/Robotics#cite_note-OED-1http://en.wikipedia.org/wiki/Robothttp://en.wikipedia.org/wiki/Technologyhttp://www.britannica.com/EBchecked/topic/38699/Isaac-Asimovhttp://www.britannica.com/EBchecked/topic/1384950/roboticshttp://www.britannica.com/EBchecked/topic/354611/machine -
7/28/2019 wireless controlled robotic car
8/57
cognition. Many of today's robots are inspired by nature contributing tothe field ofbio-inspired robotics.
The concept of creating machines that can operate autonomously datesback toclassical times, but research into the functionality and potential
uses of robots did not grow substantially until the 20thcentury.[2]Throughout history, robotics has been often seen to mimichuman behavior, and often manage tasks in a similar fashion. Today,robotics is a rapidly growing field, as technological advances continue,research, design, and building new robots serve various practicalpurposes, whetherdomestically,commercially, ormilitarily. Many robotsdo jobs that are hazardous to people such as defusing bombs, exploringshipwrecks, and mines.
http://en.wikipedia.org/wiki/Bio-inspired_roboticshttp://en.wikipedia.org/wiki/Bio-inspired_roboticshttp://en.wikipedia.org/wiki/Bio-inspired_roboticshttp://en.wikipedia.org/wiki/Classical_timeshttp://en.wikipedia.org/wiki/Classical_timeshttp://en.wikipedia.org/wiki/Classical_timeshttp://en.wikipedia.org/wiki/Robotics#cite_note-2http://en.wikipedia.org/wiki/Robotics#cite_note-2http://en.wikipedia.org/wiki/Robotics#cite_note-2http://en.wikipedia.org/wiki/Domestic_robothttp://en.wikipedia.org/wiki/Domestic_robothttp://en.wikipedia.org/wiki/Domestic_robothttp://en.wikipedia.org/wiki/Industrial_robothttp://en.wikipedia.org/wiki/Industrial_robothttp://en.wikipedia.org/wiki/Industrial_robothttp://en.wikipedia.org/wiki/Military_robothttp://en.wikipedia.org/wiki/Military_robothttp://en.wikipedia.org/wiki/Military_robothttp://en.wikipedia.org/wiki/Military_robothttp://en.wikipedia.org/wiki/Industrial_robothttp://en.wikipedia.org/wiki/Domestic_robothttp://en.wikipedia.org/wiki/Robotics#cite_note-2http://en.wikipedia.org/wiki/Classical_timeshttp://en.wikipedia.org/wiki/Bio-inspired_robotics -
7/28/2019 wireless controlled robotic car
9/57
Touch Screen
A touchscreen is an electronic visual display that can detect the
presence and location of a touch within the display area. The
term generally refers to touching the display of the device with a
finger or hand. Touch screens can also sense other passive
objects, such as a stylus. In other words, a touchscreen is any
monitor, based either on LCD (Liquid Crystal Display) or CRT
(Cathode Ray Tube) technology that accepts direct onscreen
input. The ability for direct onscreen input is facilitated by an
external (light pen) or an internal device (touch overlay and
controller) that relays the X, Y coordinates to the computer.
The touchscreen has two main attributes. First, it enables one to
interact directly with what is displayed, rather than indirectly
with a cursor controlled by a mouse or touchpad. Secondly, it lets
one do so without requiring any intermediate device that would
need to be held in the hand
Touchscreen technology has the potential to replace most
functions of the mouse and keyboard. The touchscreen interface
is being used in a wide variety of applications to improve human -computer interaction. As the
technology advances, people may be
able to operate computers without mice and keyboards. Becauseof its convenience, touch screen technology solutions has been
applied more and more to industries, applications, products and
services, such as Kiosks, POS (Point-of-Sale), consumer
electronics, tablet PC, moderate to harsh Machine Control,
Process Control, System Control/Office Automation and Car PC,
etc.
TYPES OF TOUCHSCREEN TECHNOLOGYThe touch panels themselves are based around four basic screen
technologies: Resistive, Capacitive, Surface Acoustical Wave
(SAW) and Infrared (IR). Each of those designs has dis tinctadvantages and disadvantages. The detailed study of each is as
follows:
ResistiveResistive LCD touchscreen monitors rely on touch overlay, which
is composed of a flexible top layer and a rigid bottom layer
separated by insulating dots, attached to a touchscreen controller.
The inside surface of each of the two layers is coated with a
transparent metal oxide coating of Indium Tin Oxide (ITO) that
facilitates a gradient across each layer when voltage is applied.
Pressing the flexible top sheet creates electrical contact betweenthe resistive layers, producing a switch closing in the circuit. The
-
7/28/2019 wireless controlled robotic car
10/57
control electronics alternate voltage between the layers and pass
the resulting X and Y touch coordinates to the touchscreen
controller. The touchscreen controller data is then passed on to
the computer operating system for processing.
Resistive touch screen panels are generally more affordable but
offer only 75% clarity and the layer can be damaged by sharpobjects. Resistive touch screen panels are not affected by outside
elements such as dust or water. Resistive touchscreens are used
in food-service; retail Point-Of-Sale (POS), medical monitoring
devices, portable and handheld products, industrial process
control and instrumentation. Resistive Technology is divided into
two broad categories:
4 -Wire Resistive Touchscreen TechnologyFour-wire resistive technology is the simplest to understand and
manufacture. It uses both the upper and lower layers in the
touchscreen "sandwich" to determine the X an d Y coordinates. Typically constructed with uniform
resistive coatings of ITO on
the inner sides of the layers and silver buss bars along the edges,
the combination sets up lines of equal potential in both X and Y.
In the illustration below, the controller first applies 5V to the
back layer. Upon touch, it probes the analog voltage with the
coversheet, reading 2.5V, which represents a left -right position
or X axis.
It then flips the process, applying 5V to the covershe et, and
probes from the back layer to calculate an up-down position or Y
axis. At any time, only three of the four wires are in use.
-
7/28/2019 wireless controlled robotic car
11/57
The primary drawback of four-wire technology is that one
coordinate axis (usually the Y axis), uses the outer layer, the
flexible coversheet, as a uniform voltage gradient. The constant
flexing that occurs on the outer coversheet with use willeventually cause microscopic cracks in the ITO coating, changing
its electrical characteristics (resistance), degrading the linearity
and accuracy of this axis.
2.1.2) 5-Wire Resistive Touchscreen Technology
In the five-wire design, one wire goes to the coversheet (E)
which serves as the voltage probe for X and Y. Four wires go to
corners of the back glass layer (A, B, C, and D). The controller
first applies 5V to corners A and B and grounds C and D,
causing voltage to flow uniformly across the screen from the top
to the bottom. Upon touch, it reads the Y voltage from the coversheet at E. Then the controller
applies 5V to corners A andC and grounds B and D, and reads the X voltage from E again.
-
7/28/2019 wireless controlled robotic car
12/57
So, a five-wire touchscreen uses the stable bottom layer for both
X- and Y-axis measurements. The flexible coversheet acts only
as a voltage-measuring probe. This means the touchscreencontinues working properly even with non-uniformity in the
coversheet's conductive coating. The result is an accurate,
durable and more reliable touchscreen over four- and eight-wire
designs. Microscopic cracks in the coversheet coating might
occur, but they would no longer cause non-linearities as in the
case of 4 wire resistive touch screen.
2.2 Capacitive
A capacitive touch screen panel is coated with a material that
stores electrical charges. When the panel is touched, a small
amount of charge is drawn to the point of contact. Circuits
located at each corner of the panel measure the charge and sendthe information to the controller for processing. Capacitive touch
screen panels must be touched with a finger unlike resistive and
surface wave panels that can use fingers and stylus.
Capacitive touch screens have excellent clarity, and there are no
moving parts to wear out. Liquids, dirt, grease, or other
contaminants do not affect them. Unfortunately, gloved fingers
will not activate the system. It is divided into two broad
categories as follows:
2.2.1) Surface capacitive technology
In this technology, only one side of the insulator is coated with a
conductive layer. A small voltage is applied to the layer,resulting in a uniform electrostatic field. When a conductor, such
-
7/28/2019 wireless controlled robotic car
13/57
as a human finger, touches the uncoated surface, a capacitor is
dynamically formed. The sensor's controller can determine the
location of the touch indirectly from the change in the
capacitance as measured from the four corners of the panel. As it
has no moving parts, it is moderately durable, has limited
resolution and is prone to false signals from parasitic capacitivecoupling. It is therefore most often used in simple applications
such as industrial controls and kiosks.
2.2.2) Projected capacitive technology
Projected Capacitive Touch (PCT) technology is a capacitive
technology which permits more accurate and flexible operation,
by etching the conductive layer. An X-Y grid is formed either by
etching a single layer to form a grid pattern of electrodes, or by
etching two separate, perpendicular layers of conductive material
with parallel lines or tracks to form the grid. A finger on a grid of
conductive traces changes the capacitance of the nearest traces.
This change in trace capacitance is measured and finger positionis computed.
The use of an X-Y grid permits a higher resolution than resistive
technology. Projected capacitive touch screens are clear, durable,
solid state, scratch resistant and allow gloved hand use. All these
features make them ideal for harsh, industrial, or outdoor
applications
The trend of using touch pad in smart appliances is growing day by day. Touch LCD not only provide
ease of use but also facilitate end user interface up to great extant. A touchscreen is an electronic
visual display that the user can control through simple or multi-touch gestures by touching the
screen with one or more fingers. Some touchscreens can also detect objects such as a stylus or
ordinary or specially coated gloves. The user can use the touchscreen to react to what is displayed
and to control how it is displayed (for example by zooming the text size).
Wireless links
WirelessThe term wireless means without wire, cable or any other physical connecting
link.Here in this technology the elements or devices are connected and
communicating without any physical link.
Wireless operations permit services, such as long-range communications,
that are impossible or impractical to implement with the use of wires. The
term is commonly used in the telecommunications industry to refer to
telecommunications systems (e.g. radio transmitters and receivers, remote
controls etc.) which use some form of energy (e.g.radio waves, acoustic
http://en.wikipedia.org/wiki/Electronic_visual_displayhttp://en.wikipedia.org/wiki/Electronic_visual_displayhttp://en.wikipedia.org/wiki/Multi-touch_gestureshttp://en.wikipedia.org/wiki/Stylus_(computing)http://en.wikipedia.org/wiki/Multi-touch_gestureshttps://en.wikipedia.org/wiki/Radio_waveshttps://en.wikipedia.org/wiki/Radio_waveshttps://en.wikipedia.org/wiki/Radio_waveshttps://en.wikipedia.org/wiki/Radio_waveshttp://en.wikipedia.org/wiki/Multi-touch_gestureshttp://en.wikipedia.org/wiki/Stylus_(computing)http://en.wikipedia.org/wiki/Multi-touch_gestureshttp://en.wikipedia.org/wiki/Electronic_visual_displayhttp://en.wikipedia.org/wiki/Electronic_visual_display -
7/28/2019 wireless controlled robotic car
14/57
energy, etc.) to transfer information without the use of wires.[1]
Information is
transferred in this manner over both short and long distances.
Wireless communication is the transfer of information between two or more
points that are not connected by an electrical conductor.
Answering the call of customers frustrated with cord clutter,
many manufacturers of computer peripherals turned to wireless technology
to satisfy their consumer base. Originally these units used bulky, highly
limited transceivers to mediate between a computer and a keyboard and
mouse; however, more recent generations have used small, high-quality
devices, some even incorporatingBluetooth. These systems have become
so ubiquitous that some users have begun complaining about a lack of wired
peripherals. Wireless devices tend to have a slightly slower response time
than their wired counterparts; however, the gap is decreasing.
Modes of wireless communication
Wireless communications can be via:
radiocommunication,
microwavecommunication, for example long-range line-of-sight viahighly directional antennas, or short-range communication,
light, visible andinfrared(IR) for exampleconsumer IRdevices such
asremote controlsor viaInfrared Data Association(IrDA). sonic, especiallyultrasonicshort range communication
electromagnetic inductionshort range communication and power
Applications
The application of wireless communicationm involvepoint-to-pointcommunication,point-to-multipoint communication,broadcasting,cellularnetworksand otherwireless networks.
Wi-Fi technology.
https://en.wikipedia.org/wiki/Wireless#cite_note-FS1037C-1https://en.wikipedia.org/wiki/Wireless#cite_note-FS1037C-1https://en.wikipedia.org/wiki/Wireless#cite_note-FS1037C-1https://en.wikipedia.org/wiki/Bluetoothhttps://en.wikipedia.org/wiki/Bluetoothhttps://en.wikipedia.org/wiki/Bluetoothhttps://en.wikipedia.org/wiki/Radiohttps://en.wikipedia.org/wiki/Radiohttps://en.wikipedia.org/wiki/Microwavehttps://en.wikipedia.org/wiki/Microwavehttps://en.wikipedia.org/wiki/Infraredhttps://en.wikipedia.org/wiki/Infraredhttps://en.wikipedia.org/wiki/Infraredhttps://en.wikipedia.org/wiki/Consumer_IRhttps://en.wikipedia.org/wiki/Consumer_IRhttps://en.wikipedia.org/wiki/Consumer_IRhttps://en.wikipedia.org/wiki/Remote_controlhttps://en.wikipedia.org/wiki/Remote_controlhttps://en.wikipedia.org/wiki/Remote_controlhttps://en.wikipedia.org/wiki/Infrared_Data_Associationhttps://en.wikipedia.org/wiki/Infrared_Data_Associationhttps://en.wikipedia.org/wiki/Infrared_Data_Associationhttps://en.wikipedia.org/wiki/Ultrasoundhttps://en.wikipedia.org/wiki/Ultrasoundhttps://en.wikipedia.org/wiki/Ultrasoundhttps://en.wikipedia.org/wiki/Electromagnetic_inductionhttps://en.wikipedia.org/wiki/Electromagnetic_inductionhttps://en.wikipedia.org/wiki/Point-to-point_(telecommunications)https://en.wikipedia.org/wiki/Point-to-point_(telecommunications)https://en.wikipedia.org/wiki/Point-to-point_(telecommunications)https://en.wikipedia.org/wiki/Point-to-point_(telecommunications)https://en.wikipedia.org/wiki/Point-to-multipoint_communicationhttps://en.wikipedia.org/wiki/Point-to-multipoint_communicationhttps://en.wikipedia.org/wiki/Point-to-multipoint_communicationhttps://en.wikipedia.org/wiki/Broadcastinghttps://en.wikipedia.org/wiki/Broadcastinghttps://en.wikipedia.org/wiki/Broadcastinghttps://en.wikipedia.org/wiki/Cellular_networkhttps://en.wikipedia.org/wiki/Cellular_networkhttps://en.wikipedia.org/wiki/Cellular_networkhttps://en.wikipedia.org/wiki/Cellular_networkhttps://en.wikipedia.org/wiki/Wireless_networkhttps://en.wikipedia.org/wiki/Wireless_networkhttps://en.wikipedia.org/wiki/Wireless_networkhttps://en.wikipedia.org/wiki/Wireless_networkhttps://en.wikipedia.org/wiki/Cellular_networkhttps://en.wikipedia.org/wiki/Cellular_networkhttps://en.wikipedia.org/wiki/Broadcastinghttps://en.wikipedia.org/wiki/Point-to-multipoint_communicationhttps://en.wikipedia.org/wiki/Point-to-point_(telecommunications)https://en.wikipedia.org/wiki/Point-to-point_(telecommunications)https://en.wikipedia.org/wiki/Electromagnetic_inductionhttps://en.wikipedia.org/wiki/Ultrasoundhttps://en.wikipedia.org/wiki/Infrared_Data_Associationhttps://en.wikipedia.org/wiki/Remote_controlhttps://en.wikipedia.org/wiki/Consumer_IRhttps://en.wikipedia.org/wiki/Infraredhttps://en.wikipedia.org/wiki/Microwavehttps://en.wikipedia.org/wiki/Radiohttps://en.wikipedia.org/wiki/Bluetoothhttps://en.wikipedia.org/wiki/Wireless#cite_note-FS1037C-1 -
7/28/2019 wireless controlled robotic car
15/57
CHAPTER # 2
NUTS AND BOLTS
Sainsmart 3.2tft Display:In this project we will use 3.2TFT LCD touch screen to provide different functionality to
end user. Some of these features include:
1) In vehicle user call facility2) In vehicle car conditions facility including speed, oil gauge, head lights etc
3) In vehicle graphical display for different application
The figure below shows the 3.2TFT sainsmart Touch LCD.
http://www.elecfreaks.com/wiki/index.php?title=File:LCD_TFT01_3.2W_16.jpg -
7/28/2019 wireless controlled robotic car
16/57
Pin Diagram:
Procedure for LCD:
1) Set Pin RD, CS to be 1
2) Set Pin CS to be 03) Send 8Bit Command Set to 8Bit Data Bus Lower and then send 0x00 to 8 Bit Data BusUpper4) Set Pin RS to be 05) Set Pin WR to be 06) Set Pin WR to be 17) Set Pin RS to be 1After sent the command set successfully, user needs to send the data of the command asfollows;8) Still set Pin CS to be 0 and still set Pin RS, RD to be 1
9) Send 16Bit Data of the command set to all 16Bit Data Bus.10) Set Pin WR to be 011) Set Pin WR to be 112) Set Pin CS to be 1
Procedure for Touch Interfacing:
http://www.elecfreaks.com/wiki/index.php?title=File:TFT01-2.4-04.jpg -
7/28/2019 wireless controlled robotic car
17/57
1) Read status from Pin PEN of ADS7846; if it is 0 (touching the screen), start reading
value in the next step 2; on the other hand, if it is 1 (not touching any screen yet), reads
repeatedly.
2) Set Pin DCLK, CS, DOUT to be 0
3) Send Control Byte 0x0D to Pin DIN (MOSI) of ADS7846 to specify reading 12Bit
ACD value on the X axis.
4) Send Data 0x00 to Pin DIN (MOSI) of ADS7846. While sending out data in each bit,
ADS7846 will also shift out the ADC value to Pin DOUT(MISO). The first bit data that is
shifted out is the 11th bit at the falling edge of the second DCLK. When all 8 of DCLK
are sent out completely, it reads data on the X axis as 0x0ddddddd (d=data bit11bit5).
5) Send Control Byte 0x90 to Pin DIN (MOSI) of ADS7846 to specify reading 12Bit
ADC value on Y axis. While sending out this Control Byte, the last 5Bit data ADC on X
axis will be also sent out. It begins with bit4 to bit0 and Data is arranged as 0xddddd000
(d=data bit4bit0).
6) Send Data 0x00 to Pin DIN (MOSI) of ADS7846. While sending out data in each bit,
ADS7846 will also shift out ADC value to Pin DOUT(MISO). The first bit data that is
shifted out is the 11th bit at the falling edge of the second DCLK. When all 8 of DCLK is
sent completely, it reads on the Y axis as 0x0ddddddd (d=data bit11 bit5).
7) Send Data 0x00 to Pin DIN (MOSI) of ADS7846. While sending out Data, the last 5Bit
ADC data on the Y axis will be also sent out. It begins with bit4 to bit 0 and Data is
arranged as 0xddddd000 (d=data bit4 bit0).
8) When the ADC values on both axes are read completely, need to set Pin CS to be 1 to
finish reading values from ADS7846.
9) If user wants to read the new value, repeatedly start the step 1.10) After got the ADC value on each axis completely, user needs to arrange the values.The variable that is used to store the ADC value should be read as 16Bit. When the first7Bit of data ADC is read, it is stored in the 16Bit variable as 0x000000000ddddddd ; andthe next 5Bit when it is stored in the 16bit variable is 0x000000000ddddddd. Then shiftout the first 7Bit data that is read to the left side 5Bit and then shift out the next 5Bit thatis read to the right side 3Bit. Finally, must OR(|) both sets together, user got 12Bit dataADC of the axis that is read as 0x000ddddddddddddd. This is the complete value and isready to use.
-
7/28/2019 wireless controlled robotic car
18/57
THE 27MHz TRANSMITTER
In this discussion we cover 27MHz transmitters and receivers as found in remote
control cars,
aeroplanes, walkie talkies and some of the older-style garage door openers.
We have provided a number of circuits so you can work out the best type for your
application and
these circuits will also help you understand which components are critical and which
components can
be changed.
It's a matter of looking at each circuit and seeingthe general layout, and comparing it
to the other
circuits. In this way you are building up a conceptof "building blocks" and this is the
basis to learning
electronics.
Talking Electronics does not provide any kits for these circuits as the products (toy
cars, wireless
doorbells etc) are readily available in toy shops, hobby shops and many of the $2.00
"junk Shops."
You cannot buy many of the special components and the cost of the completed item
is less than
buying the components!
Let's start:
6 bands (or frequencies) were allocated for the 27MHz band,
Channel Frequency
1 26.995
2 27.045
3 27.095
4 27.145
5 27.195
6 27.255
and these were very popular for transmission - especially in countries where
transmitting was strictly
controlled.
Both 27MHz and 49MHz circuitry produced very low cost devices and they are still
available. But you
-
7/28/2019 wireless controlled robotic car
19/57
-
7/28/2019 wireless controlled robotic car
20/57
. The first two circuits (figs 1& 2) form a single-channel transmitter-receiver link.
The second receiver
(fig 7) uses a split supply to power a motor in theforward and reverse direction (it
uses the same
transmitter as shown in fig 1). The third transmitter & receiver, (figs 12 & 22) is a
multi-channel design,
with a chip in the receiver. Then we cover a 27MHz walkie talkie. This is a 4
transistor model. It uses
the same type of super-regenerative front-end as our receiver circuits and injects
Amplitude Modulated
(AM) audio onto the signal. The result is a very noisy transmission but a very
effective way to achieve
both transmission and reception with the minimum ofcomponents. Most of the parts
have a dual
function, operating in both transmit and receive mode. This makes the circuit very
efficient,
component-wise.
Before we start, some of the Japanese transistors have either a very high frequency
capability or a
very high collector current. These transistors needto have an equivalent for the
circuit to work
successfully. Here is a list of some of the type you will come across and some
equivalents
-
7/28/2019 wireless controlled robotic car
21/57
Fig 1 shows a simple 27MHz transmitter producing a carrier.
-
7/28/2019 wireless controlled robotic car
22/57
The 27MHz transmitter PC board
This means it produces an unmodulated 27MHz signal and when picked up by a
receiver, such as
shown in fig 2, the result is a clean, noise-free reception. To increase the output of
the transmitter, the
390R resistor is replaced by a 220R. This increasesthe current from 7mA to 12mA.
The resistor could
be decreased to 150R for more output .
-
7/28/2019 wireless controlled robotic car
23/57
When the transmitter is off, the car moves forward.When the transmitter is on, the
car reverses and
moves in a circular pattern. This allows the operator to guide the car around
obstacles. It's a very
awkward way to control a car and although it is very simple and clever, it is not
really successful in
practice. We will not be going into the mechanics of how the car steers, only the factthat the
transmitter causes the motor to reverse direction. In place of the motor you could use
a relay or two
separate motors to carry out a number of functions and we will show how the circuit
can be modified to
do this.
The receiver works on a "tone," "no-tone" principlebut the transmitter doesn't
actually send a tone asthis would require additional circuitry. What happens is the receiver picks up
random noise from the
airwaves when the transmitter is not operating and this functions as the tone part of
the reception. This
random noise is amplified by the second transistor and passed to a 0.47u electrolytic
that keeps the
third transistor in conduction for the majority of the time. The operation of this will
be discussed later.
-
7/28/2019 wireless controlled robotic car
24/57
The 10u on the output of the third transistor keepsthe output low for the short
periods when the third
transistor is not low. The motor is connected in a bridge formation via four
transistors and these
change the polarity of the supply to the motor.
When the transmitter is operating, and the receiveris within range, it picks up a
27MHz carrier that
over-rides the random noise and produces a CARRIER.This means the second
transistor will not see
any noise and thus the 0.47u electrolytic will charge and turn off the third transistor.
The 10u will
charge via the 2k2 and the input to the bridge willchange from a LOW to a HIGH.
This will turn on the
opposite half of the bridge to supply current to the motor in the reverse direction.
Now we will cover the circuit in detail.
HOW THE TRANSMITTER WORKS
The transmitter is a very simple crystal oscillator. The heart of the circuit is the
tuned circuit consisting
of the primary of the transformer and a 10p capacitor. These two components
oscillate when a voltage
is applied to them. The frequency is adjusted by a ferrite slug in the centre of the coil
until it is exactly
the same as the crystal. The crystal will then maintain the frequency over a wide
range of temperature
and supply voltage fluctuations. The transistor is configured as a common emitter
amplifier. It has a
resistor on the emitter for biasing purposes but the 82p across the 390R effectively
takes the emitterto
the negative rail as far as the signal is concerned. The 390R resistor prevents a high
current passing
through the transistor as the resistance of the transformer is very low. The tuned
circuit operates at
exactly the third harmonic (also called the third overtone - an overtone is a multiple
of a fundamental
frequency) of the crystal so that the crystal will oscillate at its third overtone
(27MHz) and in-turn, keep
-
7/28/2019 wireless controlled robotic car
25/57
the frequency of the circuit stable. The transformer in the collector of the transistor
performs two
functions. 1. It matches the impedance of the transistor to the impedance of the
antenna, and 2.
Creates a resonant circuit at 27MHz to make sure the crystal oscillates at this
frequency. You can see
the transformer creates a resonant circuit by the fact that it has a capacitor across the
primary winding.
These two components create a "resonant" or "tuned " circuit and this is where the
circuit "gets its
frequency."
The crystal has a fundamental of about 9MHz and it will oscillate at this frequency
unless assisted to
oscillate at a higher frequency. This is done by the tuned circuit oscillating at
27MHz.
Now we will look at the impedance-matching feature of the transformer.
The impedance of the output of the transistor is about 1k to 5k and this means it is
the impedance
(resistance) "it works at." In other words, it is the characteristic impedance of the
transistor in this type
of stage. The impedance of a whip antenna is about 50 ohms and the transformer
matches these two
by having a TURNS RATIO.
The primary has about 12 turns and the secondary about 3 turns. This provides part
of the matching
requirement. The `pi' network, made up of the 150p,15 turn air-cored coil and 100p
capacitor assists
further in matching the output of the transformer to the antenna. When the power is
applied, the
transistor turns on fairly hard due to the 82p in the emitter being uncharged.
This puts a pulse of energy through the 10p and as the transistor turns off slightly
due to the 82p
charging, the energy in the 10p capacitor is passedto the primary of the transformer
to start the
27MHz cycle. The action of the emitter rising and falling during start-up, allows the
base to rise andfall
and this puts a pulse on the crystal to start it oscillating.
-
7/28/2019 wireless controlled robotic car
26/57
The frequency of oscillation OF THE CIRCUIT is generated by the tuned circuit in
the primary of the
transformer and the crystal merely keeps the circuit operating at exactly 27.145MHz
(or 27.240MHz,
depending on the frequency of the crystal). The turns ratio of the transformer
converts a high voltage
waveform (that has little current) from the transistor, into a low voltage waveform
with a higher current.
This is exactly what the antenna requires. But before the signal passes into the
antenna it goes
through the pi network, then an 8 turn Radio Frequency Choke. This is 8 turns of
enamelled wire
wound on a ferrite core and is called a base-load for the antenna.
The result is a 27MHz frequency called a CARRIER. The carrier produces a clean
spot on the band
that is free from background noise.
HOW THE RECEIVER WORKS
The first thing you have to realize is the receiveris really a transmitter. It's a very
weak transmitter and
delivers a low level signal to the surroundings viathe antenna. When another signal
(from the
transmitter) comes in contact with the transmissionfrom the receiver it creates an
interference pattern
that reflects down the antenna and into the first stage of the receiver.
The receiver is a super-regenerative design. This means it is self-oscillating (or
already oscillating) and
makes it very sensitive to nearby signals. It is much more sensitive than receiving a
signal and making
it oscillate a transistor.
A super-regenerative design is not universally usedbecause it is much more noisy
than conventional
reception and is not suitable for voice transmission. However it is used in simple
walkie-talkies and this
is why they are so noisy - as will be shown at the end of this article. When a signal
of the same
frequency as the super-regenerative circuit passes near the antenna, the circuit has
difficulty radiating
-
7/28/2019 wireless controlled robotic car
27/57
a signal.
This means the circuit current VARIES. These variations appear across the 2k2 load
resistor as a
change in voltage and the signal is picked off via a 100n capacitor and passed to the
second and third
stages for amplification.
The 22n across the first stage is designed to remove the high-frequency component
from the
waveform. If this were not present, the circuit would never change state. The
receiver is tuned to the
frequency of the crystal in the transmitter via a slug-tuned coil in the collector.
When the transmitter is off, the receiver picks up background noise and amplifies it
to produce
random-noise. This is amplified by the second transistor and passed to the third via a
0.47u
electrolytic. This electrolytic is designed to keepthe third transistor ON for the major
part of the time
and it does this in a very clever way. We will assume the supply has just been turned
on and the
second transistor is not receiving a signal. The 0.47u will be uncharged and it will
charge via the 10k
collector resistor and the base-emitter junction ofthe third transistor.
The action of the current flowing through the base of the third transistor will turn it
ON but after ashort
time the electrolytic will be fully charged and thecurrent will cease and the transistor
will turn off. A
10u on the collector of the third transistor will then begin to charge via the 2k2
resistor and after a
period of time called the DELAY TIME, the output will be HIGH and change the
state of the bridge. But
if a signal is present on the collector of the second transistor, (in our case this will be
background
hash), the voltage on the collector will be rising and falling. When the voltage goes
low, it takes the
positive end of the 0.47u low and the other end must follow.
The voltage on the negative end will go below the negative rail and at -0.7v it gets
clamped by the
-
7/28/2019 wireless controlled robotic car
28/57
diode. This means the electrolytic gets discharged very rapidly when the second
transistor turns on.
The result is the electrolytic takes a long time tocharge and a short time to discharge,
even when
random noise (hash) is being processed.
The action of the 0.47u is amazing and will be explained in more detail in a moment.
During the short
periods of time when the third transistor is not turned on, the 10u on the collector
will take over and
hold the signal low. It's only when a long durationof silence is encountered, that the
circuit will change
state. This period of silence is when the transmitter turns ON and the time is very
short in real terms.
Transistor Q3 is called the switching transistor. It changes between HIGH and LOW
to create the
forward and reverse direction. The switching transistor feeds two driver transistors,
Q4 and Q9. Each
of these drives two output transistors. Q4 drives Q6 and Q7. Q9 drives Q5 and Q8.
Follow these transistors on the circuit and you will see how the supply is directed to
the motor, firstly in
one direction and then the other.
The printed circuit board is quite complex because of the number of driver
transistors. But since these
cost less than 2 cents when bought in the million, it is not cheaper to use a chip.
HOW THE 0.47u WORKS
The 0.47u electrolytic on the base of the third transistor needs explaining as its
operation is very
clever.
-
7/28/2019 wireless controlled robotic car
29/57
Charging the 0.47u electrolytic
is represented as a battery.
The electrolytic is simply a tiny re-chargeable battery and when the circuit first turns
on, it is
uncharged. The charging current passes through the base-emitter junction of the
third transistor and
keeps it ON as shown in fig: 3. If the electrolyticis allowed to fully charge, the
current will fall to zero
and the third transistor will turn off. But the second transistor discharges the
electrolytic quickly before
it has time to fully charge. It does this by turning ON. How the electrolytic
discharges is shown in fig: 4.
The only components involved in the discharge are Q2 and the diode. Transistor Q2
is turned on and it
will have zero volts (0.3v) on the collector.
Discharging the 0.47u electrolytic.
This means the positive lead of the electrolytic (equivalent to the positive terminal of
the battery) will
drop from say nearly 3v, to 0.3v. The negative leadmust follow and normally it
would be at -2.7v. Yes,
the negative lead would have a negative voltage on it relative to the 0v rail, if the
diode was not
-
7/28/2019 wireless controlled robotic car
30/57
present. BUT the diode on the negative lead gets turned on as soon as the voltage on
the negative
lead falls to -0.7v and prevents it going below -0.7v. As the positive lead falls, the
energy in the
electrolytic is quickly discharged through the diode and when the second transistor
turns OFF, the
electrolytic is ready for charging, through the 10kresistor.
PIC MICROCONTROLLER
PIC18F452PIC32MX250F128B
The PIC16 series of microcontrollers have been around for many years. Although they are
excellent general-purpose microcontrollers, they have certain limitations. For example, the
program and data memory capacities are limited, the stack is small, and the interrupt
structure is primitiveall interrupt sources share the same interrupt vector. The PIC16 series
of microcontrollers also do not provide direct support for advanced peripheral interfaces,
such as USB and CAN bus, and it is rather complex to interface to such devices easily. The
instruction set of these microcontrollers is also limited. For example, there are no
instructions for multiplication or division and branching is rather simple and is made out of a
combination of skip and goto instructions. Microchip Inc. has developed the PIC18 series
of microcontrollers for high-pin-count, high-d ensity, and complex applications.
Figure 2.1 shows the current PIC microcontroller family of products. At the lowest end of
the family, we have the PIC10 microcontrollers, operating at approximately 5 MIPS and with
small form factors, less memory, and a low cost. Then we have the PIC12 and PIC16 series
of micro -controllers with midrange architectures, 58 MIPS operating performance, and
reasonable size of memory. The microcontrollers of the PIC18 family are advanced high-
performance devices, with 1016 MIPS, and offer a large amount of memory with various
on-chip peripheral support modules. As shown in Figure 2.1, the higher end of the family
consists of 16-bit devices, such as the PIC24 and the dsPIC, and 32-bit devices, such as the
dsPIC33 and the PIC32 series.
-
7/28/2019 wireless controlled robotic car
31/57
The PIC18 microcontroller family consists of three architectures: the standard PIC18F series,
the PIC18J series, and the PIC18K series. PIC18J series are 1012 MIPS, low-voltage, high-
performance microcontrollers with integrated USB, Ethernet, or LCD. PIC18K series are 16
MIPS, high-performance, and low-power devices.
The PIC18F microcontrollers can be used in cost-efficient solutions for general-purpose
applications written in C, using a real-time operating system (RTOS), and require complex
communication protocol stack, such as TCP/IP, CAN, USB, or ZigBee. PIC18F devices
provide flash program memory in sizes from 8 to 128 KB and data memory from 256 to 4
KB, operating at 2.05.0 V at speeds from DC to 40 MHz.
The basic features of the PIC18F series of microcontrollers are as follows:
77 instructions.
PIC16 source code compatible.
Program memory addressing up to 2 MB
Data memory addressing up to 4 KB
DC to 40-MHz operation
-
7/28/2019 wireless controlled robotic car
32/57
8 8 hardware multiplier
Interrupt priority levels
16-bit wide instructions, 8-bit wide data path Up to two 8-bit timer/counters
Up to three 16-bit timer/counters
Up to four external interrupts
High-current (25 mA) sink/source capability
Up to five capture/compare/pulse width modulation (PWM) modules
Master synchronous serial port module (serial peripheral interface [SPI] and
I2C modes)
Up to two universal synchronous-asynchronous receiver-transmitter (USART)
modules
Parallel slave port (PSP)
Fast 10-bit analog-to-digital (A/D) converter
Programmable low-voltage detection (LVD) module
Power-on reset (POR), power-up timer (PWRT), and oscillator start-up timer
(OST)
Watchdog timer (WDT) with on-chip RC oscillator
In-circuit programming
In addition, some microcontrollers in the family offer the following special features:
Direct CAN 2.0B bus interface
Direct USB 2.0 bus interface
Direct LCD control interface
TCP/IP interface
ZigBee interface
Direct motor control interface
There are many devices in the PIC18F family, and most of them are source compatible with
each other. Table below gives the characteristics of some of the popular devices in this family.
In this chapter, the PIC18FXX2 microcontrollers are chosen for detailed study. Most of the
other microcontrollers in the family have similar architectures.
-
7/28/2019 wireless controlled robotic car
33/57
Pic18 Family Architecture:As shown in Table 2.1, the PIC18FXX2 series consists of four devices. PIC18F2X2
microcontrollers are 28-pin devices, and PIC18F4X2 microcontrollers are 40-pin devices. The
architectures of both groups are almost identical except that the larger devices have more I/O
ports and more A/D converter channels. In this section, we shall be looking at the
architectureof the PIC18F452 microcontrollers in detail. The architectures of other standard
PIC18F series microcontrollers are very similar, and the knowledge gained in this section
should be enough to understand the operation of other PIC18F series microcontrollers.
The pin configuration of the PIC18F452 microcontroller (DIP package) is shown in Figure.
This is a 40-pin microcontroller housed in a DIL package and has a pin configuration similar
to that of the popular PIC16F877.
Figure shows the internal block diagram of the PIC18F452 microcontrollers. The CPU is at the
center of the diagram and consists of an 8-bit ALU, a n 8-bit working accumulator register
(WREG), and a 8 8 hardware multiplier. The higher byte and the lower byte of a
multiplication are stored in two 8-bit registers called PRODH and PRODL, respectively.
-
7/28/2019 wireless controlled robotic car
34/57
The program counter and the program memory are shown at the top left corner of the diagram.
Program memory addresses consist of 21 bits and are capable of accessing 2 MB of program
memory locations. PIC18F452 has only 32 KB of program memory, which requires only 15
bits; thus, the remaining six address bits are redundant and not used. A table pointer provides
access to tables and to the data stored in the program memory. The program memory containsa 31-level stack, which is normally used to store the interrupt and subroutine return addresses.
The data memory can be seen at the top central part of the diagram. The data memory address
bus is 12 bits wide and is capable of accessing 4 KB of data memory locations. As we shall
study later, the data memory consists of the SFR and the general-purpose registers (GPR), all
organized in banks.
-
7/28/2019 wireless controlled robotic car
35/57
-
7/28/2019 wireless controlled robotic car
36/57
The bottom part of the diagram shows the timers/counters, capture/compare/PWMregisters, USART, A/D converter, and the EEPROM data memory. PIC18F452 consists of
Four counters/timers
Two capture/compare/PWM modules
Two serial communication modules
Eight 10-bit A/D converter channels
256-byte EEPROM
The oscillator circuit is located at the left-hand side of the diagram. This circuit consists of
PWRT
OST
POR
WDT
Brown-out reset (BOR)
Low-voltage programming
In-circuit debugger (ICD)
PLL circuit
Timing generation circuit
The PLL is new to the PIC18F series, and it provides the option of multiplying theoscillator frequency to speed up the overall operation. The WDT can be used to force arestart of the microcontroller in the event of a program crash. The ICD is useful during
program development, and it can be used to return diagnostic data, including the registervalues, as the microcontroller is executing a program.
The I/O ports are located at the right-hand side of the diagram. PIC18F452 consists of fiveparallel ports named PORTA, PORTB, PORTC, PORTD, and PORTE. Most port pins havemultiple functions. For example, PORTA pins can be used as either parallel I/O or analoginputs. PORTB pins can be used as either parallel I/O or interrupt inputs.
Code Memory Organization:
The program memory map is shown in Figure 2.4. Each PIC18F member has a 21-bitprogram counter and hence is capable of addressing 2 MB of memory space. User memory
space on the PIC18F452 microcontroller is 00000H to 7FFFH. Accessing a nonexistentmemory location (8000H to 1FFFFFH) will cause a read of all 0s. The reset vector where the
-
7/28/2019 wireless controlled robotic car
37/57
program starts after a reset is at address 0000H. Addresses 0008H and 0018H are reservedfor the vectors of high-priority and low-priority interrupts, respectively, and interrupt serviceroutines must be written to start at one of these locations.
The PIC18F microcontroller has a 31-entry stack that is used to hold the return addressesfor subroutine calls and interrupt processing. The stack is not a part of the program or a datamemory space. The stack is controlled by a 5-bit stack pointer, which is initialized to 00000after a reset. During a subroutine call (or interrupt), the stack pointer is first incremented, andthe memory location pointed to by the stack pointer is written using the contents of the
program counter. During a return from a subroutine call (or interrupt), the memory locationpointed to by the stack pointer is decremented. Program memory is addressed in bytes andinstructions are store d as 2 or 4 bytes in programmemory. The least significant byte of aninstruction word is always stored in an even addressof the program memory.
An instruction cycle consists of four cycles: A fetch cycle begins with the programcounter incrementing in Q1. In the execution cycle, the fetched instruction is latched into theinstruction register in cycle Q1. This instruction is then decoded and executed during the Q2,Q3, and Q4 cycles. A data memory location is read during Q2 and written during Q4.
-
7/28/2019 wireless controlled robotic car
38/57
Data Memory Organization:The data memory map of the 18F452 microcontroller is shown in Figure below. The data
memory address bus is 12 bits, with the capability of addressing up to 4 MB. The memory ingeneral consists of 16 banks, each of 256 bytes. PIC18F452 has 1536 bytes of data memory(6 banks 256 bytes each) occupying the lower end of the data memory. Bank switching isdone automatically when using a high-level language compiler, and thus the user need notworry about selecting memory banks during programming.
-
7/28/2019 wireless controlled robotic car
39/57
The special function register (SFR) occupies the upper half of the top memory bank.SFR contains registers that control the operations of the microcontroller, such as the
peripheral devices, timers/counters, A/D converter, interrupts, USART, and so on.
Input Output Ports:
The parallel ports of the 18F family are very similar to those of the PIC16 series. Thenumber of I/O ports and port pins varies depending on the PIC18F family member used, butall versions have at least PORTA and PORTB. The pins of a port are labeled as RPn, whereP is the port letter and n is the port bit number. For example, PORTA pins are labeled RA0to RA7, PORTB pins are labeled RB0 to RB7, and so on.
When working with a port, we may want to
Set port direction
Set an output value
Read an input value Set an output value and then read back the output value
The first three operations are the same between the PIC16 and the PIC18F series. In someapplications, we may want to send a value to the port and then read back the value just sent.In the PIC16 series, there is a weakness in the port design a nd the value read from a portmay be different from the value just written to it. This is because the reading is the actual
port bit pin value, and this value could be changed by external devices connected to the portpin. In the PIC18F series, a latch register (e.g., LATA for PORTA) is introduced to the I/Oports to hold the actual value sent to a port pin. From the port, the latched value is read,
which is not affected by any external devices.
Port-A:
In PIC18F452 microcontroller, PORTA is 7 bits wide and port pins are shared with otherfunctions. Table 2.6 shows the PORTA pin functions.
The architecture of PORTA is shown in Figure. There are three registers associated withPORTA:
Port data registerPORTA
-
7/28/2019 wireless controlled robotic car
40/57
Port direction registerTRISA
Port latch registerLATA
PORTA is the name of the port data register. The TRISA register defines the direction ofPORTA pins, where logic 1 in a bit position defines the pin as an input pin, and a 0 in a bit
position defines it as an output pin. LATA is the output latch register, which shares the samedata latch as PORTA. Writing to one is equivalent to writing to the other one as well. Butreading from LATA activates the buffer at the top of the diagram, and the value held inPORTA/LATA data latch is transferred to the data bus, independent of the state of the actualoutput pin of the microcontroller.
Bits 0 through 3 and 5 of PORTA are also used as analog inputs. After a device reset,these pins are programmed as analog inputs, and RA4 and RA6 are confi gured as digitalinputs.
To program the analog inputs as digital I/O, the ADCON1 register (A/D register) must be
programmed accordingly. Writing 7 to ADCON1 configures all PORTA pins as digital I/O.
-
7/28/2019 wireless controlled robotic car
41/57
The RA4 pin is multiplexed with the Timer 0 clock input (T0CKI). This is a Schmitttrigger input and an open drain output.
RA6 can be used as a general-purpose I/O pin, or as the OSC2 cl ock input, or as a clockoutput providing FOSC/4 clock pulses.
Port-B:
In the PIC18F452 microcontroller, PORTB is an 8-bit bidirectional port shared withinterrupt pins and serial device programming pins. Table below gives the PORTB bit
functions.PORTB is controlled by registers, and they are as follows:
Port data registerPORTB
Port direction registerTRISB
Port latch registerLATB
The general operation of PORTB is similar to that of PORTA. Figure 2.24 shows thearchitecture of PORTB. Each port pin has a weak internal pull-up, which can be enabled byclearing bit RBPUof register INTCON2. These pull-ups are disabled on a POR and when the
port pin is configured as an output. On POR, PORTB pins are configured as digital inputs.
Internal pull-ups allow input devices, such as switches, to be connected to PORTB pinswithout the use of external pull-up resistors. This saves cost because of the reducedcomponent count and less wiring requirements.
Port pins RB4RB7 can be used as interrupt on change inputs, whereby a change on anyof pins 47 causes an interrupt flag to be set. The interrupt enable and flag bits RBIE andRBIF are in register INTCON.
-
7/28/2019 wireless controlled robotic car
42/57
Port-C,D,E:
In addition to PORTA and PORTB, PIC18F452 has 8-bit bidirectional ports PORTC andPORTD, and 3-bit PORTE. Each port has its own data register (e.g., PORTC), data direction
register (e.g., TRISC), and data latch register (e.g., LATC). The general operation of theseports is similar to PORTA.
-
7/28/2019 wireless controlled robotic car
43/57
In the PIC18F452 microcontroller, PORTC is multiplexed with several peripheral
functions, as shown in Table 2.8. On a POR, PORTC pins are configured as digital inputs.In the PIC18F452 microcontroller, PORTD has Schmitt Trigger input buffers. On a POR,
PORTD is configured as digital inputs. PORTD can be configured as an 8-bit PSP (i.e.,microprocessor port) by setting bit 4 of the TRISE register. Table 2.9 shows functions ofPORTD pins.
In the PIC18F452 microcontroller, PORTE is only 3 bits wide. As shown in Table 2.10,port pins are shared with analog inputs and parallel slave port read/write control bits. On aPOR, PORTE pins are configured as analog inputs, and register ADCON1 must be
programmed to change these pins to digital I/O.
-
7/28/2019 wireless controlled robotic car
44/57
Serial Communication (USART):
Hardware USART functions enable RS232 type serial communication to be implementedusing the hardware USART module of the microcontroller. In general, hardware-based
USART can give faster and more reliable communication. In addition, the processor cancarry out other tasks while the USART is handling the serial communication.
C18 compiler provides the USART functions given in Table 4.22 (in microcontrollerswith more than one USART a number is added to the end of these functions to identify theUSARTs). The header file usart.h must be defined at the beginning of a program usingthese functions.
The definition of these functions is given in the below table.
BusyUSART:This function returns a 1 if the USART transmitter is busy transmitting acharacter. This function should be checked before sending a new byte to the USART. Thefunction returns a 0 if the USART transmitter is idle.
CloseUSART: This function disables the USART.
DataRdyUSART: This function returns a 1 if data is available in the USART readbuffer. A 0 indicates that data is not available in the read buffer.
getcUSART: This function reads a byte from the USART buffer. An example is givenbelow:
int result;result = getcUSART( );
getsUSART: This function reads a string of characters from the USART. This functionwaits and reads a specified number of characters. There is no timeout and the program willwait forever if the specified numbers of characters are not received. An example is given
below to show how this function can be used:
char buff[20];
-
7/28/2019 wireless controlled robotic car
45/57
getsUSART(buff, 6); // Wait to receive 6 characters
OpenUSART: This function configures the USART. Two arguments are required: aconfiguration argument called config and an integer called spbrg, which specifies the valueto be written to the baud rate generator register to determine the baud rate.config
Interrupt on transmission:USART_TX_INT_ON Transmit interrupt ONUSART_TX_INT_OFF Transmit interrupt OFF
Interrupt on reception:USART_RX_INT_ON Receive interrupt ONUSART_RX_INT_OFF Receive interrupt OFF
USART mode:USART_ASYNCH_MODE Asynchronous modeUSART_SYNCH_MODE Synchronous mode
Transmission width:`USART_EIGHT_BIT 8-bit transmit/receiveUSART_NINE_BIT 9-bit transmit/receive
Slave/Master selectUSART_SYNC_SLAVE Synchronous slaveUSART_SYNCH+MASTER Synchronous master
Reception mode:USART_SINGLE_RX Single receptionUSART_CONT_RX Continuous reception
Baud rate:USART_BRGH_HIGH High baud rateUSART_BRGH_LOW Low baud rate
spbrg:
This is the value written onto the baud rate generator register to define the baud rate to beused. The formula for the baud rate is as follows:
For High Speed (USART_BRGH_HIGH),Baud = FOSC/[16 * (spbrg + 1)]
or
spbrg = FOSC/(16 * baud) 1
-
7/28/2019 wireless controlled robotic car
46/57
and
For Low Speed (USART_BRGH_LOW),Baud = FOSC/[16 * (spbrg + 1)]
or
spbrg = FOSC/(64 * baud) 1,where FOSC is the microcontroller clock frequency.
putcUSART: This function sends a byte to USART.
putsUSART: This function sends a string of characters to USART from the datamemory.
An example is given below:
putrsUSART("My Computer");putrsUSART: This function sends a string of characters to USART from the programmemory.
baudUSART: This function sets the baud rate configuration bits for enhance d USARToperation. The valid arguments can be formed from bitwise AND of the followingdefinitions:
Clock idle state:BAUD_IDLE_CLK_HIGH Clock idle state is high levelBAUD_IDLE_CLK_LOW Clock idle state is low level
Baud rate generation:BAUD_16_BIT_RATE 16-bit baud rate generationBAUD_8_BIT_RATE 8-bit baud rate generation
RX pin monitoring:BAUD_WAKEUP_ON RX pin monitoredBAUD_WAKEUP_OFF RX pin not monitored
Baud rate measurement:
BAUD_AUTO_ON Autobaud rate measurement enabledBAUD_AUTO_OFF Autobaud rate measurement disabled
-
7/28/2019 wireless controlled robotic car
47/57
MPLABXThere are several C compilers on the market for the PIC18 series of
microcontrollers. Most of the features of these compilers are similar, and they can
all be used to develop C-based high-level programs for the PIC18 series ofmicrocontrollers.
Some of the popular C compilers used in the development of commercial, industrial,
and edu-cational PIC18 microcontroller applications are as follows:
mikroC C compiler
PICC18 C compiler
CCS C compiler
MPLAB C18 C compiler
mikroC C compiler has been developed by MikroElektronika( Web site:http://www.mikroe.com) and is one of the easy-to-learn compilers with rich
resources, such as a large number of library functions and an integrated development
environment with built-in simulator and an in-circuit-debugger (e.g., mikroICD). A
demo version of the compiler with a 2K-program limit is available from
MikroElektronika.
PICC18 C compiler is another popular C compiler developed by Hi-Tech Software(
Web site: http://www.htsoft.com). This compiler has two versions: the standard
compiler and the professional version. A powerful simulator and an integrateddevelopment environment ( Hi-Tide) are provided by the company. PICC18 is
supported by the Proteus simulator (http://www.labcenter.co.uk), whichcan be used
to simulate PIC microcontroller-based systems.
A limited-period demo version of this compiler is available from the developers
Web site.
CCS C compiler has been developed by Custom Computer Systems Inc.( Web site:
http://www.ccsinfo.com). The company provides a limited-period demo version of
their compiler. CCS compiler provides a large number of built-in functions andsupports an in-circuit-debugger (e.g., ICD-U40), which aids greatly in the
development of PIC18 microcontroller-based systems.
MPLAB C18 C compiler is a product of Microchip Inc. ( Web site:http://www
.microchip.com). An evaluation version with limited functionality is available from
the Microchip Web site. MPLAB C18 includes a simulator and supports hardware
and software development tools such as in-circuit-emulators (e.g., ICE2000) and in-
circuit-debuggers (e.g., ICD2 and ICD3). In this book, we will be using the MPLAB
C18 compiler for all the projects.MPLaB C18 Compiler
http://www/http://www/http://www/http://www/ -
7/28/2019 wireless controlled robotic car
48/57
MPLAB C18 compiler (or the C18 compiler) is one of the mostpopular C compilers
available for thePIC18 series of microcontrollers. This compiler has been developed
by Microchip Inc. An evaluation version (student version) of the compiler is
available from the Microchip Web site free of charge. This evaluation version
includes all functionality of the full version of the compiler for the first 60 days.
However, some optimization routines are disabled after 60 days, and PIC18
extended mode (extended instruction set and indexed with literal offset addressing)
is not supported after 60 days.
MPLAB C18 is a cross compiler, where programs are developed on a PC and are
then loaded to the memory of the target microcontroller using a suitable
programming device.
The installation and use of the MPLAB C18 compiler and detailsof programming
using the compiler are given in this chapter.
-
7/28/2019 wireless controlled robotic car
49/57
CHAPTER #3
IMPLEMENTATION
TOUCH DISPLAY OPERATIONA resistive touch screen is constructed with two transparent layers coated with a
conductive materialstacked on top of each other. When pressure is applied by a
finger or a stylus on the screen, the top layer makes contact with the lower layer.
When a voltage is applied across one of the layers, a voltage divider is created. The
coordinates of a touch can be found by applying a voltage across one layer in the Y
direction and reading the voltage created by the voltage divider to find the Y
coordinate, and then applying a voltage across the other layer in the X direction and
reading the voltage created by the voltage divider to find the X coordinate.
Detecting a TouchTo know if the coordinate readings are valid, there must be a way to detect whether
the screen is being touched or not. This can be done by applying a positive voltage
(VCC) to Y+ through a pullup resistor and applying ground to X. The pullupresistor must be significantly larger than the total resistance of the touch screen,
which is usually a few hundred ohms. When there is no touch, Y+ is pulled up to the
positive voltage. When there is a touch, Y+ is pulled down to ground as shown in
Figure 1. This voltage-level change can be used to generate a pin-change interrupt.
-
7/28/2019 wireless controlled robotic car
50/57
TOUCH SCREEN READING
Reading a 4-Wire ScreenA 4-wire resistive touch screen is constructed as shown in Figure 2.
The x and y coordinates of a touch on a 4-wire touch screen can be read in two steps.
First, Y+ is driven high, Yis driven to ground, and the voltage at X+ is measured.
The ratio of this measured voltage to the drive voltage applied is equal to the ratio of
the y coordinate to the height of the touch screen. The y coordinate can be calculatedas shown in Figure 3. The x coordinate can be similarly obtained by driving X+
high, driving X to ground, and measuring the voltage at Y+. The ratio of this
measured voltage to the drive voltage applied is equal to the ratio of the x coordinate
to the width of the touch screen. This measurement scheme is shown in Figure 3.
-
7/28/2019 wireless controlled robotic car
51/57
Reading an 8-Wire ScreenAn 8-wire resistive touch screen is constructed as shown in Figure 4.
In comparison to a 4-wire touch screen, an 8-wire touch screen adds sense wires to
the end of each of the conductive bars. This allows any voltage offset created by the
wiring or drive circuitry to be calibrated out during operation. An 8-wire touch
screen is calibrated by measuring voltage extremes on either coordinate. First, Y+
-
7/28/2019 wireless controlled robotic car
52/57
drive is driven high and Y drive is driven low. The corresponding voltages
measured at Y+ sense and Y sense are denoted VYmax and VYmin. A similar
procedure yields VXmax and VXmin. These are the maximum and minimum
possible voltages across each coordinate.The coordinates of a touch on an 8-wire
touch screen can be read by first driving Y+ drive high, driving Ydrive to ground,
and reading the voltage at X+ sense. Using the maximum and minimum results
obtained during calibration, the y coordinate can be calculated as shown in the
equations in Figure 5. The x coordinate can be obtained by driving X+ drive high,
driving X drive to ground, and reading the voltage at Y+ sense. This process is
shown in Figure 5.
-
7/28/2019 wireless controlled robotic car
53/57
Chapter # 4
APPLICATIONS
Security systemRobotics have been a staple of advanced manufacturing for over half a
century. As robots and their peripheral equipment become more
sophisticated, reliable and
miniaturized, these systems are
increasingly being utilized for military
and law enforcement purposes.
Military and battlefield applicationscontinue to grow at an accelerated
pace due to demand fueled by
government investment. Over the past
decade, we have seen increasing
levels of investment in autonomous
vehicles used for surveillance and
security, says Rush LaSelle, Vice
President and General Manager withAdept Technology Inc. (Pleasanton, California) Applications range from
monitoring perimeters of secured areas such as airports to acting as a night
watchman.
Robots go to WarMobile robotics play an increasingly important role in military matters, from
patrol to dealing with potential explosives. With suitable sensors and
cameras to perform different missions, mobile robots are operated remotely
for reconnaissance patrol and relay back video images to an operator, says
Dr. Andrew Goldenberg, PhD, Chief Executive Officer and President of
Engineering Services Inc. (ESI, Toronto Ontario, Canada) Robots can
neutralize suspicious objects that may explode. The platform has a robot
arm to pick up explosives or suspected hazards in military or civilian
settings.
Goldenberg goes on to say, The mobile robotic platform is mounted on a
rectangular box with electronic equipment. The platform moves on wheels or
-
7/28/2019 wireless controlled robotic car
54/57
tracks, or both, and is usually battery-powered. Communication equipment
and sensors can detect images, sounds, gases and other hazards. The
communication systems read sensors and relay that information to the
operator.
Robotics help meet challenges posed by the specter of urban terrorism.
Instead of having people get close to hazards such as unattended objects
or car bombs, robots are used. If an operator concludes a dangerous object
might explode, the robot could neutralize that object by shooting to detonate
it, Goldenberg says. Mobile robots detect and explode in-ground mines or
improvised explosive devices. These same mobile robotic systems are used
for neutralizing or exploding forgotten ordnance and mines after conflicts
cease.
Autonomy or ControlThe level of autonomy separates industrial robotics from their battlefield
counterparts. Mobile robotic platforms are operated remotely and do not
have the autonomy of industrial robots. Security robotic systems are under
the total control of the operator, typically military personnel, says
Goldenberg. Security robots have not yet been made autonomous, given
the purpose of the vehicles, especially if armed. Due to a handful of
instances of friendly fire, the trend has been against providing security robot
systems the autonomy of their industrial equivalent, Goldenbergre calls.
-
7/28/2019 wireless controlled robotic car
55/57
Consequently, operator fatigue results from people directing mobile robotic
systems denied industrial-strength autonomy, says Goldenberg. I have
heard about concerns with operators of military robots being over-loaded
and fatigued while controlling the robot. The robot is given some intelligence,
but that intelligence is limited.
The limited intelligence extends to networking the mobile robots with global
positioning satellites. (GPS) Again Andrew Goldenberg: Mobile robotic
systems make use of GPS to navigate. The robot will decide how it will get to
its destination and is able to detect a target and the rest of the surrounding
environment.
Obstacle Course
Mobile robotic platforms used in national security applications must move
within unstructured environments. The ability to operate over challenging
terrain and the ability to autonomously navigate in unstructured
environments are areas of focus, LaSelle points out. The migration of
automated systems from factory lines to moving freely throughout facilities
and beyond has created demands on system design
INDUSTRIES AND MININGENGINEERING
-
7/28/2019 wireless controlled robotic car
56/57
Robots will be doing jobs like laying explosives, goingunderground afterblasting to stabilize a mine roof or mining in areas where it is impossible forhumans to work..Examples of the trend to mining automation include:Tele-operated and automated load-haul-dump trucks that self-navigate
through tunnels, clearing the walls by centimetersThe worlds largest robot, a 3500 tonne coal drag linefeaturing automatedloading and unloading.A robot device for drilling and bolting mine roofs to stabilize them afterblasting.A pilot less burrowing machine for mining in flooded g rave ls andsa nd s un de rg ro un d, wh er e hu ma n operators cannot go.A robotic drilling and blasting device for inducing controlled caving.Fig.1. Afew mining vehicle-related a
R o b o t i c technology offers significant potential to improve the difficulty of therescue workers by reducing exposures to hazardous conditions. A roboticvehicle can explore the mine and provide valuable information to theteams to assist in planning and implementing search and
-
7/28/2019 wireless controlled robotic car
57/57
rescue operations. Industrial robots have been made a significant contributiontoward automating the manufacturing processes. The ef ficientuse of robots shows product iv ity increase, p r o d u c t i o n c o s tr e d u c t i o n , a n d p r o d u c t q u a l i t y improvement. However,
most robots currently in use perform simple repetitive jobs, such aspick-and-place, machine loading and unloading, spry painting andspot welding. A basic approach has been assumed for the testing of theperformance of the semi-autonomous robot. It has been seen that thisperforms well under the simple a s s u m p t i o n s o f t h e c o n d i t i o n se s t a b l i s h e d a t t h e underground mining excavation sites. Therecent fatality statistics for both underground as well as open cast miningoperations worldwide point out that the most serious risks to thepersonnel are from different mining condit ion especially that from theinaccessible areas of the mines where regular systematic monitoringand maintenance operations are difficult and hence, none of these operations
are not carried out on a systematic basis. It is true that there is nocontrol of the human operators on such unwanted happenings. Ingeneral, underground and opencast mining conditions are a cooperativeenterprise of powerful, mobile equipment and the workers who operate it. Ifmining equipment could be automated to function without a workers
full attention ,the mining industry could enhance productivity, accessunworkable mineral seams, and reduce human exposure to the inhospitableenvironment of dust, noise, gas, water, moving equipment and roof fall. Thecritical missing link to enable mine automation is the capability of equipment toestimate its position relative to its surrounding. The lack of accurate mapsof inactive, underground mines poses a serious threat to publicsafety. According to a recent study t ens o f t housands, perhapseven hundreds o f thousands, of abandoned mines exist today in theUnited States. Not even the U.S. Bureau of Mines knows the exact number,because federal recording of mining claims was not required until 1976.Hazardous operating conditions and difficult access routes suggest thatrobotic exploration and mapping of abandoned mines may be a viable option.
For maintain the working environment safety, it is now essential toimplemented robotic systems in underground