Difference between revisions of "F16: Wireless Tilt Controlled Camera Arm"

From Embedded Systems Learning Academy
Jump to: navigation, search
(Hardware Design)
(Acknowledgement)
 
(44 intermediate revisions by the same user not shown)
Line 1: Line 1:
=== Grading Criteria ===
 
<font color="green">
 
*  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.
 
</font>
 
 
 
== Wireless Tilt Controlled Camera Arm ==
 
== Wireless Tilt Controlled Camera Arm ==
 
[[File:f16_cmpe_146_wtcca_cover.jpg|600px|thumb|centre| The Completed Arm project .]]
 
[[File:f16_cmpe_146_wtcca_cover.jpg|600px|thumb|centre| The Completed Arm project .]]
  
 
== Abstract ==
 
== Abstract ==
For this camera system, the camera moves along a track according to user’s controls. The controller, which will be one of the SJOne boards, will control the direction of movement of the camera along the track. The camera will be mounted on a track and will be connected to the second SJOne board. The camera’s movement speed is set. However, the camera’s direction will be determined by the angle in which the controller is tilted. The camera’s tilt speed will be tracked using the attached SJOne board’s accelerometer and used in the movement of the camera’s vision. Similar to the movement of the human eye, the camera in this camera system will be able see 180 degrees in all directions in forward vision. The camera can look at an angle in any direction such as left, right, up, and down. The camera can be stopped or turned off by pressing a button on the controller. If the controller is tilted 90 degrees vertically, then the camera will start moving in that tilted direction. If there is an error, the user can press a button on the controller that will stop receiving accelerometer data from the controller board and the camera will reset back to the center position of the track and the camera will be back to facing the correct orientation. Data is transferred through wireless communication between the two SJOne boards.
+
For this camera system, the camera moves according to the tilt of the wireless controller, which will be one of the two SJOne boards. The camera is mounted on a mechanical arm that is connected to the second SJOne board. The camera's movement speed is set. However, the camera's direction is determined by the angle in which the controller is tilted. The controller's tilt will be tracked using the attached SJOne board’s accelerometer and used in the movement of the camera arm. Similar to the movement of the human eye, the camera arm in this camera system is able to move nearly 180 degrees in all directions in forward vision, allowing for a wide range of different camera angles. The camera can look at an angle in any direction such as left, right, up, and down. If there is an error, the user can reset the camera arm motion controller to reset the camera back to the center position so that the camera is facing the correct orientation. Data is transferred through wireless communication between the two SJOne boards.
  
 
== Objectives & Introduction ==
 
== Objectives & Introduction ==
The objective for this project was to learn how to use motors and use them to implement a project. Here, a camera arm was designed in order to take acceleration sensor data from one board and and through wireless communication, receive information on how to move the arms with respect to how the control board would move.  
+
The objective for this project was to learn how to use motors and to use them to implement a project. Here, a camera arm was designed in order to take acceleration sensor data from one board and and through wireless communication, receive information on how to move the arms with respect to how the control board would move.  
 
The following objectives were set for the project:
 
The following objectives were set for the project:
  
1. Design an arm in CAD software to hold all the motors that will do all the movements.
+
1. Design an arm in CAD software to hold all the motors that will perform all the movements.
  
 
2. Research the proper hardware needed for the expectations for the project, which would be high precision motors that are capable of fine movement.
 
2. Research the proper hardware needed for the expectations for the project, which would be high precision motors that are capable of fine movement.
  
3. Write Software to control motors, establish wireless communication across 2 devices.
+
3. Write software to control motors and to establish wireless communication across 2 devices.
  
 
=== Team Members & Responsibilities ===
 
=== Team Members & Responsibilities ===
Line 157: Line 145:
 
| Used for regulating power to the motors
 
| Used for regulating power to the motors
 
|-
 
|-
| 3d printed Arm
+
| 3D Printed Arm
 
| SCE
 
| SCE
 
| 1
 
| 1
Line 168: Line 156:
  
 
=== Hardware Design ===
 
=== Hardware Design ===
The hardware design mainly focused on the motor control board. No additional hardware was implemented to the board that was sending the acceleration sensor data. Three motors were used in the arm design. 2 high precision servos, the HS 5065MG micro servos. These servos were chosen for the ability to have fine control and movement. They are not typical servos that they move in that they need a certain amount of pulse to trigger or needing a certain length to the duty cycle. Rather, the servo rotates bases on the duration of the pulse. The motor had a workable range of 750 - 2250 microseconds. The servo had a workable range of of 120 degrees. These were the more expensive motors and had metal gears. The third motor was the Osoyoo SG90 micro servo, which had a duty cycle of 50 hz, or 20 ms. It required a pulse of 1-2ms to rotate the motor 90 degrees, either to the left or to the right. These motors were much simpler and had plastic gears. These were not able to provide fine control. In order to power all the devices, 2 voltage regulators were purchased. A 5v Step Up/Step Down voltage regulator from Pololu was purchased to power the SG90 servo and the SJOne board. A 6V Step Up/Step Down voltage regulator from Pololu was used to power the precision servos. The 6 volts to the motors guaranteed highest efficiency and precision. All the hardware was housed in arm design in CAD tools. The design can be seen in Figure 2 and Figure 3. The schematic and hardware layout can be seen in Figure One.  
+
 
 +
===== Motor Control =====
 +
The hardware design mainly focused on the motor control board. No additional hardware was implemented to the board that was sending the acceleration sensor data. Three motors were used in the arm design. 2 high precision servos, the HS 5065MG micro servos, were chosen to be used in the hardware design because of their ability to have fine control and movement. They are not typical servos that moved in a manner that required a certain amount of pulse to trigger or needing a certain length to the duty cycle. Rather, the servo rotates based on the duration of the pulse. The motor had a workable range of 750 - 2250 microseconds. The servo had a workable range of of 120 degrees. These were the more expensive motors and had metal gears. The third motor was the Osoyoo SG90 micro servo, which had a duty cycle of 50 hz, or 20 ms. It required a pulse of 1-2ms to rotate the motor 90 degrees, either to the left or to the right. These motors were much simpler and had plastic gears. These were not able to provide fine control. In order to power all the devices, two voltage regulators were purchased. A 5V Step Up/Step Down voltage regulator from Pololu was purchased to power the SG90 servo and the SJOne board. A 6V Step Up/Step Down voltage regulator from Pololu was used to power the precision servos. The 6 volts to the motors guaranteed highest efficiency and precision. All the hardware was housed in arm design in CAD tools. The design can be seen in Figure 2 and Figure 3. The schematic and hardware layout can be seen in Figure 1.  
  
 
[[File: F16 cmpe146 wtcca hw diagram.png|600px|thumb|centre|Figure 1. Camera Arm Hardware Design]]
 
[[File: F16 cmpe146 wtcca hw diagram.png|600px|thumb|centre|Figure 1. Camera Arm Hardware Design]]
[[File: f16_cmpe146_wtcca_arm1.jpg|300px|thumb|left|Figure 2. Camera Arm Hardware Design in CAD]]
+
[[File: F16 cmpe 146 wtcca arm1.JPG|300px|thumb|left|Figure 2. Camera Arm Hardware Design in CAD]]
[[File: f16_cmpe146_wtcca_arm2.jpg|300px|thumb|right|Figure 3. Camera Arm Hardware Design in CAD]]
+
[[File: F16_cmpe 146_wtcca_arm2.JPG|300px|thumb|right|Figure 3. Camera Arm Hardware Design in CAD]]
  
 
=== Hardware Interface ===
 
=== Hardware Interface ===
Line 178: Line 168:
  
 
=== Software Design ===
 
=== 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.
 
  
 
===== Board-to-Board Wireless Communication =====
 
===== Board-to-Board Wireless Communication =====
The board-to-board wireless communication utilizes Nordic Wireless on the SJOne board. Two additional tasks were created to perform the intended operations needed in this project: one task for wireless data transmission and one task for wireless data reception. The main wireless controller performs the task that transmits data while the camera motion controller performs the task that receives data. The transmit task first interprets and uses the acceleration data captured by the SJOne board's acceleration sensor to generate the appropriate instructions to send to the camera motion controller. Then, after the instructions have been generated, the transmit task packages the instructions into a packet and sends the packet wirelessly to the other board. The receive task receives the wireless packet and unpackages the packet to obtain the instruction data. Then, the receive task uses the instruction data to control the movement of the motors.
+
The board-to-board wireless communication utilizes Nordic Wireless on the SJOne board. Two additional tasks were created to perform the intended operations needed in this project: one task for wireless data transmission and one task for wireless data reception. The main wireless controller performs the task that transmits data while the camera motion controller performs the task that receives data. The transmit task first interprets and uses the acceleration data captured by the SJOne board's acceleration sensor to generate the appropriate instructions to send to the camera motion controller. Then, after the instructions have been generated, the transmit task packages the instructions into a packet and sends the packet wirelessly to the other board. The receive task receives the wireless packet and unpackages the packet to obtain the instruction data. Then, the receive task uses the instruction data to control the movement of the motors. Figure 4 describes the general software design of the project.
  
[[File: CMPE 146 Lab Project Software Flowchart.png|600px|thumb|centre|Figure 2. Overall Project Software System Design]]
+
[[File: CMPE 146 Lab Project Software Flowchart.png|600px|thumb|centre|Figure 4. Overall Project Software System Design]]
  
 
=== Implementation ===
 
=== 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.
 
  
 
===== Board-to-Board Wireless Communication =====
 
===== Board-to-Board Wireless Communication =====
Initialization of the SJOne boards' wireless features was mostly handled by the default wireless task. For wireless communication, the wireless channel number used by both boards must be the same. The two boards used in this project each had their own wireless node address, which was used to uniquely identify each of the boards during the wireless communication. Both tasks were set to HIGH priority to ensure that they were running all of the time.
+
The wireless communication used the wireless API to perform the formation of a wireless packet and the wireless transmission of the packet. Initialization of the SJOne boards' wireless features was mostly handled by the default wireless task. For wireless communication, the wireless channel number and the air data rate used by both boards must be the same. The two boards used in this project each had their own wireless node address, which was used to uniquely identify each of the boards during the wireless communication. Both tasks were set to HIGH priority to ensure that they were running all of the time. Figure 5 describes an more in-depth view and explanation of the functionality and process of the two tasks used in this project.
  
[[File: F16 cmpe146 wtcca tasks diagram.png|600px|thumb|centre|Figure 3. Project Tasks Software Design]]
+
[[File: F16 cmpe146 wtcca tasks diagram.png|600px|thumb|centre|Figure 5. Project Tasks Software Design]]
  
 
== Testing & Technical Challenges ==
 
== Testing & Technical Challenges ==
Line 200: Line 188:
 
Initially, as we were testing the board-to-board wireless communication, many packets would often be lost during the transmission.
 
Initially, as we were testing the board-to-board wireless communication, many packets would often be lost during the transmission.
  
===== Solution: =====
+
===== Solution =====
In order to resolve this issue, we reduced the air kbps rate down to provide a more stable signal. Although reducing the air kbps rate did reduce the loss of packets, the data transmission rate became much slower.
+
We determined that the cause of the issue was the Nordic Wireless's limited wireless range. As such, in order to resolve this issue, we reduced the air kbps rate down to provide a more stable signal in a larger wireless range.
  
 
=== Getting Motors to Work Properly ===
 
=== Getting Motors to Work Properly ===
Line 208: Line 196:
 
Motors were acting sporadically and not as expected.
 
Motors were acting sporadically and not as expected.
  
===== Solution: =====
+
===== Solution =====
 
By connecting every component in the design to common ground, we were able to resolve this issue.
 
By connecting every component in the design to common ground, we were able to resolve this issue.
  
 
== Conclusion ==
 
== 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?
+
This project was a success because we completed all of our intended objectives. The two boards were able to wirelessly communicate with each other and were able to receive and send packets of data. The camera arm was able to move according to the instruction data sent wirelessly from the main wireless controller. This project increased our knowledge in both hardware and software designs. We learned a lot about the wireless API and how two boards can communicate wirelessly with each other by sending and receiving packets of information. We also learned a lot about motors and how to use them in a hardware design. Overall, we learned how to design a mechanical arm and control the mechanical arm wirelessly.
  
 +
The project was done as successful as we wanted. We started with the idea of control a camera over wireless communication. Software was going to be created to gather information from an acceleration sensor, interpret the data and transmit relevant information to a board that had motors that controlled a 3D printed arm. Much of the stuff was new, as in using motors and using PWM, understanding and implementing wireless communication over Nordic mesh network. This led to some drawbacks in understanding how to interfacing items into the projects. The project was a great learning experiencing and exposed us to new and fun concepts.
 
=== Project Video ===
 
=== Project Video ===
 
[https://www.youtube.com/watch?v=mo8RRpzAW5Y Initial Test]
 
[https://www.youtube.com/watch?v=mo8RRpzAW5Y Initial Test]
Line 220: Line 209:
  
 
=== Project Source Code ===
 
=== Project Source Code ===
*  [https://sourceforge.net/projects/sjsu/files/CmpE_S2016/ Sourceforge Source Code Link]
+
*  [https://docs.google.com/document/d/1obO9x_XEwwy6a7IKLsMxZkHof_-oGMlZRPcwlEeM7yw/edit?usp=sharing Source Code Link]
  
 
== References ==
 
== References ==
 
=== Acknowledgement ===
 
=== Acknowledgement ===
Any acknowledgement that you may wish to provide can be included here.
+
We'd like to thank Preet and Dr. Ozemek for their commitment to everyone and the limitless effort that they provide for San Jose State.
 
 
=== References Used ===
 
List any references used in project.
 
  
=== Appendix ===
+
=== References ===
You can list the references you used.
+
*[https://www.sparkfun.com/datasheets/Components/SMD/nRF24L01Pluss_Preliminary_Product_Specification_v1_0.pdf Nordic Wireless]
 +
*[http://www.micropik.com/PDF/SG90Servo.pdf SG90 Servo Motor Data Sheet]
 +
*[https://www.servocity.com/hs-5065mg Hitech HS 5065MG Servo Motor]

Latest revision as of 02:15, 21 December 2016

Wireless Tilt Controlled Camera Arm

The Completed Arm project .

Abstract

For this camera system, the camera moves according to the tilt of the wireless controller, which will be one of the two SJOne boards. The camera is mounted on a mechanical arm that is connected to the second SJOne board. The camera's movement speed is set. However, the camera's direction is determined by the angle in which the controller is tilted. The controller's tilt will be tracked using the attached SJOne board’s accelerometer and used in the movement of the camera arm. Similar to the movement of the human eye, the camera arm in this camera system is able to move nearly 180 degrees in all directions in forward vision, allowing for a wide range of different camera angles. The camera can look at an angle in any direction such as left, right, up, and down. If there is an error, the user can reset the camera arm motion controller to reset the camera back to the center position so that the camera is facing the correct orientation. Data is transferred through wireless communication between the two SJOne boards.

Objectives & Introduction

The objective for this project was to learn how to use motors and to use them to implement a project. Here, a camera arm was designed in order to take acceleration sensor data from one board and and through wireless communication, receive information on how to move the arms with respect to how the control board would move. The following objectives were set for the project:

1. Design an arm in CAD software to hold all the motors that will perform all the movements.

2. Research the proper hardware needed for the expectations for the project, which would be high precision motors that are capable of fine movement.

3. Write software to control motors and to establish wireless communication across 2 devices.

Team Members & Responsibilities

  • Kevin Lai
    • Acceleration Sensor and Wireless Communication Software Developer
    • Document Writer
  • Alex Reyna
    • Arm and Track Designer, and Motor Driving Software Developer
    • Document Writer

Schedule

Week# Start Date End Date Task Status Actual Completion Date
1 10/8 10/14 Write Project Proposal Completed 10/14
2 10/14 10/21 Finalize Project Design Completed 10/21
3 10/21 10/28 Research and Determine Necessary Components Completed 10/28
4 10/28 11/11 Purchase Parts Completed 11/15
5 11/11 11/18 Generate Schematics and Begin Prototyping Completed 11/18
6 11/18 11/25 Program First Microcontroller to Act as Wireless Remote Controller of Camera Arm Completed 11/23
7 11/25 12/2 Create Movable Camera Arm Completed 12/9
8 12/2 12/9 Program Second Microcontroller to Interface with the Camera Arm Completed 12/16
9 12/9 12/16 Perform Final Tests, Generate Final Report, and Prepare for Demo Completed 12/19

Parts List & Cost

A part list for our project.

Part Name Model Number Quantity Cost (Total) Notes
Microcontroller SJOne Board 2 $160 One for Main Wireless Controller and One for Camera Motion Controller
2.4GHz 6dBi Indoor Omni-directional Antenna Antenna 2 $9 Used for wireless communications between the boards
Osoyoo Micro Servo Motor SG90 10 $20 Used for the motor control for the arm
High Torque Metal Gear Feather Servo Motor HS-5065MG 2 $54 Used for the motor control for the arm
5V Step-Up/Step-Down Voltage Regulator S18V20F5 1 $15 Used for regulating power to the SJOne Board
6V Step-Up/Step-Down Voltage Regulator S18V20F6 1 $15 Used for regulating power to the motors
3D Printed Arm SCE 1 $0 3D printed at SJSU's SCE Club Room, free of charge with club membership

Design & Implementation

The Wireless Tilt Control Camera Arm design was broken up across two boards, both hardware and software. One board was going to be used to get data from the on-board acceleration sensor, interpret it and send it wireless over to a second board to that would receive the information transmitted and move the motors accordingly.

Hardware Design

Motor Control

The hardware design mainly focused on the motor control board. No additional hardware was implemented to the board that was sending the acceleration sensor data. Three motors were used in the arm design. 2 high precision servos, the HS 5065MG micro servos, were chosen to be used in the hardware design because of their ability to have fine control and movement. They are not typical servos that moved in a manner that required a certain amount of pulse to trigger or needing a certain length to the duty cycle. Rather, the servo rotates based on the duration of the pulse. The motor had a workable range of 750 - 2250 microseconds. The servo had a workable range of of 120 degrees. These were the more expensive motors and had metal gears. The third motor was the Osoyoo SG90 micro servo, which had a duty cycle of 50 hz, or 20 ms. It required a pulse of 1-2ms to rotate the motor 90 degrees, either to the left or to the right. These motors were much simpler and had plastic gears. These were not able to provide fine control. In order to power all the devices, two voltage regulators were purchased. A 5V Step Up/Step Down voltage regulator from Pololu was purchased to power the SG90 servo and the SJOne board. A 6V Step Up/Step Down voltage regulator from Pololu was used to power the precision servos. The 6 volts to the motors guaranteed highest efficiency and precision. All the hardware was housed in arm design in CAD tools. The design can be seen in Figure 2 and Figure 3. The schematic and hardware layout can be seen in Figure 1.

Figure 1. Camera Arm Hardware Design
Figure 2. Camera Arm Hardware Design in CAD
Figure 3. Camera Arm Hardware Design in CAD

Hardware Interface

The motors received pulse width modulation (PWM) signals from the 2.0-2.4 GPIO pins boards on the SJ One board. All devices had to share a common ground port to work efficiently. The onboard PWM API was used to control the motors. They had to be slightly tuned in that inputting a value of 50 into the initialization of the PWM . Setting the value of 4 in turn actually generated a duty cycle of 20 ms. This was verified using an oscilloscope. The percentage of the duty cycle was calculated to measure to correct duration of pulse needed to move the motors.

Software Design

Board-to-Board Wireless Communication

The board-to-board wireless communication utilizes Nordic Wireless on the SJOne board. Two additional tasks were created to perform the intended operations needed in this project: one task for wireless data transmission and one task for wireless data reception. The main wireless controller performs the task that transmits data while the camera motion controller performs the task that receives data. The transmit task first interprets and uses the acceleration data captured by the SJOne board's acceleration sensor to generate the appropriate instructions to send to the camera motion controller. Then, after the instructions have been generated, the transmit task packages the instructions into a packet and sends the packet wirelessly to the other board. The receive task receives the wireless packet and unpackages the packet to obtain the instruction data. Then, the receive task uses the instruction data to control the movement of the motors. Figure 4 describes the general software design of the project.

Figure 4. Overall Project Software System Design

Implementation

Board-to-Board Wireless Communication

The wireless communication used the wireless API to perform the formation of a wireless packet and the wireless transmission of the packet. Initialization of the SJOne boards' wireless features was mostly handled by the default wireless task. For wireless communication, the wireless channel number and the air data rate used by both boards must be the same. The two boards used in this project each had their own wireless node address, which was used to uniquely identify each of the boards during the wireless communication. Both tasks were set to HIGH priority to ensure that they were running all of the time. Figure 5 describes an more in-depth view and explanation of the functionality and process of the two tasks used in this project.

Figure 5. Project Tasks Software Design

Testing & Technical Challenges

Wireless Stability

Issue

Initially, as we were testing the board-to-board wireless communication, many packets would often be lost during the transmission.

Solution

We determined that the cause of the issue was the Nordic Wireless's limited wireless range. As such, in order to resolve this issue, we reduced the air kbps rate down to provide a more stable signal in a larger wireless range.

Getting Motors to Work Properly

Issue

Motors were acting sporadically and not as expected.

Solution

By connecting every component in the design to common ground, we were able to resolve this issue.

Conclusion

This project was a success because we completed all of our intended objectives. The two boards were able to wirelessly communicate with each other and were able to receive and send packets of data. The camera arm was able to move according to the instruction data sent wirelessly from the main wireless controller. This project increased our knowledge in both hardware and software designs. We learned a lot about the wireless API and how two boards can communicate wirelessly with each other by sending and receiving packets of information. We also learned a lot about motors and how to use them in a hardware design. Overall, we learned how to design a mechanical arm and control the mechanical arm wirelessly.

The project was done as successful as we wanted. We started with the idea of control a camera over wireless communication. Software was going to be created to gather information from an acceleration sensor, interpret the data and transmit relevant information to a board that had motors that controlled a 3D printed arm. Much of the stuff was new, as in using motors and using PWM, understanding and implementing wireless communication over Nordic mesh network. This led to some drawbacks in understanding how to interfacing items into the projects. The project was a great learning experiencing and exposed us to new and fun concepts.

Project Video

Initial Test

Demo

Project Source Code

References

Acknowledgement

We'd like to thank Preet and Dr. Ozemek for their commitment to everyone and the limitless effort that they provide for San Jose State.

References