Difference between revisions of "S17: CamBot"

From Embedded Systems Learning Academy
Jump to: navigation, search
(Bluetooth Task Implementation)
(Hardware Interface)
Line 291: Line 291:
 
|}
 
|}
  
 +
===== Bluetooth Module =====
  
 +
[[File:CmpE244_S17_cambot_RN42XV_Bluetooth_Module.jpg‎|right|180px|thumb|RN42XV Bluetooth Module]]
 +
 +
RN42XV is built around Microchip's RN42 low power Bluetooth module. Some features of this module are as follows
 +
 +
*Based on the popular 2 x 10 (2mm) socket footprint.
 +
*Voltage range: (3-3.6)Volts
 +
*Current range: 26 μA sleep, 3 mA connected, 30 mA transmit.
 +
*UART data connection interface.
 +
*Sustained data rates: 240 Kbps (slave), 300 Kbps (master)
 +
*Transmission range up to 60 feet (20 m) distance, +4 dBm output transmitter, -80 dBm typical receive sensitivity.
 +
*FHSS/GFSK modulation, 79 channels at 1-MHz intervals.
  
 
=== Software Design ===
 
=== Software Design ===

Revision as of 00:13, 22 May 2017

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.

CamBot

Abstract

The project aims to build a motorized camera holding bot that helps the photographers to create moving time-lapses across a landscape.The photographers can program the bot to move in a sequence of desired directions and capture the time-lapse. CamBot can slowly move over time to capture the time-lapse and also slowly change angles.

Objectives & Introduction

The project explores the GPIO and UART drivers in LPC1758 platform. CamBot is driven with the help of DC Motors whose PWM Signals are given by LPC1758. Since stepper motor moves in precise repeatable steps, it is best suited for applications requiring precise positioning. Precise increments of movement also allow for excellent control of rotational speed for process automation and robotics. Normal DC motors do not have much torque at low speeds. The sequence of directions for the CamBot is provided by a Bluetooth Application which sends the commands for specific movements.

Team Members & Responsibilities

  • Spoorthi Mysore Shivakumar
  • Goutam Madhukeshwar Hegde
  • Chethan Palangotu Keshava
  • Aajna Karki

Schedule

Team Schedule

SI No. Start Date End Date Task Status Actual Completion Date
1 03/14/2017 03/21/2017
  • Project proposal submission.
  • Dividing module ownership among the team members.
  • Decide on components required.
Completed 03/21/2017
2 03/21/2017 03/28/2017
  • Brainstorm on the hardware and software design.
  • List the interfaces and order the components.
Completed 03/28/2017
3 03/29/2017 04/04/2017
  • Study the datasheets of the components and understand the pin connections.
  • Prepare pinout diagrams and prepare the hardware design
  • Prepare the software design flow of each of the modules.
In Progress
4 04/05/2017 04/12/2017
  • Design the PCB and place order for fabrication.
In Progress
5 04/13/2017 04/18/2017
  • Interface Stepper Motor with SJOne Board and get the functionality working.
  • Implement a basic Android application.
  • Implement UART driver for interfacing the Bluetooth module with the SJOne board.
Not Started
6 04/19/2017 04/25/2017
  • Interface DC Motor with SJOne Board and get the functionality working.
  • Check of communication between Android application and SJOne board.
  • Implement the control of the camera via Bluetooth.
Not Started
7 04/26/2017 05/02/2017
  • Build the robot with all interfaces integrated.
  • Complete the development and testing of all modules stand-alone.
Not Started
8 05/03/2017 05/09/2017
  • Integrate all the modules and test for functionality as a unit.
  • Ensure that the motor responds to the commands provided by the application accurately.
Not Started
9 05/10/2017 05/15/2017
  • Final testing and debugging phase.
  • Update project report and prepare for demo.
Not Started

Parts List & Cost

Give a simple list of the cost of your project broken down by components. Do not write long stories here.

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

Discuss your hardware design here. Show detailed schematics, and the interface here.

PCB Design

Eagle software is used for PCB design. The steps involved in the PCB design process are discussed below.


1. PCB Schematic Design: In the first step, we need to design a circuit using components available in Eagle library.Here two important things to keep in mind are:

1. The Electrical Characteristics: Based on our requirement of voltage or current rating, we select the components which are suitable for our board.For example, if we want to connect a switch to conduct 5A current, we should not select a switch with 2A current rating from the library because the copper width for 2A switch will not be able to conduct 5A current.

2. Components Selection: We need to carefully select the components here because each component has specific dimension as defined in their library.So once we convert this schematic into board layout, the size of the pads printed on the board depends on the component selection.We can't change the size if we select the library components.But there is a way we create our custom components with required electrical characteristics and dimensions.For our design, we used most of the parts from the Sparkfun library as it is very reliable and some of the parts which are not available in the library are created manually using Eagle.

PCB Schematics

2. PCB board layout:

PCB board layout involves mainly placing components in the layout and routing them together.we can manual routing or auto routing to connect components together with copper lines.But sometimes auto routing does not work or it will not be able to route all the connectors in an efficient manner.So manual routing is the best way where we will be able to plan and do the routing. In our project, the main challenges faced while PCB design is placing connectors and components in the appropriate place.Since we used a motor driver shield, which has 14 pin male connectors on the one side and 12 pin male connectors on the other side, it was very important that we measure proper dimension to fit this board on female connectors placed on PCB.We used dimension tool of the eagle to fix the accurate placement of connectors.

The other challenge involved in the PCB design is routing the 34 pin connector for connecting SJ-one board to PCB.We decided to leave out extra 34 pin connector corresponding to SJ-one board because it can be used for any additional features added to our project.

PCB Board


  • PCB without Components
  • PCB with Components
  • PCB with Motor Driver

Hardware Interface

The hardware components used in this project include:

  • Motor Shield
  • Stepper Motor
  • DC Motor
  • Bluetooth module.


Motor Shield

The Arduino motor shield is used in this project. It comprises of two L293D dual H-bridge motor driver ICs. It has four digital inputs which are in pairs. Each pair controls a motor. The operation can be explained with an example. If pin 7 is set low and pin 2 is set high, motor 1 is turned on. Reversing the inputs will reverse the motor. In order to conserve pins, the motor driver IC pins are wired to the outputs of 74HCT595N IC which is an 8-bit shift register. The data is fed in serially into this IC which then outputs the data in the parallel form.

The inputs to the shift register consists of:

  • DIR_EN: Enable Input (Active Low)
  • DIR_SER: Data Input
  • DIR_CLK: Rising edge results in shifting in of the input data bit
  • DIR_LATCH: Rising edge results in internal bits to be moved out as parallel data
Motor Shield Schematic


Motor Shield and SJOne Interface
Motor Shield Pin SJOne Pin
4 (CLK) P2.4
7 (EN) P2.5
8 (DATA) P2.6
12 (LATCH) P2.7


Stepper Motor

Stepper motor is used to obtain the rotation of the phone for capturing a time-lapse.

Stepper motors consist of a rotor and stationary electromagnets around the rotor. The movement of the rotor is controlled by energizing the electromagnets in a particular sequence as required. The movement of the rotor occurs since the rotor is attracted towards the electromagnets. In this project, we use the NEMA 17 stepper motor which has a precision of 200 steps per revolution. Based on the angle required, the stepper motor can be configured to take the required number of steps in the provided direction.

Stepper Motor Functionality


Stepper Motor and Motor Shield Interface
Stepper Motor Motor Shield
2A and 2B M2
3A and 3B M3
SJOne PWM for Stepper Motor
Stepper Motor SJOne Pins
2A and 2B P2.0 (PWM1)
3A and 3B P2.3 (PWM4)


DC Motor

DC motor is used in this project to move the robot forward and backward. Two DC motors are used each connected to a wheel.

The DC motor converts electrical energy to mechanical energy. It consists of a current carrying conductor placed in an electromagnetic field. When current is passed through the conductor, a mechanical force is generated due to the electromagnetic effect.

DC Motor Functionality


DC Motor and Motor Shield Interface
DC Motor Motor Shield
DC Motor 1 M1
DC Motor 2 M4
SJOne PWM for DC Motor
DC Motor SJOne Pins
DC Motor 1 P2.1 (PWM2)
DC Motor 2 P2.2 (PWM3)
Bluetooth Module
RN42XV Bluetooth Module

RN42XV is built around Microchip's RN42 low power Bluetooth module. Some features of this module are as follows

  • Based on the popular 2 x 10 (2mm) socket footprint.
  • Voltage range: (3-3.6)Volts
  • Current range: 26 μA sleep, 3 mA connected, 30 mA transmit.
  • UART data connection interface.
  • Sustained data rates: 240 Kbps (slave), 300 Kbps (master)
  • Transmission range up to 60 feet (20 m) distance, +4 dBm output transmitter, -80 dBm typical receive sensitivity.
  • FHSS/GFSK modulation, 79 channels at 1-MHz intervals.

Software Design

FlowChart

The software design consists of 3 tasks:

  • Bluetooth Task
  • Stepper Motor Task
  • DC Motor Task

The Bluetooth task is of high priority since the user data needs to be received and acted upon. The Stepper Motor and the DC Motor tasks are run with medium priority.


Motor Shield Software Implementation

The shift register in the motor shield requires 4 inputs. They are configured using SJOne GPIOs as below:

GPIO MOTORLATCH(P2_7);
GPIO MOTORDATA(P2_6);
GPIO MOTORCLK(P2_4);
GPIO MOTORENABLE(P2_5);

MOTORLATCH.setAsOutput();
MOTORENABLE.setAsOutput();
MOTORDATA.setAsOutput();
MOTORCLK.setAsOutput();

Latch enabling is required every time a data is set since it controls the data moving into the shift register and the parallel data being sent out of the motor shield. This functionality of latching motor state data is implemented as follows:

for(i=0; i<8; i++)
{
     setMotorClockLow();
     
     if(latch_state & (1 << (7-i))
     {
           setMotorDataHigh();
     }
     else
     {
           setMotorDataLow();
     }
     setMotorClkHigh();
}
setMotorLatchHigh();


Stepper Motor Task Implementation

PWM Initialization:

PWMs 1 and 4 are used for Stepper Motor.

GPIO PWM1(P2_0);
GPIO PWM4(P2_3);

PWM1.setAsOutput();
PWM4.setAsOutput();

The Stepper motor coils are energized in the following sequence based on the command received from the application:

Latching for clockwise direction:

latch_state |= (1 << MOTOR3_A) | (1 << MOTOR2_A); 
latch_state |= (1 << MOTOR2_A) | (1 << MOTOR3_B); 
latch_state |= (1 << MOTOR3_B) | (1 << MOTOR2_B); 
latch_state |= (1 << MOTOR2_B) | (1 << MOTOR3_A); 

This sequence results in a clockwise rotation. The reverse of this sequence results in an anti-clockwise rotation.


DC Motor Task Implementation

PWM Initialization:

PWMs 2 and 3 are used for DC Motor.

GPIO PWM2(P2_1);
GPIO PWM3(P2_2);

PWM2.setAsOutput();
PWM3.setAsOutput();

The DC motor is activated based on the command received from the application:

Latching for forward direction:

latch_state |= (1 << MOTOR1_A);
latch_state &= ~(1 << MOTOR1_B);

latch_state |= (1 << MOTOR4_A);
latch_state &= ~(1 << MOTOR4_B);

This sequence results in a forward motion. The reverse of this sequence results in a backward motion.

Bluetooth Task Implementation

Android App 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.

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.