crazy ball

Download Crazy Ball

Post on 01-Dec-2014

24 views

Category:

Documents

2 download

Embed Size (px)

TRANSCRIPT

Effat University College of Engineering Electrical and Computer Engineering Department

Crazy BallECE 341, ECE 391 &ECE 440

Team Supervisor

Prof. Mohammed Shehatha

Team members Juahir Albakri Haneen Bawayan Maha Nour Maryam Tora

Spring 2011

Table of Contents 1. Introduction .................................................................................................................................... 1 2. Design Overview .......................................................................................................................... 3 2.1. Block Diagram .................................................................................................................. 3 2.2. Block Diagram description ........................................................................................... 4 2.3. Conveyor ............................................................................................................................. 4 2.4. Truck Car ............................................................................................................................ 6 2.5. Elevator & Catapult ......................................................................................................... 8 2.6. LCD ................................................................................................................................... 10 3. Hardware and software design .............................................................................................. 11 3.1. Hardware .......................................................................................................................... 11 3.2. Software using C language ........................................................................................ 11 4. Test Verification ........................................................................................................................ 15 4.1. Component Test.......................................................................................... 15 4.1.1. Infrared transmitter receiver sensor ........................................... 15 4.1.2. Micro touch Sensors .................................................................. 15 4.2. System test ....................................................................................................................... 17 4.2.1. IR sensor at the end of the roller coaster .......................................... 17 4.2.2. IR sensor before the care ........................................................................ 17 4.2.3. Micro touch at the end of the car track .............................................. 17 4.2.4. Micro touch at the beginning of the car track ................................. 17 4.3. Challenges during the test .......................................................................................... 18 4.3.1. The elevator challenge ............................................................................ 18 4.3.2. Car challenge ............................................................................................. 18 5. Conclusion ................................................................................................................................... 19

ii

1. IntroductionOur project for the spring of 2011 is the result of combining three different major courses revolving around multivariable control and integrating a microcontroller with different sensor circuits. Numerous reasons formed the foundation of our project, starting with fulfilling a course requirement, learning to work in a team, thinking outside the box and becoming handy with different tools! In addition to that, learning how to build and manage a project of a large scale, answering questions regarding budget management and demo construction materials. Moving on to designing the needed circuits, picking the best components and testing every one of them. Finally, assembling the separated parts together. The second reason fuelling our project - from the components integrated within it to the devices chosen for it - is that they all pool in to provide the perfect groundwork for testing the apparatuses we will be implementing in our Senior Capstone Project Automated Shipment Sorter through our final year. Giving us a home run advantage in the form of an early insight to some of the problems we need to avoid, replace or improve upon. The Crazy Ball project was an interesting experience this semester to say the least! due to some new factors appearing; the biggest of all was our freedom in picking and designing the system from scratch!! That independence in choice inspired our team to produce our best effort yet, and drove us to go that extra mile. Our project was contaminated with many a problem, but that was reassuring since our team supervisor once professed if your project is running smoothly then probably something isnt right. In the light of that statement, here are some of the obstacles our group faced: finding a replacement to the conveyer belt, designing the boxes placed on top of it and connecting them together, integrating the NXT microcontroller (used in the elevator and the catapult) with the Atmel ATMEGA 168 microcontroller (used in controlling the whole system). Some other hindrances had appeared but that 1

were in the form of a challenge rather a full-blown problem, of those we highlight the difficulty of moving the project, the accuracy needed to test it caused a strain on us until it was achieved and some of the needed components were unavailable in the market and we had to import them from the United States of America. This section will be discussed thoroughly in the body of the report. All in all, it was our most sophisticated project by far, so naturally the information and feedback obtained from it during the two months it took us to finish it were equally rewording.

2

2. Design Overview2.1. Block Diagram

3

2.2. Block Diagram descriptionCrazy Ball is a game about automated ball control. In this game the ball has a closed loop path to move through different stages such as, conveyor, rollercoaster, elevator, car and catapult. In addition, sensors were used to detect the ball location therefore controlling the next action.

2.3. ConveyorThe conveyor stage is located after the rollercoaster. It consists of rubber belt, two wheels and a DC motor attached to one of the wheels. The main function for the conveyor in this game is to carries the ball and moves it to the next stage only when the ball reaches the conveyor otherwise its turned off. An infrared senor was used to sense the ball location. Whenever an object was detected, the sensor sends directly to the microcontroller to turn on the DC motor to let the conveyor move and carry the ball to the next stage.

4

The figure above shows the IR Circuit. LD271 was chosen as IR emitter with 2.5V to connect it in series to a resistor and 5V power supply. The resistor was chosen to be 180 based on the following calculations.!!!.! !" !

R=

= 166 . But, 180 was found in the market, which is excepted value.

The phototransistor was connected to pin 15 (PB1) in the microcontroller. When there is no object the phototransistor receive infrared signal to connect the microcontroller pin to the ground. However, when an object passes between the transmitter and emitter, the it prevents the IR signal to reach the phototransistor and the MCU is no more connected to the ground but the MCU has 5V because it pulled up high. Once this happened the microcontroller send 5V to pin 27 (PC4) to turn on the motor circuit for few seconds by activating the NMOS and connecting its source to the ground to complete the motor circuit.

5

2.4. Truck CarThe truck car is the most important stage in this game because there are a lot to control in this step. In addition, its trail takes almost the most area of this game so, its the center of attention. The car is located after the conveyor and before the elevator. Its main function is to transport the ball from the conveyor area to locate the ball inside the elevator. Then goes back to its original place and wait for the ball again. Three sensors were used in the truck car stage to complete the requirements. The first sensor is IR sensor, which is located above the truck. Whenever the ball falls in the back of the truck, this sensor tells to the microcontroller to move the car backward. The second sensor is micro touch sensor, which located before the elevator stage. The car presses this micro touch sensor while its moving backward. When it pressed, the car stop moving backward and left up the truck back to locate the ball inside the elevator. After few seconds, the trucks back goes down again to its normal place and the elevator moves up. Then finally the car moves forward to reach its original place that it started from. The third and the last sensor in this phase is also a micro touch sensor, but located at the beginning of the car trail. This sensor is responsible to stop moving the car backward when it reaches its starting point to wait for the next cycle.

6

The figure above shows all the necessary circuits for this stage. First of all, the IR circuit, the same as the one in the conveyor phase. Its function is to detect the location of the ball. Detecting the ball means there is an object between IR transmitter and receiver so the phototransistor is not active and the microcontroller has 5V since its pulled up high. Once this is the case the microcontroller sends 5V to pin 24 (PC1) to activate the NMOS. Consequently, the relay that takes 6 V in its coil switch to connect 4.5V to the wire that is r