Knee Angle Data Logger

I mentioned in my team’s report that we considered using a quadrature encoder built into a servo motor for recording both speed and direction of the knee, but I decided against it because of its gearbox’s mechanical resistance to what would otherwise be ‘natural movement’. Months after the main project, I decided to design and construct a piece of wearable tech an optionally-wireless knee angle data logger to verify or disprove this assumption, for starters.

_images/fig1.jpg _images/fig2.jpg _images/fig3.jpg

Wearing the knee angle data logger:

_images/20220610_185811-2.jpg

Wearing and testing the knee angle data logger by walking around and quickly flexing the knee at different angles:


It turns out that this likely has less of an effect than initially thought. In contrast, however, the lack of mechanical compliance even with at least some material flexibility, and the heavy rotational inertia of the device about the leg as it sways, are issues. In future work, the latter may be largely solved by making the sizable prototype of its data acquisition electronics more compact and/or offloading it elsewhere along and closer to the leg.


The device consists of the following.

  • An ergonomic fabric cuff/brace that velcro-straps around the leg above, below, and at the knee.

  • An almost-servo motor (with a built-in quadrature encoder) its housing and axle spanning the brace.

  • A microcontroller ‘unit’ (MCU) in part to convert the encoder signals to an updated value of the knee angle.

  • A wireless transceiver to transmit knee angle data to a phone.

  • Two rechargeable LiPo batteries to power the MCU and the transceiver via the MCU.

  • A mini protoboard to connect the previous three electrical parts/components.

_images/kneeAngleDataLogger.png

❶ Generic representation of the servo motor (with a built-in but externally accessible quadrature encoder) its housing and axle (❷) spanning the knee brace.

❸ The servo motor’s ‘six-position’ (6P) proprietary connection or rather, a generic six-pin–header representation thereof.

❹ The pinout of ❸ and ❺ is as follows.

_images/wire_wht.svg

Motor Negative

_images/wire_red.svg

to MCU GND Encoder Ground

_images/wire_ylw.svg

Encoder Channel A

_images/wire_blk.svg

Motor Positive

_images/wire_grn.svg

to MCU 5V0 Encoder Power*

_images/wire_blu.svg

Encoder Channel B

❺ The servo motor’s ‘six-conductor’ (6C) proprietary cable a narrow ribbon cable.

❻ An Arduino MCU.

❼ MCU header pins Digital I/O: (14 total)

  • RX<0 receives via UART from a computer connected via USB OR from the Bluetooth module to the MCU, one communicating device at a time.

  • TX>1 transmits via UART from the MCU to a computer connected via USB AND to the Bluetooth module, at the same time.

  • 2 receives the Encoder Channel B signal.

  • 4 receives the Encoder Channel A signal.

  • 5 is the enable input for transmitting knee angle data versus pausing the ‘transmission loop’.

❽ MCU header pins Power:

  • Vin is the 7–12-V input to the MCU, thereby also to the servo motor’s encoder and the Bluetooth module.

  • GND is the voltage ground.

  • 5V0 is the 5.0-V (operating voltage) supply from the MCU.

  • RESET temporarily ceases running any onboard program upon being shorted to ground.

❾ Power input port (2.1-mm center-positive connector) not in use.

❿ USB (standard B) port optional use with cable (⓫).

⓬ Mini protoboard (no bus strips, 17 rows of terminal strips, 170 tie points).

⓭ Set-length solid-core insulated protoboard wire (⓮ two are uninsulated).

⓯ (Brown) two resistors (1, 2 kΩ).

⓰ DPDT and ⓱ SPST dual in-line package (DIP) switches (see Appendix).

⓲ Two four-pin headers (actually laid flat against the protoboard) for the Bluetooth module and batteries.

⓳ Two pairs of battery leads.

⓴ Bluetooth module.


System Level Block Diagrams and Technical Details


Programming the Microcontroller

image1

• The computer transmits information (a program from the Arduino IDE, in the above case) to the Arduino microcontroller (and vice-versa, albeit little in the above case) via USB.
• “USB-to-UART” is actually part of an IC onboard the microcontroller.
• USB 2 here uses half-duplex (two-way) serial communication and differential signaling.
• UART uses full-duplex (simultaneous two-way) serial communication.
• UART = Universal Asynchronous Receiver-Transmitter communication protocol.

Programming the BLE Module

image2

• The computer transmits information (BLE module configuration AT commands from any serial monitor, in the above case) to the BLE module (and vice-versa) through the microcontroller via USB.
• Again, “USB-to-UART” and “UART-to-USB” are actually parts of an IC onboard the microcontroller. This IC is ‘tied’ to the microcontroller TX and RX pins.
TX transmits via UART from the labeled device.
RX receives via UART from a communicating device.
• *using a voltage divider with a 1-kΩ resistor from 5.0 V to 3.3 V and a 2-kΩ resistor from 3.3 V to ground (microcontroller GND pins).
The logical high voltage levels of the microcontroller and BLE module are around 5.0 V (microcontroller 5V0 pin) and 3.3 V (microcontroller 3V3 pin), respectively.
As such and in this one case, not using a level shifter such as an equivalent voltage divider or transistor equivalent may damage the BLE module.

Logging Knee Angle Data (Default Operation Mode)

image3

• Technically-not-a-servomotor (No built-in feedback control of position or speed.)
Sensor: Optical Rotary Encoder (reference) in quadrature.
• For position feedback or just sensing (in this case).
Encodes direction as well as knee angle increments/decrements (0.5° resolution).
• Transparent disc with two opaque, circular ‘barcodes’ offset from each other by 0.5°.
LEDphotodiode pairs placed across these patterned ‘light-slots’.
• Outputs two digital signals.
Arduino Duemilanove Microcontroller.
• Receives encoder signals on digital pins “A” and “B”.
Decodes knee angle from encoder output.
• Connected to the microcontroller TX and RX pins.
• Android Phone.
• Windows 10 Computer.

Appendix

Switch Position 1

Functionality

Functionality

Switch 6 · ON

Shorts MCU RESET to MCU GND

Resets the MCU (temporarily)

Switch 5 · ON

Shorts 7.4 V to MCU Vin

Powers on the device

Switch 4 · ON

Shorts BLE module GND to MCU GND

Powers on the BLE module thereafter

Switch 3 · OFF

Breaks MCU GND to digital pin 5

Enables knee angle data transmission (default operation mode)

Switch 2 · ON

Shorts the MCU TX to BLE module RX by default

Enables wirelessly transmitting data logging knee angle data

Switch 1 · ON

Shorts the MCU RX to BLE module TX by default

Enables wirelessly receiving data

Switch 0 · C2

Sets the MCU TX/RX to connect to BLE module RX/TX

Enables logging knee angle data (default operation mode)

Switch 0 · C1

Sets the MCU TX/RX to connect to BLE module TX/RX

Enables programming the BLE module

1

Switch 0 is DPDT (double-pole, double-throw). Switches 1–6 are SPST (single-pole, single-throw). (Switches 7–8 are kept closed, 7 as a jumper.)