Skip to content

haris-mujeeb/LED-Brightness-Control

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

38 Commits
 
 
 
 

Repository files navigation

Components used:

Name
NodeMCU ESP8266
KY-018
White LED
Jumper wires

Procedure:

First Generate a step response for the system: image

1. Saving the sensor value for the step response using PuTTY or RealTerm:

image

Starting UART communication using RealTerm:

Ref: https://miscircuitos.com/plot-real-time-signal-coming-arduino/ image

We open the Capture tab and select the appropriate settings:

image

The data is saved in the designated location and file:

image image

2. Finding the approximate curve manually (initial guess):

We can model this setup as a 1st order with dead time (PT1-elemet + Time Shift),

image

Thus there are three important constants:
Gain K (Rise in Output Value by Rise in Input Value)
> K = (151-1003)/(1024-0) = -0.832

Time Constant Tau ( It takes 5 Tau to go from initial point to 90% steady state value.)
> Tau = 1003 - (1003-151)*0.9 = 236.2
> Tau = 20ms (from data)
> Tau = 4ms

Dead Time T = 0ms (from data)

3. Simulating the initla model in MatLab and Comparing it with the experimental data:

Generating the Transfer Function in with above calculated constants:

image

Modeling on Simulink:

image

Scope:

image

Comparing the data with experimental:

image

4. Using non-linear Curve fitting using Python SciPy Library:

Ref: https://www.youtube.com/watch?v=1H-SdMuJXTk&t=237s

We find following constant with least square method:

image

the new constants in the Simulink Model:

image

New Curve vs Experimental Data

image

5. PID Tuning:

Creating a PID Model in Simulink:

image

Tuning the Plant using PID Controller Block:

image

Block with new values for Controller Parameter:

image

Result:

image

About

LED Brightness Control

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published