Professional Documents
Culture Documents
Figure 1 shows the characteristics of the device used to construct a switching buck
converter circuit. For this experiment, a general-purpose PCB will be used.
Figur
e 2. The output inductor wound up for the experiment.
In Figure 2, the inductor on the output side uses a terroy core. Diameter 3.5 cm.,
black color and use wire No. 20 AWG wound about 55 turns in the core, which
will have an inductance of about 200uH/5A.
Fig. 3
Characteristics of the assembled buck converter circuit.
When the circuit is completed, it is shown in Figure 3. In the figure, it is seen that
the circuit is connected on the copper side of a multi-purpose PCB for easy
experimentation, correction, measurement of various signals. and connecting the
control signal and feedback signal back to the Arduino UNO control board.
Pictu
re 4 connection with Arduino UNO controller board
void setup()
{
Serial. begin(9600);
InitTimersSafe();
bool success = SetPinFrequencySafe(3,frequency);
Setpoint = 500;
//turn the PID on
myPID.SetMode(AUTOMATIC);
}
void loop()
{
Input = analogRead(A0);
// Serial.println(Input);
myPID.Compute();
// analogWrite(PIN_OUTPUT, Output);
pwmWrite(3, Output);
// Serial.println(Output);
}
Fi
gure 6. Oscilloscope in response to a 10 ohm load.
In Figure 7 is a 20V/2A power supply for the experimental circuit, which we can
observe. Behavior in terms of input power and the performance of this preliminary
circuit
In Figure 8, the program will modify the PID_v1.h library file where the
SampleTime position from the original value is equal to 0.1S. Let us change it to
the value of 0.001S instead in order to increase the duration of checking the error
value (Error). and is suitable for the response speed of the output voltage change.
Figure 9. The buck converter circuit designed and used in the experiment.
Experiment with another project with constant current control. By using the
Arduino UNO board using a PID Control program and using a PWM signal to
adjust the current that needs to be controlled to be stable. and receive a feedback
signal to analog pin A0 to read the value that occurs in the work (Process Value:
PV) and compare with the value that determines the operation of the system (Set
Point: SP), which will be The error value (Error) allows the program to adjust the
compensation value. (Compensation) that is appropriate correctly.
Figure 2. Current
value measured by setting Setpoint = 0.5A.
Figure 2 is a measurement of the resulting current. In which we will set the current
to be controlled at (Set point) 0.5A and the result from the power supply at the
voltage value of 6.58V is equal to 0.49A.
The next picture 4 is an experiment to increase the voltage of the power supply to
10V and test the operation of the circuit. This is to observe the response of the
system when the input voltage is unstable.
Figure 5 shows the measured current value when the input voltage is increased at
10V, it is equal to 0.52A, which the result is slightly higher than the value we need
(Setpoint), about 0.02A, which is still acceptable.
Figure 6. Pulsed
modulation signal characteristics in response to 10V input voltage.
In Figure 6, it can be seen that the nature of the resulting signal As the input
voltage increases, the duty cycle decreases. Compared to the supply voltage of
6.58V, this is to adjust in response to changes in input voltage and maintain a
constant current value.
Figure 7 shows an
input voltage increase of 15V.
Figure 8 shows the amount of current generated. When adjusting the voltage of the
power supply to 15.02V, the value is equal to 0.55A.
Figure 9. Pulse-
width modulated signal in response to an input voltage of 15V.
Fig. 9 The signal characteristics will have a reduced duty cycle. Compared with the
pressure of the previous experiment. And in the experiment, increasing the power
supply voltage to 20.01V in the next figure below gives a similar result.
Figure 10 The
experimental power supply voltage was increased to approximately 20V.
Figure 11 The
amount of current generated at the 20.01V power supply is equal to 0.58A.
Figure 11 The amount of current that occurs when the power supply is
approximately 20.01V, equal to 0.58A, with an error of 0.08A.
Figure 12. The
resulting modulation pulse signal.
Figure 12 shows the characteristics of the pulse width modulation signal, the duty
cycle will decrease. and a small error value of 0.08A
Figure 13
Characteristics of the experimental project
In Figure 13, all the circuits used in the test are connected and connected
together. During the experiment, the 10 ohm resistor (load) was quite hot so had to
use a fan to blow the heat to reduce the heat.
/*************************************************** *******
* PID Basic Example
* Reading analog input 0 to control analog PWM output 3
* Application for Current Contance Control
************************************************** ******/
#include <PWM.h>
#include <PID_v1.h>
void setup()
{
Serial. begin(9600);
InitTimersSafe();
bool success = SetPinFrequencySafe(3,frequency);
void loop()
{
Input = analogRead(A0);
// Serial.println(Input); // Debuger Input feedback
myPID.Compute();
// analogWrite(PIN_OUTPUT, Output);
pwmWrite(3,Output);
// Serial.println(Output); // Debuger PWM Signal Driver MOSFET
From the figure above, Figure 14 is the nature of the circuit connection. used in
experiments by devices that will function as switching It is a power MOSFET
STP105N3LL which will control signal as pulse modulated from pin 3 and use a 1
ohm 1 watt resistor to detect the current that occurs. The voltage drop across this
resistor will pass through the low pass filter circuit again before feeding it to pin
A0, which this pin will be a feedback pin.
Another project for controlling the speed of DC Motor (DC Motor) and using PID
Control as an algorithm to control the speed. by detecting the signal of the rotary
encoder, which is attached to the motor This will reduce the time spent on selecting
and installing a rotary encoder. The motor used will be the model CHR-GM25-
370, using a voltage of 12Vdc only.
Figure 1.
Characteristics of the connection on the experimental board.
Picture 2: Circuit
connection between Arduino UNO board and DC motor driver board.
In Figure 2, the circuit is connected between the processor board and the motor
driver board. In the part of the motor driver board, it receives all power from the
power supply adapter. To make it easier to experiment and have enough current to
use in this whole circuit.
Figure 3. Power
connection between DC motor and motor driver board.
In this project, for switching the direction of rotation of the motor. Let us swap the
wires connected between the motor driver board to red and black wires to the
motor connector. red and white can be used We will be able to see the nature of the
encoder signal that occurs from this direction switch.
int time_H;
int time_L;
intFrequency;
int encoder0PinA = 2;
int encoder0PinB = 3;
int encoder0Pos = 0;
int encoder0PinALast = LOW;
int n = LOW;
float t_period;
int sampleRate = 10;
double Setpoint, Input, Output;
double Kp=1, Ki=5, Kd=0.001;
PID myPID(&Input, &Output, &Setpoint, Kp, Ki, Kd, DIRECT);
void setup()
{
Serial.begin(9600);
pinMode (encoder0PinA, INPUT);
pinMode (encoder0PinB, INPUT);
pinMode (PIN_OUTPUT, OUTPUT);
Setpoint = 1000;
myPID.SetSampleTime(sampleRate);
myPID.SetMode(AUTOMATIC);
Serial.print(" ");
Serial.print("Test SP = ");
Serial.print(Setpoint);
Serial.print(" Hz");
delay(1000);
analogWrite(PIN_OUTPUT,40); // Start up DC Motor
delay(100);
}
void loop()
{
n = digitalRead(encoder0PinA);
if ((encoder0PinALast == LOW) && (n == HIGH)) { // Test For Signal A and B Direction
if (digitalRead(encoder0PinB) == LOW) {
// encoder0Pos--; // Recommend not to use
Serial.print(" CW, "); // Mark Direction CW
} else {
// encoder0Pos++; // Recommend not to use
Serial.print(" CCW, "); // Mark Direction CCW
}
time_H = pulseIn(encoder0PinA,HIGH);
time_L = pulseIn(encoder0PinA,LOW);
t_period = time_H+time_L;
t_period = t_period/1000;
Frequency = 1000/t_period;
if(Frequency>3000){ // Set error Variable for t_period more
Frequency = 0;
}
Input = Frequency;
Serial.print("PV = "); // Recommend not to use
Serial.print(Input); // Recommend not to use
myPID.Compute();
analogWrite(PIN_OUTPUT, Output);
Serial.print("PWM = "); // Recommend not to use
Serial.println(Output); // Recommend not to use
}
encoder0PinALast = n;
}
Experiment board DC Motor Speed
Control with Arduino UNO
by nattaponPosted on31/08/2021
This project is to build a training kit for controlling DC motor speed (DC Motor
Speed Control) with a small internal brushless motor and using a voltage of
24V/0.1A. Arduino UNO size 5Vp-p to control the motor drive size 24V to suit
both the voltage and motor driving current. This motor can be purchased from
various disassembly parts stores. at a very affordable price
Figure 1. Characteristics of the DC motor used in the experiment (1).
Fig. 6 Characteristics of the positioning of the mounting devices. Because the holes
are drilled for fixing the board and the motor.
Figure 7 Start drilling holes in the clear acrylic sheet for fixing various devices.
Figure 8 Attach the motor and Arduino UNO controller board to the clear acrylic
sheet.
Figure 7 and Figure 8. After drilling the holes, fix the motor and the Arduino UNO
controller board to the clear acrylic sheet and attach the rubber buttons at the
bottom of the 4 corners to make it easy to place on the table and reduce vibrate
during the experiment
Figure 10 Mount the motor driver board on the clear acrylic sheet.
Figure 10 shows the characteristics of mounting the motor driver board on a clear
acrylic sheet. and will continue to connect various signal cables For motor control
such as power supply to the motor about 24V, pulse width modulation signal wire
and ground wire.
/*
Program Test Board DC Motor Speed Control with Arduino UNO
DC Motor : 24VDC / 0.1A
MCU : Arduino UNO
Dev by : www.electronicsDNA.com
Date : 21-8-64, (V.0)
*/
#include <PWM.h>
int led = 9;
int input = 2;
int time_H;
int time_L;
float t_period;
float Frequency;
//int Setpoint = 120; // Set point Rang 400-700
double Output_PWM = 0;
// int error = 0;
int32_t frequency = 25000; // frequency (in Hz)
void setup() {
InitTimersSafe(); // initialize the digital pin as an output.
pinMode(led, OUTPUT);
pinMode(input, INPUT);
Serial.begin(9600);
bool success = SetPinFrequencySafe(led, frequency);
//if the pin frequency was set successfully, turn pin 13 on
if(success) {
pinMode(13, OUTPUT);
digitalWrite(13, HIGH);
}
}
void loop() {
Output_PWM = 20;
pwmWrite(led,Output_PWM);
delay(5000);
Output_PWM = 150;
pwmWrite(led,Output_PWM);
delay(5000);
Output_PWM = 250;
pwmWrite(led,Output_PWM);
delay(5000);
}
Figure 14 shows the circuit characteristics for a DC motor speed control training
set. Which will be in the part of the Arduino UNO control board (left side) and part
of the buck converter circuit (right side) to drive the motor and receive the pulse
video modulation control signal
Figure 15 Characteristics of the completed DC motor speed control training set.
For this project, it is a small project. Another type for use in speed control for a
small DC motor. We can control the general speed (Open-Loop Control) by
adjusting the pulse width modulation signal from the Arduino UNO controller
board as we want, which is a basic form. For the next part, we will continue to
develop a training set for DC motor speed control. by adding a circuit to detect the
rotational speed of the motor So that we can experiment in a closed control
(Closed-Loop Control) or a feedback control system (Feedback Control) in another
way.
Reference
Build the Simple Tachometer Sensor
for DC Motor Speed Control
by nattaponPosted on02/09/2021
Fig. 2 shows the size of the small size optical sensor implemented. And can design
a circuit to be used with the motor speed control training set.
Figure 3 Preliminary experiments before use
Figure 4 and Figure 5 show how to prepare a general-purpose PCB to assemble the
circuit to form a module and make it easy to install. In Figure 5, the PCB is cut to a
smaller size to fit the sensor.
Figure 6 is the assembly of various devices on the PCB and the nature of
assembling a sensor module for use.
Figure 7. Wiring to the sensor module.
Figure 8 shows the characteristics of the assembled sensor module and can be
used.
Figure 9. Assemble some circuits on the motor driver board.
Figure 9 shows some parts of the circuit on the additional motor driver
board. Which in this part will adjust the signal level (Signal conditioner) between
the signal received from the sensor and the signal that will be sent to the control
board to be appropriate
Figure 10 Prepare to fix the module to the base with copper wire.
Figure 11. The appearance of the module fastening to the support base.
Figure 10 and Figure 11 show how the sensor module is attached to the holder. In
this case, No. 16 (AWG) copper wire is used to mount, because we can easily
adjust the distance between the detection position and the inclination of the sensor
bar. to get the correct tachometer signal
Figure 12 Overview of the assembly with the motor speed controller project.
Figure 13 shows the use of black electrical tape to attach to the winding rotor. in
order to generate a pulse signal while rotating However, when the sensor detects
the position of the black band, it will result in the signal on the output side being
logic 1 and vice versa, if the black band is not detected, the signal on the output
side will be logic 0.
Figure 14 and Figure 15 are the characteristics of attaching the black band to the
rotor. In this experiment, it will be attached together in 4 points in the opposite
manner and the distance is as close as possible. And when experimenting with the
motor to rotate, we will get the signal generated in Figure 15, in which the figure
will measure the signal at the output of this speed detection circuit.
Figure 17. The circuit designed and used in the experiment is part of the motor
speed control training set project. (outside the blue box) in which the blue box is
the part of the motor speed detection It is mainly powered by an optical sensor
(TCRT5000) and a transistor (2N4401).
Figure 18 Characteristics of the experimental project Tools and equipment used
For the project to create a speed detection circuit for the motor, this is a small
project. Another one that requires very little equipment to build. But it will take
some time to adjust the signal detection distance to get the correct signal. Including
finding ways to mount the modules that are flexible for later use. However, the use
of optical sensors this time may be useful to readers for various applications.
Simple PID Adaptive Tuning for
Mini Fan Speed Control with
Arduino UNO
by nattaponPosted on08/03/2022
Figur
e 2. Specification and characteristics of the experimental fan.
Figure
3. Characteristics of the circuit for experiment.
#include <PID_v1.h>
#define PIN_INPUT 0
#define PIN_OUTPUT 3
void setup()
{
//initialize the variables we're linked to
Input = analogRead(PIN_INPUT);
Setpoint = 500; // SP Test = 300, 500, 700
pinMode(13, OUTPUT);
digitalWrite(13, LOW);
delay(3000);
void loop()
{
Input = analogRead(PIN_INPUT);
myPID.Compute();
analogWrite(PIN_OUTPUT,Output);
}
Fig.
5 Experiment 1 The PWM signal drives the fan when SP = 300 is set.
Fig
ure 6 Experiment 1 The amount of current supplied to the circuit when SP = 300
Fig
ure 7 Experiment 2 Voltage drop across the fan when SP = 500
Fig
ure 8 Experiment 2 The PWM signal drives the fan when SP = 500 is set.
Fig
ure 9 Experiment 2 The amount of current supplied to the circuit when SP = 500
In Fig. 7 to Fig. 9 are Experiment 2 with setpoint set to 500 and measure the output
signal at pin D3 in Figure 8 (CH1 has increased frequency) and at the measurement
channel 2 (CH2) it will be signal. feedback which will increase the voltage to
2.45V as well, the amount of current supplied to the fan will increase to about
300mA, shown in Figure 9.
Fig
ure 10 Experiment 3 Voltage drop across the fan when SP = 700
Fig
ure 11 Experiment 3 The PWM signal drives the fan when SP = 700 is set.
Fi
gure 12 Experiment 3 Amount of current supplied to the circuit when SP = 700
In the last experiment, Fig. 10 to Fig. 12, Experiment 3, set the setpoint value to
700 and measure the output signal at pin D3 in Fig. 11 (CH1 has increased
frequency) and the signal channel 2 (CH2) as a feedback signals. This will increase
the voltage to 3.45V and the amount of current supplied to the fan is about 400mA,
shown in Figure 12.
For experimenting in this project, we will observe not many PID Adaptive Tuning
control results because the fan will only adjust the speed to the setpoint without
much load and use the display of LED (D13) to reveal the change of the new
control parameters. But in case we want to apply this control method to systems
with more loads, it will help to see the difference clearly. In part, the admin has
brought various devices. enough to come to design and test the project In order to
give a preliminary idea to the readers first.