11. Output devices

Motor Monitor LED

Aims

I have already tried a couple of out put devices like LED and DC motor in the emending programing week. Also I designed a board for driving stepper motors. here is the link. What I want to try this week is to hack an old CD driver from a laptop that I found in the street and take out the motors and activate them. Also I really got into making a close loop system for controllable BlDC motor.


Hack DC

I first start to play with the principle of electro magnetic. I made a DIY DC motor.

Fig01- The needed material

Fig02 - The assembled

Tips: use the thin wire with the

Digging for motors

So couple of month a go one of my friends wants to trash her old laptop. I saved it and took it apart now it is prefect time to take some prat of it for learning purposes.

The cooling system of the laptop has a fan which is a brushless dc motors. I kind of broke it while opening it and fail myself to document the process of dismounting it but you can find out some shoots after it came out.

Then I tried to power it up to see if it is works or not.

after that I saw there are 2 more pins on the board called P and A. I search online but I did not find what they referring too. So I connect them to my Arduino and start plotting the values to make sense out of it.

the above picture is the connected pins for reading those out put

Reading the out put without interruptions

Reading the out put with interruptions

void setup() {
  pinMode(7, OUTPUT);
  pinMode(A0, INPUT);
  Serial.begin(9600);
}
void loop() {
  int p = analogRead(A0);
  if (Serial.available()) {
    Serial.println(p);
  }
  digitalWrite(7, HIGH);
}

I used the following code too

int s = 20;
int d = 20;
void setup() {
  pinMode(7, OUTPUT);
  pinMode(A0, INPUT);
  Serial.begin(9600);

}

void loop() {

  if (s > 255 || s <= 0) {
  d = -d;
  }

  digitalWrite(7, HIGH);
  analogWrite(A0, 1023);
  s = s + d;
}

Then I start digging into a DVD reader of a laptop for its motors. But this time tried to document the process.

this is the DVD reader that I am taking apart

Inside of the DVD reader

As you can see there are 2 motors one in the center and the other in the left side of the first one. It looks the middle one is a brushless motor and next to it is a stepper motor.

After removing the frame and the covers you can see the inner parts.

Then I detach each item one by one

From this device I extract the following Motors

There are couple of interesting project that has been done by this Motors. I wanted to try to replicate one of them. But I realized that the connections on the motors are very small and I do not have such connector.


Group assignments

We Had to measure energy usage of devices. If I had two multimeter I could have done it by measuring the voltage and Current.

P(t) = V(t) * I(t)

As you can see the power consumption in each second fluctuating between 0.228-0.24 watt.

So the energy that it consume during 15 second is equal to average of the energy bounds multiple by 15(duration).

E = Pt
E = ((0.228+0.24)/2) * 15
E = 3.51 (j)

Charlieplexing

The concept is very nice but it sounded a bit complex at firs. I did not get it at first mostly because the circuit was not clear at first. Then I realized that there is not connection between the LEDs and common Grand which made me more confuse. At the end I realized that the flow of the current is the key and how this system take advantage of direction of current in the LEDs.

#define LED_1 5
#define LED_2 6
#define LED_3 7

void setup()
{
  pinMode(LED_1, INPUT);
  pinMode(LED_2, INPUT);
  pinMode(LED_3, INPUT);
}

void loop()
{
  set_pins(LED_1, LED_2);
  delay(300);
  set_pins(LED_2, LED_1);
  delay(300);
  set_pins(LED_3, LED_1);
  delay(300);
  set_pins(LED_1, LED_3);
  delay(300);
  set_pins(LED_2, LED_3);
  delay(300);
  set_pins(LED_3, LED_2);
  delay(300);
}

void set_pins(int high_pin, int low_pin)
{
  reset_pins();
  pinMode(high_pin, OUTPUT);
  pinMode(low_pin, OUTPUT);
  digitalWrite(high_pin, HIGH);
  digitalWrite(low_pin, LOW);
}

void reset_pins()
{
  pinMode(LED_1, INPUT);
  pinMode(LED_2, INPUT);
  pinMode(LED_3, INPUT);
  digitalWrite(LED_1, LOW);
  digitalWrite(LED_2, LOW);
  digitalWrite(LED_3, LOW);
}

Design

After trying it with the Arduino I start the designing a PCB with the Attiny1614. But it did not go well.

Then I compare it by Niels board so I realized main missing the resistors. Also I saw that in that board there is regulator which I am not sure if I need it because I am using different chip. To simplify the process, I switched the chip to Attiny44. After this change I decided to add a external clock with higher speed(20MHz) then internal clock of the Attiny44 (8MHz).

Any way after many corrections with instructors I finally finished the design. turns out that I did not need that regulator. also I realized that it would be the best if I add a capacitor close to the chip in order to reduce the noise.

But later, I decided to add a 5V Zener regulator to clamp the voltage at 5V and power the board with a power supply. Since the board was already double side I put the power management at the back to have cleaner look in front.

production

milling

After exporting the PCB designs. I made production files in mode. In the first try the milling failed because there was problem with the file generated by mod. I am not sure but I think the difference between black and white was not right so it made the traces narrower then it supposed to be. To fix this I had to generate the file and do the conversions again. I started the file by cutting the top traces with end mill 1/64 inch. Then I changed the end mill to 1/32 to do the holes and outer cut. After that I had to carefully remove the cut part of PCB without moving the outer part. In the next step I cleaned up the double side tape from back side and add the tap to the front. the PCB was stocked again back to its place but flipped. I changed the tool to 1/64 inch for last time and run the back part.

Via

After milling the real challenge of this board started. I had to insert 31 via in to the PCB. The via are very small and it is very hard to keep them in place. it took me almost 3 hours to put them all in.

Soldering

Then I start gathering the Components that I have used. I made a shopping list from the Schematic design and start collecting them from inventory.

Soldering the 30 LED was fun. I just worried a bout their direction. So before soldering I had to double check that. Finding the direction of the Attiny44 was quit easy with having the power traces thicker then the other. Also, I solder the back side at the end because the power jack would made the PCB sloppy and the soldering of top part would be much harder.

Programming

I designed this board to be programmed with ISP programmer. But my windows does not like my ISP programmer. After many tries I decided to use Arduino uno as ISP bootloader. I followed this tutorial on how to do this. It was very easy and fast. I first tested it with a simple blink. Then I start to do complex stuff. you can follow up on my progress in my github page.

#define high_pin A0
#define Low_pin A1
void setup() {

  pinMode(high_pin, OUTPUT);
  pinMode(Low_pin, OUTPUT);
}


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

!! the complex stuff is under construction !!

#define pin_1 A0
#define pin_2 A1
#define pin_3 A2
#define pin_4 A3
#define pin_5 A4
#define pin_6 A5


int pins[6] = {pin_1, pin_2, pin_3, pin_4, pin_5, pin_6};
int led_row = 6;

void setup() {
  init_pins();
}

void loop() {
  digitalWrite(pins[0], LOW);
  digitalWrite(pins[1], HIGH);
  digitalWrite(pins[2], HIGH);
  digitalWrite(pins[3], HIGH);
  digitalWrite(pins[4], HIGH);
  digitalWrite(pins[5], HIGH);
  ///////////////////////////

}

void ledLight() {
  //for (int i = 0; i <= led_row; i++) {
  int i = 0;
  int high_pin = pins[i];
  for (int j = 0; j <= led_row; j++) {
    if (i != j) {
      set_pins(high_pin, pins[j]);
      delay(300);
    }
  }
}


void gameOfLife() {
  //deth law => if the number of the neighbores got more then 4
  // born law => if the number of the neighbores are less then 3
  // stay law => if the numbers are equal to 3 or 4 nothing will change
}


void set_pins(int high_pin, int low_pin)
{
  digitalWrite(high_pin, HIGH);
  digitalWrite(low_pin, LOW);
  keep_rest(high_pin);

}

void init_pins()
{
  for (int i = 0; i <= led_row; i++) {
    pinMode(pins[i], OUTPUT);
  }
}


void reset_pins()
{
  for (int i = 0; i < led_row; i++) {
    digitalWrite(pins[i], LOW);
  }
}

void keep_rest(int high_pin) {
  for (int i = 0; i < led_row; i++) {
    if (pins[i] == high_pin) {
      digitalWrite(pins[i], LOW);
    }
  }
}

link to Video

Files

You can find the design and production files in the following links. keep in mind that production had made for SRM-20(RML format). Kicad files Production files

GitHub page


class note

electro magnetic

induction

F= CAnI/l

where C is a proportionality constant, A is the cross-sectional area of the plunger, n is the number of turns in the solenoid, I is the current through the solenoid wire, and l is the length of the solenoid. For units using inches, pounds force, and amperes with long, slender, solenoids, the value of C is around 0.009 to 0.010 psi (maximum pull pounds per square inch of plunger cross-sectional area).

rotor and stator relay

solenoid

SSRs

Mosfat

Diode

Why we have the coil in the power supply? inductor for current LC filtering

PWM

Motors

difference between dc and Stepper Motor

brush

PID control

battery

safety issues

Wire calculation
molex connector

calculation of the power needed