Difference between revisions of "S14: Androbot"

From Embedded Systems Learning Academy
Jump to: navigation, search
(Battery)
(Battery)
Line 180: Line 180:
 
*Weight:      10 Oz  
 
*Weight:      10 Oz  
 
*Dimensions:  50mm (Width); 29mm (Height); 72mm (Length)
 
*Dimensions:  50mm (Width); 29mm (Height); 72mm (Length)
 +
 +
=== Stepper motor ===
 +
The typical self balancing robot uses DC motor with encoders but we decided to go with stepper motors as new challenge. Stepper motors are characterized by their torque and looking at our chassis design we were in the need of motors with more torque. The trade off for these motor is power consumption they consume power even in static position
 +
These motors are available in National Electrical Manufacturers Association i.e.NEMA standards which has predefined structural design guidelines for manufacturing practices.
 +
Mainly these motors can be categorized into
 +
*1. Unipolar : has one winding with center tap per phase
 +
*2. Bipolar: have a single winding per phase
 +
As Unipolar motors can be used in Bipolar mode also by neglecting centre tap this will provide use flexibility in driver selection and different mode of the application.
  
 
=== Software Design ===
 
=== Software Design ===

Revision as of 22:05, 22 May 2014

Project Title

ANDROBOT

Abstract

Androbot is a self balancing robot. The robot maintains it's balance using the IMU 6050 sensor. The values of accelerometer and gyroscope from the IMU sensor help in controlling the stepper motor. The wheels are connected to the stepper motor. The movements of the robot can be controlled using a Android phone app via Bluetooth.

Objectives

Objectives.

  • To develop a self balancing robot using accelerometer and gyroscope sensor.
  • To control the motion of the robot using Bluetooth module.
  • To develop an Android application for the motion control.

Team Members & Responsibilities

Fig 1. System Design
  • Digvijay Patil
    • Driver Development + Android App Development
  • Mahesh Chudasama
    • Mechanical Design + Hardware
  • Shashank Tupkar
    • FreeRTOS Software Design + Android App Development

Introduction

The idea of this project was to design and construct a robot that can be balanced and driven on two wheels. This behavior is similar how a segway (a new mode of transportation) works. The project aims to control the motion or direction of the robot through Android app via bluetooth module.Our goal was to have a working finished product – a robot that, without human interaction, could balance on two wheels.

Schedule

Week# Date Task Actual
1 03/6 Project role distribution Completed
2 03/13 Partlist discussion and Block Diagram Completed
3 03/16 Partlist finalization and Circuit Schematic Completed
4 03/20 Ordering parts and components Completed
5 03/27 Mechanical assembly, Hardware and Android app layout, Interfacing GY 521 With SJ One Board Completed
6 04/03 Hardware test and Kalman Filter firmware coding Completed
7 04/10 Test and debug part (a) Self balancing robot In progress
8 04/17 Android app creation for Bluetooth module testing Completed
9 04/24 Integrating Android app with Bluetooth module Completed
10 05/01 Testing and debug Not Completed
11 05/08 Testing and debug Not Completed
12 05/15 Demo Not Completed

Parts List & Cost

The table below summarizes the parts used and the cost for the Androbot project till now. (To be completed)

Sr. No. Part Description Qty Total Cost
1 SJOne Board ARM Cortex M3 1 $80.00
2 Stepper Motor 1.8* NEMA 17 12 V
Step size = 1.8*
Imax = 400 mA
2 $12.99
3 Wheel Diameter : 9 CM
Width : 0.5"
2 $9
4 Shaft Coupler To couple wheel with motor shaft 2 $6.99
5 ULN2004 IC Motor driver IC
Number of Buffers inverter/IC : 7
Imax = 500 mA
2 $0.65
6 16 Pin IC holder To hold ULN2004 IC , So in case of IC failure, we can replace it immediately 2 $1.3
7 IMU6050 6 Axis Gyro + Aceelerometer
+- 1.5 g
1 $7
8 Battery- Light weight NIMH = 12V 2000 mAH
Weight : 434 oz
1 $19.99
9 HC-05 Bluetooth Module Sensitivity : 80 dBm
Operating Voltage : 1.8 to 3.6 V
Output : UART
Data rate : Variable
1 $12
10 Chassis Made from plastic tiffin box by cutting it from 3" Height 1 $6
11 Strip connector To connect development board with prototype board 2 $3
12 Prototype Board For implementing driver circuitry 1 $5
Total Cost $163.92

Design & Implementation

Hardware Design

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

CmpE244 S14 T15 Androbot schematic 3.jpg

The above figure shows the detailed schematic of the project. It shows the interfacing of SJ_One Board with different modules along with their pin connections. It also shows the the communication protocols used for interfacing the modules.

Fig 6. IMU6050 Sensor

The following modules are interfaced with SJ_One Board

  • 1) MPU6050 orientation detection sensor

MPU6050 is a 6 degree of freedom (DOF) Accelerometer + Gyroscope chip from InvenSense. It is the world’s first integrated 6 axis MotionTracking device that combine 3 axis gyroscope, 3 axis accelerometer and a Digital Motion Processor™ (DMP) all in a small 4x4x0.9mm package. It operates at a 3.3V or 5V supply and communicates via I2C at a maximum speed of 400kHz. It comes with the breakout board called GY-521.

  • 2) HC-05 Bluetooth module
  • 3) HC-SR04 Ultrasonic sensor
  • 4) Stepper motor driver.

The mechanical structure for the robot is designed using a plastic container. The plastic container is mounted on two stepper motors. The shaft of the stepper motors are connected to two wheels. The PCB along with the SJ One board and the different modules is mounted on the plastic container which manages the motion of the robot.

Fig 6. Main Robot

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. This section describes the actual physical hardware devices used in the project.

Battery

Stepper motors are open-loop controller so we have selected as basic building block stepper motor. On the other hand NEMA stepper motor requires power source which can deliver 4-5 W and with 12 V supply our requirement was of 400mA per phase to drive the stepper so altogether 1600mA was the expected drain we calculated for 4 phases of 2 motors. In addition 5v power supply with IC 7805 is built up to drive SJSU-One board, Ultra-sonic and GPU sensor. With these requirement there were following options of Rechargeable battery choice 1. Lithium-ion batteries are common one they are one of the most popular types of rechargeable battery for portable electronics, with best energy densities i.e. with higher sourcing capacity of 4V, 2000 to 3000mAh but these batteries need very careful charging practices and a bit expensive as compared to NiMH cells. 2. NiMH cells are is the robust choice for these type of applications, they come with 1.2V, 2200mAh ratings. The assembly of the multiple cells is used as RC car batteries in most of the robot application, typically we need 10 cascaded cell to built up 12V power supply. The reasons to select these batteries are easy charging cycles. Please find the specification of the same as below:

Fig 6. Battery
  • Product: 12V 2000mAh NiMH Battery
  • Make: Made of 10 x AA NiMH 2000mAh cells
  • Connector: Bare Leads
  • Fit Models: RC airplanes, such as Wattage
  • Feature: Rapidly charge up and long cycle life
  • Weight: 10 Oz
  • Dimensions: 50mm (Width); 29mm (Height); 72mm (Length)

Stepper motor

The typical self balancing robot uses DC motor with encoders but we decided to go with stepper motors as new challenge. Stepper motors are characterized by their torque and looking at our chassis design we were in the need of motors with more torque. The trade off for these motor is power consumption they consume power even in static position These motors are available in National Electrical Manufacturers Association i.e.NEMA standards which has predefined structural design guidelines for manufacturing practices. Mainly these motors can be categorized into

  • 1. Unipolar : has one winding with center tap per phase
  • 2. Bipolar: have a single winding per phase

As Unipolar motors can be used in Bipolar mode also by neglecting centre tap this will provide use flexibility in driver selection and different mode of the application.

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.

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.

1) MPU 6050 Interface

Setup is performed by writing to the various configuration registers. You only need to write to three registers for accelerometer and gyroscope in the end, leaving the rest as zeros, however it is still good practice to write these zeros just in case the register didn't reset correctly. We used the code from the github to save time, as the header file already has the naming of every register address. I have only shown the registers which were frequently used. For all the other registers please refer the code.

  1. define MPU6050_ADDRESS 0b11010010 // Address with end write bit
  2. define MPU6050_RA_ACCEL_XOUT_H 0x3B
  3. define MPU6050_RA_ACCEL_XOUT_L 0x3C
  4. define MPU6050_RA_ACCEL_YOUT_H 0x3D
  5. define MPU6050_RA_ACCEL_YOUT_L 0x3E
  6. define MPU6050_RA_ACCEL_ZOUT_H 0x3F
  7. define MPU6050_RA_ACCEL_ZOUT_L 0x40
  8. define MPU6050_RA_TEMP_OUT_H 0x41
  9. define MPU6050_RA_TEMP_OUT_L 0x42
  10. define MPU6050_RA_GYRO_XOUT_H 0x43
  11. define MPU6050_RA_GYRO_XOUT_L 0x44
  12. define MPU6050_RA_GYRO_YOUT_H 0x45
  13. define MPU6050_RA_GYRO_YOUT_L 0x46
  14. define MPU6050_RA_GYRO_ZOUT_H 0x47
  15. define MPU6050_RA_GYRO_ZOUT_L 0x48
  16. define MPU6050_RA_WHO_AM_I 0x75

The first line defines the address of the chip, which is 0x69 since AD0 is pulled high. This value is stored in the 7 most significant bits, with the least significant bit being the read/write bit. When cleared, this tells the chip a write is about to occur and when set it tells the chip to send data from the specified register address. This setting and clearing is done by ORing the address with 0x01 for a read, or leaving it untouched for a write. This operation is performed by the I2C driver. Not all of these addresses are writable, and some aren't even mentioned in the datasheet. The first part of the setup is to check the I2C link is functioning. This is done by simply reading the register at 0x75, referred to as MPU6050_RA_WHO_AM_I. This contains the chips I2C address, which is always 0x68, regardless of the state of AD0. If this communication is successful, you know your chip functions partially, congratulations! The next step is to write to all the configuration registers. We do not know why so many registers are written but all the registers need to be written for proper functioning of the chip.

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:

Issue #1

Deciding the motors and battery. (To be completed)

Issue #2

Deciding the the body of the bot. (To be completed) We did not want our robot to be very heavy and consume more voltage.

Issue #3

  • Interfacing GY-521(Accelerometer and Gyroscope Sensor) board with the SJ One board.

IMU MPU 6050 works on I2C and SPI both. We decided to go with I2C as I2C state machine was already written. There were number of issues faced here:

  • 1. Getting the proper address of the IMU for initiating the communication. The tricky part here is if AD0 pin of IMU sensor is pulled low the address is 0x68 and if its pulled high the address is 0x69. This took a while to figure out.
  • 2. MPU 6050 once it is initialized by writing the specified registers, you do not have to again write the registers for reading the data. To get the data just keep on reading the specified registers for values.
  • 3. The data in the register comes in 2 bytes with the MSB byte first. So first left shift the values of MSB by 8 and concatenate it with LSB. The difficult part is to get the data in the exact format which took while to figure as there is no basis to decide whether the data is correct or not. The data acquired and the data concatenated should be in the uint_8 format.

Issue #4

We did not use the encoders so we could not find the exact position of the wheels. We could not decide by how many steps each of the wheel rotated.

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

[1] http://www.cdiweb.com/datasheets/invensense/PS-MPU-6000A.pdf
[2] http://www.starlino.com/imu_guide.html
[3] http://www.botched.co.uk/pic-tutorials/mpu6050-setup-data-aquisition/

Appendix

You can list the references you used.