Design and Construction of a Light-Detecting and Obstacle-Sensing Robot for IoT—Preliminary Feasibility Study

Authored by: Mohammad Farhan Ferdous , Prayag Tiwari , V. B. Surya Prasath

Handbook of IoT and Big Data

Print publication date:  March  2019
Online publication date:  February  2019

Print ISBN: 9781138584204
eBook ISBN: 9780429053290
Adobe ISBN:




In this chapter, we present a new design and construction of a light sensing and obstacle detecting robotic vehicle using a microcontroller. The primary aim here is to provide the basics of a robotic vehicle using microcontroller, and develop the light, obstacle sensing capabilities in an embedded systems platform along with IoT-enabled capability. Our overall system is developed with a photo detector, an ultrasonic sensor for obstacle detection, along with using light for determining the direction where the robotic vehicle is moved. The specimen detects light and obstacles: when a light will fall on the sensor of the specimen, it will stop traveling; detect an obstacle on the way of its travel it stops travelling. The photo sensor/detector, ultrasonic sensor, and DC motor by which the robot is made to move are all being interfaced to a microcontroller that forms the overall control. One of the advantages of our work is the development of a sensing robot for light as well as obstacles.

 Add to shortlist  Cite

Design and Construction of a Light-Detecting and Obstacle-Sensing Robot for IoT—Preliminary Feasibility Study

3.1  Introduction

Automation is pervasive in the current decade, and nowadays every system is automated in order to face new challenges. The advantages of such automated systems include reduced manual operations, more flexibility, reliability, and guarantee of higher accuracy. Due to this trend, the majority of the modern fields prefer automated control systems; especially in the field of electronics, automated systems are proven to provide good performances. Further, unmanned systems play very important role to minimize of the risk of human life; for example, drones/unmanned aerial vehicles (UAVs) are increasingly utilized in modern wars. Recent advancements in the field of robotics have increased the demand for automated systems that can self-sustain, detect, and manoeuver tasks efficiently.

Automation technology in off-road equipment is an active area of research and several technological hurdles are yet to be solved [1]. One of the biggest hurdles is reliable detection of obstacles and recognition. There have been efforts to model obstacle detection using visual servoing. Using a novel autonomous control architecture, specialized sensing, combined with manipulation and visual servoing as well as Bayesian classification, the nomad robot found and classified five indigenous meteorites during an expedition to the remote site of Elephant Moraine in 2000 [2]. The primary reason for utilizing such a mobile robot is the capability of it to execute one or more tasks repeatedly with high speed as well as accuracy [3]. In [4] a design for the controller was undertaken with stable walk with defined dynamic and static parameters. Further, the authors of [4] humanoid locomotion as a hybrid system proposed the canonical equation for the universal for momentum of different join angles to produce exact human locomotion. A key capability required by an autonomous mobile robot is the possibility to navigate through an area. The one of the goals of robot navigation is obstacle avoidance. The mobile robot must travel from a start point to a target point while being able to detect and avoid the obstacles [5]. Hence the robot always keeps a safe distance from the obstacles in order to travel from the start point to the goal point. The navigation of the mobile robot can be more efficient if the robot can detect the distance of the obstacle from the robot. Thus, good map constructions of the atmosphere and using a proper sensor that gives accurate data are essential to repel from obstacle collisions. The robot should able to process the data from the sensor as quickly as possible when it detects an obstacle [5], so that it can escape the obstacle and go to a new safe path. Both the robot and the obstacles may be damaged due to obstacle collision. There are considerable interests to build a mobile robot to use in space, military, office, hospital, and industry [6]. It also can be used to imitate human jobs like cleaner, postman, waiter, security guard, and more.

The field of robotics encompasses a broad spectrum of technologies in which computational intelligence is embedded in physical machines, creating systems with capabilities far exceeding the core components alone [7]. In a smart and connected society driven by Internet of Things (IoT) devices [8–10], robotic systems will play important roles in enabling smart cities [11–13]. Such robotic systems are then able to carry out tasks that are unachievable by conventional machines, or even by humans working with conventional tools. The ability of a machine to move by itself—that is, “autonomously”—is one such capability that opens up an enormous range of applications that are uniquely suited to robotic systems. This research is a recent advancement in automation, healthcare, and space exploration [14]. In the field of mechatronics systems, the worth and value of automated systems is very high and gives good performance. In a war situation, these robots are very useful to reduce the human losses and money. Example of this system is target detecting. The automated system is here for detecting the targets. It is developed using an embedded system with a microcontroller. The mobile robot vehicle moves whenever required. The push recovery is still challenging, because the robot does not have as much physical strength and decision-making capability that normal humans have [15]. To be useful in the real world, robots need to move safely in unstructured environments and achieve their goals despite unexpected changes in their surroundings. The environments of real robots are rarely predicable or perfectly known, so it does make sense to make precise plans before moving.

In this work, we present a light-sensing and obstacle-detecting robotic vehicle. One of the major advantages of our automated robot is that it senses the light and directs itself toward the high-luminance areas. For this purpose, we custom-designed our robot with sensors that detect the luminance density effectively under varying illumination conditions. Further, we deployed ultrasonic sensors that allowed the robot to avoid any potential obstacles that could prevent it from reaching the high-luminance areas successfully. In this paper we describe the details of our design and construction of a light-detecting and obstacle-sensing (LiDOS) robot developed by us. Our design includes a mobile robotic vehicle where the sensors are mounted and controlled in an automatic way. From the standby mode the mobile robot vehicle is moved, and whenever an obstacle and light are detected by the photo sensor and ultrasonic sensor respectively, the information is passed to the microcontroller within the robot vehicle. Obstacle avoidance is accomplished through a combination of global and local avoidance subsystems that deal with both known and unknown obstacles in the operating area of the vehicle [16]. Based on these, the microcontroller changes the direction of the robot by driving the motors in the direction of the target. Pushes were induced from behind with closed eyes to observe the motor action as well as with open eyes to observe learning-based reactive behaviors [17]. The following components were used in the hardware side: microcontroller, battery, photo sensor or photo detectors, ultrasonic sensors, motors, and motor drivers. The hardware in this robot is a microcontroller, battery, sensors, light-dependent resistor, and motor and stepper motor drivers’ body shell. This system can be used to get accurate results and to reduce human efforts.

The rest of this chapter is organized as follows: Section 2 reviews related light- and obstacle-detecting robotic vehicles systems from the literature. Section 3 provides the details of our proposed system with sensors and microcontroller. Finally, Section 4 concludes the paper.

3.2  Literature Review

In what follows, we review works related to the current study of the ultrasonic sensor and photosensor-detecting light and obstacle robotic vehicle system technology. We reviewed different obstacle-detecting robot mechanisms that have been built. These robots can be divided into two categories: either mobile or fixed robots. The purpose of this chapter is to briefly describe mobile robots that are used in difficult or dangerous environments.

3.2.1  Review of Mobile Robots

  • SR04 Mobile Robot Author: David P. Anderson, Department of Geological Sciences, Southern Methodist University Description: The SR04 is a small mobile robot suitable for exploring human habitats unattended. It is controlled by a Motorola HC6811 microprocessor running in an M.I.T. 6.270 CPU card, similar to the commercially available “Handy Board.” Two 12-volt DC gear-head motors manoeuver the robot in a dual-differential drive configuration, balanced by a non-driven tail wheel caster and powered by a 12 volt 2.2 amp-hour sealed lead acid battery. Sensory input is provided by (in order of priority) front bumper switches, IR collision avoidance, stereo sonar ranging, photodetectors, passive IR motion detection, and shaft-encoder odometry.
  • Machina Speculatrix Author: W. Grey Walter, Smithsonian Institution Description: These vehicles have a light sensor, touch sensor, propulsion motor, steering motor, and a two vacuum tube analogy computers. Even with this simple design, Grey demonstrated that his robots exhibited complex behaviors. He called his creation Machina Speculatrix, after their speculative tendency to explore their environment. The Adam and Eve of his robots were named, respectively, Elmer and Elsie (Electro Mechanical Robots, Light Sensitive). The light sensor is rigidly fixed to the steering assembly so that it is always pointing in the direction of travel. This is my third-generation design, and I have reduced the construction to the bare necessities to make it easier to build. Grey’s turtles has a steering assembly that rotated 360 degrees and in only one direction. This requires slip rings to carry electricity to the drive motor and the light sensor. Since there is no LEGO part like this, I added a switch to detect when the steering assembly is pointed backward. This condition is used to reverse the steering motor direction, creating a windshield wiper action. The post that supports the light sensor also pushes the switch. The small wheel on the front is used for debugging and to set the initial direction.
  • Photobot Authors: Dan and Caleb DeGard, Seattle, Washington Description: The robot was used for a robotics demonstration at a community college. Components common in the amateur robotics industry were used, such as a Parallax Basic Stamp microcontroller, servomotors and wheels from a radio control (R/C) model, a servo control chip, and a cadmium-sulfide photoresistor and potentiometer. The robot was assembled using duct tape, Velcro, and rubber bands. No soldering was required. Electrical connections were made using the wire-wrapping method. A full listing of the control program is included. This mobile robot was developed to serve as a demonstration at a meeting of the technology club at the Seattle Central Community College. The club had a desire to become involved in robotics, and was making their first step by inviting us to introduce them to the industry (sport, vocation, avocation, all-consuming compulsion)—initial discussions within the club were tending toward mind-numbing complexity. The robot consists of a Parallax Basic Stamp 2 on a carrier board, two hacked servos with wheels, a battery pack for the servos, a 9V battery for the stamp, a CdS cell, and a 10K potentiometer. In addition, a Ferrettronics FT639 chip is used to provide the square-wave signal for the servos. This chip is optional, as the Stamp can be programmed to provide the square-wave signal. It does, however, make servo operation easier, and we now tend to use it whenever we use servos with a microcontroller. There are also several LEDs mounted on the carrier board, used to track the active subroutine. These are not necessary for the operation of the robot, but they do look cool. A length of 18AWG wire is bent to form a tailskid, and a couple of rubber bands hold the Stamp carrier board on top of the servo battery pack.
  • ActivMedia Pioneer 3-DX Mobile Robot The ActivMedia Pioneer 3-DX robot is a two-wheel drive intelligent mobile platform equipped with advanced devices for sensing and navigation in a real-world environment, including wheel encoders and ultrasonic sensors. The circular basis has a diameter of 50 cm and can carry up to 23 Kg. It is mainly conceived for research experiments. The robot operates as the server in a client-server environment: Its controller handles the low-level details of mobile robotics, including maintaining the platform’s drive speed and heading over uneven terrain, acquiring sensor readings such as the sonar, and managing attached accessories like the Gripper. To complete the client-server architecture, the robot requires a client connection: software running on a computer connected with the robot’s controller via a serial link and that provides the high-level, intelligent robot controls, including obstacle avoidance, path planning, features recognition, localization, and so on.

3.2.2  Hardware Review—Photo Light Sensors

  • Fundamental light sensors or photodetectors: The photosensor or LDR is used to sense changes in the quantity of light in its atmosphere. It is a cadmium-supplied device and has nonlinear characteristics. However, its sensitivity to the light is quite slow, due to its response time to the light is slower compared with a photodiode or phototransistor. The value of its resistance decreases when the intensity of the light falling on the sensor increases. The behavior of the photocell can be seen as that of a light-control potentiometer. The photocell is interfaced with the Handy Board using a voltage divider circuit. Using this circuit, input voltage Vin is the voltage drop across a 47Kohm pull-up resistor and photosensor, and the output voltage is the voltage across the Rphot (of output voltage Sent apped between the resistors).
  • Ultrasonic distance sensor: Parallax’s PING ultrasonic sensor provides a very low-cost and easy method of distance measurement. This sensor is perfect for any number of applications that require you to perform measurements between moving or stationary objects. Naturally, robotics applications are very popular, but one can also find this product to be useful in security systems or as an infrared replacement if so desired. You will definitely appreciate the activity-status LED and the economic use of just one I/O pin. The PING sensor measures distance using sonar; an ultrasonic (well above human hearing) pulse is transmitted from the unit and distance-to-target is determined by measuring the time required for the echo return. Output from the PING sensor is a variable-width pulse that corresponds to the distance to the target. Interfacing to the BASIC Stamp and Javelin Stamp microcontrollers is a snap: a single (shared) I/O pin is used to trigger the PING sensor and “listen” for the echo return pulse. And the intelligent trigger hold-off allows the PING to work with the BS1! An onboard three-pin header allows the PING to be plugged into a solderless breadboard (on a Boe-Bot, for example) and to be connected to its host through a standard three-pin servo extension cable.
  • Ultrasonic movement detector: A matched pair of ultrasonic transducers operating at 40 KHz will reliably detect movement 4 m to 7 m away. It uses two 9V–12V circuit boards. The circuit is crystal-locked by 40 KHz crystal for maximum efficiency. This crystal-locked ultrasonic movement detector kit is built around a matched pair of ceramic transducers that convert movement energy to electrical energy and vice versa. Any movement in the area scanned by the transducer will be detected and a pulse produced. In this kit the pulse turns on an LED. Pads are provided to take this pulse to add-on circuits, where it may be used to turn on buzzers, lights, and so on. A PCB (printed circuit board) mounted switch can be used to switch between an automatic reset about 0.3 seconds after the detector has been triggered or to stay latched on. The unit will reliably work from four meters to more than 8 meters, depending on the sensitivity setting and the direction of the movement. The design was not built at once. We studied different possibilities and noticed how the thing worked and then reversed it and saw how it worked and noted down the changes. Finally we selected the optimum procedure and used the components that were best fit for the project in expenses and quality. We had studied all the relevant light sensors we needed to use in this project; finally we selected the LDR as light sensor. Then we went through the selection procedure of the range sensor for obstacle detection, and we chose the ultrasonic sensor for the obstacle detection. Finally we selected the microcontroller PIC16F676 for the project.

3.3  Design of a Light-Sensing and Obstacle-Detecting Robotic Vehicle

3.3.1  Block Diagram of the System

The block diagram in Figure 3.1 shows the sequence of the communication path of the signal generated from the photosensor (LDR) and ultrasonic distance sensor; when it comes to the pin of the microcontroller, it gives the off signal, and the motor goes in off mode and gradually stops the vehicle car.

Block diagram of the system.

Figure 3.1   Block diagram of the system.

3.3.2  Block Diagram of the Control Circuit

The block diagram in Figure 3.2 shows that whenever any obstacle is encountered in front of the range sensor (ultrasonic distance sensor) of the specimen, the sensor will give the command to the microcontroller, and when any light falls on the sensor of the specimen, it gives a command to the microcontroller, and the program in the microcontroller executes the command from the sensors and changes the output (motor).

Block diagram of the control circuit.

Figure 3.2   Block diagram of the control circuit.

3.3.3  Circuit Diagram of the Controller

Figure 3.3 shows the circuit diagram of the controller.

Circuit diagram of the controller.

Figure 3.3   Circuit diagram of the controller.

3.3.4  Program

// define io #define _IO_SIGNAL RA5_bit #define _D_SIGNAL TRISA5_bit #define _O_MOTOR RA0_bit #define _D_MOTOR TRISA0_bit #define _O_LED RC1_bit #define _D_LED TRISC1_bit #define _Solar_H RC2_bit #define _Solar_H_Dir TRISC2_bit void main() {  unsigned int EchoTime = 0, Distance = 0;  PORTA = 0;  PORTC = 0;  ANSEL = 0;  // set IO  _IO_SIGNAL = 0;  _O_MOTOR = 0;  _O_LED = 0;  _Solar_H_Dir = 1;  // init io  _D_SIGNAL = 0;  _D_MOTOR = 0;  _D_LED = 0;  _Solar_H = 1;  // wait time for initialize Sonar Module  Delay_ms(500);  while(1)  {   // set signal to Lo   _IO_SIGNAL = 0;   _D_SIGNAL = 0; // send start signal for Tout time   _IO_SIGNAL = 1;    Delay_us(5);   _IO_SIGNAL = 0;   _D_SIGNAL = 0;   // clear counter   EchoTime = 0;   Distance = 0;   // wait for Thold time   Delay_us(200);   _D_SIGNAL = 1;   // count echo time, every count equal 3us   while(_IO_SIGNAL == 1){EchoTime++;}   if(EchoTime > 500 && _Solar_H == 0)   {    _O_LED = 0;    _O_MOTOR = 1;   }   else   {    _O_LED = 1;    _O_MOTOR = 0;   }   // give delay before next measurement   Delay_ms(100);  } }

3.3.5  Design of a Light-Sensing and Obstacle-Detecting Robotic Vehicle  Building of Experimental Setup

In Figure 3.4, we show our four-wheel small robotic vehicle. It is a single DC motor drive four-wheel automotive mobile vehicle. An ultrasonic distance meter sensor and light sensor are placed on the roof of the vehicle. When the toy moves in a forward direction, it always observes any obstacle and light in front and on top of it, and when detects anything or any toy car, it gives the signal to the microcontroller and stops running the motor, which is why it is called a light-detecting vehicle.

Light-sensing and obstacle-detecting robotic vehicle.

Figure 3.4   Light-sensing and obstacle-detecting robotic vehicle.

3.3.6  Instrument and Measurement  List of Required Components



Ultrasonic distance sensor

1 pcs

Photosensor or light sensor

1 pcs

Microcontroller (PIC16F676)

1 pcs

Motor (DC)

1 pcs

Power source (6VDC battery)

1 pc


1 pcs


2 pcs


3 pcs

Connecting wires  Features

  • The PING))) has only has three connections, which include Vdd, Vss, and one I/O pin.
  • The three-pin header makes it easy to connect using a servo extension cable; no soldering required.
  • Provides precise, non-contact distance measurements within a 2 cm to 3 m range.
  • Simple pulse in/pulse out communication.
  • Burst indicator LED shows measurement in progress.
  • 20 mA power consumption.
  • Narrow acceptance angle.  Key Specifications

  • Power requirements: +5 VDC
  • Communication: Positive TTL pulse
  • Dimensions: 0.81 × 1.8 × 0.6 in (22 × 46 × 16 mm)
  • Operating temp range: +32°F to +158°F (0°C to +70°C)

An ultrasonic sensor typically utilizes a transducer that produces an electrical output in response to received ultrasonic energy. The normal frequency range for human hearing is roughly 20–20,000 hertz. Ultrasonic sound waves are sound waves that are above the range of human hearing, and thus have a frequency above 20,000 hertz. Any frequency above 20,000 hertz may be considered ultrasonic. Most industrial processes, including almost all sources of friction, create some ultrasonic noise. The ultrasonic transducer produces ultrasonic signals. These signals are propagated through a sensing medium, and the same transducer can be used to detect returning signals. The energy bursts travel from the ultrasonic sensor, bounce off objects, and are returned toward the sensor as echoes. Transducers are devices that convert electrical energy to mechanical energy, or vice versa. Conversely, when a voltage is applied across certain surfaces of a solid that exhibits the piezoelectric effect, the solid undergoes a mechanical distortion. Transducers are also used in earphones and ultrasonic transmitters that produce a mechanical output from an electrical input. Ultrasonic transducers operate to radiate ultrasonic waves through a medium such as air. Transducers generally create ultrasonic vibrations through the use of piezoelectric materials such as certain forms of crystal or ceramic.  Ultrasonic Control Basics

Ultrasonic signals are like audible sound waves, except the frequencies are much higher. Our ultrasonic transducers have piezoelectric crystals that resonate to a desired frequency and convert electric energy into acoustic energy and vice versa. The illustration shows how sound waves, transmitted in the shape of a cone, are reflected from a target back to the transducer. An output signal is produced to perform some kind of indicating or control function. A minimum distance from the sensor is required to provide a time delay so that the “echoes” can be interpreted. Variables that can affect the operation of ultrasonic sensing include target surface angle, reflective surface roughness, or changes in temperature or humidity. The targets can have any kind of reflective form—even round objects.  The Advantages of Ultrasonic Sensor

Ultrasonic sensors have a lot of advantages for using in real application. The advantages of ultrasonic sensor are as follows:

  • Discrete distances to moving objects can be detected and measured.
  • Less affected by target materials and surfaces, and not affected by color.
  • Resistance to external disturbances such as vibration, infrared radiation, ambient noise, and EMI radiation.
  • Measures and detects distances to moving objects.
  • Impervious to target materials, surface, and color.
  • Solid-state units have virtually unlimited, maintenance-free lifespan.
  • Detects small objects over long operating distance.
  • Ultrasonic sensors are not affected by dust, dirt, or high-moisture environments.
  • Ultrasonic level sensors are usually non-contact type; that is, they do not make any contact with the process fluid under level detection.
  • Besides, they consist of fixed components only, hence require less maintenance.  The Limitations of Ultrasonic Sensor

Some disadvantages of ultrasonic sensor are as follows:

Ultrasonic level measurement technique cannot be suitably applied in all fields, since use of ultrasonic level sensors includes a few setbacks too. Many factors exist that have the tendency to influence the returned echo signal back to the sensor. Some of them include the following:

  • Materials like powders, liquids and so on
  • Heavy vapors
  • Surface turmoil
  • Foam
  • Ambient noise and temperature  LIGHT or Photo Distance Sensor

This is capable of measuring the distance to objects at ranges from 10 to 80 cm. It provides a voltage output that can be connected to an analogy input on the Handy board.

The distance sensor transmits a short burst of infrared light at intervals of about 1 ms. The light source is behind one of the lenses, which focuses the light into a narrow beam.

Light reflected from an object in this beam will return to the sensor, at an angle which depends on the distance to the object. This light passes through the other lens on the distance sensor, and is focused onto an array of light detectors. Light arriving at different angles will fall on a different respective set of light detectors.  Devantech SRF04 Range Finder Sensor

The SRF04 was designed to be just as easy to use as the Polaroid sonar, requiring a short trigger pulse and providing an echo pulse. The SRF04 timing diagram is shown below. You only need to supply a short 10uS pulse to the trigger input to start the ranging. The SRF04 will send out an eight-cycle burst of ultrasound at 40 kHz and raise its echo line high. The minimum and maximum range describes the sensor limits at 0 degrees (straight on from the sensor), while the angle describes the rough shape of the sensor cone at one half the sensor’s range. In actuality, the sensors do not detect in a perfect cone.

The echoes column lists the number of echoes recorded by the sensor. This always refers to the number of echoes recorded by the most recent ranging; with each new ranging, old values are overwritten. The range time column refers to the time to perform a ranging. The sensors using digital communication respond as soon as an echo is received.  Light-Dependent Resistor (LDR)

We used an LDR sensor to detect the luminance difference around the robot. These three sensors were separated by 120 degrees to easily detect the light around the robot. To isolate the LDR voltage variation from the PIC controller we used and LM229 comparator. Comparators constantly compare pairs of voltages and provide a digital indication (“1” or “0”) of which voltage is higher. Using the dedicated chip frees the microcontroller, which is now interrupted only when the digital signal changes.

The LM239 is a quad, single-supply comparator. A quad can compare four different pairs of voltages.

This comparator can operate up to 36 volts (or +18 V to −18 V). Since we intend to connect it to a microcontroller, so we made this as +5 V and GND. The LM239 is pin compatible with MC3303, LM339, and LM2901 chips. Although their operating temperature ranges differ (and there are a few other differences), anyone can work fine in this project.  Light or Photosensor Control Basics

A photoconductive light sensor does not produce electricity but simply changes its physical properties when subjected to light energy. The most common type of photoconductive device is the photoresistor, which changes its electrical resistance In response to changes in the light intensity. Photoresistors are semiconductor devices that use light energy to control the flow of electrons, and hence the current flowing through them. The commonly used photoconductive cell is called the Light-Dependent Resistor Or LDR.

The most commonly used photoresistive light sensor is the ORP12 Cadmium Sulphide photoconductive cell. This light-dependent resistor has a spectral response of about 610nm in the yellow to orange region of light. The resistance of the cell when unilluminated (dark resistance) is very high at about 10MΩs, which falls to about 100Ωs when fully illuminated (lit resistance).

To increase the dark resistance and therefore reduce the dark current, the resistive path forms a zigzag pattern across the ceramic substrate. The CdS photocell is a very low0cost device often used in auto dimming, darkness or twilight detection for turning the street lights on and off, and for photographic exposure meter types of applications.  Application of Photosensor or Light Sensor

Photocells are commonly used to detect the incandescent lamp that acts as a contest start indicator. They are also used to find the light beacons marking certain parts of the board, such as the goals. While they can be used to measure the reflectivity of the game board surface if coupled with a light source such as a red LED or an incandescent lamp, the IR reflectance sensors are usually better at this function. Photocells are sensitive to ambient lighting and usually need to be shielded. Certain parts of the game board might be marked with polarized light sources. An array of photocells with polarizing filters at different orientations could be used to detect the polarization angle of polarized light and locate those board features.  Advantages of Light Sensor

  • They are useful and can help many security problems.
  • They protect our valuables.
  • Some are easily assessable (e.g., cash points).
  • They control things properly (e.g., traffic lights).  Disadvantages of Light Sensor

  • They can easily be set off and cause problems.
  • They can break down.  Microcontroller

In this project we used microcontroller chip PIC16F676, which has 14 pins. This intense (200 nanosecond guidance execution) yet simple-to-program (just 35 single word directions) CMOS Flash-based 8-bit microcontroller packs Microchip’s great PIC® MCU engineering into a 14-stick bundle and highlights 8 channels for the 10-bit analog-to-digital (A/D) converter, 1 comparator, and 128 bytes of EEPROM information memory. This gadget is effortlessly adjusted for car, modern machines, and purchaser section level item applications that require field reprogrammability.

The features of the microcontroller are as follows:

  • 128 bytes of EEPROM data memory
  • Programmable draw-up resistors
  • Independently selectable simple channels
  • ICD2 programming support or investigating support with discretionary header connector
  • Eight oscillator choices, including the Exactness 4 MHz R/C oscillator with programmable adjustment and power-on reset  Fundamental of PIC

PIC is a family of Harvard architecture microcontrollers made by microchip technology, derived from the PIC1650 originally developed by general instrument’s microelectronics division. PICs are popular with developers and hobbyists alike due to their low cost, wide availability, large user base, extensive collection of application notes, availability of low-cost or free development tools, and serial programming (and reprogramming with flash memory) capability. PICs were also commonly used to defeat the security system of popular consumer products (pay-TV, PlayStation), which attracted the attention of crackers.

PICs have a set of register files that function as general purpose RAM; special purpose control registers for on-chip hardware resources are also mapped into the data space. The addressability of memory varies depending on device series, and all PIC devices have some banking mechanism to extend the addressing to additional memory. Later series of devices feature move instructions which can cover the whole addressable space, independent of the selected bank. In earlier devices, any register move had to be through the accumulator. To synthesize indirect addressing, a “file select register” (FSR) and “indirect register” (INDF) are used. A read or write to INDF will be to the memory pointed to by FSR. Later devices extended this concept with post- and pre-increment/decrement for greater efficiency in accessing sequentially stored data. This also allows FSR to be treated like a stack pointer.

PICs have a hardware call stack, which is used to save return addresses. The hardware stack is not software accessible on earlier devices, but this changed with the 18 Series devices. Hardware support for a general purpose parameter stack was lacking in the early series, but this greatly improved in the 18 Series, making the 18 Series architecture friendlier to high level language compilers.  Instruction Set

PICs’ instructions vary in number from about 35 instructions for the low-end PICs to about 70 instructions for the high-end PICs. The instruction set includes instructions to perform a variety of operations on registers directly, the accumulator and a literal constant or the accumulator and a register, as well as for conditional execution and program branching. To load a constant, it is necessary to load it into W before it can be moved into another register. On the older cores, all register moves needed to pass through W, but this changed on the high-end cores. PIC18 cores have skip instructions that are used for conditional execution and branching. The skip instructions are “skip if bit set” and “skip if bit not set.” Because cores before PIC18 had only unconditional branch instructions; conditional jumps are synthesized by a conditional skip (with the opposite condition) followed by a branch. The PIC architecture has no (or very meager) hardware support for saving processor state when servicing interrupts. The 18 Series improved this situation by implementing shadow registers, which save several important registers during an interrupt.  Pin Description

Pin Number



Vdd—Positive Power Supply






RA3/MCLR/Vpp—Port A


RC5—Port C


RC4—Port C


RC3/AN7—Port C


RC2/AN6—Port C


RC1/AN5—Port C


RC0/AN4—Port C








Vss — Ground  Special Microcontroller Features

  • Fail-safe clock monitor
  • Power-on reset
  • Power-up timer (PWRT) and oscillator start-up timer (OST)
  • Two-speed start-up mode
  • Programmable code protection
  • Power-saving sleeping mode
  • Peripheral features
    • Two 8-bit timer/counter with prescalar
    • One 16-bit timer/counter
    • High source/sink current: 25mA
    • Parallel Slave Port (PSP): 40/44 pin-device only
  • Low-power features
    • Primary run (XT, RC, Oscillator, 76 µA, 1MHz, 2V)
    • RC_RUN (7 µA, 31.25kHz, 2V)
    • Timer1 oscillator (1.8 µA, 32kHz, 2V)
    • Watchdog timer (0.7 µA, 2V)
    • Two-speed oscillator start-up
  • Analog features
    • 10-bit, up to 14-channel analog-to-digital converter
    • Dual analog comparators
    • Programmable low-current brown-out reset (NOR) circuitry
    • Programmable low-voltage detect (LVD)
  • Oscillators
    • Three crystal modes: LP, XT, HS (up to 20 MHz)
    • Two external RC modes
    • ECIO (up to 20 MHz)
    • 8 user-selectable frequencies

3.4  Experiment Results

After building the project we were testing the robotic vehicle. Our project’s first objective was design a robotic vehicle using 14 pins microcontroller (PIC16F676) that input and output pins used accurately. The working components such as ultrasonic sensor, LDR, DC motors, transistor, and other devices are connected with the microcontroller. There is a program in the microcontroller and which direction must help to detect light and obstacle of the robotic vehicle.

Our project’s second objective was to develop the light- and obstacle-sensing capability of the robotic vehicle. The vehicle LDR sensor can detect to any type of light beam; to fulfill to our project objective, when a light beam falls on an LDR sensor then the vehicle will stop and the light-sensing capacity is high. We also used an ultrasonic sensor, which can sense any type of obstacle. When an obstacle is found to be in front of the robotic vehicle then it will stop travelling, else the robotic vehicle always goes forward.

The results of the work utilized the following sensors:

  1. Two ultrasonic range finders mounted on the vehicle to detect obstacles and provide information to detour around the obstacle.
  2. Light sources attached to a position in the room and a rotating light-detecting sensor located on the vehicle to update the absolute position.

3.5  Conclusion

The work presents a prototype design and construction of a light-detecting and obstacle-sensing robot. We showed how to build the overall circuit and programmed the PIC we chose to test the robotic vehicle. Based on the distance between the sensors and the surface of obstacles, the robotic vehicle (as the vehicle we were working on had different polarity stuff) will stop if it detects the obstacles or else seamlessly move forward. Our preliminary feasibility of building this multi-sensor based robotic vehicle shows promise, and we are currently extending this to be an Internet of Things (IoT) enabled device.


Bischoff R. , “Advances in the development of the humanoid service robot HERMES,” Proceedings of the International Conference on Field and Service Robotics, pp. 156–161, 1999.
Apostolopoulos D. , M. Wagner , W. Whittaker , “Technology and field demonstration results in the robotic search for Antarctic meteorites,” Proceedings of the International Conference on Field and Service Robotics, pp. 185–190, 1999.
Langer D. , Mettenleiter, F. Hartl , and C. Frohlich , “Imaging laser radar for 3- D surveying and cad modeling of real world environments,” Proceedings of the International Conference on Field and Service Robotics, pp. 13–18, 1999.
Semwal , Vijay Bhaskar , et al. “Biologically-inspired push recovery capable bipedal locomotion modeling through hybrid automata.” Robotics and Autonomous Systems 70 (2015): 181–190.
Corke P. , G. Winstanley , J. Roberts , E. Duff , and P. Sikka , “Robotics for the mining industry: Opportunities and current research,” Proceedings of the International Conference on Field and Service Robotics, pp. 208–219, 1999.
Thrun S. , et al., “Experiences with two deployed interactive tour-guide robots,” Proceedings of the International Conference on Field and Service Robotics, pp. 37–42, 1999.
Torrie M. , S. Veeramachaneni , B. Abbott , “Laser-based obstacle detection and avoidance system,” Proceedings of the SPIE Conference on Robotics and Semi- Robotic Ground Vehicle Technology, pp. 2–7, 1998.
Kadam, V. G. , Tamane, S. C. , and Solanki, V. K. , “Smart and connected cities through technologies.” In Big Data Analytics for Smart and Connected Cities, pp. 1–24. IGI Global, Hershey, PA, 2019.
Sanju, D. D. , A. Subramani and V. K. Solanki . “Smart City: IoT based prototype for parking monitoring & parking management system commanded by mobile app,” Second International Conference on Research in Intelligent and Computing in Engineering, 2018.
Dhall, R. , V. K. Solanki , “An IoT based predictive connected car maintenance approach,” International Journal of Interactive Multimedia and Artificial Intelligence, 4(3), 2017.
Solanki, V. K. , M. Venkatesan , S. Katiyar , “Conceptual model for smart cities for irrigation and highway lamps using IoT,” International Journal of Interactive Multimedia and Artificial Intelligence, 4(3), 28–33, 2018.
Solanki, V. , M. Venkatesan , S. Katiyar , “Think home: A smart home as digital ecosystem in circuits and systems,” Scientific Research, 10(7), 2018.
Solanki, V. K. , S. Katiyar , V. B. Semwal , P. Dewan , M. Venkatesan , N. Dey , “Advance automated module for smart and secure city,” ICISP, Procedia Computer Science, 78, 367–374, 2015.
Semwal, V. B. , P. Chakraborty , G. C. Nandi . “Less computationally intensive fuzzy logic (type-1)-based controller for humanoid push recovery,” Robotics and Autonomous Systems 63, 122–135, 2015.
Semwal, V. B. , K. Mondal , G. C. Nandi . “Robust and accurate feature selection for humanoid push recovery and classification: Deep learning approach,” Neural Computing and Applications, 1–10, 2015.
Moore K. and M. Torrie , “John Deere Final Report: Obstacle Detection and Avoidance for an Automated tractor,” Tech. Rep, Center for Self-Organizing and Intelligent Systems, Utah State University, August. 1999.
Semwal, V. B. , A. Bhushan , G. C. Nandi , “Study of Humanoid Push Recovery Based on Experiments,” Control, Automation, Robotics and Embedded Systems (CARE), 2013, International Conference on. IEEE, 2013.
Search for more...
Back to top

Use of cookies on this website

We are using cookies to provide statistics that help us give you the best experience of our site. You can find out more in our Privacy Policy. By continuing to use the site you are agreeing to our use of cookies.