# Week12 : Output Devices

For power consumption measurement of cartridge heater:
group page

Eagle

Image

Program

Driver circuit

Motor

Power supply

## Mechanism of bipolar stepping motors

Basically bipolar stepping motors have two coils inside. They can rotate by switching current in order: A>C, D>B, C>A and B>D.

What enable to do that is H-bridge circuit which is illustrated as below.

You can flip the direction of current by simply selecting which transistor (or FET) to open.

Since stepping motors have two coils, you need two H-bridges to drive them.

## Look into the sample board

What you see in Neil’s sample board.
board

• IC3 and IC4 (A4953) are the H-bridges.

• C2 to C4 are added in order to stabilize power source. (hey are specified in A4953 data sheet)

• IC2 is a regulator that drops 12V power supply from J2 to 5V for Attiny44.

• J3 goes to the motor.

## Design my own board

Traced Neil’s sample board.

## Wire up motor correctly

Refer to data sheet of stepping motor and check which two lines are from the same coil.

Looking at Neil’s sample program, I guessed __A2 = A- = PA0 (goes to C : green line in the diagram), A1 = A+ = PA1 (goes to A : red line), B2 = B- = PA3 (goes to B : yellow) and B1 = B+ = PA4 (goes to D : blue) __.
hello.stepper.bipolar.44.full.c

``````~~~
#define A2 (1 << PA0) // H-bridge output pins
#define A1 (1 << PA1) // "
#define B2 (1 << PA3) // "
#define B1 (1 << PA4) // "
~~~
//
// A+ B+ PWM pulse
//
void pulse_ApBp() {
clear(bridge_port, A2);
clear(bridge_port, B2);
set(bridge_port, A1);
set(bridge_port, B1);
for (count = 0; count < PWM_count; ++count) {
set(bridge_port, A1);
set(bridge_port, B1);
on_delay();
clear(bridge_port, A1);
clear(bridge_port, B1);
off_delay();
}
}
~~~

//
// A- B- PWM pulse
//
void pulse_AmBm() {
clear(bridge_port, A1);
clear(bridge_port, B1);
set(bridge_port, A2);
set(bridge_port, B2);
for (count = 0; count < PWM_count; ++count) {
set(bridge_port, A2);
set(bridge_port, B2);
on_delay();
clear(bridge_port, A2);
clear(bridge_port, B2);
off_delay();
}
}
``````

Wire them up.

## Make and load program in to the board

On terminal:

``````\$ make -f  hello.stepper.bipolar.44.full.make
\$ sudo make -f  hello.stepper.bipolar.44.full.make program-usbtiny
``````

Result

### Some questions rose up

• Motor does not rotate when ISP programmer is connected.
• Can’t write program into Attiny44 while motor is connected to the board.
• PC cannot find ISP programmer… why?

## Problems

I am keep struggling with Eagle export problem.

Firstly, the image does not come out in right size.

When I try to export board as an image from `file > export > image`, the image I get sizes 3502 x 2252 regardless of Image Size setting 1748 x 1124. This is almost twice as big than it supposed to be and not precisely 2 times bigger but bit off. We, as a lab, concluded that this is an issue from the retina display as this issue only reproduces on Mac that has retina.

The export setting on Eagle

Actual image I get from Eagle

The second issue I have been facing is that a scope of an exported image also appears to be wrong compare to the original board image I see on working area of Eagle.

This is the board I am trying to export to png image.

This is the exported image.

At the moment, I am assuming that this problem is caused by somehow Eagle recognizing texts on the layer which is not visible and try to include them in the scope.

As you see below, the texts on the other layer seem just fit the wrong scope.

Associated with this issue, I am having another insignificant, although very annoying issue. If anyone knows how to get rid of this text from Top layer please let me know.