Skip to content

OUTPUT DEVICES

Welcome to week 9 assignment!

Key Learnings
This week I learned about output devices such as, speakers, motion sensors, movement sensors, led lights. I also learned about transistors & motors and how to connect them to a circuit

Files download

Stepper Motor Schematic and Board

Motors

In order to decide which motor should I use, I compared all 3 motors available in our lab:

DC Motor Servo Motor Stepper Motor
Used in cars, fans & blenders. Used in doors, windows and indicators. Used in 3D machines, robotic arms.
Full rotation. 180 Degrees rotation. Rotation is divided into segments - can do full rotation.
Capable on running at high speed, can be noisy and can generate a lot of heat. Speed can be controlled - therefore; they are excellent for small slow movements. Requires an output card to handle the high output frequency required.
DC motors are less precise than stepper motors. servo motor is accurate to about +- 0.02 degrees. stepper motor is accurate to +- 0.005 degrees.
Requires an encoder to ensure accuracy Servo motors allow for a small amount of error in position before they start to move. Stepper motors, by design, are quick to change position—simply fire a few outputs and the output shaft will have to rotate a couple of degrees.

According to this comparison I concluded that my art installation should either use a servo motor or stepper not a DC motor.

My Circuit Components

1- Microcontroller - Doit wroom esp 32
2- Capacitor - 100nf
3- Distance sensor - HC-SR04 (will upload it later)
4- H bridge Transistor - An H-Bridge is a circuit that can drive a current in either polarity and be controlled by *Pulse Width Modulation (PWM). my driver has a built in H Bridge.

  • Pulse Width Modulation is a means in controlling the duration of an electronic pulse.

5- stepper Motor
6- Motor Driver A4988 (Which contains an embedded H bridge transistor & a Potentiometer)
7- External Power Supply
8- Strip Light (will upload it later)

Designing - Milling and Soldering my Circuit

To design my board I used EAGLE and mods project as I specified in week 08 assignment.
Step1 I downloaded footprints of my driver, I only found a through hole driver in the lab, therefore; I used a THH footprint in my design.

Step2 I started a new project, gave it a name, added components to schematic and assigned the net classes to .4mm. I also named the GND and all voltage connections in my schematic and gave them a wider trace (1mm).

Step3 I generated a board from my schematic, moved elements and pressed on autoRouter.

NOTE I made a mistake here by naming many wires as Voltage in my schematic, they got connected in my board, I didn’t notice the connections and this resulted in unwanted traces.

Step4 draw a rectangle, turn off all wires except for top layer, export an image and save as traces.
turn off all layers except for dimensions and pads, export an image, save as cut.

Step 5 import your PNG images on modsprojects.org, choose traces end mill or cut end mill (depending on which image you uploaded), change origin to 0,0,0 **I forgot to do that and the machine was milling traces above my board).

step6 import your generated .rml file into the machine control program, calibrate your X,Y&Z (according to our previous group test we noticed an inclination in the sacrifise board therefore we calibrate Z on the lower side).

step7 Prepare your soldering tools:
soldering - Solder Wire
- Solder Iron (make sure your sponge is wet).
- Tweezers
- ventilation to avoid inhaling the led in your solder wire.
- Third arm to hold your board.

milled_board

solder_board

milling

hero_shot1

hero_shot2

Connecting my circuit

Step1 After milling my circuit I checked with a multimeter if there is any short and if all pins are connected correctly, as specified in week6 assignment of how to use a multimeter, turn your knob into the continuity test mode add both probes on any two pins, you should hear a beep if they are supposed to be connected.

Step2 Connect your controller to your laptop and compile a sketch. this is the code I compiled.

int stepPin =14 ;
int dirPin = 25;


void setup() {
  // put your setup code here, to run once:
pinMode(stepPin, OUTPUT);
pinMode(dirPin, OUTPUT);

}

void loop() {
  // put your main code here, to run repeatedly:
digitalWrite(dirPin, HIGH);
digitalWrite(stepPin, HIGH);
delayMicroseconds(1000);
digitalWrite(stepPin, LOW);
delayMicroseconds(1000);

}

Step3 Since I am using a driver with an embedded Potentiometer, using a screw I adjust my potentiometer according to the following equation:
Current = Vref / 8(Rcs) (resistance of my driver is 0.1ohm)
1 = Vref /8(0.1)
Vref=1.25

I adjusted the current value to 1.25, using a multimeter to check value and a screwdriver for potentiometer.

Step4 to connect my stepper motor with the driver on my circuit, it is important to understand that there are 4 wires coming out of the stepper motor, each two wires are connected to one coil, each two must be connected with (2B2A) and (1A1B) you can test which two are from the same coil using a potentiometer.

stepper_sriver

connect

Debugging

My motor didn’t move!
There was a lot of thinking and analyzing of why my motor didn’t move!
At first I checked the circuit file from eagle and found out it didn’t match my schematic due to giving the same name for some wires in my design!! therefore, I checked all my connections on my printed PCB with a multimeter and found out where I made mistakes.

I cut few connections and connected other pins to each other.

debug

debugg so I cut all the wrong connections and soldered new ones on my circuit.

debugging

My motor was still not moving!

I checked the code I compiled in my controller, I changed the delay time to 1000 instead of 200 and it worked!

The speed of the stepper motor is determined by the frequency of the pulses we send to the STEP pin. The higher the frequency, the faster the motor runs. You can control the frequency of the pulses by changing

delayMicroseconds(1000);

In my code, I defined the step pin (STEP) and the direction pin (DIR), in the void setup I defined the output pins. pinMode(stepPin, OUTPUT); pinMode(dirPin, OUTPUT);

In my code the direction of the stepper motor will remain the same.

This was my reference for the code and for the stepper motors in general www.makersguide.com

rasha_video

motor_video

rasha

GROUP ASSIGNMENT

For group assignment we powered few motors with different voltages with the power supply machine. group_assignment

1- The Air pump was provided with 2.9 voltage and required .19 current P=V*I P=.5W
2- The Neo-Pixel Led was provided with 2.9 voltage and required .22 current P=V*I P=.6W
3- The Vibrator Motor was provided with 2.9 voltage and required .07 current P=V*I P=.2W
4- The 3 VOLT DC Motor was provided with 2.9 voltage and required .03 current P=V*I P=.15W
5- The 12 VOLT DC Motor was provided with 11.9 voltage and required .25 current P=V*I P=.3W
6- Another 12 VOLT DC Motor was provided with 11.9 voltage and required .09 current P=V*I P=.7W
7- The 12 VOLT Water pump was provided with 11.9 voltage and required .56 current P=V*I P=6.7W

group assignment page

stepper motor tutorial 1
stepper motor tutorial 2


Last update: July 5, 2023
Back to top