Difference between revisions of "S14: Virtual Dog"
Proj user16 (talk | contribs) (→Software Design) |
Proj user16 (talk | contribs) (→Software Design) |
||
Line 209: | Line 209: | ||
=== Software Design === | === Software Design === | ||
− | + | On Start of the ROBOT, the ADC is initialised for the reading the data. This is used to calculate which zone the object lies. Based on this decision, the robot has to decide whether it should follow, stop or turn in any other direction. This is performed by initialising the PWM. If any other obstacle comes in between the range of the object and the robot, then the buzzer is activated and hence buzz sound is produced. The Bluetooth for the UART is initialised so that this is used for the communication between the Android application and ROBOT. With the help of the Application the Robot is started. This activates the sensor task so that data is read from all the three sensors. Based on the sensor readings and after the normalization of the data read, decision is made on which direction the Robot should move. Using the Motor Driver Task and with the help of the decision made, the motors are made to rotate in the appropriate direction. Finally, the values and the direction which are decided are sent to the Bluetooth task. This task functions in transmitting and receiving the data to the android application. This application also used to start and stop the robot.<br> | |
+ | |||
+ | In the Motor Driver task, the finite state machine is read for each entry of the sensor data. Based on the state machine the Robot decides on the direction to move. If the decision made is forward, then the front two wheels which are connected to the driver are made to move. This causes the device to move forward. If it is forward left, then the front left wheel’s speed is decreased. This causes the device to turn left. If it is forward right, then the front right wheel speed is decreased. This causes the device to turn left. If the decision made is reverse, the wheels are made to rotate in the opposite direction. If it is reverse left, then the back left wheel’s direction is opposite and the speed is decreased. This causes the device to turn reverse left. If it is reverse right, then the back right wheel’s direction rotates in the opposite direction and the speed is decreased. This causes the device to turn reverse right. With the help of all the decisions, the Robot can be made to rotate 360 degree making the Robot to detect the object’s range and moving in appropriate direction. Finally, after Robot has moved such that the object comes into the ZONE_2, all the state machines are reset. This loop occurs until there is an indicator received telling the Robot to stop.<br> | ||
+ | |||
+ | In the Sensor Driver Task, the sensor values from all the three proximity sensors are read. They are normalized by using calculating the mean of the previous 30 sensor values. Based on this, the object position is determined. If the object is located in the Zone 1 of the middle sensor, then the finite state machine is changed to reverse. The robot moves until the original position is achieved. If the object is located in the Zone 3 and Zone 4 of the middle sensor, then finite state machine is moved to the Forward state which causes the robot to move forward. The left sensor detects the object if it is in Zone 1 and Zone 2. Based on the decision, the finite state machine is changed to reverse right. This moves the robot in the reverse right direction causing the direction of the robot to turn left. The right sensor detects the object if it is in Zone 1 and Zone 2, and the finite state machine is moved to the reverse left. This causes to change the direction of the robot to the right. The left sensor detects the object if it is in Zone 3 and Zone 4. Based on the decision, the finite state machine is changed to forward left. This moves the robot in the forward and left direction causing the direction of the robot to turn left. The right sensor detects the object if it is in Zone 3 and Zone 4, and the finite state machine is moved to the forward right. This causes to change the direction of the robot to the right. Thus based on the sensor values, the next stage of the Finite State Machine is decided and moves to that particular state.<br> | ||
=== Implementation === | === Implementation === |
Revision as of 23:29, 22 May 2014
- How well is Software & Hardware Design described?
- How well can this report be used to reproduce this project?
- Code Quality
- Overall Report Quality:
- Software Block Diagrams
- Hardware Block Diagrams
- Schematic Quality
- Quality of technical challenges and solutions adopted.
Contents
Project Title : Virtual Dog - An Object Following Robot
Abstract
This section should be a couple lines to describe what your project does.
In this project, we plan to build a device which would be able to track and follow a particular object. So if suppose that object is you, that device will follow you just like your dog. This tracking and following will be done in two dimensions, i.e. not just forward-backward movement, but left-right also. This can be achieved with the help of two devices, one will be used as reference and other device will continuously keep on monitoring the reference device. If position of reference device changes other device rearranges its position so as to maintain the desired relationship between them.
Objectives & Introduction
The main objective is to build an object following robot, which will follow a particular object in 2-Dimension. To make the robot follow at the same speed as of object we used four DC motor for the four wheels of robot so that it can accelerate the robot to desired speed. To keep track of object movement we used three proximity sensors (20cm-150cm) so that the robot can easily track the object. To power up the robot we used two batteries, one of 5V and other of 12V. 5V battery is used to power up the SJOne Board and 12V battery is required to run the DC motors. We have also implemented an Android App to start/stop robot and read the realtime statistics of sensors and our algorithm. To display the value of sensor as well as decision taken by robot on Android App we used Bluetooth module.
Team Members & Responsibilities
- Hari
- Implemented sensor driver and algorithm to normalize sensor values, Android Application.
- Manish
- Implemented central control logic and FSM.
- Viral
- Implemented motor driver and Motor State Machine, bluetooth driver.
Schedule
Week# | Task | Estimated Completion Date |
Status | Notes |
---|---|---|---|---|
1 | Order Parts | 3/16 | Partially Completed | Not finalized with sensor for distance measurement. Ordered other parts. |
2 | Sensor Study | 3/23 | Completed (3/30) | Research on sensors took more time than expected due speed constrains of sensors conflicting with our requirement. Finally decided to move with IR proximity sensor. Sensors ordered. |
3 | Sensor Controller Implementation | 3/30 | Completed (4/6) | Three sensors interfaced with on board ADC pins. Controller implemented to determine direction of movement based on those three sensors |
4 | Servo and Stepper Motor Controller Implementation | 4/6 | Completed (4/6) | Initially planned to use stepper motor for steering and servo to move robot. But due to power constraints, decided to use DC motors to make a 4WD robot. Controller implemented to move and turn robot based on differential wheel speeds. |
5 | Central Controller Logic Implementation | 4/13 | Completed (4/13) | Integrated both controllers and developed basic logic to control wheels based on sensor input. |
6 | Assembly and Building Final Chassis | 4/20 | Completed (4/20) | Mounted all hardware parts on chassis to make a standalone robot. Central controller logic is still tuning. |
7 | Unit Testing and Bug Fixing | 4/27 | Completed (5/4) | Tested various combinations of object movement and tuned our algorithm accordingly. Tuning of algorithm took more time than expected because of many corner cases. |
8 | Testing and Finishing Touch | 5/4 | Completed (5/11) | Faced strange problem at final stages. Earlier sensors were giving linear output for distance v/s ADC value. Over the period we realized that our robot is not following the way it used to follow earlier. So we need to calibrate distance v/s ADC value again, and based on that we required to change our algorithm. |
9 | Android Application using Bluetooth | N/A | Completed (5/22) | Developed an Android Application through which we can start and stop our robot and able to collect realtime data for sensor values as well as decisions taken by robot. |
Parts List & Cost
# | Part Description | Quantity | Manufacturer | Part No | Cost |
---|---|---|---|---|---|
1 | SJOne Board | 1 | Preet | $80.00 | |
2 | IR Distance Sensor (20cm - 150cm) | 3 | Adafruit | GP2Y0A02YK | $47.85 |
3 | DC Motor (12V) | 4 | HSC Electronics | $6.00 | |
4 | Wheels | 4 | Polulu | $8.00 | |
5 | Battery 5V/1A 10000mAh | 1 | Amazon | $40 | |
6 | Battery 12V/1A 3800mAh | 1 | Amazon | $25 | |
7 | LM2938D (Motor Driver IC) | 2 | HSC Electronic | $5.40 | |
8 | Chassis | 2 | Walmart | $12.00 | |
9 | Accessories (jumper wires, nut-bolts, prototype board, USB socket) | $20.00 | |||
10 | RN42-XV Bluetooth Module | 1 | Sparkfun | WRL-11601 | $20.95 |
Total (Excluding Shipping and Taxes) | $265.20 |
Design & Implementation
The design section can go over your hardware and software design. Organize this section using sub-sections that go over your design and implementation.
Hardware Design
All the three proximity sensor will measure their respective value analog and send it to the ADC pin of the SJOne board which will convert it to the digital value,the convert digital value will be utilized to determine the distance between the robot and the object. Based on the calculated distance the PWM value is determine for each DC motor, these PWM value is given as input to the DC motor via LM293D IC. The Bluetooth device will read the value of the sensor from the SJOne board through UART and send it to the Android App which will display the value of sensor as well as decision taken by robot.
DC Motor
We are using four DC motor for our project, the DC motor we are using has following rating 5-12V, 0.16Amp, 2000RPM. We are using DC motor so that we can provide 360 degree rotation to our robot wheel as well as it can help to drive the robot at a very high speed.
Proximity Sensor
This SHARP distance sensor bounces IR off objects to determine how far away they are. It returns an analog voltage that can be used to determine how close the nearest object is. These sensors are good for detection between 20cm-150cm.
LM293D IC
L293D is a typical Motor driver or Motor Driver IC which allows DC motor to drive on either direction. L293D is a 16-pin IC which can control a set of two DC motors simultaneously in any direction. It means that you can control two DC motors with a single L293D IC.
Bluetooth Module
The RN-42 is compatible with the Bluetooth versions 2 and below. The advantage of using this module is it's low power and at the same time can provide a good data rate. This provides a high performance on chip antenna where data rates upto 3Mbps are transferred. The disadvantage is that, it has a very less distance which is approximately 20 meters. There is a pull up circuit of 1k to the Vcc. This is provided so that if the input power supply has instability or tends to bounce which causes the that device to be damaged. There is separate pin allocated for the Factory Reset such that this comes into the picture when the module is misconfigured. The toggle of the specific GPIO pins indicate the status of the module. When toggled at 1Hz, the module is discoverable and is waiting for a connection. When at 10Hz, it made to change to the command mode. If it is very low, then module is already connected to another device over the bluetooth.
Hardware Interface
Design Consideration
On board ADC is used to read the proximity sensor value.
Pulse Width Modulation (PWM) is used to control the DC motor.
Universal Asynchronous Receiver Transmitter(UART) is used to communicate with the Bluetooth module.
Software Design
On Start of the ROBOT, the ADC is initialised for the reading the data. This is used to calculate which zone the object lies. Based on this decision, the robot has to decide whether it should follow, stop or turn in any other direction. This is performed by initialising the PWM. If any other obstacle comes in between the range of the object and the robot, then the buzzer is activated and hence buzz sound is produced. The Bluetooth for the UART is initialised so that this is used for the communication between the Android application and ROBOT. With the help of the Application the Robot is started. This activates the sensor task so that data is read from all the three sensors. Based on the sensor readings and after the normalization of the data read, decision is made on which direction the Robot should move. Using the Motor Driver Task and with the help of the decision made, the motors are made to rotate in the appropriate direction. Finally, the values and the direction which are decided are sent to the Bluetooth task. This task functions in transmitting and receiving the data to the android application. This application also used to start and stop the robot.
In the Motor Driver task, the finite state machine is read for each entry of the sensor data. Based on the state machine the Robot decides on the direction to move. If the decision made is forward, then the front two wheels which are connected to the driver are made to move. This causes the device to move forward. If it is forward left, then the front left wheel’s speed is decreased. This causes the device to turn left. If it is forward right, then the front right wheel speed is decreased. This causes the device to turn left. If the decision made is reverse, the wheels are made to rotate in the opposite direction. If it is reverse left, then the back left wheel’s direction is opposite and the speed is decreased. This causes the device to turn reverse left. If it is reverse right, then the back right wheel’s direction rotates in the opposite direction and the speed is decreased. This causes the device to turn reverse right. With the help of all the decisions, the Robot can be made to rotate 360 degree making the Robot to detect the object’s range and moving in appropriate direction. Finally, after Robot has moved such that the object comes into the ZONE_2, all the state machines are reset. This loop occurs until there is an indicator received telling the Robot to stop.
In the Sensor Driver Task, the sensor values from all the three proximity sensors are read. They are normalized by using calculating the mean of the previous 30 sensor values. Based on this, the object position is determined. If the object is located in the Zone 1 of the middle sensor, then the finite state machine is changed to reverse. The robot moves until the original position is achieved. If the object is located in the Zone 3 and Zone 4 of the middle sensor, then finite state machine is moved to the Forward state which causes the robot to move forward. The left sensor detects the object if it is in Zone 1 and Zone 2. Based on the decision, the finite state machine is changed to reverse right. This moves the robot in the reverse right direction causing the direction of the robot to turn left. The right sensor detects the object if it is in Zone 1 and Zone 2, and the finite state machine is moved to the reverse left. This causes to change the direction of the robot to the right. The left sensor detects the object if it is in Zone 3 and Zone 4. Based on the decision, the finite state machine is changed to forward left. This moves the robot in the forward and left direction causing the direction of the robot to turn left. The right sensor detects the object if it is in Zone 3 and Zone 4, and the finite state machine is moved to the forward right. This causes to change the direction of the robot to the right. Thus based on the sensor values, the next stage of the Finite State Machine is decided and moves to that particular state.
Implementation
This section includes implementation, but again, not the details, just the high level. For example, you can list the steps it takes to communicate over a sensor, or the steps needed to write a page of memory onto SPI Flash. You can include sub-sections for each of your component implementation.
Testing & Technical Challenges
Describe the challenges of your project. What advise would you give yourself or someone else if your project can be started from scratch again? Make a smooth transition to testing section and described what it took to test your project.
Include sub-sections that list out a problem and solution, such as:
My Issue #1
Discuss the issue and resolution.
Conclusion
Conclude your project here. You can recap your testing and problems. You should address the "so what" part here to indicate what you ultimately learnt from this project. How has this project increased your knowledge?
Project Video
Upload a video of your project and post the link here.
Project Source Code
Send me your zipped source code and I will upload this to SourceForge and link it for you.
References
Acknowledgement
Any acknowledgement that you may wish to provide can be included here.
References Used
List any references used in project.
Appendix
You can list the references you used.