Sie sind auf Seite 1von 4

SSA 5 — ”Arduino programming”

Emil
February 29, 2020

Eindhoven University Of Technology

Department Of Mechanical Engineering

Goals
The main goal of this SSA is to find how to use Arduino encoding language in order to
control the voltage that is supplied to the servos. This will prevent them from overheating.

Conclusion
I found two ways of creating such a system. The first one uses a potentiometer a small device
which changes the voltage by hand. The second way is just by writing a code stating the
exact amount of potential that needs to supplied. The main disadvantage of the second way is
that in order the exact values to be find a huge amount of testing needs to be done. However,
once they are found the system will be very precise. Whereas, by using potentiometer it will
be very difficult to control by hand the exact amount of energy that needs to be supplied.
In conclusion I believe without using potentiometer our design will do a better job.

Problems
No problems met

Recommendations/Next Step
• Figure out how we can cope with the laser cutting problems

• Start working on the programming itself

1
Time Spent
3-hours of searching and watching different videos which gave me some insight into what and
how arduino works 0.5-hour to understand how we can control the voltage 1.5-hour writing
overleaf

Overleaf Link
https://www.overleaf.com/read/cstmsqptcjsb

2
Arduino
Since my task was to find out how we can control the voltage transferred from the arduino
to the servo motor. However, before I am able to to figure it out, firstly, I needed to make
myself acquainted with the whole language. This seems to be very important since Bonne
who is the best at Arduino quitted. Firstly, I watched some introductory videos on Youtube.
This programming language is closer to Matlab than Phyton. It consist of two main parts:
(setup)- this function is used to mainly to introduce new variables,libraries, pin modes, etc.
Whereas the (loop) function is the part which is usually used for encoding the main script
and sequences. Sometimes even before the (setup) function some constants can be intro-
duced for example:

• const int analogOutPin = 3;

This equation saves into the program’s memory that the servo motor is connected to the
arduino via the third supplying energy exit of the chip. This is very important since later in
the script we will need several times to use this constant in order the system to transfer the
energy and information to the right exit. The next thing next video I looked into explains
that Arduino is often used for programming a servo motor. What I found useful for our
project is that in arduino’s software there are several basic introductory codes one of which
is made for servo motors.

1 Voltage control
Arduino language is mainly used for programming different electronic devices. In order this
script to work properly, usually there should be stated the amount of voltage difference that
needs to be supplied. Since we work with Arduino Uno chip the maximum potential it can
create is 5V. However, to prevent the servos from overheating in some cases we should de-
crease this amount of potential. This will be done with the function [analogwrite]:Example1

• analogwrite(analogOutPin, 0 - 1024);

The first item in the brackets is the above mentioned constant showing the exit to which
the servo is connected. The second section with the numbers in it presents the amount of
Voltage we want to supply. In Arduino’s programming language the voltage is presented
by integer values. In other words instead of directly writing 5Volts which as mentioned is
the maximum we write 1024. Consequently, for 2.5 Volts we write 512 and so on. By using
this function analogwrite it is supposed that voltage can be controlled. However, I did not
find a way we set the program to control itself what amount of voltage is enough and what
is excessive. So in order to make the best use of this script we should several times test
the system by implementing different values. Another important thing that testing should
help us find is the amount of time for which the system should be supplied with the specific
potential. This is done by the function in example1

• delay(Number)

3
This function should be placed right after the function it is referred to. Another important
feature is that the numbers we put into the brackets refer not to seconds but to miliseconds.
This is seems to be a big advantage since we will be able to more accurately program the
movement of the servos.

2 Volatage control by potentiometer


Potentiometer is a small device which is implemented into the arduino chip. It costs around
2 Euro and its main task vary the amount of energy supplied by hand. If we use such type
of a system the script is almost the same with some small differences. For example:

• sensorValue=analogRead(analogInPin);//read the analog in value

• outputValue = map(sensorValue , 0 , 1023 , 0 , 255); // map it to the range of the


analog out;

• analogWrite(analogOutPin,outputValue); // change the analog out value

By writing this script to the system we set the program to change its potential freely by the
potentiometer.
In the following references Video 1 will give you the best insight into what we should actually
do. The other videos concentrate more on how to calculate the voltage inputs and some basic
programming on arduino.

References
[1] Video 1

[2] Video 2

[3] Video 3

[4] Video 4

Das könnte Ihnen auch gefallen