Micromouse Project Microcontroller Application Lab PDF

Title Micromouse Project Microcontroller Application Lab
Author Alex Le
Course Micro-Controller Based Systems
Institution University of the West of England
Pages 66
File Size 3.2 MB
File Type PDF
Total Downloads 15
Total Views 151

Summary

Micromouse Project Microcontroller Application Lab...


Description

2019/2020 Department of Engineering, Design, and Mathematics University of the West of England

MICROMOUSE REPORT Course: UFMFKA-30-2 - Microcontrollers applications group lab 19sep_1

Module Tutors: Wenhao Zhang Submission Date

1

TABLE CONTENTS : SECTION 1 : PROJECT INTRODUCTION ................................................................. 4 1.1 Introduction: ......................................................................................... 4 1.2 Aims and Objectives: ............................................................................. 4 SECTION 2: PRIMARY INVESTIGATION ................................................................ 6 2.1 Conceptual Design and justification........................................................ 6 2.1.1 Conceptual Design .............................................................................. 6 2.1.2 Justification of Design .......................................................................... 6 2.2 Hardware and/or software design .......................................................... 11 2.2.1 Hardware Design: ............................................................................... 11 A) Sensor Board..................................................................................... 11 B) Microcontroller Board ...................................................................... 11 C) Motor Board ..................................................................................... 12 2.2.2 Software Design ............................................................................... 10 A) ADC for Sensing ................................................................................ 11 B)I/O, Timer, PWM,QEI: ........................................................................ 16 C) UART: ................................................................................................ 16 D) Software combining .......................................................................... 18 E) Navigation .......................................................................................... 20 2.3 Component testing and evaluation.......................................................... 21 A) SensorTests ....................................................................................... 21 B) )Summary of Control and Navigation Tests ......................................28 SECTION 3: SECONDARY INVESTIGATION ........................................................... 29 3.1 PID Control ...........................................................................................29 3.1.1 PID tuning and simulation ................................................................. 29 3.2 Serial Communication ........................................................................... 34 3.2.1 Conceptual Design ............................................................................. 34

2

3.2.2 Pseudo Code....................................................................................... 36 3.2.3 SPI .................................................................................................... 38 3.3 Motor control .................................................................................... 39 3.3.1 Design of a motor control board ...................................................... 39 3.3.2 Motor velocity control using PWM .................................................. 40 3.4 Maze solving ......................................................................................... 43 3.4.1 Comparison of algorithms and simulation......................................... 43 SECTION 4. SYSTEM INTERATION ....................................................................... 48 4.1 Hardware Design................................................................................ 48 4.2 Software Design ................................................................................... 49 SECTION 5. PROJECT MANAGEMENT ................................................................... 51 5.1 Task Allocation and Description ............................................................ 51 5.2 Gantt chart ........................................................................................... 51 5.3 Budget management............................................................................. 54 5.4 Problem and solving ............................................................................. 55 SECTION 6. GROUP WORK REFLECTION .............................................................. 56 SECTION 7.CONCLUSION ..................................................................................... 56 SECTION 8.IMPROVEMENT .................................................................................. 57 SECTION 9.REFERENCES....................................................................................... 58 SECTIOPN 10. APPENDIX ...................................................................................... 59 10.1 Schematic and PCB.................................................................................59

3

SECTION 1 :

PROJECT INTRODUCTION

1.1 Introduction :

For students from BEng / MEng Electronic Engineering level 2, the design, development and testing of a micro-control-based embedded device through the use of a handheld, compact robot call Micromouse will take place in typical groups of four students. Students are expected to compete at the end of the course with their Micromouse robot. Mouse will win the award with the fastest time to go downtown. This document provides a report on the development, construction and testing of a smart mobile robot created to compete in a competition for 'Micromouse.' I planned, built and programmed the robot Micromouse over the two term periods of this academic year. This paper will describe all the problems I encountered in the design and development of this robot, the solutions I have found and the reasons I have to select those solutions.

what is Micromouse?

“Micromouse is an occurrence that solves a labyrinth by tiny robot mice. The labyrinth is composed of an 18-by-18 cell grid with 5 cm walls each 1.2 cm thick. The mices are completely autonomous robots which need to be able to enter the central area of the maze with no help from a predetermined starting location. The mouse will have to track its location, explore the walls, map out the labyrinth and detect when the target has been achieved. Once you have found the optimal path, start the path as soon as possible..”

4

the mouse will

Rules for the Maze: ⚫

The maze will be of 8 by 6 grids.



Grid Size will be of 18cm by 18cm.



Walls will be of 5cm high and 1.2cm thick.



Passageways between the walls shall be 16.8cm wide.

1.2 Aim and Objectives : ⚫

Design and build a small robotics platform that can explore in the size of a typical Micromouse labyrinth.



Explore the framework for precise regulation of DC motors with feedback.



Find hardware design constraints for the development of a robot to carry out a specific mission.



Find sensors for use on a Micromouse for close-range remote detection.



Explore mobile robots navigation techniques including odometer use and sensor input.



Development of both software and hardware Micromouse including mouse chassis parts and electrics.

5

SECTION 2: PRIMARY INVESTIGATION : 2.1 Conceptual Design and justification : 2.1.1 Conceptual Design :

At the outset of this project, my main aim was to build a portable and reliable mouse that would never restrict the creation of the software.

According to competition rules in Micromouse University, the labyrinth is 8 x 6 cell ranges and every cell is 18 x0005 cm square and 18 x0005 cm square. The Micromouse diameter should be within 18 x0005 cm, so that my micromouse can travel without any restriction in the labyrinth. With the 2 gear DC motors in place, I chose to use 2 circular PCBs, which were the same shape as the 11 x0005 cm chassis and half moon shape of the PCB for sensors, on the front and connected to the chassis. I also wanted to use two rotating DC motorboards.

Initially, all the groups that included a sphere-shaped structure of 110 mm diameter and motors that were installed in gears and encoders were created from the components provided by the tutors.My aim was to build a hardware after these components were obtained to allow use of existing robotic components. The frame's scale makes it possible for the robot to navigate in 160 mm labyrinth corridors.The sensor, motor and main board are already enclosed in the case. The rollers measure 40 mm in diameter.

6

Figure 1: PICTURE TAKEN FROM BLACKBOARD WHICH SHOWS INITIALLY PROVIDED CHASSES,WHEEL AND MOUNTING BRACKETS

Two Faulharber Speed Control gearboxes and encoders were fitted with 6 volt DC engines. The engine speed is decreased from 6700 to 625 minutes, producing a torque at a distance of 30Nm, because of the default gearbox ratio of 8:1. This torque helps micromouse to travel on a single surface if the robot weighs no more than 400 grammes.

Built into optical encoders is an vital part of the robot as they determine the data required to measure the motor speed and how far a robot has gone. Encoders allow a voltage of 3.2-5.5 volts to work and have 2 outputs and 16 lines per revolution. The measurement of 64 resolution lines in one rotation of the wheel was centred on each edge change.

7

FIG2: DEMONSTRATING OPTICAL ENCODERS

For control of motor direction, H-bridge (L298N) was used. The engine speed is controlled by the PWM signal inserted in the pins allowed by the Chip. The H-bridge operates according to the idea that "1" or "0" signals are sent to the corresponding input pins that change motor direction. The following table illustrates this process:

H-bridge has a maximum current level of 2 amperes, which helps us since the motors used 750mA and used 1.5 amperes. There is no need to use a heat sink with Hbridge that makes it economic.

8

The robot design should also include sensors so they feel the next walls and signal the robot to stop or adjust the robot's course. On each side, one on the front and two on either side, I chose to use three sensors. I have been studying ultrasound sensors, sharp IR sensors and near-internal IR sensors. Upon checking them, I decided to use IR proximity sensors. They were slightly less efficacious than ultrasonic sensors but they had the benefit of being cheaper and power-efficient at their size. One big downside however is that they are overwhelmed by light, leading to faulty outputs.

2.1.2 Justification of Design : A) 3 PCBs:

For proper control of the Micromouse, two dsPIC30F4011 must be used to power the entire system with an H-bridge for power of two DC engines. Two PCBs, one for the microcontroller board, and another for the motorboard are supplied with the initial design. Nonetheless, Micromouse will use pre-programmed instructions to provide sensors that allow them to respond to environment changes and as such, requires another sensor unit PCB to be mounted in front of the robot.

B) Robot Assembling:

Due to long-term leave from the plague so I didn't get the printed circuitry resulting in no hardware. But according to the original hardware design we will be as follows:

There are 8 threaded plastic bars and two PCBs are placed over the chassis. On the chassis with the diameter shown in Figure, four holes are distributed. That's why the threaded bars and the PCB are placed in 4 holes, while the base layer is shown by the 4 bolts. Because of the shape of our sensor board, we have to make sure that our Micromouse can fit well.The bottom of the frame is fitted with two nuts. Finally, we use a certain number of female and female cable connectors to connect 3 PCBs to make each component.

9

The figures below display my conceptual design shows that the sensor panel is positioned before the chassis, and the microcontroller panel makes decisions on the data of the sensors and sends the signals to the motor panel to test the engines.

Figure 3

Figure 4

10

2.2 Hardware and/or software design : 2.2.1 Hardware Design:

Due to long-term leave from the plague so I didn't get the printed circuitry resulting in no hardware. But according to the original hardware design we will be as follows :

A) Sensor Board :

As stated earlier, the shape of our sensor board is half lunar to match the frame. I'll use 4 sensor modules, including: IR LED, phototransistor and a proper resistive network. In order to improve the accuracy of detection blocks 2 units are mounted on the front and 2 on each side of the frame. For sensor cases, Lego devices are utilised to ensure close proximity of the receiver to the transmitter..

B) Microcontroller Board :

For efficient motor control due to insufficient Quadrature Encoder pins, two dsPIC30F4011 microcontrollers are needed. Quadrature Encoder is used to calculate the shaft's speed, to monitor the distance the DC motor has travelled. For two motors' direction pins are used the 2 digital pins for each dsPIC30F4011 microcontroller. .

Moreover, 4 analogue pins are used for reading data obtained from the sensor on the first microcontroller. In dsPIC30F4011, there are 9 analogue pins, but because there are only 4 sensors, I chose for our sensors AN3, AN6, AN7 and AN8.

Additionally, the dsPIC30F4011 provides two dedicated serial port communications hardware peripherals, UART1 and UART2. The use of UART1 is for two dsPIC30F4011 to interact. After programming, two microcontrollers can

11

communicate with each other by opening a 4-way DIP switch. However, two other 3 way DIP switches are used to choose which dsPIC30F4011 software to be used. These two UART pins are all connected. But I do not use any additional UART module for communication with other peripheral devices such as PCs, so that UART2 is not used. I am not using this feature.

In order to switch these two LEDs or other human interface, two standard LEDs connect directly to 2 digital pins and a tactile button make it easy to check and balance board part by part.

In addition, serial condensers are required to minimise noise or circuit disruptions. Due to interference signals in critical position, the device is easily compromised in a noisy environment and the functioning is erroneous. The VDD and VSS in the dsPIC30F4011 are as similar as possible. In order to supply the + 5V supply to the microcontroller, 7805 voltage regulator will also be used.

Lastly, the motor board and the microcontroller board are paired with two connectors. The signal switches through the headers to control the

two

engines'speed and direction. For each motor, I chose to use a connector that is the same as the connector on the lecturer's motor board. In addition, for control and test purposes, other connectors have been agreed to use.

C) Motor Board: Two DC motors are required to drive my Micromouse. For control the course of the engines an L298N H-bridge is used. In the course of the engines, H – Bridge plays an significant role. The positive voltage will be applied across the motor if switches S1 and S4 (depending on the figure below) are closed and S2 and S3 are open. This voltage is reverse which closing switches S2 and S3.

12

Figure 5

The PWM functions for 2 engines connected with the Allow H-bridge pins using dsPIC30F4011's microcontroller to adjust engine speed. In addition, the 4 Hbridge inputs are linked to the 2 direction pins of each engine, while 4 outputs are connected to the DC gear, enabling us to control the motor rotation direction.

Additionally, 8 Schottky Barrier Diodes 1N5819 are going to use as rectifiers in the motor circuits, due to the motor circuit is inverse circuit, the low forward voltage and fast recovery time of these diodes lead to increased efficiency of the circuit. These will help to reduce the spike when the motors are doing periodically reverses direction.

Finally, two DC gears plug-in plug-in connectors are used as well as two for Micro-controller-board motor unit combination.

13

2.2.2 Software Design : A) ADC for Sensing As I said earlier, I needed a sensor to help the mouse sense the environment and send data to a microcontroller, so that the robot could understand which action to take next. I required the Analog to Digital Converter to perform these steps.

My sensor reads data as an analogue value, which are converted into a digital value via ADC to make it visible to my dsPIC30F4011.

Figure 6. Analog to Digital Convert

The normal voltage supply is + 5v and I have a resolution of 10 bit for dsPIC30F4011. The continuous signal from 0 to 5v is then mapped to (1024 byte) values for the 10-bit converter. I can determine from here that quantisation voltage Q is a voltage range-dependent function.

14

Vref + − Vref − Q=

2k (1) 5v

Q=

210

= 4.88N V (2)

For my Micromouse I chose to use the firecracker connector with Analog 3(pin

5), Analog 6(pin 8), Analog 7(pin 9) and Analog 8(pin10).It is necessary to configure the bits to the right channel and to the right buffer channel as it

contains configuration bits

each channel's sampled output.The following figure indicates the that I assign to the analogue pin I use.

.

Figure 7 Configuration of Scan Channel

15

B) I/O, Timer, PWM,QEI:

Simple I/O function is implementing in software design such as defined two directions of the motors or toggle LED for debug purposes. As I need to control the direction of the two motors, I need to define them as digital output pins. According to the schematic of the microcontroller board, two-direction pins for each motor are connected to PWM and digital function shared pins, so I also need to disable PWM function during the setup. Similarly, one of the LEDs is also connected to the PWM shared pin, after disabling the PWM function. Based on I concept, I am going to use two LEDs to indicate the Micromouse turning left or right, while the mouse turn left, the red LED is light up and the green LED is going to light up when the mouse turn right. [Schematic]

10ms Timer Interrupt will be used for counting external events and producing accurate internal cyclic events. In Timer1, Interrupt are created most commands used for controlling our micromouse movement, including UART transmission, scale, and cast drive returned from the PID controller and updated the PWM operating time.

For the control of the engine duty cycle, PWM and QEI are used to measure rotating shaft speed and direction.

C) UART: I decided to use two microcontrollers to control two motors as serial communication between two dsPIC30F4011 is necessary to implement in our Micromouse. The dsPIC30F4011 has two independent UART modules while we only use UART1 for PIC to PIC communication. Firecracker was initially used as a basis for serial contact activities between

two dsPIC30F4011. The waveform below displays transmission and

reception

signals in the Firecracker board for both microcontrollers. When the

button is

pressed, a master controller character is transmitted. The transmitter is

yellow and


Similar Free PDFs