Thanks very much for your replies and especially for the advice about avoiding interference. I shall incorporate all those points in my design.
"I see that you have gone down the “distributed control” route with individual PICs, ...."
I like the sound of calling my set up a “distributed control” system. I had not fully realised it was so different to Vital Byte. Your blog describing the use of a serial bus led me to read up about this concept and that led to I2C. In reality, I did not set out by designing the whole system – it just seemed to evolve in that direction after I had initially constructed the PIC board for controlling the gas valve. Also, I think the way I ended up controlling the gas valve may be placing more demands upon the PIC, so cramming all into one device would have been particularly difficult.
"I see that you are measuring the ambient and then doing the cold junction compensation in software – you might find the thermocouple amp AD595 of interest, since it does the linearisation and compensation all in one package."
Following your earlier posts, I was going to use this device and it would probably have saved me a lot of time. As with all aspects of this project, after reading your notes on Vital Byte, I downloaded relevant Microchip application notes and went from there. Doing things my long-winded way did mean I learn more about what is going on.
"I remember that your gas valve servo has limit switches to prevent “integral wind-up”, but how do you handle it with the feed pump speed PID."
I am probably misunderstanding your question here, so I apologise that the following “essay” is so long.
If the term “servo” always means a specific type of device that converts a PWM input to a motor-driven positional output, then I am not using servos. (I’m not being deliberately pedantic here, it’s just that I am ignorant of how these terms are commonly used).
In my gas valve mechanism a stepper motor turns a threaded rod and this moves a sliding block along its guides. The sliding block is connected by a lever to the end of a rod which is thus moved in the same direction as the threaded block but to a smaller extent. The end of this rod enters the body of the gas valve through an O-ring seal. The very end of the rod is tapered and forms the needle of the needle valve. It enters a hole inside the valve body through which the gas has to pass. Thus the needle is pushed or pulled in/out of the hole unlike a normal valve where the shaft of the needle is threaded and is moved by rotating it. Unlike a servo-controlled valve, the system has no way of knowing the position of the mechanism so the sensors at each end of travel of the screwed block are essential to stop the motor turning too far so the block jams up on the end of the threaded rod. The valve can be fully closed or opened by sending a coded message to the PIC which then turns the stepper motor until the end of travel is reached. The result of PID analysis is sent as the number of steps to open / close the valve. Because of the fine thread and the effect of the lever, it takes several hundred steps to fully open the valve.
With the pump motor, there is no separate ESC unit. The pulse width modulated power output is generated by the PIC device itself using one of its CCP modules which is based on the system clock (4 MHz). The CCP PWM output is set to a frequency of 10 KHz. (i.e. each cycle lasts 100 usecs). This means that the ON time of a single PWM cycle can vary from 0 up to 100 usecs in 400 steps of 0.25 usecs. This seemed to me to be a good enough resolution. I would be interested to know if this is how other people and Vital Byte controls electric motors.
I think I read that for the VitalByte feed-pumps, you send a PWM output to an ESC (??). If so, do you use a commercial ESC?
The result of the PID analysis of motor speed increases or decreases the ON time of the PWM output but the software limits this to values between zero (stop) and 400 (max speed).
One complicating factor was that, with the PIC running at 4 MHz, I found that the timers run too fast to allow measurement of the time of rotation of the pump. So the time between successive pulses from the Hall effect sensor are measured using TMR2 running under an external 32.768 KHz crystal. Did you find the same thing or do you accomplish the pump speed measurement in a different way?
"Which LCD display are you using (the bigger the better for my eyes!)"
My eyes seem to demand the use of "reading" glasses for more and more tasks these days. My LCD display has characters 5 mm high and has 4 rows x 16 characters. This was one of the cheaper models at Farnell (£9.34 each) and works fine, except I wish I had gone for a display with more characters per line. I may add another PIC (with a different I2C address) connected to a second display so I can send different data to each display. I think this may prove more versatile (and cheaper) than buying one big new LCD.
This is the device I use: http://uk.farnell.com/jsp/search/productdetail.jsp?sku=2063248&CMP=i-bf9f-00001000
But I'll not be adding another LCD until I've made more progress as there is a VERY long way for me to go before I have anything near a functioning system.