Difference between revisions of "Variable Frequency Electrosense"

From Mech
Jump to navigationJump to search
Line 38: Line 38:


===Buttons===
===Buttons===
'''Linear Actuator Control'''

Note: for these buttons to have any effect, the "Activate" button needs to be pressed before these buttons
*'''Pause''': board will stop moving (if it was already moving)
*'''Forward''': module will move forward, towards the right (if not already moving forward) at a constant speed
*'''Reverse''': module will move reverse, towards the left (if not already moving reverse) at a constant speed
*'''Accelerate''': module will increase speed (by decreasing the delay between clock pulses of the bipolar stepper motor by 1 ms)
*'''Slow''': module will decrease speed (by increasing the delay between clock pulses of the bipolar stepper motor by 1 ms)

'''Sensing Control'''


*'''Calibrate''': returns the emitter/sensor module to the zero position. Unless it is in the middle of calculating and plotting, the module will immediately head in the reverse direction until it hits the limit switch and then it will go forward 200 steps so that the limit switch is completely released. All of our tests have been designed and analyzed according to and starting from this zero position. Once the Calibrate button is pushed, this process cannot be stopped unless someone flips the PIC power switch or the +12V/-12V power switch, etc.
*'''Calibrate''': returns the emitter/sensor module to the zero position. Unless it is in the middle of calculating and plotting, the module will immediately head in the reverse direction until it hits the limit switch and then it will go forward 200 steps so that the limit switch is completely released. All of our tests have been designed and analyzed according to and starting from this zero position. Once the Calibrate button is pushed, this process cannot be stopped unless someone flips the PIC power switch or the +12V/-12V power switch, etc.
Line 55: Line 65:


The Object Identification routine is performed automatically when "Data Acquisition" and "Activate" are pressed in sequence. Once the module has stopped moving and all 19 magnitude and phase bode plot points have been calculated and plotted, the program will compare the bode plot with library of bode plots of different object type in which the object was directly underneath the sensor and display the object index of the object with the closest matching bode plot for magnitude and phase in the space between the buttons. Thus, the program will try to identify whatever is underneath the sensor at its current position after each calculation and plotting routine (each time it has moved and stopped).
The Object Identification routine is performed automatically when "Data Acquisition" and "Activate" are pressed in sequence. Once the module has stopped moving and all 19 magnitude and phase bode plot points have been calculated and plotted, the program will compare the bode plot with library of bode plots of different object type in which the object was directly underneath the sensor and display the object index of the object with the closest matching bode plot for magnitude and phase in the space between the buttons. Thus, the program will try to identify whatever is underneath the sensor at its current position after each calculation and plotting routine (each time it has moved and stopped).

'''Linear Actuator Control'''

Note: for these buttons to have any effect, the "Activate" button needs to be pressed before these buttons
*'''Forward''': module will move forward, towards the right (if not already moving forward) at a constant speed
*'''Reverse''': module will move reverse, towards the left (if not already moving reverse) at a constant speed
*'''Accelerate''': module will increase speed (by decreasing the delay between clock pulses of the bipolar stepper motor by 1 ms)
*'''Slow''': module will decrease speed (by increasing the delay between clock pulses of the bipolar stepper motor by 1 ms)


===Code===
===Code===

Revision as of 12:41, 16 March 2010

Introduction

INSERT INTRO

Team

  • Tod Reynolds
  • Pill Gun Park
  • Joshua Peng

INSERT TEAM PIC

Concept Overview

Mechanical Design

Electrosense Water Tank - Mechanical Design

Linear Actuator - Mechanical Design

Electrical Design

Bipolar Stepper Motor Circuit - Electrical Design

Signal Generation Circuit - Electrical Design

Signal Amplification/Level Shifting Circuit - Electrical Design

Code

PIC Code

Processing Code

The Processing code will display a window on the computer monitor that allows the user to control the motion of the linear actuator and sensor, run through a single routine of calculation and plotting, and run through full object identification and object detection routines.

INSERT PIC OF WINDOW

Buttons

Linear Actuator Control

Note: for these buttons to have any effect, the "Activate" button needs to be pressed before these buttons

  • Pause: board will stop moving (if it was already moving)
  • Forward: module will move forward, towards the right (if not already moving forward) at a constant speed
  • Reverse: module will move reverse, towards the left (if not already moving reverse) at a constant speed
  • Accelerate: module will increase speed (by decreasing the delay between clock pulses of the bipolar stepper motor by 1 ms)
  • Slow: module will decrease speed (by increasing the delay between clock pulses of the bipolar stepper motor by 1 ms)

Sensing Control

  • Calibrate: returns the emitter/sensor module to the zero position. Unless it is in the middle of calculating and plotting, the module will immediately head in the reverse direction until it hits the limit switch and then it will go forward 200 steps so that the limit switch is completely released. All of our tests have been designed and analyzed according to and starting from this zero position. Once the Calibrate button is pushed, this process cannot be stopped unless someone flips the PIC power switch or the +12V/-12V power switch, etc.
  • Activate: activates the linear actuator so that the module can move
  • Data Acquisition: activates calculation and plotting (runs the Object Detection routine)
  • Calculate/Plot: runs through a single routine of calculation and plotting, the module will not move after the bode plots are generated.

Object Detection

In order to run the Object Detection routine, you must press the "Data Acquisition" and "Activate" in sequence.

"Data Acquisition" should be pressed first and "Activate" after. The module will then perform calculations and plotting at its current position, then move a halfinch forward, and then repeat this process until it hits the limit switch at the end.

If you press "Activate" first, then "Data Acquisition" after, the module will move a halfinch forward from its current position, perform calculations and plotting after it stops, and then it will repeat this process until it hits the limit switch at the end. In this case, the step and measurements in the text file output will be off by 1 index.

Object Identification

The Object Identification routine is performed automatically when "Data Acquisition" and "Activate" are pressed in sequence. Once the module has stopped moving and all 19 magnitude and phase bode plot points have been calculated and plotted, the program will compare the bode plot with library of bode plots of different object type in which the object was directly underneath the sensor and display the object index of the object with the closest matching bode plot for magnitude and phase in the space between the buttons. Thus, the program will try to identify whatever is underneath the sensor at its current position after each calculation and plotting routine (each time it has moved and stopped).

Code

Processing Window Functions

  • Plot the emitted and sensed sinusoidal voltage signals - in the top left quadrant, these signals are plotted with horizontal guidelines that hit the maximum peak of the waves which also display the amplitude (mapped analog voltage values) so that you can visually compare and calculate the magnitude just by analyzing this plot. These signals also have vertical guidelines that hit the vertical mid point of both waves so that you can check the phase shift between the emitted and sensed waves. The amplitude difference and phase shift is displayed in the top corners of the plot.
  • Plot the FFT Magnitude - the whole magnitude spectrum of the FFT of the emitted and sensed wave is plotted in the middle left quadrant. There are vertical guidelines showing the frequency at the peak for both the emitted and sensed wave and what it should be (the frequency of waves we are sending out of the AD9833 function generator chip). If the transfer function from the input (emitted wave) to the output (sensed wave) is linear, then there should only be a single peak in this plot.
  • Plot the FFT Phase - the whole phase spectrum of the FFT of the emitted and sensed wave is plotted in the bottom left quadrant. The same vertical guidelines used in the FFT Magnitude plot are used here.
  • Plot the Magnitude and Phase Bode Plots - an experimental magnitude and phase bode plot is plotted at 19 frequencies between 100Hz and 10kHz
  • Display Object Type and Object Location - assuming that the sensor passes an object as it moves forward and runs through routines, program will run through an algorithm to determine where the object is according to the hashes on the back and what the object type is according to a bode plot library
  • Debug space - You can uncomment some portions of our code to display the values of arrays and variables on the empty right side of the window. Currently, for a few seconds after a calculation and plotting routine (until the module finishes moving a halfinch), the program will display the 19 magnitude and phase points of the bode plot. It current also continuously displays many of the variables used in the calc() function.

Test Results and Analysis