Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Fryer Controller using PIC18F4620

Status
Not open for further replies.

lloydi12345

Member
Hi ETO, I'm back and so glad to stick with this site again. I just graduated from our university and I'm newly hired in a company developing controllers which I really wished doing after graduation. I'm doing micro-controller projects a lot since college. It has been my passion and I really love making them. I would like also to tell you that this post is a very long one. I hope you can still be with me :)

This is my first time to work and I am given a ("very complicated" - for me) task to do. The task is to continue the previous project made by a previous engineer which is a Fryer. I am the only one working for this area and I have no group-mates with me. I am only good in programming micro-controllers and designing basic DC circuits for digital. During my studies I didn't go into deep details about circuits related to analog so I think I need to research more and study harder. The controller's function are temperature monitor for the cooking oil on the fryer, timer, alarm and change the temperature on the oil on certain time by controlling a gas valve to turn it on and off. The project has a PIC18F4620, keypad buttons(for products), gas valve, piezoelectric speaker, 4 digit seven segment and Resistance Temperature Detector(RTD).

For me it would be hard because I find it difficult to edit a project designed already by someone (which I don't know, haven't met yet and have no communication at all) than creating my own or starting from scratch in designing the circuits and programming the micro-controller. Currently the controller is already built and I am tasked to troubleshoot it because it is already working but only returned because of defects. I tried asking the superior if I can build my own but he said I only got 3 months to be evaluated for my performance. He doubts that I can finish the project in 3 months if I will start again from the bottom. I started the project from July 1. He said in order for me to finish it quickly I should troubleshoot the controller board by removing, adding or replacing the components there. He said to me that after finishing this project then that will be the right time he would allow me to build my own from scratch and he will give me lots of time for it. Currently the fryer controller can already cook foods but sometimes the foods are overcooked or undercooked. I understand now his program codes like 85% of the routines and also the same percentage of knowledge on his designed circuit.

As a starter I planned a lot and my first step is to break down all the project by sections. First will be to check the temperature displayed if it is accurate. What I did is reduce the software codes and remove the routines not related to the temperature. I only enabled the 7seg display routines and temp related routines. I managed to let it work. I am using a Tecal Calibrator which has a built in temperature display (newly calibrated) to test with my RTD.

I decided first to take tests on a stable temperature. I set only 280 deg F on the calibrator and I am not changing it at any times.

Here are my observations: (No fryer used yet but only Tecal Calibrator with temperature display)

1st Situation:
I tried using the micro-controller in a room temperature with no proper ventilation. Inserted the RTD in the calibrator and the temperature shown is fluctuating. If the temp shown on the calibrator is 280 deg F the micro-controller showed jumping values like 275, 278, 269 (lowest), 281 (highest) and so on like every 200-500ms and the temperature intervals are not the same.

2nd Situation
I tried using the micro-controller in a room where the air conditioner is producing very low temperature. The temperature shown on the controller is not fluctuating rather it is steady and not jumping. The temperature only changes every 1-2 sec but by only 1 or 2 temperature intervals.

The first problem is that the controller takes time to reach the temperature displayed on the Calibrator (for both situations) from the off mode of the controller to the on mode. It takes around 5-15 minutes before it reaches the nearest temperature it can show when the calibrator's temperature is stable at 280 deg F. Another problem is that the temp has around -1 to 10 deg Fahrenheit error on the 1st situation while on the second is a stable 2-5 deg Fahrenheit error.

What I think is that some components used were not in industrial grade meaning most of the components plugged were cheap and can't withstand the temperature inside the controller box. I think changing them to the highest quality will improve the results of the temperature. Another thing is that I think there are internal noises available and I have seen capacitors missed like caps beside the Vcc and Gnd of the PIC and also on the LM358 IC.

I really don't know why the previous engineer decided to fabricate it already on a PCB when there are errors. For me he rushed doing it just to present something to the superior that can cook even if there are still a lot of errors.

My superior also said that if I can prove that the controller board that the previous engineer made is inappropriate and has a lot of mistakes then he will give me a chance to extend my deadline and construct my own but I think I can't prove it without any of your help. I'll be doing research for the meantime while hoping for kind people out there to offer even just a little light for me. Can you help me determine the problem of the slow response time and the environmental temperature issue? Is there something I have to add on the circuit?

This site has been of help for me for almost a year and I hope I can still have same support technically and maybe a spiritual support for a first time worker :) like me. Thank you a lot.

I attached the whole schematic of the project on mediafire. I don't know why I can't attach zip files here on ETO. Feel free to check it. Also if you want to see the project codes just tell me.

**broken link removed**

EDIT: I added images on my reply for this thread below for your convenience.
 
Last edited:
Could you please upload it as a pdf/png/gif file (much easier for most of us to see than a rar file)?
Is it just the RTD which is at 280F, or the whole calibrator/controller?
 
Last edited:
Yes, please put the schematic files in a more common format. I can't read a rar file.
 

Attachments

  • forum1.zip
    36.5 KB · Views: 124
Last edited:
That doesn't help me. I can't read a Proteus file either. ;)
 
Neither can I!
 
Thank you for your replies alec_t, crutschow and ericgibbs. Sorry for the late response ( only got Sunday as my day off ) and the trouble I made. I attached now an image file. I divided the schematic in 3 parts since it can't fit in just one screen.

Could you please upload it as a pdf/png/gif file (much easier for most of us to see than a rar file)?
Is it just the RTD which is at 280F, or the whole calibrator/controller?
The Tecal Calibrator which I used for testing is at exact 280F shown on its panel. I inserted the fryer controller's RTD in it and the 7 segment displays slightly different temperature.
 

Attachments

  • Part 1.JPG
    Part 1.JPG
    250.2 KB · Views: 164
  • Part 2.JPG
    Part 2.JPG
    259.6 KB · Views: 178
  • Part 3.JPG
    Part 3.JPG
    276.8 KB · Views: 156
Last edited:
A couple of things, really fast:

1. C3 is WAY too big for it's location.
2. Lack of bypass caps on OP amps etc.
3. You mentioned RTD. Could it be a thermister? They usually have a 100 ohm resistance at 25C They are usually 3 or 4 wire, not 2.
What are the characteristics?
 
1. C3 is WAY too big for it's location.
I really don't know why he used a great amount of capacitance there. I usually place 100uF elec cap there but I don't know if it would be right.

2. Lack of bypass caps on OP amps etc.
Yes, I will be placing like .100 uF ceramic caps on the OP amp and the PIC

3. You mentioned RTD. Could it be a thermister? They usually have a 100 ohm resistance at 25C They are usually 3 or 4 wire, not 2.
I don't really know what it is. I tried googling the label on it but can't find one. The sensor is already old (like for 2 years already) and we got lots of them here. The people here can't find a datasheet for it and can't remember if there's a datasheet included. At room temperature with no air conditioner it has a resistance of 75k ohms. The sensor looks like this one on my attachment. It's from this website at the bottom part.
 

Attachments

  • pitcoprobe.jpg
    pitcoprobe.jpg
    17.9 KB · Views: 155
Last edited:
The 470 should be on the input side of the regulator. Even 100 uf is too large on the output side. Take a look at the datasheet. Probably a 1 uf electrolytic and a 0.1 ceramic.

The 0.1 ceramic sounds good for the PIC. The OP amp, probably a 1 uf polyester.

That would be a thermister.

Tell me about your 24 VDC supply? Commercial?

Find out if one side of the thermister is connected to the sheath.

Put like a 0.1 metalized poleyester between pis 6 & 7 of the LM358

Take a scope and look around at the outputs (AC coupled) of the OP amp and the power supplies
 
Looks like a resistance thermometer (RTD) hooked up in a Wheatstone bridge.
See Here; https://en.wikipedia.org/wiki/Resistance_thermometer

I really have no idea about it. But I've read this wiki last time well I think it is. I just can't see an exact product details about my sensor on the net.

The 470 should be on the input side of the regulator. Even 100 uf is too large on the output side. Take a look at the datasheet. Probably a 1 uf electrolytic and a 0.1 ceramic.

The 0.1 ceramic sounds good for the PIC. The OP amp, probably a 1 uf polyester.

That would be a thermister.

Tell me about your 24 VDC supply? Commercial?

Find out if one side of the thermister is connected to the sheath.

Put like a 0.1 metalized poleyester between pis 6 & 7 of the LM358

Take a scope and look around at the outputs (AC coupled) of the OP amp and the power supplies

Yes, having a look on the datasheet it says .1uF ceramic cap and il just place 1uf elec cap on the 7805's output side. May I ask why polyester than ceramic?

About the 24VDC supply, the previous designer used the 220 AC socket then 2 wires connected to a small transformer like the image below. Then 24vdc comes out. I don't have any idea about the purpose of the 2 pairs of 6 series connected 1N5402 diodes where the input is 24Vdc and the output is also 24Vdc.

I'm really not sure if it's a thermister or what. :(

What do you mean sheath? Are you referring to the L shaped metal rod? I tried testing both terminals with the rod but none of them is connected to the rod.

Okay I'll try placing polyesters.

I tried connecting the output of the lm358 to the oscilloscope and i can't see any noise. Haven't tried yet on the 7805 but I think there would be because of lack in caps.
 

Attachments

  • 220px-Transformer.filament.agr.jpg
    220px-Transformer.filament.agr.jpg
    10 KB · Views: 170
Last edited:
The choice of bypass caps is a long one because each cap has it's own purpose and characteristics. Ceramic is generally good for high speed switching. The OP amp should have neither. Ceramic for the regulator would be OK and they are cheaper. There are times you'll actually see a tantalum+ceramic+polyester being used together as a bypass cap.

The suggested polyester in the FB loop would lower the Bandwidth of the OP big time, and make it less prone to oscillate.

The use of lots of diodes is to reduce the input voltage to the 5V regulator by n*0.6 volts. It might not be a smart move. You could see if any improvement would happen if you operated it off a regulated 24 VDC supply and a regulated 5V supply at least for testing purposes. Placing a transorb and a reversed biased diode for spike suppression may not be a bad idea after the rectification. Power line spikes and RF might be getting in and disrupting things, thus good operation would be dependent on the environment. You also might need a power line filter. These are just ideas at this point.
 
Last edited:
Okay, I'll try your advices k.i.s.s. about the caps. Do you think my circuit setup for the RTD or thermister so slow? It takes 10-20 mins. before the nearest current temperature is determined.
 
Look at A11 with a DVM and compare to the PIC's value. You need a stable temperature read and you don't have that. Not even with a bath apparently. All the stuff mentioned could impact that. AC line fluctuations and nearby equipment could affect that. No, I don't like the power supply, but that usually is a significant cost.

You mentioned a gas valve.

Slowness is basically going to be a function of thermal mass relative to the BTU/hr input. You won't get any faster than if the gas valve is fully open. Right?

The next part of temperature control is how fine can you control the gas valve. It could be proportional or continuously variable, it could be PWMed, it could be ON/OFF. There will be a cycle time associated with the latter. I don't know.

Proportional control P= (Tm-Ts)*k results in a Tm (temperature measured) < Ts (temperature Setpoint)

Usually this is solved by using PI or PID control. Both are relaitively easy to do. Finding the constants, not so easy. Integral control has the ability to make the setpoint and MV (measured value) agree. Derivative control tends to prevent overshoot. If the proportional constant is too high, the system oscillates. I did these 20+ years ago. You must implement reset windup elimination in software which isn't hard.

The time-temperature response of your system from rest to setpoint at full power wouldn't hurt to have.
 
A small point but for the circuit to work properly Q1 must be a PNP, not an NPN as shown.
 
Look at A11 with a DVM and compare to the PIC's value. You need a stable temperature read and you don't have that. Not even with a bath apparently. All the stuff mentioned could impact that. AC line fluctuations and nearby equipment could affect that. No, I don't like the power supply, but that usually is a significant cost.

You mentioned a gas valve.

Slowness is basically going to be a function of thermal mass relative to the BTU/hr input. You won't get any faster than if the gas valve is fully open. Right?

The next part of temperature control is how fine can you control the gas valve. It could be proportional or continuously variable, it could be PWMed, it could be ON/OFF. There will be a cycle time associated with the latter. I don't know.

Proportional control P= (Tm-Ts)*k results in a Tm (temperature measured) < Ts (temperature Setpoint)

Usually this is solved by using PI or PID control. Both are relaitively easy to do. Finding the constants, not so easy. Integral control has the ability to make the setpoint and MV (measured value) agree. Derivative control tends to prevent overshoot. If the proportional constant is too high, the system oscillates. I did these 20+ years ago. You must implement reset windup elimination in software which isn't hard.

The time-temperature response of your system from rest to setpoint at full power wouldn't hurt to have.

About the gas valve, the current design is just using on and off intervals and no PWM is involved. Thank you for pointing out lots of details on how I will deal with it in the future. They are not accepting a 5 mins. delay on temperature-time response since it is the cause of undercooked and overcooked foods. Will this force me to try another circuit?

For now I think I should focus first on the temperature detection problems because now errors are getting massive with your explanations :) Did you mean that I should try first using a well regulated 25v source from a device perhaps than using this transformer he made? How long did it take you to finish a temperature reader project?

What do you also mean on windup elimination?


I really would like to suggest to my superior to start my own design because I've noticed that there are lots of problems. I think drilling and soldering additional components on this board might destroy it or even end up not operating. I hope I can gather more info. from people like you to back me up on my suggestion when he asks me.
 
Last edited:
.............
Proportional control P= (Tm-Ts)*k results in a Tm (temperature measured) < Ts (temperature Setpoint)

Usually this is solved by using PI or PID control. Both are relaitively easy to do. Finding the constants, not so easy. Integral control has the ability to make the setpoint and MV (measured value) agree. Derivative control tends to prevent overshoot. If the proportional constant is too high, the system oscillates. I did these 20+ years ago. You must implement reset windup elimination in software which isn't hard........
Just my opinion but I think a digital type control system such as one using Fuzzy Logic is more appropriate for a microprocessor that PI or PID, which is basically using a microprocessor to simulate an analog control loop. You said you did this 20 years ago, likely as an analog loop. The problem with PI(D), as you noted, is that determinng the PID circuit gain and time constants required to prevent oscillations and generate a stable system is difficult, especially if you don't know the system response times and gains, as is the case here. It's easier to determine the needed control parameters in a Fuzzy Logic loop, more obvious how to tweak the loop if it's not working properly, and things like preventing integrator windup are not a concern. The Fuzzy program basically consists of a series of simple If-Then-Else loops, something that a microprocessor readily performs.
 
I'm suggesting a commercial 5V power supply and a commercial 24 V PS just to prove a point. Tap into the circuit at the proper spots and probably your problems will go away.
Your then left with a few bypass caps and one suggested BW limiting cap. Most of the complaints were power supply related. I'd start there.

I have no idea what the requirements are, but this is the idea: https://www.automationdirect.com/ad...l power supply&utm_campaign=dc+power+supplies if you don't have a lab supply.

Linear supplies are usually out of favor these says.

Bypass caps are a part of good design, but most of the time they don't break one. An EMI filter may be regulatory and basically prevents the PIC oscillator from radiating into the power line and stuff nearby from getting in.

That transistor didn't look right, but I concentrated on the other stuff.

It wouldn't be so bad if you could say it needs a new power supply, would it?

Other stuff, like surge suppressors add cost, but contribute to reliability and insurance issues. It's one think if my french fries aren't done and quite another if the gas valve sticks.

You asked about the PID stuff. The first took 2 people about 9 months and one was me. The PC didn't exist then. 7 PID loops with recipie programming, data logging that did simultaneous voltage, current, temperature and power control with shorted thermocouple detection using computed energy when heating up. The disc drive was bigger than desktop PC, but not as big as the 64 MB removable disk drives the size of a washing machine that I worked with. It was written in Fortran running in a Foreground/Background real time OS.

the latter PID loop was to use an RTD sensor that was mounted to the device being controlled, but i was changing the setpoint of an environmental chamber from -80 to 200 C with basic over an IEEE-488 bus. The PC was in it's infancy. This was using an HP-86 computer.
 
Last edited:
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top