Вы находитесь на странице: 1из 14

myFIGHT!

The myFight! is the ultimate interactive martial arts training device. Combining traditional punching bag
training equipment and state of the art embedded data acquisition hardware from National Instruments
the myFIGHT is a revolutionary system that can take your fitness and skills to the next level.

Required Hardware
Item PT# QTY
FSR 408- Long Strip SEN-09674 7
FSR 402- Circular RB-Int-02 3
ST22-100GN Stranded Wire 1615487 2
OpAmp (LM358N) LM358N 5
20K Ohm Resistors 10
Green LED COM-09592 11
Red LED COM-09590 3

1
Contents
Required Hardware 1

Introduction 3

myFIGHT Concept 3

Using myFIGHT. 3

Getting Started . 3

Required Software 3

Required Hardware. 3

Hardware 4

NI-myRIO4

Required Hardware&Electronics..4

Circuit Design 5

Sensor Setup. 8

Software . 8

myFIGHT Real-Time Host. 9

FPGA Interface ..10

Windows Host.11

Software Setup..12

Running myFIGHT..13

References....14

2
Introduction

myFIGHT Concept
The myFIGHT employees LEDs located adjacent to force sensing resistor targets. When the LED lights up
the user has an allotted amount of time, based on the difficulty level, to hit the appropriate target to
score a hit. If the user does not hit the target within the time limit the target will time out and he/she
will get a miss indicator. The myRIO reads the target sensors through the FPGA for fast data acquisition
and response. The myRIO then reads and writes data to the real time system on the myRIO for
processing and data transmission to the Windows Host. The Windows host runs the games user
interface which allows the player to select game mode, difficulty, number of targets, and shows the
results at the end of the session.

The design is intended to provide a fun method of training ones speed and reaction time while getting a
great working out in the process.

Using myFIGHT
Getting Started
The myFIGHT can be added to any punching bag or punching surface.

Required Software
LabVIEW 2013 or later and:
o LabVIEW Real-Time Module
o LabVIEW FPGA Module
o Xilinx Compile Toolkit
Or LabVIEW Student Edition 2013(includes the above)
NI-RIO Device Drivers

Required Hardware
myRIO
Force Sensing Resistor 408- Long Strips
Force Sensing Resistor 402- Circular Strips
ST22-100GN Stranded Wire
OpAmp (LM358N)
20K Ohm Resistors
Green and Red LEDS

3
Hardware

NI myRIO

Figure 1: NI-myRIO

The NI myRIO is a low-cost embedded device that utilizes LabIVEW to integrate Real-time and FPGA
programming. The myRIO has built in Wi-fi for programming and communications. The device also can
be programmed and communicate with host computers through USB.

The NI myRIO provides 8 Single Ended Analog Input(AI) 8 , 2 Differential Analog Inputs(AI), 6 Analog
Outputs (AO), DAC resolution of 12 bits, and 40 Digital I/O (DIO) lines. It also has audio inputs, 5V LVTTL
input, and 3.3 V LVTTL Output. The system also runs a Real-Time operating system and gives the user
access to the built in FPGA.

Required Hardware & Electronics


The first necessary component would be the punching/kicking bag. Any bag that is used for training
purposes can be converted into a myFIGHT. The electronic components that are needed for the targets
are the force sensing resistor (FSR) strips and circular pads, Operation Amplification Circuit, and the
myRIO. A FSR sensor is a made of a conducting material whose resistance changes when a force is
applied. The FSRs will be placed in a target pattern and when hit will return analog voltages to the
Digital Input ports of the myRIO.

4
Figure 2: Cross Section of the Circular and Strip Force Sensing Resistors.

Circuit Design
The circuit for acquiring a hit located below in figure 3 utilizes the LM358N Operation Amplifier, a 20k
Ohm Resistor, and the FSR.

Figure 3: FSR Circuit and Force vs Vout Graph

Figure 4: LM358N Operational Amplifier Pin-out

In figure 3 we can see when force is applied to the FSR the voltage increases based on the
resistor values given. For the purpose of this experiment midrange sensitivity was selected. The user
wants to have a light hit register but you do not want the material attaching the device to the bag to
trigger the FSR line. The FSR acts as a force switch which will be read by the myRIOs Digital Input Lines.

5
The FSR in its non-depressed state will have an infinite resistance and limit the voltage output from the
circuit. When the FSR is depressed its resistance will reflect the values in Figure 5. The output of the
OpAmp is fed into the myRIOs Digital Input lines. As long as the voltage is below 2.2Vs the line will not
read a hit.

Figure 5: Force vs Resistance Value of the FSR

The voltage response of the FSRs when struck are given by the following equation.

Figure 6: Voltage Response of FSR Circuit

Figure 7: OpAmp Circuit for FSR input

Rm = Resistance of the resistor RFSR = Resistance of the FSR V+ = 5 volt supply

6
When the FSR and Rm are located as in Figure 4 the voltage out will increase as pressure is applied. If
one were to switch the positioning of the resistors the voltage would decrease as pressure is applied.

Figure 7: Circuit Diagram of Connector B

The wiring diagram in Figure 7 shows how each of the FSRs are fed into Connector B on the myRIO. Each
of the sensors are connected to the 5 V Vcc line. The outputs of each of the circuits are fed into their
corresponding Digital Input lines and read into the FPGA of the myRIO.

Figure 8: Connector A LED Wiring Diagram

7
Connector A supplies the myRIO access to most of the LEDs which will control the user visual cues as to
which target to hit. The LEDs are connected to the Digital Outputs of the myRIO.

Sensor Setup
In order to create multiple targets and minimize the amount of sensors needed we overlaid multiple FSR
strips. In figure 9 the red sections indicate FSR sensors. The green circles show the locations of the LEDs
which will indicate to the user which section to hit. Two strip FSRs are attached vertically where a
persons torso would be located. Three separate FSRs are attached horizontally making sure to cross
both vertical strips. When the intersection of the FSR strips are hit then both Digital Input lines will
register a high which is then interpreted as a hit for that target.

Figure 9: Sensor and LED Locations

Software
The myFIGHT implements all aspects of the LabVIEW embedded design programming. The myFIGHT
code consists of three modules; the RT host, FPGA hardware interface, and the Windows host. The RT
and Windows host applications are based on the Queued Message Handler architecture and utilize the

8
STM (Simple TCP/IP Messaging) library for two-way network communication. The two modules operate
as follows:

myFIGHT RT Host
This module communicates with both the myRIO FPGA and the Windows host. Its main duties are
network communication and session (a sequence of hits constituting a workout session) generation
and control. This code runs continuously as a startup Real-Time executable. The steps it takes are:

1) Establish a TCP listener and wait for a Windows host to connect from any location.
2) Once a connection has been established, wait for session information (duration, workout type,
combat style, difficulty) to be sent from the host.
3) Generate a pseudo-random sequence of hits and timeouts based on the information sent from
the Windows Host
4) Initialize FPGA and timers
5) Wait for user to tap in to start workout
6) Output commands to FPGA to control FPGA timer and hit zone LEDs
7) Poll FPGA for hit information, calculate timing and accuracy/validity for each hit.
8) Send live session data back to Windows Host
9) Proceed with sequence until number of hits or duration specified has been reached.
10) Finish sequence, send done command to Windows host
11) Restart (back to 1)

Figure 10: RT Host top level block Diagram.

9
Figure 11: RT Host session generation VI

FPGA Hardware Interface:


The FPGA hardware interface code accepts commands from the RT host, controls the LEDs that indicate
where and when to hit the myFIGHT, interprets signals from the force-sensitive resistor sensors, and
maintains the timers used to calculate user hit/reaction time. This code runs continuously with a loop
rate of 40 MHz.

Whenever a user hits a target; the FPGA sends the location to the RT host via a DMA FIFO and updates
the running hit timer. Whether or not this target is appropriate is determined by the RT host; the FPGA
simply reports hits and timing with a high degree of accuracy. The FPGA code does contain basic logic
that correlates hit zones as defined by the RT host into actual sensor lines/signals, as the mapping is
not 1-to-1 (some zones consist of multiple sensors or sensors that overlap other zones.)

The FPGA interface also controls the LEDs that provide visual stimuli for the user. When the RT Host
determines that a hit is valid or a timeout occurs, it sends a command to the FPGA to reset the hit timer
to zero and light the LEDs appropriate for the zone/hit/timeout.

10
Figure 12: FPGA interface block diagram. Contains similar logic for zones 3-8 (not shown)

Windows Host:
The Windows Host is a client application for the RT host and provides an interactive user interface. The
Windows Host communicates with the RT host to send user commands and also interprets and presents
live session data from the RT host. The steps it takes are this:

1) Start, reset UI.


2) Establish connection to RT Host or report that no myFIGHT hardware is available on the
network.
3) Prompt the user to enter their user name (for leader board) and workout preference.
4) Once the user has finalized their selection (Difficulty, style, duration, etc.), send information to
RT host.
5) Receive and interpret live data returned from RT host during workout.
6) Wait for session to finish and RT host to send done command.
7) Report and present workout data (reaction time, hits/misses) to user, update persistent
statistics.

11
8) Log pertinent user data to file
9) Stop.

Figure 13: Windows Host UI

Software Setup
The software setup for the myRIO is simple and the following .

1. Install LabVIEW 2013, LabVIEW Real-Time Module, LabVIEW FPGA Module, and the NI-RIO 2013
Device Drivers.
2. Plug the myRIO into the USB port of the host machine.
3. Launch the myRIO setup configuration to configure the devices IP address.
4. Load Measurement and Automation Explorer.
5. Expand the Remote Systems tab and verify that the device is listed below.
6. Once the IP Address of the system is configured in MAX we are ready to start the application.

12
Running myFIGHT!
The myFIGHT is simple to use.

1) Run the Real-Time Host and then the Windows Host applications
2) Select your game mode and difficulty
3) The myFIGHTs Green LEDs will light up indicating that it is ready for you to Tap In!
4) Tap any target and the game will start
5) When a targets green LED lights up hit the corresponding target before the timeout passes.
6) If the user scores a hit the Green LEDs will flash
7) If the user hits the wrong target or time expires for that target then the red LEDs will light up.
8) At the end of the game the all Green LEDs will stay lit
9) Check the scoreboard and see your results

13
References

Datasheet for Force Sensing Resistors:


http://www.robotshop.com/content/PDF/datasheet-30-81794.pdf

Interlink Electonics 0.5" Circular FSR from Robotshop:


http://www.robotshop.com/interlink-05-circular-fsr-3.html

Interlink FSR Long from Sparkfun:


https://www.sparkfun.com/products/9674

LM358N datasheet:
http://www.ti.com/lit/ds/symlink/lm158-n.pdf

Green LED:
https://www.sparkfun.com/products/9592

RED LED:
https://www.sparkfun.com/products/9590

14