Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

PID Temperature Controller using PIC16F886

Status
Not open for further replies.

ajit_nayak87

Member level 5
Member level 5
Joined
Oct 30, 2017
Messages
86
Helped
1
Reputation
2
Reaction score
1
Trophy points
8
Activity points
981
Dear all.

I am looking for simple Circuit & C code to develop PID controller using PIC16F886/887.I would like to connect PT100/jtype & ktype sensor using temprature measutrementView attachment PT100.pdf

I have attached Pt100 sensor connected to MCP3425 with PIC16f886. i could able to read value using MCP and able to convert to actual degree. The i/p given through calibrator and same reading observed .


Now i would like to implement PID Logic in this.

1) How can i derive Kp,Kd,ki values & equations?
2) how can i calculate % error calculation?
3) simple c code for PID example.
4) any simple circuit that can use for PID application for temperature controller
5)more easier method that can i switch between , jtype, ktype, pt100 sensor
 

Library:
https://bitbucket.org/Virviglaz/mylibraries/src/master/Common/PID.c
https://bitbucket.org/Virviglaz/mylibraries/src/master/Common/PID.h
Usage (init):
Code:
PidType PID;
  PID_init(&PID, 1, 0.05, 0.25, PID_Direction_Direct);  //èíèòèàëèçàöèÿ ÏÈÄ
  PID_SetMode(&PID, PID_Mode_Automatic);
  PID_SetOutputLimits(&PID, PWM_Step, PWM_Period);
PID processing:
Code:
    PID.mySetpoint = SetTemp;    
    PID.myInput = RealTemp;
    PID_Compute(&PID);    
    SetPWM = (u16)PID.myOutput;
Kp, Ki and Kd values you define experimentally.
 

Hi,

There is plenty of explanations woth code around.
Search the internet and with a quick view check out if it looks professional.
(Sources from manufacturers like microchip, or other big companies are reliable. Look for one with detailed descriptions and detailed mathematics - even if you don't understand everything by now)

Then try to use and modify the code.
Contact us if you need help, but show your code, tell us what you did understand, and tell us exactly what you don't understand)
Don't post global questions, because a forum can't replace school and can't replace the will to learn)

To your questions:
1) There are tutorials on how to do this. But first make the code to run. Use initial values: kp =1, ki = 0, kd = 0, this gives a simple proportional regulation loop. If you see oscillations, then reduce kp.
2) what exactly do you mean? What's the use of it?
Generally: percentual values are relative values:
percentual_error = error (absolute) * 100% / reference_value.
What is your "reference_value"?
3) more than enough code available. But what is "simple"?
A PID needs a timed (usally interrupt driven) regulation loop.
If you already know what this means, and know how to code it: every PID code may be simple for you.
If you don't know this, then you need to learn it.
4) This usally is one of the first things you need. You need an application. You need specifications. (Like regulation speed. A temperture regulation of a room may need a calculation every 300s, a soldering station every 1s, an industrial high speed plastics welding solution maybe every 0.05s)
Then you need the hardware for this.
In simplest case any microcontroller with ADC input and PWM output will do.
5) start with the simplest: a PT100. Circuits are available. Thermocouple is another story. Do this after your PID is working satifactory. Read through thermocouple theory. I recommend to use ready to buy ICs...with datasheets and application notes.

Klaus
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top