40
THE OPENFES PROJECT 2009 EEE193A – Final Presentation

EEE193A – Final Presentation. Matthew BlanfordTeam Lead / Kernel Drivers / Analog TENS Circuit Kevin StoneDigital Logic / FES Algorithm Dennis DahlquistCourse

Embed Size (px)

Citation preview

Page 1: EEE193A – Final Presentation. Matthew BlanfordTeam Lead / Kernel Drivers / Analog TENS Circuit Kevin StoneDigital Logic / FES Algorithm Dennis DahlquistCourse

THE OPENFES PROJECT 2009EEE193A – Final Presentation

Page 2: EEE193A – Final Presentation. Matthew BlanfordTeam Lead / Kernel Drivers / Analog TENS Circuit Kevin StoneDigital Logic / FES Algorithm Dennis DahlquistCourse

Matthew Blanford Team Lead / Kernel Drivers / Analog TENS Circuit

Kevin Stone Digital Logic / FES Algorithm

Dennis Dahlquist Course Instructor

Dr. Nils A. Hakansson Project Mentor (Support)

Dr. Warren D. Smith Faculty Advisor (Support)

Kris Moyer EEE Contractor (Support)

Kevin Herron GUI Form Design

Tony Rivas Mechanical Engineering

Page 3: EEE193A – Final Presentation. Matthew BlanfordTeam Lead / Kernel Drivers / Analog TENS Circuit Kevin StoneDigital Logic / FES Algorithm Dennis DahlquistCourse

OpenFES Introduction

• FES (Functional Electrical Stimulation) bike• Provides upper and lower body workout for SCI (Spinal Cord Injury) patients• Provides natural (user powered) workout.• FES is a rehabilitation technique where controlled electrical current is used to stimulate nerves in order to evoke muscle contractions against resistance.• Specific waveforms produce maximum muscle efficiency

Page 4: EEE193A – Final Presentation. Matthew BlanfordTeam Lead / Kernel Drivers / Analog TENS Circuit Kevin StoneDigital Logic / FES Algorithm Dennis DahlquistCourse

OpenFES Project Goals

• Modular Design • Firmware based solution to allow for upgradability and testing• FES Algorithm that runs completely in kernel memory space• Complete fabrication of the digitally controllable TENS unit• Careful attention to muscle physiology to allow for maximum efficiency

Page 5: EEE193A – Final Presentation. Matthew BlanfordTeam Lead / Kernel Drivers / Analog TENS Circuit Kevin StoneDigital Logic / FES Algorithm Dennis DahlquistCourse

Personal Goals - Matt Blanford

•Learn DSP programming and PCB fabrication. •Get practical bus communication protocol experience •Hone my kernel driver development skills •Take a product from idea to reality.

Page 6: EEE193A – Final Presentation. Matthew BlanfordTeam Lead / Kernel Drivers / Analog TENS Circuit Kevin StoneDigital Logic / FES Algorithm Dennis DahlquistCourse

Personal Goals – Kevin Stone

• Further my software and hardware skills.• Work as team member to efficiently accomplish a common goal. • Learn how to take a circuit from concept to completed PCB. • Gain experience with embedded system programming and architecture.• Implement complex algorithms in a hardware description language

Page 7: EEE193A – Final Presentation. Matthew BlanfordTeam Lead / Kernel Drivers / Analog TENS Circuit Kevin StoneDigital Logic / FES Algorithm Dennis DahlquistCourse

Task Schedual – Gantt Chart

Page 8: EEE193A – Final Presentation. Matthew BlanfordTeam Lead / Kernel Drivers / Analog TENS Circuit Kevin StoneDigital Logic / FES Algorithm Dennis DahlquistCourse

Recumbent Bike Modifications

Page 9: EEE193A – Final Presentation. Matthew BlanfordTeam Lead / Kernel Drivers / Analog TENS Circuit Kevin StoneDigital Logic / FES Algorithm Dennis DahlquistCourse

Software

Everything produced by OPENFES is free and open source. Anyone is free to use, modify, and sell our designs.

From day one, the OPENFES Project has had a strong web presence. Hosted both on OpenSVN and GoogleCode, the Trac Wiki and SVN repository encourage community involvement and eventually…

Real-world user feedback!

Page 10: EEE193A – Final Presentation. Matthew BlanfordTeam Lead / Kernel Drivers / Analog TENS Circuit Kevin StoneDigital Logic / FES Algorithm Dennis DahlquistCourse

TENS Unit

TENS - Transcutaneous Electrical Nerve Stimulation

Initial research and prototyping was done on an 1-channel analog TENS unit design from Silicon Chip Magazine. Once the concept was proven, we enlisted the help of a contractor to help with design of a 8-channel TENS unit with digitally controlled frequency, duration, and amplitude.

Page 11: EEE193A – Final Presentation. Matthew BlanfordTeam Lead / Kernel Drivers / Analog TENS Circuit Kevin StoneDigital Logic / FES Algorithm Dennis DahlquistCourse

Microcontroller to TENS Unit Block Diagram 1.0

BeagleBoard

SDATA

SCLOCK

TENSUNIT(x0)

TENSUNIT(x1)

TENSUNIT(xF)…

TENS Unit Block Diagram (Digital Side)

TENS MODULE

SDA

SCL

Buscontroller Module address

decoder

a[3:0]

State machinecontroller

enable

p[5:0]

Digital to Analog

Binary SearchAlgorithm

ANALOG

GPIO (1)

GPIO (2)

CurrentFeedback

c[7:0]

Page 12: EEE193A – Final Presentation. Matthew BlanfordTeam Lead / Kernel Drivers / Analog TENS Circuit Kevin StoneDigital Logic / FES Algorithm Dennis DahlquistCourse

Microcontroller to TENS Unit Block Diagram 2.0

Page 13: EEE193A – Final Presentation. Matthew BlanfordTeam Lead / Kernel Drivers / Analog TENS Circuit Kevin StoneDigital Logic / FES Algorithm Dennis DahlquistCourse

Am

plit

ude

Time450μs

33ms

Pulse Waveform (2 consecutive pulses)

Am

plit

ude

Time200-250ms

1 bike rotation

Pulse Train Waveform (cont. next page)

Pulse duration

Pulse frequency (30Hz)

Pulse train duration

I (m

A)

I (m

A)

Page 14: EEE193A – Final Presentation. Matthew BlanfordTeam Lead / Kernel Drivers / Analog TENS Circuit Kevin StoneDigital Logic / FES Algorithm Dennis DahlquistCourse

Pulse Train Waveform

pedal

crank

pulse train start angle

pulse train stop angle

θstart

θstop

Am

plit

ude

Crank Angle

θstart θstop θstart θstop

I (m

A)

Page 15: EEE193A – Final Presentation. Matthew BlanfordTeam Lead / Kernel Drivers / Analog TENS Circuit Kevin StoneDigital Logic / FES Algorithm Dennis DahlquistCourse

Multiple channel stimulation (right side)

0°θgstart=4°

Am

plit

udes

Crank angles

θqstart=308°

θqstop=323°

θhstart=111°

θhstop=170°

θgstart=4° θgstop=72°

Gluteus

Hamstrings

Quadriceps

θgstop=72°

θhstart=111°

θhstop=170°

clockwiserotation

θqstart=308°

θqstop=323°

Page 16: EEE193A – Final Presentation. Matthew BlanfordTeam Lead / Kernel Drivers / Analog TENS Circuit Kevin StoneDigital Logic / FES Algorithm Dennis DahlquistCourse

Design Calculations

Page 17: EEE193A – Final Presentation. Matthew BlanfordTeam Lead / Kernel Drivers / Analog TENS Circuit Kevin StoneDigital Logic / FES Algorithm Dennis DahlquistCourse

Time vs. (Current and RPM)

I (mA

)

Time (s)

RPM

tstart tmaintain thold tend

Imin

startt=

tbd

Imax=

14

0m

A

RPM

min

start=

tbd

RPM

min

en

d=3

5rp

mR

PM

max=

55

rpm

RPM

targ

et

dt

dI

dI/d

t=m

ax c

harg

e ra

te =

tbd

Tstart – Current increases at maximum rate (max charge rate)

Tmaintain – Current is increased (or decreased) in order to maintain target RPM

Thold – Muscle fatigue becomes dominant factor, decreasing RPM

Tend – Minimum stable RPM reached, stimulation should cease

Page 18: EEE193A – Final Presentation. Matthew BlanfordTeam Lead / Kernel Drivers / Analog TENS Circuit Kevin StoneDigital Logic / FES Algorithm Dennis DahlquistCourse

I2C Packet Contents

18 bit length packet

A[3:0] = Address of desired module

P[5:0] = Pulse count (000000 => 0 pulses, 111111 => 31 pulses)

C[7:0] = Current amplitude (00000000 => 0mA), 11111111 => 254mA)

START | A A A A P P P P P P C C C C C C C C | STOP3 2 1 0 5 4 3 2 1 0 7 6 5 4 3 2 1 0

SCL

SDA

S B1 B2 Bn… P

I2C Bus: Microcontroller to Module Communication

Page 19: EEE193A – Final Presentation. Matthew BlanfordTeam Lead / Kernel Drivers / Analog TENS Circuit Kevin StoneDigital Logic / FES Algorithm Dennis DahlquistCourse

Analog 1-Channel TENS 1.0

Page 20: EEE193A – Final Presentation. Matthew BlanfordTeam Lead / Kernel Drivers / Analog TENS Circuit Kevin StoneDigital Logic / FES Algorithm Dennis DahlquistCourse

Analog 1-Channel TENS 2.0

Page 21: EEE193A – Final Presentation. Matthew BlanfordTeam Lead / Kernel Drivers / Analog TENS Circuit Kevin StoneDigital Logic / FES Algorithm Dennis DahlquistCourse

TENS Analog Circuit PCB 3.0

Page 22: EEE193A – Final Presentation. Matthew BlanfordTeam Lead / Kernel Drivers / Analog TENS Circuit Kevin StoneDigital Logic / FES Algorithm Dennis DahlquistCourse

TENS Analog Circuit PCB 4.0

Page 23: EEE193A – Final Presentation. Matthew BlanfordTeam Lead / Kernel Drivers / Analog TENS Circuit Kevin StoneDigital Logic / FES Algorithm Dennis DahlquistCourse

TENS Analog Circuit PCB 4.0

Page 24: EEE193A – Final Presentation. Matthew BlanfordTeam Lead / Kernel Drivers / Analog TENS Circuit Kevin StoneDigital Logic / FES Algorithm Dennis DahlquistCourse

TENS Analog Circuit Schematic 4.0

Page 25: EEE193A – Final Presentation. Matthew BlanfordTeam Lead / Kernel Drivers / Analog TENS Circuit Kevin StoneDigital Logic / FES Algorithm Dennis DahlquistCourse

Atmel AT91Sam9261-ek Dev Kit

Page 26: EEE193A – Final Presentation. Matthew BlanfordTeam Lead / Kernel Drivers / Analog TENS Circuit Kevin StoneDigital Logic / FES Algorithm Dennis DahlquistCourse

Texas Instruments “Beagle Board”

Page 27: EEE193A – Final Presentation. Matthew BlanfordTeam Lead / Kernel Drivers / Analog TENS Circuit Kevin StoneDigital Logic / FES Algorithm Dennis DahlquistCourse
Page 28: EEE193A – Final Presentation. Matthew BlanfordTeam Lead / Kernel Drivers / Analog TENS Circuit Kevin StoneDigital Logic / FES Algorithm Dennis DahlquistCourse

Ångström 2009

Ångström was started by a small group of people who worked on the OpenEmbedded, OpenZaurus and OpenSimpad projects to unify their effort to make a stable and userfriendly distribution for embedded devices like handhelds, set top boxes

…and now FES Equipment!

Page 29: EEE193A – Final Presentation. Matthew BlanfordTeam Lead / Kernel Drivers / Analog TENS Circuit Kevin StoneDigital Logic / FES Algorithm Dennis DahlquistCourse

OpenFES Controller

We have implemented a custom Linux driver that acts as referee between our Quadrature encoder, Touchscreen UI and our custom hardware TENS Unit.

The driver contains three main components: Interrupt logic, character device for UI communication, and I2C interface for sending data to and from the TENS unit across an external bus.

Page 30: EEE193A – Final Presentation. Matthew BlanfordTeam Lead / Kernel Drivers / Analog TENS Circuit Kevin StoneDigital Logic / FES Algorithm Dennis DahlquistCourse

I2C Waveforms from BeagleBoard

Page 31: EEE193A – Final Presentation. Matthew BlanfordTeam Lead / Kernel Drivers / Analog TENS Circuit Kevin StoneDigital Logic / FES Algorithm Dennis DahlquistCourse

Clock Pulsing @566Mhz

Page 32: EEE193A – Final Presentation. Matthew BlanfordTeam Lead / Kernel Drivers / Analog TENS Circuit Kevin StoneDigital Logic / FES Algorithm Dennis DahlquistCourse

Data Acquision

Use General Purpose Input Output to receive, process, and transmit data.

Use a Rotary Encoder to feed the position of the bike crank to the Microcontroller.

Use Microcontroller to send signals to the TENS unit.

Page 33: EEE193A – Final Presentation. Matthew BlanfordTeam Lead / Kernel Drivers / Analog TENS Circuit Kevin StoneDigital Logic / FES Algorithm Dennis DahlquistCourse
Page 34: EEE193A – Final Presentation. Matthew BlanfordTeam Lead / Kernel Drivers / Analog TENS Circuit Kevin StoneDigital Logic / FES Algorithm Dennis DahlquistCourse

Rotary Encoder

AMT102-V

Shaft Size 8 mm to 2 mm

Programmable Resolution Uses Capacitors.

2.5 x 1

Page 35: EEE193A – Final Presentation. Matthew BlanfordTeam Lead / Kernel Drivers / Analog TENS Circuit Kevin StoneDigital Logic / FES Algorithm Dennis DahlquistCourse

Programmable Resolution

Resolution 48 – 2048

48, 96, 100, 125, 192, 200, 250, 256, 384, 400, 500, 512, 800, 1000, 1024, 2048 Pulses Per Revolution.

Page 36: EEE193A – Final Presentation. Matthew BlanfordTeam Lead / Kernel Drivers / Analog TENS Circuit Kevin StoneDigital Logic / FES Algorithm Dennis DahlquistCourse

Encoder Type

Incremental - Channel A and B 90 degrees out of phase

Better Resolution – More accurate position and speed

Simple Grey Code

Reference bit (Z-signal) for positioning.

Page 37: EEE193A – Final Presentation. Matthew BlanfordTeam Lead / Kernel Drivers / Analog TENS Circuit Kevin StoneDigital Logic / FES Algorithm Dennis DahlquistCourse

THE OPENFES PROJECT 2009Solutions to Problems encountered

•Problem: How should we maintain data coherency while trying to calculate crank angle in a heavily multi processed kernel?•Solution: Atomic Operations.

•Problem: How can we communicate with a Java UI from the Linux kernel when the JVM is completely abstracted from our memory map?•Solution: Character devices

•Problem: Time-variant characteristics of analog circuitry cause unwanted fluctuations in electrode output current•Solution: Digital feedback algorithm (Binary Search Tree).

Page 38: EEE193A – Final Presentation. Matthew BlanfordTeam Lead / Kernel Drivers / Analog TENS Circuit Kevin StoneDigital Logic / FES Algorithm Dennis DahlquistCourse

THE OPENFES PROJECT 2009Solutions to Problems encountered

•Problem: How should we maintain data coherency while trying to calculate crank angle in a heavily multi processed kernel?•Solution: Atomic Operations.

•Problem: How can we communicate with a Java UI from the Linux kernel when the JVM is completely abstracted from our memory map?•Solution: Character devices

•Problem: Time-variant characteristics of analog circuitry cause unwanted fluctuations in electrode output current•Solution: Digital feedback algorithm (Binary Search Tree).

Page 39: EEE193A – Final Presentation. Matthew BlanfordTeam Lead / Kernel Drivers / Analog TENS Circuit Kevin StoneDigital Logic / FES Algorithm Dennis DahlquistCourse

THE OPENFES PROJECT 2009Current problems or concerns

•Problem: How can we develop functionally relevant performance benchmarks.•Problem: Reliable QE Decoding•Problem: How should we secure the character device that governs the operation of our TENS unit?

Page 40: EEE193A – Final Presentation. Matthew BlanfordTeam Lead / Kernel Drivers / Analog TENS Circuit Kevin StoneDigital Logic / FES Algorithm Dennis DahlquistCourse

THE OPENFES PROJECT 2009Questions from the class…

How did you get started with GPIO interrupts?

Why did we use multiple CPLDs?