S16: Dan

From Embedded Systems Learning Academy
Revision as of 00:00, 22 May 2016 by Proj 146u2 (talk | contribs) (Schedule)

Jump to: navigation, search

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.

Project Title

Abstract

The project will use an Android application to determine how much liquid a syringe pump outputs. The application will communicate with a Bluetooth module attached to the SJSU One board which will control the stepper motor driver to determine how many steps the stepper motor will take on the syringe pump.

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.

Team Members & Responsibilities

  • Nicholas Foulk
    • Software block diagrams
    • Hardware block diagrams
    • Ordering all parts other than 3D printer ones
    • Parts list
    • Real-time task programming
    • Buttons on Phone app
    • Video for the demonstration
  • Anson Jiang
    • Bluetooth Phone Application Designer
    • Communications Manager
    • Writing on the social Ledge page
    • Ordering 3D parts
  • Danny Luong
    • Software Process Coordinator
    • Real-time task programming
    • Writing on the social Ledge page
    • Debugging
      • Real-time tasks
      • Phone Application

Schedule

Show a simple table or figures that show your scheduled as planned before you started working on the project. Then in another table column, write down the actual schedule so that readers can see the planned vs. actual goals. The point of the schedule is for readers to assess how to pace themselves if they are doing a similar project.

Week# Start Date End Date Tasks Status Result
1 4/7 4/9 Order Parts Completed (4/20) (4/17) It was much more challenging to order the 3D parts than expected. Most of the initial parts have been ordered.
(5/4) We ordered parts like hex bolt, bearing, and a coupling to make our design more complete.
2 4/8 4/15 Create Block Diagram, Flow Charts, Pseudo Code, Schematic Completed(5/20) (4/15)The initial schematic is completed, but the flow charts and pseudo code have been delayed because of parts.
Bluetooth programming was moved forward. We are not sure what else to add in terms of flow charts.
(5/20) We decided to make an in-depth software block diagram for showing the entire process of communication.
3 4/16 4/22 Build syringe pump and work on stepper motor programming Completed (4/21) (4/12) Parts are getting delivered and they all will arrive by the 26th of April.
They have arrived and we built it. The next portion is setting up the stepper motor with the system.
We have found at this point we need additional parts.
(5/4) We have realized we are missing a needed and hex bolt bearing have ordered it.
(5/13) We decided on trying to attach a hose to the end of the syringe and bought the parts for it.
4 4/23 4/31 Work on bluetooth communication between SJ one board and Android device Completed (4/30) (4/23) Bluetooth module was easy to purchase. We moved forward with writing the Android application.
(5/2) We are have written an elementary design to start testing out the process.
(5/10) We decided on two methods of software design, one with automatic reversal of the syringe and
the other with user enabled direction reversal.
5 5/1 5/8 Work on Android device control for syringe pump Completed (4/30) (5/1)We have a list of options for users to decide how many steps they want to take with the stepper motor,
but we have no correlation with an amount of liquid dispersed yet.
6 5/9 5/16 Test syringe pump for accuracy and Android device control Completed (5/10) We have pushed out liquid from the syringe into a cup for testing. We have counted the number of steps it
takes to empty a syringe. We have counting the number of steps for filling a syringe.
(5/20) We made adjustments to make the project more presentable.

Parts List & Cost

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

Part No. Name Description No. of Items Link to Datasheet Price
1 HC-06 Bluetooth Module Used for android app communication with the SJSU One Board 1 TBA $19.99
2 Stepper motor driver Interfacing between SJSUOne Board and Stepper Motor 1 A4988-Datasheet $22.45
3 Stepper motor 1 NEMA-17-Datasheet $14.11
4 Syringe Used for sucking and ejecting liquid in a thin stream 1 $7.99
5 T-Slotted Extrusion Part of the syringe holder for dispensing the proper amount of liquid 1
6 Linear Motion Shaft 8mm Shaft, 330m in length, steel 1
7 Linear Bearings Used for CNC applications, LM8UU 1 $10.59
8 Rigid Coupling User on the shaft of the stepper motor for turning the metal rod. 1 $21.45
9 DC output power supply For powering the SJ one board and stepper motor driver without the use of a USB connection. 1 $15.94
10 Inline switch For turning the circuit on and off without unplugging the power supply. 1 $4.00
11 3D printed part #1 Syringe Mount Holding the top side of the syringe 1 Varies
12 3D printed part #2 Rod Barrel Holding the bottom side of the syringe 1 Varies
13 3D printed part #3 Rod plunger Holding the rods in between the syringe and stepper motor 1 Varies
14 3D printed part #4 Stepper motor mount Mounting the stepper motor at level with the rods to the push the syringe. 1 Varies
15 Female Luer Connecting the syringe to a plastic tube. 1 $10.99
16 Male Luer Connecting the plastic tube to a needle. 1 $10.99
17 Syringe Needle Needle for outputting liquid. 10 $6.99
18 Hack Saw Cutting metal rod. 1 $15.99

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.

System Design Version 4.png

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.


The stepper motor driver board communicates with the stepper motor driver using two pairs of wires which represent each coil on the motor. The stepper motor steps when the stepper motor driver manipulates the current through the pair of coils to cause a rotation.

Pin 0.0 was used as an UART TX pin and Pin 0.1 was used as an UART RX pin to be connected to the Bluetooth module to enable Bluetooth communications between the SJSUOne board and the Android application.

Six SJSUOne pins were used for controlling the stepper motor driver,not including power and ground pins.
Pin 2.0 was used as an output GPIO pin for the stepper motor driver's enable pin that allows for motor control when LOW.
Pin 2.1 was used as an output GPIO pin for the stepper motor driver's ms1 pin that allows for the configuration of full,half,quarter,eighth,sixteenth steps of the motor.
Pin 2.2 was used as an output GPIO pin for the stepper motor driver's ms2 pin that allows for the configuration of full,half,quarter,eighth,sixteenth steps of the motor.
Pin 2.3 was used as an output GPIO pin for the stepper motor driver's ms3 pin that allows for the configuration of full,half,quarter,eighth,sixteenth steps of the motor.
Pin 2.4 was used as an output GPIO pin for the stepper motor driver's step pin that allows the motor to do one step (if ms1,ms2,ms3 are LOW) on a LOW to HIGH transition on this pin.
Pin 2.5 was used as an input and output GPIO pin for the stepper motor driver's direction pin that allows for the motor to go in a forward direction when HIGH and a backward direction when LOW.

Software Design

/* move this to implementation
Overall for our software design we have three main components.

The first component is the Android application. The purpose of this component is to be able to accept user input of 0 to 30mL (max amount of liquid per our syringe) rounded to the nearest .5mL (how accurate our product will be) and the application will convert that into the appropriate number of letters to be sent through Bluetooth UART to the board to receive and decode. To protocol to send the amount to the SJSUBoard was sending a byte 'a' to signal the start of data stream. Then the appropriate letters were sent ('b'=.05mL, 'c'=.1mL, 'd'=.5mL, 'e'=1mL, 'f'=5mL, 'g' =10mL) until the exact amount was sent through Bluetooth to the board and a byte 'z' was sent to signal the end of the data stream. After the data is done being sent, the application will disable input until the stepper motor task sends a byte to signal that the process is complete to allow for another execution.

The second component is the Bluetooth receiver task. The purpose of this component is to wait for a message from the Android application and handle the data stream. It will discard all bytes sent until a start byte of 'a' is sent and it will enter a loop to add up the letters to form the total amount of liquid represented in the application. It will discard all other bytes that are not part of the decoding key and will exit the loop once a done byte of 'z' is sent. The program will then multiply the amount of mL of the syringe to the determined constant for steps per mL and send the result into a queue.

The last component is the Stepper Motor task. This task will block waiting forever until data from the Bluetooth receiver task is put into the queue. The stepper motor task will take step data from the queue and create a low to high transition on the step pin voltage # of steps amount of times to push the syringe to dispense liquid to the appropriate amount. The task will then be looped until the user presses the on-board switch to reset the motor to its original position after giving time for the user to do what they need to with the syringe output. After the button is pressed, the task will reverse the direction the motor to return it to its original state in preparation for the next use. A byte is sent through uart to signal the application that the task is complete and unlock the app to allow for a new input.

  • /

CmpE146 Dan FlowChartDiagram1.png

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.


Android Application design will consist of finding a bluetooth device screen and then allows user to enter amount of liquid to dispense

SJSUOne Board will have a bluetooth task that will wait for bluetooth message, process it and send to stepper task

Stepper task will take message from que and process the exact amount of steps to output the specified liquid from syringe.

/* Hardware implementation here

  • /

The first component is the Android application. The purpose of this component is to be able to accept user input of 0 to 30mL (max amount of liquid per our syringe) rounded to the nearest .5mL (how accurate our product will be) and the application will convert that into the appropriate number of letters to be sent through Bluetooth UART to the board to receive and decode. To protocol to send the amount to the SJSUBoard was sending a byte 'a' to signal the start of data stream. Then the appropriate letters were sent ('b'=.05mL, 'c'=.1mL, 'd'=.5mL, 'e'=1mL, 'f'=5mL, 'g' =10mL) until the exact amount was sent through Bluetooth to the board and a byte 'z' was sent to signal the end of the data stream. After the data is done being sent, the application will disable input until the stepper motor task sends a byte to signal that the process is complete to allow for another execution.

The second component is the Bluetooth receiver task. The purpose of this component is to wait for a message from the Android application and handle the data stream. It will discard all bytes sent until a start byte of 'a' is sent and it will enter a loop to add up the letters to form the total amount of liquid represented in the application. It will discard all other bytes that are not part of the decoding key and will exit the loop once a done byte of 'z' is sent. The program will then multiply the amount of mL of the syringe to the determined constant for steps per mL and send the result into a queue.

The last component is the Stepper Motor task. This task will block waiting forever until data from the Bluetooth receiver task is put into the queue. The stepper motor task will take step data from the queue and create a low to high transition on the step pin voltage # of steps amount of times to push the syringe to dispense liquid to the appropriate amount. The task will then be looped until the user presses the on-board switch to reset the motor to its original position after giving time for the user to do what they need to with the syringe output. After the button is pressed, the task will reverse the direction the motor to return it to its original state in preparation for the next use. A byte is sent through uart to signal the application that the task is complete and unlock the app to allow for a new input.

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. A major issue was to get 3d printed parts on time as it hindered our hardware implementation until they arrived.
The parts were expensive and needed to be order ahead of time to start making actual progress.

My Issue #2

Part Compatibility

The metal rod we ordered was 1 meter long and a 300-330 millimeter portion need to be cut for the system.
The metal rod had a tight fit with the hex bolt for pushing the syringe.
The couple holding the shaft of the stepper motor and the metal rod wasn't tight enough. We had to force it to clamp down on the metal rod to make it spin.

My Issue #3

Soldering Issues

Pins needed to be soldered to the stepper motor driver for the power and SJ one board connections.
The wires for powering the stepper motor driver with a 5 volt wall power supply and stepper motor connections were soldered to the board themselves instead of pins and it they became loose and unstable often.
The stepper motor wires needed to be cut shorter every time they need to be resoldered.

My Issue #4

Troubleshooting

Sometimes the SJ one baord doesn't power up properly or the stepper motor connections aren't working causing us to have to reset the system.
Stepper motors are inherently inaccurate because they don't have a feedback loop and our program needed to be adjusted a number of times because of it.

My Issue #5

Accuracy

Stepper motors have no feedback loop and are known for being less precise so we sometimes have trouble getting the output as accurate as we want it.
Since there is no feedback loop in stepper motors we are not constantly tracking the position the syringe is currently in and as a result we have to
set a static starting position at start up every time.

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.


1. Knowledge of stepper motors and stepper motor driver.
2. Bluetooth communication.
3. Android application development with bluetooth.
4. Interfacing hardware and software.
5. Experience using uart
6. Experience using queues
7. Powering SJ one board and stepper motor driver using power supply.

Project Source Code

References

Acknowledgement

Any acknowledgement that you may wish to provide can be included here.

References Used

NEMA 17 Stepper Motor Data Sheet

http://www.pbclinear.com/Download/DataSheet/Stepper-Motor-Support-Document.pdf


A4988 Stepper Motor Driver Data Sheet

https://cdn.sparkfun.com/datasheets/Robotics/A4988-Datasheet.pdf


Stepper Motor Driver Schematic

https://cdn.sparkfun.com/datasheets/Robotics/BigEasyDriver_v16.pdf

Appendix

You can list the references you used.