The aim of this week assignment is to add an output device to a microcontroller board I've designed and program it to do something. The group assignment is to measure the power consumption of an output device.

Assignment content:

Softwares used:

Machines used:

  • Milling machine - Roland SRM-20.

Datasheets:

Resources:


12.1. Group assignment:

The group assignment of this week is to measure the power consumption of an output device. Documentation of the group assignment is available on the group assignment page.

Click here to enter the group assignment page.


12.2. Individual assignment:

I have used Vibrating Mini Motor as an ouput device for my final project, which is a "wearable Knee monitoring device". The operating voltage range of the vibrating motor used is 2.5-3.8V. The higher voltages result in a stronger vibration. Refer to the following table for the vibrating motor specifications:

NoSpecificationValue
1Rated voltageDC 3.0V
2Operating voltage2.5-3.8V
3Dimension10mm diameter
45V current draw100mA
54V current draw80mA

As explained in the final project page, the vibrating motor will be mounted on a small board that designed to be connected to the micro-contoller board using an ISP cable. For design details and fabrication process of this PCB, refer to my Final Project >> Circuit design >> Shank circuit.

Based on the micro-contoller circuit routing, the vibratating motor pin is connected to pin 11 of the ATtiny84, which is "PA2 (ADC2)".

motor_pin

ATtiny84 pinout: attiny84

Final Circuit from different views: Vibrating_Motor

Connection:

This PCB is connected to the micro-contoller circuit (ATtiny84) using an ISP cable. The micro-contoller circuit is then connected to Arduino UNO for the purpose of programming using "Arduino as ISP"; refer to week 15 point (15.2.1.2.) for connection. "Tx" and "Rx" pins of ATtiny84 board and Arduino UNO are connected to each other in order to communicate the data between the ATtiny84 micro-contoller board and the computer. However, remember to remove the "Tx" and "Rx" connection while programming. Arduino UNO is connected to the computer using USB cable. Connection is as shown in the following image:

circuit_connection

Since the ISP header pins between the two circuits are not in the same order, therefore I have changed some of the wires places from the output circuit (shank circuit) side to fit with the micro-controller (thigh circuit) connector order. The following image shows the ISP header pins of both circuits and mentions the colors of the wires as well.

ISP

Test code:

As a first step, the vibrating motor will be programmed to vibrate every second as an indication and feedback for the user that the system is running.

const int motorPin = 2;

void setup()
{
   pinMode(motorPin, OUTPUT);
}

void loop()
{
   digitalWrite(motorPin, HIGH);
   delay(1000);
   digitalWrite(motorPin, LOW);
   delay(1000);
}

Video of the operating system:

Vibration patterns:

The second code was used for my final project as an alarm to inform the user to stop bending his/her leg more when it reachs 140 degree. It vibrates in a pattern of maximum PWM (255) and minimum (0) with a delay of 100 mSec. "knee_angle" is the measured range of movement based on the measrments by the Inertial Measurement Units (IMUs) - MPU6050 placed on the thigh and the shank. You can refer to the MPU6050 code from week 10, point 10.2.3.

if (knee_angle > 140)
   {  
      analogWrite(motorPin, 255);
      delay(100);
      analogWrite(motorPin, 0);
      delay(100);
   }

Video of the operating system:


⤧  Next post 13. Interface and Application Programming ⤧  Previous post 11. Applications and Implications