Group 8 - UCF EECS

Download Report

Transcript Group 8 - UCF EECS

Group 8
Matt McNealy (EE)
Scott Martin (EE)
Andrew Lee (CpE)
Josh Hamby (EE)

To design and implement a device that will allow
weight lifters to monitor and track their progress
electronically.
 To build a sensor system that:
 Measures the electric potential generated by certain
muscle groups.
 Detects the angle of body part being exercised.

To learn about wireless technology, medical
devices and programming microcontrollers.
 To find points of over exertion in any particular
exercise and improve on underworked muscle
groups.
Scott
 Sensor circuit:
Parts acquired
and researched:
 Operating
time: 3 hours.
Microcontroller programming
 Operating voltage: 2.8-3.7V
Control Unit Design
 Powered by polymer lithium

Control module:



ion battery
Documentation
 Dimensions: 2.1” x 2.3”
Prototyping 
 Measure S-EMG ranging from
Budget 
0.02-5mV.
Research & Design
 Capability of measuring a full

Parts acquired
researched:
360and
degree
range of motion in
Wireless interface
three dimensions.
microSD

 interface
Communicate with the control
module up to 3 meters.
 Must secure to the body via

velcro strap.
Andrew
Matt
Parts acquired
and researched:
Operating
time: 3 hours.
Power system
Operating voltage: 3.3V
Filters
Powered by a 9V lithium
battery.
Dimensions: 3” x 2.6”
Wirelessly receive data from
the sensor circuit.
Automatically
countand researched:
Parts acquired
repetitions PCB
and design
sets. and assembly
EMG detection
Display data on the LCD
Accelerometer
screen.
Write data to a micro-SD card.
Josh

Sensor circuit:
 Operating time: 6.5 hours.
 Operating voltage: 3.7V
 Powered by polymer lithium





ion battery
Dimensions: 2.1” x 2.3”
Measure S-EMG ranging from
0.02-5mV.
Capability of measuring a full
360 degree range of motion in
three dimensions.
Communicate with the control
module up to 15 meters.
Must secure to the body via
Velcro strap.

Control module:








Operating time: 34 hours.
Operating voltage: 3.3V
Powered by a 9V lithium
battery.
Dimensions: 3” x 2.6”
Wirelessly receive data from
the sensor circuit.
Automatically count
repetitions and sets.
Display data on the LCD
screen.
Write data to a micro-SD card.

Processing of the signal enables the user to
maximize their workout experience.
Amplifier:
Gain of 1000+
 High CMRR >95 db for frequencies 10 – 500 Hz
 Input impedance = 10 x electrode impedance

Skin Preparation:
Cleaned and freed of dry skin cells
 Centered on the belly of the muscle
 2 Electrodes 2 cm center to center


INA122P-ND
 Voltage supply: 2.2 – 36
VDC
 Supply current: 60 - 85
μA
 CMRR: 83 - 96 db
 Gain: 1-10000
 Input impedance: 10^10
ohm
 Digikey: $5.56

AD626AN-ND
 Voltage supply: 2.4 - 10
VDC
 Supply current: 230 - 290
μA
 CMRR: 66 - 90 db
 Gain: 1-100
 Input impedance:
200 k ohm
 Digikey: $7.46

MMA7260Q :
 Power supply:
○ 2.2 - 3.7 VDC
○ 500 - 800 μA
 Selectable sensitivity:
○ 1.5g = 800 mV/g
○ 2g = 600 mV/g
○ 4g = 300 mV/g
○ 6g = 200 mV/g
 Sleep mode option
 Sparkfun: $19.95






8 bit MCU running at 16 MHZ with XTAL
Serial Communication via UART, I2C, SPI
6 channel 10 bit Analog to Digital Converter
3 Timers, 6 PWM channels
Free C Compiler and Development Tools
$4.30 @ Digikey

The clock must be at a specific frequency in
order to set the correct sampling rate to sample
data from the EMG sensor. The clock value was
chosen to ensure the highest sampling
resolution possible that the Atmega 328 can
support.


AVR Studio is an Integrated Development Environment for
writing, compiling, simulating, and debugging
AVRDUDE is an open source utility to
download/upload/manipulate the ROM and EEPROM


AVRlibc is the Standard C Library for AVR
microcontrollers and provides basic
functions like printf, stdio calls, math
functions, plus some AVR-specific functions
AVRLib provides functions for conventional
tasks such as writing to LCD’s and SD cards
and reading from buttons and encoders
Sensor Software Block Diagram

The software on
the sensor is a
while() loop that
continuously
samples the
voltages on the
accelerometer
and EMG sensor
input pins



Using highest possible Sampling Frequency
125kHz
Approximate resolution is 4.9 mV
The free running mode allows the control
unit to continuously update the voltage
received off the sensor and provide the user
with a measurable output of intensity.
USART Functions
FILE usart_stream = FDEV_SETUP_STREAM(usart_putchar,
usart_getchar, _FDEV_SETUP_RW);
 This sets up the stream object that avr-libc uses for standard i/o.
void usart_init(unsigned int baud)
 This function enables the receiver and transmitter, sets the frame
format, and sets standard i/o to use the USART stream.
int usart_putchar(char c, FILE *stream)
 This function puts character to send into the USART i/o data
register and handles converting the newline character.
int usart_getchar(FILE *stream)
 This function waits for the receive complete bit to be set in the
USART control register then gets the charaacter out of the data
register.
General Software Block Diagram:
Control Unit
Starting with the
Main(); block different
functions are called
depending on which
state it is on while
button is pressed.
State 1 calls
free_mode();
State 2 calls
free_mode(); with
saving enabled.
State 3 calls credits();
Control Unit Software Block Diagram

The main menu items are part of a state machine which call
the functions free_mode(save_flag) and credits when the
button is pressed while in a specific state. The save_flag
determines whether or not createfile(fileName, file) gets called.





3 Terminal Device to get sequential input
2 bit grey code provides 4 states for MCU to read
MCU must keep track of previous state.
Debouncing via software delays or hardware LPF’s
Triggering via Interrupts or Polling






LCD Logic - 3.3V @ 2-3mA
LED Backlight - 7V @ 40-50mA (very bright)
Full 4,096 Color Display
Uses the Epson S1D15G10 or Philips PCF8833 Controller
Active Display Dimensions: 1.2"x1.2”
Two-wire serial SPI interface (clock and data)
LCD Functions
void LCDSend9Bit(int data);
Breaks the 9th bit out into this special case so that we can use only 8bit variables in the main loop
 static void LCDInitIO()
Sets up the data direction port and turns on inputs and outputs
 void LCDInitController()
This function configures the Epson LCD controller
 void LCDClearScreen(int color)
This function blanks the screen.
 void drawString(char *s, int fg, int bg, int x, int y)
This function allows the writing of text to the screen with control over
the string to write, foreground and background color, pixel position
in the x and y directions


Specifications
 Operating voltage: 2.8–13 VDC
 Supply current: 14-17 mA
 Transmit frequency range:
 902.62-927.62 MHZ
 Data rate: 100-56,000 bps
 Operating temperature range:
 -30 to 85C
 SIP Style Price: $29.45 from Digikey
 Part #: TXM-900-HP3-PPO-ND
 SMD Style Price: $29.45 from Digikey
 Part #: TXM-900-HP3SPO-ND

Specifications
 Operating voltage: 2.8–13 VDC
 Supply current: 16-21 mA
 Receive frequency range:
 902.62-927.62 MHZ
 Data rate: 100-56,000 bps
 Operating temperature range:
 -30 to 85C
 SIP Style Price: $43.40 from Digikey

Part #: RXM-900-HP3-PPO_-ND
 SMD Style Price: $39.22 from Digikey

Part #: RXM-900-HP3-SPO-ND
Antenna

JJB Series

 The Electrical
Specifications:
SP Series “The
Splatch”

○ Center Freq. 916MHz
The Electrical
Specifications:
○ Bandwidth 30MHz

○ Wavelength 1/4-wave


○ Impedance 50 ohms

○ Connection Direct solder
Model: ANT-916JJB-xx
Price: $1.96 from
Digikey

Center Freq. 916MHz
Bandwidth 30MHz
Wavelength 1/4-wave
Impedance 50 ohms
Connection Surface-mount
Model: ANT-916-SP
Price: $2.08 from Digikey
Layout of Parts
Sensor Unit

Data from the
accelerometer and
sensor units are
fed into the
ATmega328p
MCU.
This data is
streamed to the
control unit via
transmitter at
9600bps.
DATA

DATA
DATA
DATA
Layout of Parts
Control Unit


Data will be received
by the receiver and
fed into the
ATmega328p MCU.
Data is then saved to
the SD card in the
FAT32 file system
architecture. It will
become a CSV file.
(Comma-separated
values)
Splatch
1 2 3 4 5 6
DATA
On/
Off
19
20
21HP3
22RXM
23 900
24
25
26
27
LP8345
Nokia
Display
28
29
30
31
32
33
34
35
36
29
18
9V
10nF
1uF
4
6
20
7
8
22pF
Atmel
Atmega
328
22pF
5
3
21

The SD card can now
be removed from the
device and read on a
computer .
ISP
Prog
23
24
25
26
27
28
19
22
30
31
32
1
2
9
10
11
12
13
14
15
16
17
330
330
DATA
330
330
Reset
330
Rot
Enc
Reset
330
330
1
2
3
4
uSD
5
Socket
6
7
8
CD1
CD2
D1
D2
SD CARD MODULE
For our data logging we based our
design off of CC Dharmani’s “SD
Card Interfacing with ATmega 8/32
(FAT32 implementation)” project.
The circuit design was carefully
adapted to work with our
Atmega328p.
A standard SD card adapter was used
in testing and prototyping.
We used his method of creating a
FAT32 file.
More info at:
http://www.dharmanitech.com/2009/0
1/sd-card-interfacing-with-atmega8fat32.html
SD MODULE cont..
This schematic
shows the
integration of
the SD card
module into our
design.
The SD card
module
requires 3.33.6v in order to
write data to the
micro SD card.
SD Functions




Void createFile(unsigned char *fileName,
unsigned char file[512]);
 Creates a file in FAT32 format in the root
directory.
Unsigned char readFile(unsigned char flag,
unsigned char *fileName);
 Determines if filename is valid and returns a
flag.
Unsigned char convertFileName(unsigned char
*fileName );
 Converts filename into FAT format.
Unsigned long searchNextFreeCluster(unsigned
long startCluster);
 Searches for the next free cluster in the root
directory.
Simulator

We initially wanted to
implement a simulator which
would display various
information of each workout
saved on the SD card.

Due to unforeseen
programming issues with the
control unit and lack of time we
unable to implement more than
one exercise.

We have left it up to the user to
take the data stored on the SD
card and use it at their
discretion.
CSV file
The CSV file saved on the SD card can be
opened and read.
 The SD card will contain from each
workout:

○
○
○
○
X-axis
# of repetitions
Z-axis
EMG signal
 Format: 126,0,200,5,
125,0,201,5,
....................
 Used to keep track of the effectiveness of the
user’s workouts.
CSV file (Excel)
It is up to the user how he/she would like to
use the data. For example, the CSV file
can be easily opened using Excel and a
graph can be made using the values
stored.
The columns are the X-Axis, Repetitions,
Z-Axis and EMG signals respectively.
300
250
200
Series1
Series2
150
Series3
Series4
100
50
0
1
Opening the CSV file in Excel
3
5
7
9
11
13
15
17
19
21
Graphing the data in Excel

Requirements
 Generate sufficient electricity to keep the unit running for 3
hours.
 Environmentally friendly
 Length of charge
 Determining factors: Availability, capacity, & size

Operating Voltages
 (1) MMA7260Q – 3.7
 (1) Atmel ATmega328 – 3.7V
 (1) TXM-900-HP3 – 3.7V
 (2) INA122 Instrumentation amplifier
– 3.7V
 Total Power Consumed: 370mW
 CR2032 3V lithium button cell
battery was used initially, but the
accelerometer did not function
properly due to a dropout voltage
across the battery of 500mV.
Minimum voltage for the
accelerometer is 2.7V
 Capacity: 225mAh. Radius=20mm
,height=3mm
Device
Power
Consumption
(mW)
MMA7260Q
Accelerometer
1.8
ATmega328
0.9
INA122
0.3
TXM-900-HP3
39.2
 Powered by a rechargeable
3.7V lithium-ion battery.
 Has a capacity of 650mAh.
 Running time of 6+ hours
before needing a charge.

Operating Voltages
 (1) Nokia display – 3.3V
Device
Power
Consumption
(mW)
uSD
3
ATmega328
0.9
RXM-900
15
Nokia
LCD
900
 (1) Atmel ATmega328 – 3.3V
 (1) RXM-900-HP3 – 3.3V
 (1) uSD – 3.3V
 Demands 340mA
 Total power consumption of 1.112 W
 Powered by the Ultra life 9V battery
 Chemistry: Lithium
 Capacity: 1.2 A*h
 Can run the module for 4 hours before
replacement is needed.
Testing For EMG Signals

Obstacles:
 Noise from lab equipment
(60Hz hum)
 Used a 9V battery to
power the circuit
 Noise artifacts from
movement of body, RF, and
cables
 Active filters may enable
more accurate readings
but it was decided to use
passive filters for RF and
rely on the difference
amplifier to discard noise
from the body.
Testing The MMA7260Q
X-axis = vertical
Z-axis = horizontal
X-axis = horizontal
Z-axis = vertical
Testing – Hardware Design Sensor / Digital
The FT232RL serial to USB converter was used to
monitor values being sampled by the MCU by
displaying them on a PC in a terminal window.
 The accelerometer pins for SLEEP, GS1 and GS2
were wired to Vcc, GND and GND during testing
but were moved to the pins PB0, PB1 and PB2 to
offer additional configuration flexibility.
 8 bits of resolution on the ADC pins connected to
the accelerometer and to the EMG sensor
provided 0 - 255 values between GND and VCC. It
was unnecessary to use 10 bits.

Testing – Hardware Design Control Unit




The FT232RL serial to USB converter was used to
monitor values being transmitted from the sensor
to the control unit MCU .
The SPI interface from the MCU to the LCD had to
run at 3.3V, wouldn’t work at 5V.
Wireless reception improved from a few feet to 60
ft once the design was moved from a breadboard
to the PCB with ground plane.
MicroSD circuit worked well without modifications
Testing the Control Unit

Andrew
troubleshooting
the microSD
circuit.
Testing/Implementation – Software Design
Sensor

The sensor software is implemented as designed;
a loop samples the voltages on the sensor input
pins and then those values are put into a
datastream which is transmitted to the control unit
microcontroller.

Troubles with processing the serial data on the
control unit were solved by adding some
“padding”, or unused characters to the data
stream.
Testing/Implemtation – Software Design
Control Unit



The various functions for controlling the LCD and
writing to the microSD card worked well
independently as designed.
The algorithm for reading off the encoder inputs
has room for improvement, does not always
record correct state for unknown reasons.
The implementation we used to transfer data to
the control unit caused issues related to timing
which were difficult to track down. These issues
interfered with the LCD drawing functions and
required us to scale back the UI.
Implemented User Interface Block Diagram

The UI is
implemented
using a state
machine
with each of
the display
screens
being a
different
state.
Possible improvements






Use a buffer to store the data packets on the
sensor side so that a more modular design can be
used on the control unit side.
Create a better method of data logging.
Reduce power consumption.
Reduce size of circuits.
Utilize internal memory and USB interface.
Implement a heart rate monitor.
Budgeting
Fully funded
by the V.A.
 Contributions
by SignTek.


Questions?