PIC 18F-series MCU dev-board
The main aim of this paper is to study and create a general purpose printed circuit board for general application in the field of robotics using a PIC 18F4550(Peripheral Interface Controller) microcontroller as the heart of the circuit. Different types of robots have different requirements. The task at hand is to study these requirements and create a general purpose Printed Circuit Board which can be used as the circuitry of a number of different kinds of robots. An ideal Circuit design would utilize all the functions of the microcontroller being used. The main features of our robot’s brain are analog to digital conversion, pulse width modulation (can be thought of as digital to analog conversion), communication techniques. We also need to provide signals to govern our relay system and a way to connect to mechanical appendages. All these will be inculcated in our design.
Over the years we as human being have fantasized of creating a being as superior as ourselves, which has eventually led to our fascination with robots. A robot is analogous to a human being. Just as we have five senses that govern our actions, every kind of robot has certain requirements including: certain number of sensors, a brain for processing the information from the sensor and certain number of outputs required for performing a task based on the input from the sensors. Let’s take the example of a simple task, such as cleaning a table. Our eyes take images of the table, which are then studied by our brain to determine the dirty parts and tell our hands to clean those portions of the table.
To perform this task our brain employs a certain algorithm which links our eyes to our hands. This same algorithm can be reproduced in our robot. The question is, what kind of inputs do our sensors provide to our robot’s brain (the PIC microcontroller in this case), and in what form will the brain provide us with outputs? The sensors maybe light sensors, ultrasound sensors, heat sensors, infrared sensors etc.The output may either travel to our relay system directly, or we might need to transfer data from one point to another, or transfer data from our brain to a display unit (for example, a 16x2 LCD screen), when our sensors provide a particular input to the brain. Above all, we need to establish a link between the programming platform and our robot so we can program it to perform the given task. All these functions will now be incorporated into our design.
2. Circuit Design
I have selected the PIC 18F4550 as the heart of the controller due to its self-programmability and support for a large number of hardware peripherals. By self-programmability we mean that this device can write to its own program memory space under internal software control. By using a bootloader routine, located in the protected Boot Block at the top of program memory, it becomes possible to create self-modifying applications.
This circuit was simulated in National Semiconductor’s Multisim v10 and the Printed Circuit Board was designed in Diptrace v2.1.The final design of the board can be seen in figure given.
2.1. Building a basic USB Development Board
To build an USB development board based on a PIC18F4550 we require the following
- · A 20MHz crystal oscillator & two 15 or 22pF associated capacitors.
- · A USB-B or USB-A connector powering the PIC (Vss & Vdd) and linked to D- & D+ pins.
- · A 'decoupling' capacitor between Vss &Vdd (100nF &eventually another between 1 and 10uF )
- · A 'decoupling' capacitor between Vss &Vusb (220nF min, 470nF is also good)
- · A switch boot for hard reset on MCLR'
- · A switch reset for entering in Boot mode on RB4.
- To introduce self-programmability we have to first program the microcontroller using In-Circuit Serial Programming. The Boot and Reset switches are used to toggle the board between Bootloader mode and Execute mode. In the Bootloader mode, the microcontroller is statically programmed. After that it is transferred into the Execute mode, where the execution of the code takes place.
2.2. Sensors Interfacing
Every kind of robot that we build needs a certain number of sensors, which may be light sensors, heat sensors, ultrasound sensors etc. These sensors require electric power. To maintain the output within a certain range (usually 0-5V), we provide five 3 pin sensor ports with the centre being the output and the rest of the pins being at +5V and GND (for reference). The sensors output are connected to the Analog to Digital Conversion pins* of the PIC 18f4550 IC. The output of the sensors, which was initially analog, will now be converted into a digital from which can easily be understood by the processor. Also, two potentiometers that act as an exterior reference for the microcontroller have been connected to further ADC ports.
2.3. Interfacing with external Controlling Devices
A 38Khz Infrared Receiver Module, with TSOP 1238 IC(produced by Vishay Instruments) as the centre, has also been added to introduce one-sided serial communication with an external device. This provides stimulus from an external device, which governs the functioning of the robot. This board has also been provided with an extra port for pairing it with a wired remote that will offer speed control. The eight pins of the port on the bottom left of the board have been connected to the four input pins of the L293D IC, two pins have been used to offer speed control(the connections can be seen in Table 1)and remaining two pins power the external remote.
Also, as male jumpers have been connected to the pins of the ICs, we can easily connectan external communication circuit to our system for serial or parallel communication.
2.4. Interfacing with a Display Unit
With the purpose of establishing a way to communicate with the user via a Digital Display Unit, this board has been made compatible with a 16 by 2 LCD (Liquid Crystal Display) screen.
The 16-pin LCD that i used contains an internal backlight to enhance the display.
2.5. Interfacing with our Relay System
For running our relay system we use the L293D Integrated Circuit that will link our motors to our brain. For Speed control we apply Pulse Width Modulation (PWM) techniques. As they are edge triggered, the enable pins of the L293D are shorted with the PWM pins in our microcontroller (see Figure 3).The four input pins of the L293D have been connected to four Digital pins of the microcontroller, while the output pins are shorted with the connection of the motor.
This circuit can be used to control only Direct Current and Servo motors. DC motors can be connected to port M1 and M2.If we need to run more than 2 motors, an external L293D circuit can be connected to the system using the port on the far right of the PCB. Apart from DC motors, this board also allows us to utilize stepper motors (upto 8 pin). We limit he use of heavy motors due to the current limitation of the L293 D IC.
The board i designed can be used to make the following types of robots:
- Line follower
- Grid follower
- Obstacle chaser/avoider
- Manual robots of any kind
- Legged Robots-Quadrupedal
- Swarm Robots using external communication circuitry
This board will fulfill the needs of any student who is interested in basic robotics. Below is the pin connection of PIC18-F series 40 pins.
|6||Next switch (SPST)|
|10||Speed control (down)|
|19||L293D input1 / LED1|
|20||L293D input2 / LED2|
|21||L293D input3 /LED3|
|22||L293D input4 / LED4|
|23||USB connector type B (pin2)|
|24||USB connector type B (pin3)|
|36||L293D Speed up|
|37||Select button (SPST)|
All the pins, which are in red, are the system configuration pin or can say, basic circuitry to operate PIC Microcontroller. Remaining are custom pins, which are set by me. Sensor1 to sensor5 are 5 analog pins which can be connected to any analog output giving device through the male connectors above LCD.
Next and select buttons are push buttons which are used to give active low when pressed. Potentiometers are also connected to analog pins, which are on the left of LCD in orange colour.
One is just connected to LCD, for its brightness. Hence i have not mentioned that in the list.
I hope that L293D pin connection will be clear to you, when you will read my article on L293D motor driver. Apart from this, there are 4 Red LEDs which are connected in parallel to input pins of L293D and 4 green LEDs which are just used for signal and indicating purposes on the board. For example: I used them to show auto caliberation of IR sensor in my code.
To setup and start programming PIC, follow my articles on pic intro and programming setup. I have also made an tutorial for you on blinking LED with this PIC microcontroller board. You can also see some robotic implementation by this board here.
If you have any doubt or query, just contact me at my email address.