Fyp Report
Fyp Report
Fyp Report
M.Haseeb 5602
M.Mubeen 5611
Project Supervisor
Signature:_______________________________
We certify that this Final Year Project Titled “Design and Development of a Low-Cost Electro
spinning Machine for Nanofabrication” is our project. The project has not been presented
elsewhere for assessment. The material used from other sources has been appropriately
acknowledged/referred to.
Copyright in the text of this Report rests with the student author. Copies (by any process)
either in whole or of extracts, may be made only per the author’s instructions or lodged in
the Department of Electrical Engineering library. Details may be obtained by the
librarian. This page must form part of any such copies made. Further copies (by any
process) may not be made without the author's permission (in writing).
The ownership of any intellectual property rights which may be described in this report is
vested the in Department of Electrical Engineering, Government College University
Faisalabad, subject to any prior agreement to the contrary, and may not be made available
for use by third parties without the written permission of the Department of Electrical
Engineering, which will prescribe the terms and conditions of any such agreement.
ACKNOWLEDGEMENTS
We are thankful to ourcreator Allah Almighty to have guided us throughout this work at every
step and for every new thought thatHe hadset up in our minds to improve it. Indeed, we could
have done nothing without His priceless help and guidance. Whosoever helped us throughout the
course of our project, whether our parents or any other individual was His will, so indeed none
be worthy of praise but Allah.
We are profusely thankful to our beloved parents who raised us when we were not capable of
walking and continued to support us throughout every department of our life. We would also like
to express special thanks to our supervisor for his help throughout our Final Year Project.
We would also like to pay special thanks to Dr. Arslan Dawood Butt for his tremendous support
and cooperation. Each time we got stuck in something, he came up with asolution. Without his
help, we wouldn’t have been able to complete our Final Year Project. We appreciate his
patience and guidance throughout the whole project.
Finally, I would like to express my gratitude to all the individuals who have rendered valuable
assistance to my study.
ABSTRACT
The benefits to researchers and society from nanotechnology are substantial. If the standard is to
produce very minute particle-size fibers and materials nanotechnology is the only way to achieve
the same. Nanotechnology is one of the rapidly growing scientific disciplines due to its
enormous potential in creating novel materials that have advanced applications.
Nano-fibers have a high surface area to volume ratio, and porosity so only we can be applied in
advanced applications such as filter medium, adsorption layer in protective clothing, face masks,
etc. Electro-spinning has a viable technique to produce Nano-fibers.
This review summarizes and presents the methods to provide functions to Nano-fiber webs and
applications, characterization, evaluation methods, market value, and future directions of Nano-
fiber webs. Incorporating drugs, nanoparticles, functional matters, or arranging special surface
structures are customarily used methods to furnish the performance of Nano-fibers. Nano-fibers
have a high surface area to volume ratio, and porosity so only we can apply lied in advanced
applications such as filter medium, adsorption layer protective clothing, face masks, etc.
Electrospinning is via the able le technique to produce nano-fiber ports on the fabrication of
nano-fibers and it's their characteristics and high-tech application in chemical protective clothing,
drug delivery, tissue engineering, and, filter mediums.
A nanofabrication electrospinning machine is available in the market but it is very expensive and
fabrication is very expensive in all fields. Considering all these problems, we have designed the
latest electrospinning machine for nanofabrication. In this way, we can make Nano fiber at a low
cost. Furthermore, the promising application areas of the nano-fiber web include drug delivery,
water filtration biomedical application, energy storage protective clothing, and air/gas filtration.
The characterization of nano-fiber webs includes general functional properties.
Key Words:Drug delivery, Electro spinning, Fiber, Polymer, Nano-fiber, Tissue Engineering
Graphical Abstract
DECLARATION.........................................................................................................................................................iii
COPYRIGHT STATEMENT.....................................................................................................................................iv
ACKNOWLEDGEMENTS.........................................................................................................................................v
ABSTRACT..................................................................................................................................................................vi
Graphical Abstract.....................................................................................................................................................vii
Table of Contents.......................................................................................................................................................viii
List of Figure.................................................................................................................................................................x
List of Tables...............................................................................................................................................................xii
List of Abbreviations.................................................................................................................................................xiii
CHAPTER 1: INTRODUCTION................................................................................................................................1
1.1 Introduction...................................................................................................................................................1
1.2 Literature Review..........................................................................................................................................4
1.3 Electro-spinning Operation...................................................................................................................................6
1.3 Objective.......................................................................................................................................................7
CHAPTER 2: PROJECT METHODOLOGY...........................................................................................................7
2.1 Developed Model..........................................................................................................................................8
2.2 Hardware.......................................................................................................................................................9
2.2.1 Electrical Parts:.......................................................................................................................................10
2.3 Software......................................................................................................................................................29
2.3.1 Fusion 360....................................................................................................................................................29
2.3.2 QT Designer.................................................................................................................................................31
2.3.3 Visual Studio................................................................................................................................................32
2.3.4Arduino IDE..................................................................................................................................................33
CHAPTER 3: RESULTS & DISCUSSION..............................................................................................................35
3.1 Circuit:...................................................................................................................................................................35
3.2 Output.................................................................................................................................................................37
3.3 Explanation.........................................................................................................................................................37
CHAPTER 4: COMMERCIALIZATION...............................................................................................................38
4.1 End Product.........................................................................................................................................................38
4.2Business Model Canvas.......................................................................................................................................39
4.3 Marketability.......................................................................................................................................................40
5. SUSTAINABLE DEVELOPMENT GOALS.......................................................................................................40
REFERENCES............................................................................................................................................................41
APPENDIX A..............................................................................................................................................................43
List of Figure
Figure_1:Graphical Abstract..........................................................................................................0
Figure_4:Collector Drum...............................................................................................................6
Figure_5:Arduino Uno...................................................................................................................7
Figure_10:BTS 7960....................................................................................................................13
Figure_12: DC Motor...................................................................................................................15
Figure_14:Needle Sizes................................................................................................................17
Figure_15:Fusion 360...................................................................................................................19
Figure_16:Qt Designer.................................................................................................................20
Figure_17:Visual Studio.............................................................................................................301
Figure_18:Arduino IDE................................................................................................................30
Figure_19:Electrospinning Process................................................................................................7
Figure_38:Arduino IDE................................................................................................................30
Figure_19:Electrospinning Process................................................................................................7
Figure_38:Arduino IDE................................................................................................................30
Figure_21:Threaded Rod..............................................................................................................23
Figure_22:End Product.................................................................................................................28
Figure_23:I2C...............................................................................................................................28
Figure_29: Circuit.........................................................................................................................36
List of Tables
Table 1:...........................................................................................................................................4
Table 2:.........................................................................................................................................36
Table 3:.........................................................................................................................................37
List of Abbreviations
1.1 Introduction
Nanofabrication comes from Greek word “Nanos” which means small.One nanometer is one
billionth of a meter or 10-9 meters. One Nanometer is about 100000 times smaller than the
diameter of a human hair.The main property of Nanofabrication is that it’s not only useful for
researchers and scientists field as well as it is also useful for businessmen, particularly in the
textile industry, medicine industry, paint industry, defense systems etc. because of money
making.
Electrospinning is specially designed for the production of fibers according to requirements, for
devices and system by controlling the shape of fibers and mainly the size of fibers at Nano-scale.
This technology can also work at the bulk level, with small atoms combining to form a large
structure of fibers.
In this process, high-voltage electric field is provided and nano-fibers are made with the process
of charging and ejecting polymer solution via a syringe. As compared to the other manufacturing
process of nano-fiber this method is a very easy and simple technique. [1]
When we talk about Nano fibers then we should keep in mind that “Nano” is less than one
micron and cannot be seen without enhancement of visualization. Nano fibers have a diameter
the 50-300nm. Some people believe that the size of Nano-fiber is up to 500nm then it is Nano-
fiber. But in fact, Nano fibers are the fibers with diameter between 100-500nm. Things that is
most important Nano fibers successfully used in medicine, in filters, protective fabrics tissue
platforms, and many other applications in our daily life.
The electrospinning technique uses electrostatic force to produce fibers. Electro spun fibers has a
high surface area while a small pore size. Theory of Nano fibers spinning process and limiting
factors affecting processes like thermal and mechanical properties and nature of polymer
solution.
1
During this process, the solvent gradually evaporates into the moving space between the needle
and the collector, which ultimately leads to the collector’s continuous and thin fibers .[4]
Electrospinning has gained growing interest in the science community and industry since the late
20th century and is considered a critical scientific and commercial enterprise with global
economic benefits. Electrospinning is a versatile and simple method to assemble continuous
nano-fibers.[2]
The Equipment used for electro-spinning is very simple according to their construction, which
includes a high voltage source with opposite polarity i.e. positive and negative, and a syringe
pump with a tube to carry solution from the syringe to conducting collector. Highly charged
fibers are directed toward the oppositely charged collector, which may be a rotating drum or
maybe a flat surface to collect fibers of solution. The shape of fibers is according to
requirements.
In the process of electrospinning high voltage electrically charge the flow of polymer solution. A
high-voltage electrode is linked with the polymer solution. The solution is then revolving
through a syringe. Due to the presence of high voltages between the tip of the syringe and the
grounded collector, the Taylor cone is made at the tip of the syringe producing sub-micron
diameter fibers. Fiber hardens as polymer solvent creates an interconnected fiber layer on the
surface of the grounded collector from where fibers are collected after their formation.
Preference is given to polymer solution as the high viscosity of the solution doesn’t allow for the
formation of sub-micrometer fibers. This problem linked with the use of poisonous solvents
required for the majority of polymers is the major barrier in industrial production.
The popularity of electrospinning is primarily due to the simplicity and versatility of the
equipment and fabricate nano-fibers with a high surface area to volume ratio and a large number
of inter-/intra fibrous pores [3].
Tissue engineering is a multidiscipline field that uses the principle of electro-spinning in order to
biological relief that maintains, restores, or improves the function of the tissue. In case of any
2
injury or disease natural tissue can be lost or weakened etc. so to heal wounds artificial supports
are required to repair damaged tissues and decaying bones structure.
There is a high prospect for electrospinning to be a carrier of drugs in specific areas. In order to
drug into the Nano-fiber matrix form, a drug is encapsulated into the Nano fibrous structure
utilizing electrospinning. There is a few critical frameworks for a drug like a burst release of
drugs. Release of tetracycline hydrochloride from an electro-spun blend of 50:50 of PEVA, PLA
explored. This is because tetracycline can’t be soluble in chloroform, it is dissolved in a small
amount of methanol and added to the polymer solution. After mixing polymer solution and drug
were then electro-spun and collected on a collector to produce a sheet in the form of nanometer
thickness. The break of this drug was observed in pure water by UV-VIS by element analysis.
Nanofabrication is also very useful in chemical and process industries in different areas like as a
catalyst, sensing, physical and chemical adsorption process, etc. For large scale, a catalyst is
acceptable when it provides easy recycling and stream of operations without affecting the purity
of products. So there is a need to improve the catalyst performance and stability of enzymes used
in the processes to compete at a large scale. The aging interest in nanoparticles of metal as they
hold real promise for their use in catalyzes, chemical sensing, etc. Lithium showed excellent
particles selectively depositing electro-spun anatase. Nano-fibers using photocatalytic features of
Titania. This one is the simplest route to fabricated metal-decorated Titania that have
applications in chemical sensing and catalysis.
Nano-fibers have also been used as biosensors and gas sensors. In the hydrolysis of urea to
ammonia and carbon dioxide urease act as a catalyst and can be used in urea detection. Nano-
composite fibers of urease and polyvinyl-pyrrolidone were prepared by using the process of
electro-spinning. Nano-fibers have been also used for air filtration applications for many
decades. Thin Nano webs have poor mechanical properties due to this property Nano webs are
laid over a substrate to make it into a filtration medium. Small fiber diameter causes slip flows at
fiber surfaces, causing increased catch and inertial impaction efficiency of composite filter
media. At the same pressure drop enhanced filtration is possible with fibers having a diameter of
fewer than 0.5 microns and it is possible easily by the process of electro-spinning.
3
Nano-fiber of poly (ethylene oxide) fixed with MWCNT was successfully achieved by the
process of electro-spinning. Nano-fibers have to be aligned and separated into the fiber matrix
for the diffusion of MWCNT. From the microscopy view, it has been that most MWCNTs were
aligned along the fiber axis.
Electrospinning has electrical and optical applications as well as other beneficial applications
like sensors. It is used in solar yachts, light crews, and for mirror use in space. Electrospinning
ha also has useful applications in Nano-conductors, nano-electronic applications like transistors,
and ultra-small antennas.
The Unique features of Nano-particles have attracted not only scientists, and researchers but also
businesses, particularly, textiles because of their gigantic economical potential to create, alter,
and impure the fibers at the bulk level, it also enhances the durability and performance of textile
fibers. Due to the excellent properties of nano-fibers several applications of electrospinning will
be developed. Based on nano-fibers, one can see many more developments in the textile field.
In the year 1900, electrospray technology, which began in the late 1890s, was developed into
electrospinning.[9]These nano-fibers possess unique properties, making them suitable for various
applications in fields such as biomedicine, filtration, energy storage, and sensors.We present a
complete table(Table 1) of, year-by-year development of electrospinning for a better
understanding of the history behind this new approach.
Year References
1902 Cooley and Morton patented the electro-spinning process. [10]
1914 John Zeleny's jet ejection at the metal capillary's tip [11]
1934 Formhals holds a patent for the creation of the E-spin device, [12]
which involves the fabrication of cellulose acetate with
acetone as the solvent.
1936-40 Other patents by Formhals [13]
1950-59 Nano-fibers as a filter for gas masks are manufactured in a [14]
factory. (only in USSR)
1960 Jet formation study and E-spun fibers as a filtration material
4
1964 Formation of Taylor cone
1971 Baumgarten's apparatus for spinning acrylic microfibers
1995 According to Doshi and Reneker, the diameter of the fiber
decreases as the distance between the collector and the
needle tip and the Taylor cone increases.
1996- Publications on working parameters like a solution, ambient,
2001 and instrumental parameters.
1996 Reneker, D. H., & Chun, I. Nanometre diameter fibers of
polymer, produced by electrospinning. Nanotechnology.
2001-05 Electro-spun nanofibers: synthesis and characterization
Different researchers from various countries introduced
several sorts of electro-spin instruments.
2001 Deitzel, J. M., Kleinmeyer, J., Harris, D., & Beck Tan, N.
C.The effect of processing variables on the morphology of
electro-spun nano-fibers and textiles. Polymer.
2002 Electrospinning Machines for Biomedical Applications [22]
2003 Electrospinning Machine Design. [18]
2004 Multi-Jet and Co-Axial Electrospinning Machines
2005 Synthesis of Multi-component and Core-Shell Fibers. [19][20]
2006 During this time, the majority of papers focused on the use
of electro-spun nano-fibers as sensors, tissue engineering
materials, chemical warfare stimulant protection, filters,
scaffolds, batteries, and catalysts. In addition, these
microfibers have found use in the medical industry as
medication delivery devices.
2008 Industrial Applications of Electrospinning [21]
2017 For mosquito protection, electrospinning potential is used to
make cloth. The fabric that resulted was found to be helpful
in preventing mosquito bites in tests.
2018 Electrospinning Machines for Environmental Applications [23]
Table 1: History Of Electro-spinning
5
Electrospinning is a method of deforming a conical droplet of polymer Solution ejected from a
nozzle tip into ultra-fine fibers using electric charges. The diameters of electro-spun fibers range
from 10 nm to 10 μm. Nanometer-sized fibers could be used in conductive polymeric biosensors,
filter membranes, biomedical scaffolds, wound dressing materials, artificial organs, nano-
electronics, nano-composites, and chemically protective clothing, among other uses. [15]
Electrospinning is a physical method that involves exposing a polymer solution to strong electric
fields to produce ultrathin fibers. Figure_19 depicts a schematic illustration of a typical
laboratory electro-spinning setup. A polymer solution is deposited within a syringe that is
horizontally mounted on a digitally controlled pump, allowing for exact control of the solution
flow rate. The polymer solution is then pumped into a metallic millimeter-sized needle that is
coupled to a high-voltage power supply in positive DC mode with low current intensity. The
polymer solution droplet at the needle's tip bends and forms a Taylor cone, which is then ejected
as a charged polymer jet at a critical high voltage (10kV-30kV). The electrical field extends and
accelerates this towards a grounded and oppositely charged collector. The solvent entirely
evaporates as the electro-spinning jet moves through the electrical field, while the entanglements
in the polymer chains prevent it from breaking up. As a result, ultrathin polymer fibers are
deposited on a metallic collector, which is then used to combine the fibers into nonwoven mats.
[16]
This non-mechanical process produces electro-spun fiber mats with structural advantages
such as ultra-fine structures, high porosity, a high surface-to-volume ratio, and customized
morphology. Electrospinning is a non-thermal technology that allows thermo-sensitive chemicals
to be encapsulated, which is critical for conserving structure and improving stability and
functionality during food preparation and storage. [17]
6
Figure_19: Electro-spinning Process
1.3 Objective
The main objectives of this project are:
To design and develop a prototype of an electrospinning machine composed of
mechanical hardware, PCB, Stepper motor (To control the speed of the syringe pump),
Brushless DC motor(Collector Drum), GUI (effective control of machine), Arduino-
based control and to safely apply an electrical application of high DC voltage between the
syringe pump and collector drum.
The electrospinning process was first described in the early 20th century and has since
undergone significant advancements. Initially, it was employed mainly for producing polymer
fibers, but later modifications enabled the fabrication of composite and functional fibers.
Electrospinning is a versatile and widely used technique for producing nano-fibers with
diameters ranging from a few nanometers to several micrometers. The process involves applying
an electric field to a polymer solution or melt, resulting in the formation of continuous fibers.
The electrospinning process involves several key factors that influence the fiber formation,
including the solution properties (viscosity, conductivity, surface tension), processing parameters
(applied voltage, flow rate, distance between the spinneret and collector), and environmental
conditions (humidity, temperature). Various researchers have investigated the effects of these
parameters on fiber morphology and alignment.
We use Arduino and BTS7960 DC Motor Driver to regulate the speed of our collector drum. We
have a variable resistor to control the speed of the collector drum and display the revolutions per
minute of the collector drum on seven segments
We used an Arduino Uno and a stepper motor driver in our syringe pump. The syringe is driven
by a threaded rod linked to our stepper motor. We are using another seven segments to display
the speed of the motor in milliliters per hour.
8
Arduino Uno BTS 7960-Driver DC Motor Collector
Drum
Power Supply
GUI
1.5 Hardware
Electro-spun nano-fiber possesses attractive properties, including a high aspect ratio, large
surface area, and excellent mechanical performance, which has attracted great attention since the
end of the 20th century.[6][7]
9
Nema 17 stepper motor
The CNC Shield V3 is a board that can be used to control stepper motors and other
devices in a computer numerical control (CNC) system. It is specifically designed to work with
the popular Arduino Uno microcontroller board and allows for easy connection of stepper motor
drivers, limit switches, and other input/output devices.
The CNC Shield V3 provides a simple and effective way to control CNC machines, such as 3D
printers, laser cutters, and milling machines, by receiving G-code commands from a computer
and translating them into precise movements of the stepper motors. It also includes features such
as end-stop support, motor drivers with adjustable current, and a PWM spindle control signal.
Overall, the CNC Shield V3 is an essential component in building a reliable and accurate CNC
system using the Arduino platform.
10
Figure_3: CNC Shield Layout
The CNC Shield V3 is a popular stepper motor driver board designed for use with Arduino-
based CNC machines. Here is a brief overview of the pin configuration of the CNC Shield V3:
X-STEP: This pin controls the step signal for the X-axis stepper motor.
X-DIR: This pin controls the direction signal for the X-axis stepper motor.
Y-STEP: This pin controls the step signal for the Y-axis stepper motor.
Y-DIR: This pin controls the direction signal for the Y-axis stepper motor.
Z-STEP: This pin controls the step signal for the Z-axis stepper motor.
Z-DIR: This pin controls the direction signal for the Z-axis stepper motor.
STEPPER EN: This pin enables/disables all stepper motors.
SPINDLE EN: This pin enables/disables the spindle motor.
SPINDLE PWM: This pin controls the speed of the spindle motor using Pulse Width
Modulation (PWM).
LIMIT SWITCHES: These pins are used to connect limit switches for each axis to the
CNC Shield.
PROBE: This pin is used to connect a touch probe to the CNC Shield.
COOLANT: This pin is used to control a coolant system (such as a mist coolant or flood
coolant).
11
1.5.1.2 Collector Drum:
The collector should be a good electric conductor, such as aluminum; rectangle aluminum plates,
(10 cm long, 4 cm wide, 0.5 cm thick) were made. In addition, a collector holder base was
designed to support the collector and allow the distance between the collector and the needle tip
of the syringe to be changed.[5]
12
The Digital I/O pins can be used as either input or output pins, depending on the requirements of
the project. The Analog input pins can read analog values from 0 to 5V, while the GND pins
provide a ground connection for the connected components. The 3.3V pin provides a regulated
3.3V output, while the 5V pin provides a regulated 5V output. The VIN pin can be used to power
the board using an external power source. The Reset pin is used to reset the microcontroller on
the board.
Figure_5:Arduino Uno
13
Figure_6:Arduino Block Diagram
Arduino Uno Pin Configuration:
Power Pins:
VIN: This pin allows an external voltage source (7-12V) to be connected to power the Arduino
board.
5V: Provides a regulated 5V output, which can be used to power external components.
3.3V: Supplies a regulated 3.3V output for low-power components.
Ground Pins:
GND: Connects to the ground (0V) reference of the power supply.
Digital I/O Pins:
There are 14 digital input/output pins, labeled from 0 to 13.
They can be individually configured as either a digital input or digital output.
The digital pins can output either 0V (LOW) or 5V (HIGH).
Analog Input Pins:
There are 6 analog input pins, labeled from A0 to A5.
Each pin can read an analog voltage (0-5V) from sensors or other analog sources.
PWM (Pulse Width Modulation) Pins:
Six of the digital pins (3, 5, 6, 9, 10, and 11) also support PWM output.
PWM allows you to simulate an analog voltage by varying the duty cycle of the digital signal.
Reset Pin:
RST: This pin is used to reset the microcontroller. A momentary LOW signal on this pin resets
the Arduino.
14
Communication Interface:
RX (Receive) and TX (Transmit): These pins are used for serial communication with other
devices.
I2C Interface:
A4 (SDA) and A5 (SCL): These pins are used for I2C communication with other devices.
SPI Interface:
Pins 10 (SS), 11 (MOSI), 12 (MISO), and 13 (SCK): These pins are used for SPI
communication with other devices.
The Arduino Uno board is typically programmed using the Arduino IDE (Integrated
Development Environment), and you can upload your sketches (programs) through a USB
connection.
Keep in mind that the voltage levels on the I/O pins are limited to 5V, so take necessary
precautions when interfacing with components that require different voltage levels to prevent
damage. Additionally, the total current drawn from all pins should not exceed the board's current
limitations. Always refer to the Arduino Uno datasheet and official documentation for more
detailed information and specifications.
The A4988 is a micro-stepping motor driver module that is commonly used to control
stepper motors in 3D printers, CNC machines, and other precision machinery.
The A4988 driver is capable of driving bipolar stepper motors with up to 2A of current per
phase. It is a popular choice for DIY projects due to its ease of use and low cost. The module is
compatible with various microcontrollers such as Arduino, Raspberry Pi, and others, and can be
easily controlled using simple code.
The A4988 driver works by receiving signals from the microcontroller and then controlling the
current flow through the stepper motor windings. The driver uses a technique called chopper
current regulation to ensure that the current is kept at a constant level, which helps to prevent
overheating and improves motor performance.
The module supports different micro-stepping modes, which allow for more precise control over
the motor movements. It can operate in full-step, half-step, quarter-step, eighth-step, sixteenth-
15
step, and even up to 32 micro-steps. This means that the motor can be controlled in smaller
increments, resulting in smoother and more precise movements.
16
Figure_8: A4988 Pin Configuration
17
REF (or Current Adjust): This pin is used to set the reference voltage, which in turn controls
the current limit for the stepper motor. By adjusting a potentiometer connected to this pin, you
can set the maximum current that the motor can draw.
The term NEMA stands for National Electrical Manufacturers Association, which is an
industry trade group that sets standards for various electrical components, including stepper
motors. The NEMA 17 is a stepper motor that conforms to the standards set by this group,
specifically in terms of its mounting dimensions, shaft size, and flange shape.
The NEMA 17 stepper motor works by converting electrical pulses from a stepper motor driver
into precise mechanical movements. The motor has a total of four wires, two for each phase, and
is driven by sending electrical signals to each phase in a specific sequence. This causes the rotor
to rotate in small steps, which can be precisely controlled by the stepper motor driver.
The NEMA 17 stepper motor typically has a step angle of 1.8 degrees per step, which means that
it takes 200 steps to complete a full revolution. However, by using micro-stepping drivers, the
motor can be controlled in smaller increments, resulting in smoother and more precise
movements.
18
The NEMA 17 stepper motor is commonly used in various applications, including:
1. 3D printers - The NEMA 17 is a popular choice for 3D printers due to its high torque
output and precise control over motor movements.
2. CNC machines - The motor is also commonly used in CNC machines for controlling the
movements of the machine's axes.
3. Robotics - The NEMA 17 stepper motor is used in many robotic applications due to its
high torque output, precise control, and compact size.
4. Camera sliders - The motor is used in camera sliders to provide smooth and precise
movements for time-lapse or video recording.
In summary, the NEMA 17 stepper motor is a popular choice for various applications that
require precise control over motor movements. Its high torque output, compact size, and
compatibility with various stepper motor drivers make it a versatile option for many DIY and
commercial projects.Here's the pin configuration for both types:
Unipolar NEMA 17 Stepper Motor (4 wires):
Wire 1 (Red or Blue): Common center tap for coils A and B.
Wire 2 (Yellow): Coil A lead.
Wire 3 (Green): Coil A center tap (usually not used in a unipolar configuration).
Wire 4 (Black): Coil B lead.
Bipolar NEMA 17 Stepper Motor (6 wires):
Wire 1 (Red or Blue): Coil A lead.
Wire 2 (Yellow): Coil A center tap.
Wire 3 (Green): Coil B lead.
Wire 4 (Black): Coil B center tap.
Wire 5 (White): Sense A (not used in all setups; can be left disconnected).
Wire 6 (Brown): Sense B (not used in all setups; can be left disconnected).
The BTS7960 is a high-power H-bridge motor driver module designed for controlling DC
motors. It is capable of driving motors with a maximum current of up to 43A and a voltage of up
to 27V. The module is widely used in various applications that require high-power motor control,
such as electric vehicles, robotics, and industrial machinery.
19
The BTS7960 motor driver works by receiving signals from a microcontroller and then
controlling the direction and speed of the connected DC motor. The module consists of two H-
bridge circuits, each of which is capable of driving one motor. The H-bridge circuit is a circuit
configuration that allows for the control of the motor's direction and speed by switching the
polarity of the voltage applied to the motor.
The BTS7960 motor driver provides various protection features to ensure the safe and reliable
operation of the connected motor. These include over-current protection, over-temperature
protection, and short-circuit protection. The module also has a built-in brake function that can be
used to quickly stop the motor in case of an emergency.
Figure_10:BTS 7960
The BTS7960 motor driver is commonly used in various applications, including:
1. Electric vehicles - The BTS7960 module is used in electric vehicles to control the speed
and direction of the motor that drives the wheels.
2. Robotics - The module is used in robotics applications to control the movements of
robots. The high-power output of the module allows for the control of large and heavy robots.
3. Industrial machinery - The BTS7960 is used in various industrial machinery, such as
conveyor belts, cranes, and other heavy machinery, to control the speed and direction of the
connected motors.
20
4. DIY projects - The module is widely used in DIY projects that require high-power motor
control, such as electric skateboards, RC cars, and drones.
In summary, the BTS7960 is a high-power H-bridge motor driver module that is widely used in
various applications that require high-power motor control. Its features, including over-current
protection, over-temperature protection, and short-circuit protection, make it a reliable and safe
option for controlling high-power DC motors.
21
The BTS7960 is controlled using Pulse Width Modulation (PWM) signals to control the speed
and direction of the motors. To control the motor speed and direction, you need to provide PWM
signals to the two input pins of each channel:
IN1A and IN2A: These are the input pins for channel A. To control the speed and direction of
the motor connected to channel A, you will need to provide PWM signals to these two pins.
IN1B and IN2B: These are the input pins for channel B. Similarly, to control the motor
connected to channel B, you will need to provide PWM signals to these two pins.
By varying the duty cycle of the PWM signals on IN1A/IN2A and IN1B/IN2B, you can control
the motor speed, and by setting the appropriate logic levels on these pins, you can change the
motor direction.
1.5.1.7 DC motor:
A DC motor is a type of electric motor that converts electrical energy into mechanical
energy in the form of rotational motion. It operates using a magnetic field created by a stationary
component called the stator and a rotating component called the rotor. When an electrical current
is applied to the stator, it creates a magnetic field that interacts with the magnetic field of the
rotor, causing it to rotate.
DC motors can be classified into two main types based on their construction: brushed DC motors
and brushless DC motors.
Brushed DC motors use brushes to transfer electrical current to the rotor, while brushless DC
motors use electronic commutation to switch the current to the stator windings. Brushed DC
motors are simpler and cheaper to manufacture, but they tend to have lower efficiency and
shorter lifespan due to the wear and tear of the brushes. Brushless DC motors, on the other hand,
are more complex and expensive, but they offer higher efficiency, longer lifespan, and more
precise control over the motor.
The main parameters of DC motors include voltage rating, current rating, speed rating, torque
rating, and power rating. The voltage rating refers to the maximum voltage that can be applied to
the motor, while the current rating refers to the maximum current that can be drawn by the
motor. The speed rating and torque rating determine the motor's performance characteristics, and
the power rating refers to the maximum power output of the motor.
22
Figure_12:DC Motor
DC motors are used in a wide range of applications, including:
1.Robotics - DC motors are used in robotics for driving wheels, arms, and other moving parts.
2.Electric vehicles - DC motors are used in electric cars, bikes, and scooters for propulsion.
3.Industrial machinery - DC motors are used in various industrial machinery, such as pumps,
fans, and conveyor belts, for driving moving parts.
4.Home appliances - DC motors are used in home appliances, such as vacuum cleaners,
blenders, and hairdryers, for driving moving parts.
5.DIY projects - DC motors are used in various DIY projects, such as RC cars, drones, and
motorized toys.
23
1.5.1.8 Syringe:
Sucking and ejecting liquid through a tube with a nozzle and piston or bulb in a narrow stream.
The syringe is an essential component of an electro-spinning machine. The electrically spun
solution is poured into the syringe. A critical parameter is the flow rate of the polymer solution
within the syringe. Because the polymer solution will have adequate time to polarize, a lower
flow rate is advised. If the flow is high, bead fiber with a large diameter will form instead of
smooth fiber with a small diameter, which will dry quickly when it reaches the collector.
Figure_13: Syringe
24
Figure_14: Syringe Parts
1.5.1.9 Base:
We have the base of an electro-spinning machine with wood to avoid from electrical hazards and
it also reduces the effect of noise pollution. Meanwhile wooden base is also balance with the four
wooden blocks in every corner with rubber foot that make it safe zone for working and behave as
good insulator. This unique feature also a cause of a shock hazard free environment.
Supporting pillars give the collector drum and rod a solid basis, ensuring that they stay in place.
Our support is made of wood, which ensures that the components are securely held in place and
protective.
Threaded bars, often called studs, are cylindrical bars that have continuous threading at both ends
but no head or fashion tip. They can be used as a U-bolt, anchor bolt, clamp, or hanger, among
other applications. The threaded rod could be threaded down the rod.Actually in our project of
electrospinning machine threaded rod is used to push the syringe in order to move out the PVA
solution through needle.
25
Figure_21: Threaded Rod
1.5.1.12 I2C:
I2C is a two-wire, synchronous, serial communication protocol developed by Philips (now NXP
Semiconductors) in the early 1980s. It was designed to enable simple and efficient
communication between multiple devices using just two wires: SDA (Serial Data) and SCL
(Serial Clock). I2C is a master-slave protocol, meaning that there is one master device that
controls communication with multiple slave devices.
I2C communication is based on a master-slave relationship. In this context, the master device
initiates and controls the communication, while the slave devices respond to commands from the
master. The master generates the clock signal (SCL), and data is transferred along the data line
(SDA).
Each I2C device on the bus is identified by a unique address. The I2C protocol supports two
addressing formats: 7-bit and 10-bit addressing. The 7-bit addressing mode allows for up to 128
(2^7) devices on the bus, while the 10-bit addressing mode allows for a larger address space,
accommodating up to 1024 (2^10) devices.
26
The communication between the master and slave devices is organized into data frames. Each
frame consists of a Start condition, the 7- or 10-bit address of the slave device (including the
read/write bit), the data bytes (if any), and an acknowledgment (ACK) or not-acknowledgment
(NACK) bit. A NACK is sent by the receiving device to indicate that it cannot process the
received data.
Start Condition: The master initiates communication with a Start condition, signaling the
beginning of a transaction.
Address Byte: The master sends the address of the target slave device along with the read/write
bit (R/W). The R/W bit indicates whether the master wants to read from (R/W=1) or write to
(R/W=0) the slave device.
Data Transfer: Data is transmitted or received in 8-bit bytes between the master and slave
devices.
ACK/NACK: After receiving each byte, the receiver sends an ACK or NACK bit to indicate
successful reception or an error, respectively.
Stop Condition: The master generates a Stop condition to signal the end of a transaction.
Multi-Master Configuration:
I2C supports a multi-master configuration, which allows multiple master devices to share the
same bus. In this setup, each master must handle bus arbitration to prevent conflicts when more
than one master attempts to communicate simultaneously. The master that wins the arbitration
gains control of the bus.
To use I2C in your project, you will need to follow these steps:
i. Identify the I2C address of the LCD module and configure it appropriately in your
microcontroller's code.
ii. Implement the necessary I2C functions or use libraries provided by the microcontroller's
manufacturer to facilitate communication with the LCD.
iii. Design the user interface on the LCD to present the information required for the
electrospinning process.
27
I2C Pull-up Resistors:
As previously mentioned, I2C is an open-drain bus, which means that devices can pull the SDA
and SCL lines low but cannot actively drive them high. To ensure that the lines return to the high
state when not in use, pull-up resistors are required. The value of the pull-up resistors is critical
as it affects the rise time of the signal edges and, therefore, the maximum achievable bus speed.
The typical value for pull-up resistors is around 2.2kΩ to 10kΩ, depending on the bus
capacitance and speed requirements.
Figure_23:I2C
28
1.6 Software
List of software’s that are used in the project to program the Arduino Uno board, and to design
the 3D model of Electrospinning and to design the GUI, andtobuild a code are following:
Fusion 360
QT Designer
Visual Studio
Arduino IDE
29
Collaboration and Cloud-Based: Fusion 360 is cloud-based, meaning that designs and project
data can be accessed and collaborated on from virtually anywhere with an internet connection.
This facilitates seamless collaboration among team members and clients, making it easier to
work on projects together.
Electronics and PCB Design: Fusion 360 has expanded its capabilities to include electronics
design and PCB (Printed Circuit Board) layout features. This allows users to design and model
electronic components and integrate them into larger assemblies.
3D Printing and Additive Manufacturing: Fusion 360 supports 3D printing workflows,
allowing users to export their designs in various file formats compatible with 3D printers. This
makes it easier to prototype and manufacture parts using additive manufacturing technologies.
Product Visualization and Rendering: Fusion 360 provides visualization tools that allow users
to create realistic renderings and animations of their designs. This is particularly useful for
marketing purposes, presentations, and design reviews.
30
2.3.2 QT Designer
Qt Designer is the Qt tool for designing and building graphical user interfaces (GUIs) with
QtWidgets.Qt is a free and open-source cross-platform application framework widely used for
developing software applications with a graphical user interface (GUI). It was originally
developed by Trolltech, which was later acquired by Nokia and then by The Qt Company. The
framework is written in C++ but provides bindings for various other programming languages,
including Python, Java, and others. Qt's main purpose is to provide developers with a
comprehensive set of tools and libraries to create applications that can run on multiple operating
systems without significant code changes.
One of the primary features of Qt is its ability to create applications that can run on various
operating systems without the need for significant platform-specific modifications.
Qt excels in creating graphical user interfaces. It provides a comprehensive set of widgets,
controls, and layouts that allow developers to design interactive and aesthetically pleasing
interfaces. The framework follows a "write once, run anywhere" philosophy, which means that
the GUI design remains consistent across different platforms.
Qt is widely used in various industries, including automotive, consumer electronics, medical
devices, industrial automation, gaming, and more. It has a strong developer community and is
supported by a large number of companies.
Figure_16:Qt Designer
31
2.3.3 Visual Studio
32
2.3.4Arduino IDE
33
Figure_38:Arduino IDE
34
CHAPTER 3: RESULTS & DISCUSSION
3.1 Circuit:
Figure_27:Final View
35
Figure_29:Circuit
36
3.2 Output
3.3 Explanation
After performing the process of electro-spinning on copper foil as well as on Aluminium foil it is
clearly seen on Figure_25 and Figure_26 a layer of nano-fiber deposit on respective foil and it
has been seen on microscope more precisely. It is clearly observed that the the solution is
converted into nano-particles by applying electrostatic force.
37
CHAPTER 4: COMMERCIALIZATION
We have designed a low-cost electro-spinning machine that produces nano-fibers from PVA
solution at high voltages. Figure 22 shows the hardware of our designed machine, consisting of a
CNC Shield V3 (for stepper motor), Arduino Uno, Collector Drum, 12 Volts Computer Supply,
A4988 DC Motor Driver, 4A Buck-Boost Converter, DC Motor (12-14Volts), 16x4 LCD,
Bts7960 for DC motor collector drum, Nema 17 stepper motor. For operation, we need a PC for
using the GUI, and a physicaldevice. With the help of a graphic user interface, the user will
provide the flow rate of PVA solution from syringe.
38
4.2Business Model Canvas
39
4.3 Marketability
4.4.1 Modes of Marketing Advertising
The six fundamental modes of communication utilized in marketing are advertising, digital
marketing, direct marketing, personal selling, public relations, and sales promotion.
The two basic types of marketing are business-to-business (B2B) and business to consumer
(B2C).
4.4.1.2 B2B Marketing
Here we can start our product marketing with some other chemical business and chemical
industries by using B2B method.
4.4.1.3 B2C marketing
And also start marketing with directly customer and sell out that product.
40
REFERENCES
[1] Velasco Barraza, R. D., et al. "Designing a low-costelectrospinning device for practical learning in a
bioengineering biomaterials course." Revistamexicana de ingenieríabiomédica 37.1 (2016): 7-16.
[2] S.G. Kumbar, R. James, S.P. Nukavarapu, C.T. LaurencinElectrospunnanofiber scaffolds: engineering
soft tissuesBiomed. Mater., 3 (3) (2008), p. 034002, 10.1088/1748-6041/3/3/034002
[3] J. H. Wendorff, S. Agarwal, and G. A., Electrospinning: materials, processing, and applications. John &
Sons;Feb 8: Wiley, 2012.
[4] Bosworth, L., and Sandra Downes, eds. Electrospinning for tissue regeneration. Elsevier, 2011.
[5] Owida, H. A., Moh'd, B. A. H., & Al Takrouri, M. (2022). Designing an integrated low-cost
electrospinning device for nanofibrous scaffold fabrication. HardwareX, 11, e00250.
[6] T. Subbiah, G.S. Bhat, R.W. Tock, S. Parameswaran, S.S. RamkumarElectrospinning of nanofibersJ.
Appl. Polym. Sci., 96 (2) (2005), pp. 557-569
[7] S. Jiang, Y. Chen, G. Duan, C. Mei, A. Greiner, S. AgarwalElectrospunnanofiber reinforced composites:
a reviewPolym. Chem., 9 (2018), pp. 2685-2720, 10.1039/C8PY00378E.
[8] Park S, Park K, Yoon H, Son J, Min T, Kim G. Apparatus for preparing electro spun nano fibers:
designing an electro spinning process for nanofiber fabrication. Polymer International. 2007
Nov;56(11):1361-6.
[9] Thenmozhi S, Dharmaraj N, Kadirvelu K, Kim HY. Electrospunnanofibers: New generation materials
for advanced applications. Materials Science and Engineering: B. 2017 Mar 1;217:36-48..
[10] Sarkar K, Gomez C, Zambrano S, Ramirez M, de Hoyos E, Vasquez H, Lozano K. Electro spinning
to force spinning™. Materials today. 2010 Nov 1;13(11):12-4.
[11] Zeleny J. The electrical discharge from liquid points, and a hydrostatic method of measuring the
electric intensity at their surfaces. Physical Review. 1914 Feb 1;3(2):69.
[12] Ismail HM, Ali-Adib S, Younes HM. Reactive and functionalized electrospun polymeric nanofibers
for drug delivery and tissue engineering applications. Therapeutic Delivery. 2019 Jun;10(7):397-9.
[13] Pokorný, Pavel. "Praktické a teoretickéaspektyelektrickéhozvlákňovánínanovláken." (2015).
[14] Luo CJ, Stoyanov SD, Stride E, Pelan E, Edirisinghe M. Electrospinning versus fibre production
methods: from specifics to technological convergence. Chemical Society Reviews. 2012;41(13):4708-35.
[15] Park S, Park K, Yoon H, Son J, Min T, Kim G. Apparatus for preparing electro spun nanofibers:
designing an electrospinning process for nanofiber fabrication. Polymer International. 2007
Nov;56(11):1361-6.
[16] Torres-Giner S. Electro spun nanofibers for food packaging applications. In Multifunctional and
nano reinforced polymers for food packaging 2011 Jan 1 (pp. 108-125). Woodhead Publishing.
41
[17] Zhang C, Li Y, Wang P, Zhang H. Electrospinning of Nanofibers: Potentials and perspectives for
active food packaging. Comprehensive Reviews in Food Science and Food Safety. 2020 Mar;19(2):479-
502.
[18] Li, D., Wang, Y., Xia, Y. (2003). Electrospinning of Polymeric and Ceramic Nanofibers as Uniaxially
Aligned Arrays. Nano Letters, 3(8), 1167-1171. DOI: 10.1021/nl0344256
[19] Zong, X., Ran, S., Kim, K. S., Fang, D., & Hsiao, B. S. (2003). Structure and process relationship of
electrospunbioabsorbablenanofiber membranes. Polymer, 44(22), 6593-6602. DOI: 10.1016/S0032-
3861(03)00639-7
[20] Li, M., Mondrinos, M. J., Chen, X., Gandhi, M. R., Ko, F. K., Lelkes, P. I., & Zhou, J. (2005). Co-
electrospun poly (L-lactide)/poly (ethylene oxide) nanofibrous scaffolds for tissue engineering. Journal
of Biomedical Materials Research Part B: Applied Biomaterials, 74(1), 35-42. DOI: 10.1002/jbm.b.30180
[21] Torres-Giner, S., Martinez-Abad, A., Ocio, M. J., &Lagaron, J. M. (2008). Stabilization of a
nutraceutical omega-3 fatty acid by encapsulation in ultrathin electrosprayedzeinprolamine. Journal of
Agricultural and Food Chemistry, 56(3), 791-796. DOI: 10.1021/jf072487i
[22] Matthews, J. A., Wnek, G. E., Simpson, D. G., &Bowlin, G. L. (2002). Electrospinning of collagen
nanofibers. Biomacromolecules, 3(2), 232-238.
[23] Demirci, Serkan, et al. "pH-responsive nanofibers with controlled drug release properties." Polymer
Chemistry 5.6 (2014): 2050-2056.
42
APPENDIX A
43
stepper1.setAcceleration(X_ACCEL);
// tell the PC we are ready
Serial.println("<Arduino is ready>");
;;;;;;;;;;;;;;;;;;;;;
}
//=============
// The loop function is what is always running and refreshes BAUD_RATE times per second
void loop() {
}
//=============
// Here we get data from the serial port, read it one byte at a time, store each subsequent byte in the buffer (list)
// then read it and declare the values to variables in this code
voidgetDataFromPC() {
// If there is data from the serial port
if (Serial.available() > 0) {
// turn on the LED to indicate we are receiving
digitalWrite(ledPin, HIGH);
// read the a single character
char x = Serial.read();
// the order of these IF clauses is significant
if (x == endMarker) {
reading progress = false;
newDataFromPC = true;
// clear the buffer
inputBuffer[bytesRecvd] = 0;
// and parse the data
returnparseData();
}
if (readInProgress) {
// add the character to the buffer
inputBuffer[bytesRecvd] = x;
bytesRecvd ++;
if (bytesRecvd == buffSize) {
bytesRecvd = buffSize - 1;
}
}
if (x == startMarker) {
bytesRecvd = 0;
readInProgress = true;
}
digitalWrite(ledPin, LOW);
}
}
//=============
/*
# <Mode, Setting, Pump Num, Value>
# Mode can be SETTING, RUN, JOG, STOP
# Setting can be SPEED, ACCEL, DELTA, ONE, FEW, ALL, ZERO
# Pump number can be 1 or 2 or 3 or 12 or 13 or 23. (## indicates two pumps to run)
*/
// Here is where we take the string <...> that we have read from the serial port and parse it
voidparseData() {
//Split the data into its parts
// strtok scans the string input buffer until it reaches a "," or a ">"
// Then we declare the variable associated with that part of the inputBuffer
// each strtokcontiues where the previous call left off
char * strtokIndx; // this is used by strtok() as an index
strtokIndx = strtok(inputBuffer, ","); // get the first part - the mode string
strcpy(mode, strtokIndx); // copy it to messageFromPC
strtokIndx = strtok(NULL, ","); // get the second part - the setting string
strcpy(setting, strtokIndx); // copy it to messageFromPC
strtokIndx = strtok(NULL, ","); // get the third part - the motor ID int
String motorstr(strtokIndx);
motorID = atoi(strtokIndx); // convert to integer and copy it to motorID
motors[0] = 0;
if(motorstr.indexOf("1") >= 0) {
motors[0] = 1;
}
Serial.println("string");
44
Serial.println(motorstr);
Serial.println("Status");
Serial.println(motors[0]);
strtokIndx = strtok(NULL, ","); // get the fourth part - the value float
value = atof(strtokIndx); // convert to float and copy to value
strtokIndx = strtok(NULL, ","); // get the fifth part - the direction character
strcpy(dir, strtokIndx); // copy the character to dire
strtokIndx = strtok(NULL, ","); // get the fourth part - the value float
p1_optional = atof(strtokIndx); // convert to float and copy to value
distances[0] = p1_optional;
if (strcmp(setting, "RUN") == 0) {
distances[0] = 999999.0;
}
Serial.println("Status Distances");
Serial.println(distances[0]);
newDataFromPC = true;
replyToPC();
returnexecuteThisFunction();
}
voidclearVariables() {
charmessageFromPC[buffSize] = {0};
char mode[buffSize] = {0};
char setting[buffSize] = {0};
intmotorID = 0;
float value = 0.0;
chardir[buffSize] = {0};
float p1_optional = 0.0;
}
// =============================
// So we do a string comparison using strcmp(str1, str2) as a condition to determine what to do next
// Here we can add new functions if we like, for example if we wanted to add a "TEST" to the mode
// input we would add a condition if (strcmp(mode, "TEST") == 0 {...}
voidexecuteThisFunction() {
if (strcmp(mode, "STOP") == 0) {
returnstopAll();
}
else if (strcmp(mode, "SETTING") == 0) {
returnudpateSettings();
//Serial.print("UPDATING SETTINGS\n");
}
else if (strcmp(mode, "RUN") == 0) {
// Check if any stepper is currently running and do not allow execution if that is the case
//if (!stepper1.isRunning()) {
if (strcmp(setting, "DIST") == 0) {
returnrunFew();
// }
}
}
else if (strcmp(mode, "PAUSE") == 0) {
returnpauseRun();
}
else if (strcmp(mode, "RESUME") == 0) {
returnrunFew();
}
}
//=============
// Here is where we reply to the PC if we find that we have new data from the PC
// This is executed on everyloop if we detect that we have new data from the pc
voidreplyToPC() {
if (newDataFromPC) {
newDataFromPC = false;
Serial.print("<mode: ");
Serial.print(mode);
Serial.print(" ,setting: ");
Serial.print(setting);
Serial.print(" ,motorID: ");
Serial.print(motorID);
Serial.print(" ,value: ");
Serial.print(value);
Serial.print(" ,direction: ");
45
Serial.print(dir);
Serial.print(" ,p1 optional: ");
Serial.print(p1_optional);
//Serial.print(" ,p2 optional: ");
// Serial.print(p2_optional);
//Serial.print(" ,p3 optional: ");
//Serial.print(p3_optional);
Serial.print(" ,Time ");
Serial.print(curMillis>> 9); // divide by 512 is approx = half-seconds
Serial.println(">");
}
//executeThisFunction();
}
// Here we want to send our current distance to the PC
// We send the motor ID and then print out distance left
// This returns the step difference between where we are at now and where we want to be.
// Since the Baud Rate is larger than the speed of rotation for max motor speed
// we return the distance left only if it changes otherwise it would print out the same
// number a million times
voidsendDistanceToPC(intmID) {
switch (mID) {
case 1:
if (stepper1.distanceToGo() != oldDistanceLeft1) {
Serial.print("<DISP1|");
Serial.print(stepper1.distanceToGo());
Serial.print(">");
}
oldDistanceLeft1 = stepper1.distanceToGo();
break;
}
}
//============
// Update the settings for each stepper. This is run before performing any moving functions
// It sets the speed, accel, and jog delta for each pump
voidudpateSettings() {
stepper1.setCurrentPosition(0.0);
switch (motorID) {
case 1:
if (strcmp(setting, "SPEED") == 0) {
stepper1.setMaxSpeed(value);
}
else if (strcmp(setting, "ACCEL") == 0) {
//stepper1.setAcceleration(value);
stepper1.setAcceleration(value);
}
else if (strcmp(setting, "DELTA") == 0) {
jog1Delta = value;
}
break;
}
clearVariables();
}
//======================================
// The main function for moving the pumps. Takes in a displacement (in steps) and then moves that much
// For now this is implemented in a constant speed (acceleration is zero except for start and stop where it is max)
// anytime you are running your pumps you should always calll get data from PC in case you want to send a STOP command
// This should be complete!
// Need to add the ability to report distance remaining back to LCD monitor
//===================================
// This function will run few ie if (p1, p2) or (p1, p3) or (p2, p3) are enabled
intarray_sum(int * array, intlen) {
intarraySum;
arraySum = 0;
for(int index = 0; index <len; index++)
{ arraySum += array[index]; }
returnarraySum;
}
voidrunFew() {
// First we determine the direction of movement. If 1, then it's forward, otherwise it's -1.
// We use 1 and -1 so that we can multiply any number and reverse the math, minimizing lines of code
46
AccelSteppersteppers[1] = {stepper1};
int direction = 1;
if (strcmp(dir, "B") == 0) {
direction = -1;
}
Serial.print("Direction");
Serial.println(direction);
// Second we set the distance to move for each stepper.
// We use direction and multiply the value saved in the distances array;
// The distances array is set above to default to 999999 if 'RUN' else, the value set.
Serial.println("Status Distances");
Serial.println(distances[0]);
for (inti = 0; i< 3; i += 1) {
if (motors[i] == 1) {
toMove = direction * distances[i];
Serial.print("Seddingtomove command: ");
Serial.println(toMove);
steppers[i].move(toMove);
}
}
// Finally the main loop where we move and check the steppers status
// We declare an array to store the status of each stepper
intstepperStatus[1] = {0};
// Then we loop until that sum is equal to the number of selected steppers
// That number is stored in the motors array, 1 for selected, 0 otherwise
// If we have 1 and 3 for example motors = [1, 0, 1] => sum = 2
Serial.println("Entering While Loop ");
Serial.println(array_sum(stepperStatus, 1));
Serial.println(motors[0]);
Serial.println(array_sum(motors, 1));
// 4000 steps == 1 mm
while (array_sum(stepperStatus, 1) != array_sum(motors, 1)) {
// We iterate over the 3 possible steppers
for (inti = 0; i< 3; i += 1) {
// If this stepper is selected
if (motors[i] == 1) {
// Ask the stepper to move to position at constant speed.
if (stepperStatus[i] == 0 ) {
steppers[i].run();
}
// Check if it reached it's position
if (steppers[i].distanceToGo() == 0) {
// If yes then store that value in the stepperStatus array.
stepperStatus[i] = 1;
}
}
}
getDataFromPC();
}
clearVariables();
}
voidstopAll() {
for (inti = 0; i< 3; i += 1) {
steppers[i].stop();
}
}
voidpauseRun() {
for (inti = 0; i< 3; i += 1) {
distances_to_go[i] = steppers[i].distanceToGo();
targets_position[i] = steppers[i].targetPosition();
distances_left[i] = distances_to_go[i] - distances_left[i];
steppers[i].move(p1_distance_to_go);
}
while (strcmp(mode, "RESUME") != 0) {
// do nothing
getDataFromPC();
}
for (inti = 0; i< 3; i += 1) {
distances[i] = distances_left[i];
}
47
returnrunFew();
}
BTS 7960 Code
int SENSOR_PIN = 0; // center pin of the potentiometer
intRPWM_Output = 5; // Arduino PWM output pin 5; connect to IBT-2 pin 1 (RPWM)
intLPWM_Output = 6; // Arduino PWM output pin 6; connect to IBT-2 pin 2 (LPWM)
void setup()
{
pinMode(RPWM_Output, OUTPUT);
pinMode(LPWM_Output, OUTPUT);
}
void loop()
{
int value = analogRead(SENSOR_PIN);
value = map(value,0,1023,0,255);
// sensor value is in the range 0 to 1023
// the lower half of it we use for reverse rotation; the upper half for forward rotation
analogWrite(RPWM_Output, 0);
analogWrite(LPWM_Output, value);
}
48