Difference between revisions of "S16: Robolamp"

From Embedded Systems Learning Academy
Jump to: navigation, search
(Software Design)
(Software Design)
Line 178: Line 178:
 
The bulk of the software design involves five tasks, four queues, and an added handler for accepting raw data from the separate OpenCV-driven program. The first task of importance, visionTask, receives data from the handler and converts the raw data to a percentage value from -90 <-> +90. This data is placed on a queue specific for the next task, CV_core. CV_core contains all of the logic necessary for calculating and interpreting each servo motor's next movements after converting the data received from the queue from percentage to degrees. This data is passed into another queue used by the PWMTask. The PWMTask recieves data from CV_core and another task yet to be discussed, LEDTask. PWMTask is capable of setting the motor values based off percentage or degrees, giving freedom to the user. <insert LEDTask info here> . The final task, errorTask, handles the various error checking logic used throughout each individual task in the system. Depending on the error ID, the task displays the corresponding error on the SJSUOne's LED display. For an in-depth look at the calculations used for motor movement/smoothing and development of a percentage/degree standard for specific tasks, the GitHub repository has been listed towards the end of the documentation.
 
The bulk of the software design involves five tasks, four queues, and an added handler for accepting raw data from the separate OpenCV-driven program. The first task of importance, visionTask, receives data from the handler and converts the raw data to a percentage value from -90 <-> +90. This data is placed on a queue specific for the next task, CV_core. CV_core contains all of the logic necessary for calculating and interpreting each servo motor's next movements after converting the data received from the queue from percentage to degrees. This data is passed into another queue used by the PWMTask. The PWMTask recieves data from CV_core and another task yet to be discussed, LEDTask. PWMTask is capable of setting the motor values based off percentage or degrees, giving freedom to the user. <insert LEDTask info here> . The final task, errorTask, handles the various error checking logic used throughout each individual task in the system. Depending on the error ID, the task displays the corresponding error on the SJSUOne's LED display. For an in-depth look at the calculations used for motor movement/smoothing and development of a percentage/degree standard for specific tasks, the GitHub repository has been listed towards the end of the documentation.
  
[[File:StateMachine.png|600px|thumb|centre|Figure 2. Software Design Flow]]
+
[[File:StateMachine.png|900px|thumb|centre|Figure 2. Software Design Flow]]
  
 
=== Implementation ===
 
=== Implementation ===

Revision as of 03:45, 23 May 2016

Grading Criteria

  • 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.

Robolamp: Autonomous Laptop Lamp

Abstract

Robolamp features an autonomous lamp that follows the movement of a user-defined object through OpenCV. For our project, we designated a specific mechanical pencil as our tracking object. Using two micro servo motors reflecting the 'x' and 'y' axis of rotation along with a uniquely designed lamp, Robolamp follows and tracks the user's writing movement while emitting a concentrated light on the surrounding area.

Objectives & Introduction

Show list of your objectives. This section includes the high level details of your project. You can write about the various sensors or peripherals you used to get your project completed.

  • The lamp shall follow movement of the user-selected object (mechanical pencil)
  • The lamp shall utilize two servo motors capable of interpreting pixel data from external program
  • The external program shall be supported by OpenCV libraries
  • The lamp shall contain an LED circuit driven by external power supply
  • The lamp shall be user-created and 3D printed

Team Members & Responsibilities

  • Brandon Zhen
    • Write code for the motor movement based on CV data
    • Transfer designs for lamp parts into 3D-printable models
  • Dustin Phou
    • Order parts
    • Design circuit to externally power motor and LED
  • James Ogden
    • Create an OpenCV program that will track hand movement
    • Design the components used to create the physical lamp

Schedule

Week# Date Task Actual
1 4/4 Obtain approval for the project, research and order necessary parts, make rough design of system Approval obtained, research and design still in progress
2 4/11 Research software for designing the tracking system (OpenCV), write a simple program to track an object to test functionality and how data is generated Built OpenCV and used a sample program to track a marker using the color of its cap
3 4/18 Write an OpenCV program to track the movement of a hand across a desk The program is able to recognize an open palm and track it, but needs to be adjusted for the case of the hand writing
4 4/25 Test servo motors by connecting their pins to the SJOne board to determine how they can be controlled Through testing found that the PWM duty cycles that correspond to -90° and +90° are 2.5% and 12.5%, respectively. Used this information to write a program to control the rotation of a motor based on coordinate data received from OpenCV.
5 5/2 Construct the lamp using a combination of motors and 3-D printed lamp components (base, stand, arm) Design of base completed
6 5/9 Functionally verify lamp's movements and bugfix tracking algorithm Design of arm completed, verified connectivity of components
7 5/16 Finalize project and demo Thorough testing and debugging of servo smoothing and tracking. Project report and wiki-page completed.

Parts List & Cost

Item # Part # Description Amount Total Cost
1 SG92R Micro Servo Motor 4 $23.80
2 LD1117 3.3V 800mA Linear Voltage Regulator 1 $1.25
3 Adafruit 977 TO-220 Clip-On Heatsink 1 $0.75
4 Adafruit 518 1 Watt Heatsink Mounted LED 1 $3.95
5 3-050504M Aluminum SMT Heat Sink 0.5" x 0.5" 1 $2.75
6 3M 8810 Heat Sink Thermal Tape 25mm x 25mm 1 $0.95
7 n/a 3D Printed Base 1 Free
8 n/a 3D Printed Arm 1 Free
9 n/a 3D Printed Head 1 Free
10 n/a Webcam 1 Free

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

This project consists of a main lamp system that interfaces with the SJOne board and several other small subsystems.

block diagram of lamp

The lamp is composed of a custom-made arm, base and head. Two servo motors connect the parts together: one connects the arm to the base and one connects the head to the arm. The arm is capable of rotating a full 180°, while the head was limited to rotating only 90°. The head houses a generic webcam inside of it that collects data for OpenCV to process. The head also has a 1 Watt LED mounted onto it to serve as the lamp's light source.

Because the motors draw a variable current that might exceed the current rating on the SJOne's pins, they were powered externally. The LED also shares this power circuit due to its large current draw. The basic voltage regulator circuit used to power them is shown below.

power circuit diagram

The LED on the head was also given a dedicated circuit in order to control its brightness based on the lighting conditions in the room. The circuit can be seen below.

LED control

Hardware Interface

In this section, you can describe how your hardware communicates, such as which BUSes used. You can discuss your driver implementation here, such that the Software Design section is isolated to talk about high level workings rather than inner working of your project.

Software Design

Show your software design. For example, if you are designing an MP3 Player, show the tasks that you are using, and what they are doing at a high level. Do not show the details of the code. For example, do not show exact code, but you may show psuedocode and fragments of code. Keep in mind that you are showing DESIGN of your software, not the inner workings of it.

The bulk of the software design involves five tasks, four queues, and an added handler for accepting raw data from the separate OpenCV-driven program. The first task of importance, visionTask, receives data from the handler and converts the raw data to a percentage value from -90 <-> +90. This data is placed on a queue specific for the next task, CV_core. CV_core contains all of the logic necessary for calculating and interpreting each servo motor's next movements after converting the data received from the queue from percentage to degrees. This data is passed into another queue used by the PWMTask. The PWMTask recieves data from CV_core and another task yet to be discussed, LEDTask. PWMTask is capable of setting the motor values based off percentage or degrees, giving freedom to the user. <insert LEDTask info here> . The final task, errorTask, handles the various error checking logic used throughout each individual task in the system. Depending on the error ID, the task displays the corresponding error on the SJSUOne's LED display. For an in-depth look at the calculations used for motor movement/smoothing and development of a percentage/degree standard for specific tasks, the GitHub repository has been listed towards the end of the documentation.

Figure 2. Software Design Flow

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

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.