Skip to content
Snippets Groups Projects
Commit 49e0d841 authored by Adrián Torres's avatar Adrián Torres
Browse files

stepper_motor

parent 6ea99102
Branches
No related tags found
No related merge requests found
Pipeline #242382 passed
......@@ -112,7 +112,12 @@
<li><a href="#oled" class="button">OLED</a></li>
<li><a href="#motor" class="button">DC Motor</a></li>
<li><a href="#servo" class="button">Servo motor</a></li>
</ul>
</ul>
<ul class="actions">
<li><a href="#steppermotor" class="button">Stepper Motor</a></li>
</ul>
<ul class="actions">
<li><a href="#networking" class="button primary">Networking</a></li>
......@@ -1929,6 +1934,38 @@ void loop() {
<p><video controls width="100%"; max-width="800"><source src="images/adrianino/servo.mp4" type="video/mp4"></video></p>
<h2><a id="steppermotor"></a>Stepper Motor</h2>
<p>A stepper motor is a motor that we can rotate 360 degrees, and also control its position very precisely through movements of degrees. You can see unipolar or bipolar stepper motors. In the following <a href="https://itp.nyu.edu/physcomp/lessons/stepper-motors/"><b>link</b></a> you can find more information. In my case I am going to use a <a href="https://es.aliexpress.com/item/32950051616.html?spm=a2g0s.9042311.0.0.274263c0Ayejoq"><b>NEMA 17 bipolar stepper motor.</b></a></p>
<li><b>Connection and schematic</b></li>
<p>To control a stepper motor we will use two H bridge, such as the <a href="https://www.digikey.com/product-detail/en/allegro-microsystems-llc/A4953ELJTR-T/620-1428-1-ND"><b>Allegro A4953.</b></a>I design and manufacture a small board where I solder the two Allegro A4953 driver, two 1uF capacitor, two 10uF capacitor and with the flat connectors where there is no room for mistakes when connecting it. It includes two traces to feed with the 9V battery (or another power supply). I use the digitals ouputs of the ATtiny1614 PA4 (Arduino pin 0), PA5 (Arduino pin 1), PA6 (Arduino pin 2), PA7 (Arduino pin 3).</p>
<span class="image main"><img src="images/adrianino/a_48.jpg" alt="" /></span>
<p>Here you can find the design in Eagle and the PNG's to create the board.</p>
<p><a href="assignments/adrianino/stepper_motor_eagle.zip"><b>- Stepper Motor Schematic + Board</b></a>
<p><a href="assignments/adrianino/stepper_motor_png.zip"><b>- Stepper Motor traces</b></a></p>
<p><img src="images/adrianino/a_49.jpg" width="50%"; max-width="700" /></p>
<li><b>Programming</b></li>
<p>Here you will find the programming to use a stteper motor. Here you can find the Arduino file to download. <b>Recommendation:</b> Download the program from the link, in the text the symbols <b><></b> of the libraries are missing. Below you can see a video of how it works. </p>
<p>For the power supply, I use an external 12V 0.6A source. It is also important to know which is each coil, for that we will use the multimeter and measure the resistance ohms of each coil.</p>
<p><a href="assignments/adrianino/stepper_motor/stepper_motor.ino"><b>- Arduino Hello Stepper Motor</b></a>
<p><video controls width="100%"; max-width="800"><source src="images/adrianino/motor2.mp4" type="video/mp4"></video></p>
<h1><a id="networking"></a>Networking and Communicaions</h1>
<h2><a id="hc05"></a>Bluetooth - HC05</h2>
......
//Original code Mauro Herrero Fab Academy 2021
//Fab Academy 2021 - Fab Lab León
//Stepper Motor
//Adrianino
//ATtiny1614
#include <util/delay.h>
#define onDelay() _delay_us(12) //PWM on time
#define offDelay() _delay_us(38) //PWM off time
#define pwmCount 100 // number of PWM cycles, total time 5000 us - 5 milliseconds
const int blue = 0;
const int red = 1;
const int green = 2;
const int black = 3;
const int pulseDelay = 10;
int stepsPerRev = 200;
void setup() {
// put your setup code here, to run once:
pinMode(blue, OUTPUT);
pinMode(red, OUTPUT);
pinMode(green, OUTPUT);
pinMode(black, OUTPUT);
}
void ApBp() {
digitalWrite(red, LOW);
digitalWrite(black,LOW);
for (int count = 0; count < pwmCount; ++count){
digitalWrite(blue, HIGH);
digitalWrite(green, HIGH);
}
}
void AmBp() {
digitalWrite(blue, LOW);
digitalWrite(black, LOW);
for (int count = 0; count < pwmCount; ++count){
digitalWrite(red, HIGH);
digitalWrite(green, HIGH);
}
}
void AmBm() {
digitalWrite(blue, LOW);
digitalWrite(green, LOW);
for (int count = 0; count < pwmCount; ++count){
digitalWrite(red, HIGH);
digitalWrite(black, HIGH);
}
}
void ApBm() {
digitalWrite(red, LOW);
digitalWrite(green, LOW);
for (int count = 0; count < pwmCount; ++count){
digitalWrite(blue, HIGH);
digitalWrite(black, HIGH);
}
}
void stepCW() {
ApBp();
AmBp();
AmBm();
ApBm();
}
void stepCCW(){
ApBm();
AmBm();
AmBp();
ApBp();
}
void loop() {
// put your main code here, to run repeatedly:
for (int i = 0; i<stepsPerRev; i++) {
stepCW();
}
delay(1000);
for (int i = 0; i<stepsPerRev; i++) {
stepCCW();
}
delay(1000);
}
File added
File added
docs/images/adrianino/a_48.jpg

314 KiB

docs/images/adrianino/a_49.jpg

167 KiB

File added
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment