3 Attachment(s)
4 Channel Thermostat using PID loops
Guys,
Over the past few months I've been working with DT on a project which I will now share with the PBP community. Darrel put together 99% of the code and routines (some of which have already been published on his website and here on the forum). My contribution was constructing the test equipment and running the real life trials and then tweaking the values to get the best accuracy for the equipment used.
Background
I keep reptiles, well snakes to be exact. These need to be maintained in a controlled environment, with a steady heat source at one end of their enclosure, which needs to be thermostatically controlled.
http://www.picbasic.co.uk/forum/atta...9&d=1266672273
Whilst there are already commercially available pulse proportional thermostats on the market, these are single units. I really wanted to use one unit that had 4 separate pulse proportional thermostats which would cut down on lots of wiring etc.
The original idea was to have 4 pots to set the target temperature for each vivarium with the temperature displayed on an LCD, however for ease of testing we opted for using hyper terminal and a simple RS232 connection.
Development
I have an EasyPIC5 development board, and to make life simple purchased a few of their add on modules such as the 1307 based real time clock, pot board, and several connection boards to connect the solderless breadboard to.
http://www.picbasic.co.uk/forum/atta...8&d=1266671836
To test the code and develop the project as we went along I constructed a box from 18mm melamine board, approx 400mm x 400mm x 200mm (LWH) and installed a 50w powerplate (a flat panel ceramic heater) to the roof inside the box. A 240v 4amp solid state relay was used as the means to turn the heater on and off, especially as the opto isolation could be driven directly from the PIC.
DS18B20's were used for the sensors, and one was connected via lengths of wire to the EasyPIC5 board. The sensor was placed inside the box which was placed on a flat surface. The SSR connected to the mains and it's input connected to the EasyPIC board too.
Darrel produced the 1st version of the PID code to drive just one channel. I then compiled and ran it to see how it performed. Over the course of several evenings I managed to get the values tweaked enough to maintain a stable temperature that would drift no more than 0.5 a degree in the course of the evening.
Armed with the feedback, DT then went on to work on multiple channel PID loops, and after a few weeks of frantic PM's between him and Henrik came back with some further code for me to test and try. The result was that after some further tweaking at my end, we managed to have 4 independent channels all running at the same time and in the test rig, maintaining a constant temperature.
Future Development
The plan was to now develop the fancy options such as using the clock module to program a night time drop in temperature if required, menu buttons, and possibly a means of monitoring / setting via software on a computer, even to storing temperature data in an eprom for use with the PC software. However this meant porting the code to a different chip and so Darrel suggested the 18F4550.
We got as far as having testing out the USB coms, and getting the PID loops running, however due to personal reasons we've had to halt development of this side of the project, at least for the present time.
I'm now going to concentrate on developing a prototype PCB based on the 16F877A code, which has achieved the main goal, which was 4 independent pulse proportional thermostats. I'll use this prototype in the two vivs that house my two Royal pythons, which was my original intentions. However if anyone would like to contribute and take this project further, possibly to its full potential then please feel free to drop me an e-mail or PM. I've attached the code and all the includes for use in MCS (PBP 2.60 is required).
In the meantime I would like thank Darrel for all his hard work and contribution to the project. It's guys like him that make this forum a pleasure to visit. Whilst I may not entirely understand the complicated maths that goes on in a project such as this, I've learned a lot by way of his examples. - Darrel, Thank you !
Do not use image in post #11
Guys,
Normally when strip boarding I build as I build up the board from the schematic as I go along, and often test each section, ie get the LCD working, then the sensors, then the switches, then the RTC etc. However this time I used an application to design the board and having followed it found that the board contains an error somewhere as the LCD doesn't work. I'm no longer able to edit the post to remove the image so..
DO NOT USE THAT IMAGE
2 Attachment(s)
MKII prototype - Low Voltage Side Works !
Well I've just completed the two boards in the MKII prototype, and was pleased to find that when I plugged the mains lead in there was no bang, no smoke but the thing actually powered up and displayed temperatures on all 4 inputs with the LEDs flashing away indicating the outputs were also running.
All that's needed now is to make up the sensor leads properly, fit the correct 3 core cable for the supply and hook up the output board to the controller via 7 way cable - then install it and monitor how it performs...
I'll post up a few more photo's as the installation progresses.
http://www.picbasic.co.uk/forum/atta...0&d=1279223804
Re: 4 Channel Thermostat using PID loops
Great post! It must be cool to have a history showing your project going from start to finish. Just curious, did you end up using the Triacs and Optoisolators for cost, size or both? I have a HV control project and I am considering the difference between the two. Thanks.
Re: 4 Channel Thermostat using PID loops
Hi,
Yes I opted for the isolators and triacs for both cost and size.
Re: 4 Channel Thermostat using PID loops
Has the incPID_mc.pbp file been modified?
I can see several commented lines.
Has Henrik posted this file somewhere on the forum?
1 Attachment(s)
Re: 4 Channel Thermostat using PID loops
As far as I'm aware there was no modifications since the original one posted at the start of the thread. Here's the version I have used in all subsequent builds (change the TXT ext to pbp)
Re: 4 Channel Thermostat using PID loops
Thought I should update this thread with some more images of the finished MKII prototype which has been running now for just over a year now without any issues.
http://micro-heli.co.uk/MK2%20back.jpg
From the back, and
http://micro-heli.co.uk/MK2%20front.jpg
From the front.
The RS232 connector on the board is obsolete, and is connected to a panel mounted socket on the rear. I was thinking of adding one of those new 232 > USB TTL cables to make connectivity easier, but to be honest I've only ever needed to adjust the time from GMT to BST and back, which was easy from the unit rather than from the PC, so haven't bothered.
Re: 4 Channel Thermostat using PID loops
To many people like me, the result is almost a work of art (grin). I'd love to see some detail on how you mounted the LCD to the front panel...
Happy Holidays.
Cheerful regards, Mike
Re: 4 Channel Thermostat using PID loops
Over the years I've received several requests regarding using this code for a commercial product. Whilst I had lots of request there were two deciding factors why it was not pursued. The first was the the fact that others had contributed to the development of the code, namely Henrik and Darrel, and, at the time of development it was for my own private use with no financial gain. It may well be that they would have no issue if the unit was made and sold as a hobby rather than business, but I respect that without formal signed agreements it would be the wrong thing to do. The post here details the development and the code was (is) available as is for others to learn and develop their own PBP projects. If parts of the code are used, then please respect the condition in the header and include all contributors in your code.
The second reason is that any item sold in the EU needs to me certain standards, especially electronics that switch mains potential. The risk in supplying a unit which is not CE marked to someone could result in the supplier / developer being sued or facing a custodial sentence should it be proved that the device was the cause of any loss to person or property. To get the device through the testing, documentation and due-diligence procedure would of cost near £10K, which even if I had the approval from the other parties involved in the code development, was ruled out as I didn't have that sort of money, and given the specialty of the project, there simply isn't enough of a market to recover that sort of cost, let alone make a small profit.
I have also been approached for the development files and schematics etc. These are now archived, and other than what's featured here, will not be posting up any further files, or updates that I have made.
In closing, I would like to re-iterate my thanks to Darrel and Henrik for their help in developing the code for this project, which insistently has been running now for over three years, 27/7, 365 days a year with not so much as a hick up. I've not even had to replace the battery in the RTC !
Malcolm
Re: 4 Channel Thermostat using PID loops
May I ask who makes the case and where you purchased it please?
Re: 4 Channel Thermostat using PID loops
Re: 4 Channel Thermostat using PID loops
Sorry for being such a noob I'm good with soldering but that's about it. The question I have is I noticed that several of the pins on the pic are not connected to anything I am assuming that they are used to program the pic, can someone tell me how to connect them or point me in the right direction.
Thanks much
Re: 4 Channel Thermostat using PID loops
I don't use them for programming the PIC, they are just unused ports. The PIC is programmed via the EasyPIC development board shown at the start of the thread