How about it? Experiments of the third kind , take 999999.

How about it? Experiments of the third kind , take 999999. Update Testing the temperature controller

There has been some talk about PID controllers to keep temperature constant. And I wanted to keep the 'D' out of the PID.

After the melted box experiment (see early postings on this subject), I had some idea of the amount of power needed to keep the box with sensors at about 40C, and from that the hard - and software design evolved. As I proudly mentioned before, it is not always that so many lines of code work first time. The temperature controller does, and works beautifully. The way I had implemented it is like this: PIC has PWM output at about 10kHz with 256 steps. Once every second I measure the voltage across the sensor diode, and if it is lower than my set point voltage then I decrement the PWM by one step to a minimum of zero, and if it is higher then I increment the PWM by 1 step to a maximum of 255. The big question was "Will this be fast enough and will this be stable?" The above method creates a proportional band of 256 steps, and creates the 'I' factor in the control loop. That is, as long as there is any error, the PWM will be altered in the right direction. Note that the voltage over the Si diode sensor is lower for a higher temperature.

Anyways, here is the setup, thermocouple taped to the hot plate:

formatting link
you can see the very thin thermocouple wire escaping bottom left. Tests with the box open revealed that for 40C the diode voltage was exactly

500mV. RS232 was connected, and power, and then the box was closed, and in 'debug' mode of the thing the ADC steps were monitored. I also scoped the PWM and measured power consumption.
formatting link
That yellow thing was used to clamp the thermocouple to the hot plate in the box open test, As was to be expected the amount of power used, even with this thermally non-insulated box in the open air, was already a lot lower then in the melted box tests, about 700mW:
formatting link
that is the lab supply. I ran this experiment on 3.8V, and not the final 3.5V, as I had to keep a MAX232 serial chip working too. The effect of running on badly filtered wrong voltage is that the other AD channels become noisy:
formatting link
Note the second channel, how nicely it stabilizes around 499 to 500 steps, this is the voltage across the sensor diode (set point was 500). The last 2 channels are the light sensors, I have not blacked out one yet, and it is not 100% light proof here either, so those are very noisy here, but nice large signals. The first channel is the PIC internal reference against the external MCP1525 2.5 V reference, clearly that needs some work on either or both those references, as it seems to vary. Looks like the external reference changes. I think the maintained temperature was close enough to 40C here:
formatting link

Even with box open the PWM did not have to go to maximum:

formatting link
but this is in a heated living room at 23C, so for -5C with box closed and insulated we should see several watts input.

As to the performance, I did set the start up PWM value to 128 (50%), and then there is once an overshoot, due to thermal delay before the diode sees the heat from the transistor, then things settle down fast. As I expected it settled within a few minutes (128 seconds means 128 delta for the PWM), seems even better with box closed, no air interference. I am happy with the thermal controller for this experiment, now I can move on to the design of the main board. To get error and control messages from the PIC micro controller in the small black box to the PIC micro controller on the main board I have decided to use the ASCII codes above 127... Multi-processor multi PIC, some here will tremble with fear. Its is fun though !

Reply to
Jan Panteltje
Loading thread data ...

How about it? Experiments of the third kind , take 999999. Update First testing of the main board

Today I assembled most of the main board, that means most components are now in place. Powered it up ad did some testing:

formatting link
This tests the take over of the battery pack in case of a mains failure. Also tested is the MAX232 for RS232 communications with the PC. A new feature I did think of is the beeper, you can see the HUGE round beeper to right in the picture, it is the type that has build in electronics, so only needs some 3 to 5V DC. The idea is to alert you in case any error condition occurs, the most likely one being somebody unplugging the unit from the mains (wall wart). This beep is so loud that it sounds like a car alarm... The following error conditions will result in several different beep codes, in fact I use the first PIC to send the BELL signal n times, and the second PIC (still missing in this picture as it still needs to be programmed) will then detect the BELL and activate that beeper (on pin 8 via a transistor). I2C ack error fatal External EEPROM data verify error after a value is written fatal Internal EEPROM programming verify error (mainly data pointers) fatal, but will continue do I need to save these pointers in EERPOM? delta temperature too high needs immediate attention reference voltage difference too high needs immediate attention watchdog reset fatal usually, as timers are now screwed up. brownout reset fatal (battery empty and no mains) low battery needs attention main failure needs immediate attention, before backup battery goes empty and probably a few other error conditions when I think of it :-) All is reported nicely in ASCII by the PIC in the black box, but I declined to use a LCD display here (could be easily added on PIC 2) for power and simplicity reasons, So it will beep n x, different for each error, as the old PC did...

This is the backside of the main board, the side where the black box will be mounted with foam thermal insulation:

formatting link
Opto coupler is clearly visible ,the 7805 voltage regulator and IRLZ34N MOSFET will be mounted against the side of the alu box. Also I added a fail safe circuit in the power supply regulator, as the black box would be destroyed by a lose control wire (voltage sense), that would push the PIC supply to the max battery voltage, so rejecting the idea of a crowbar, I added a second LED as a voltage sensor to limit the voltage to the black box at all times to about

4.5V, normally it would be 3.5V, as it is a lot of work to rebuild the little electronics in that box. (you can see both LEDs light up green in the first picture as he black box is not fitted and in fact this IS the missing control wire condition) So far for today, need to change a wiring error...

There is another interesting thing about the multi-PIC setup, the PICs outputs are ORed with 2 1N4148 diodes into the MAX 232, so both will be able to send messages to the terminal.. The PIC on the main board will listen to commands from the PIC in the black box, and the PIC in the box will forward commands from the terminal to the PIC on the main board. The PIC on the main board does the alarm beeping. It seems complicated and it can cause a brain jam as you cannot just send anything in software, as then it would trigger some loop, but it works, I have used the same dual PIC setup in my scintillation counter. But, as stated, the PIC on the main board still has to be programmed, will simply run on its internal RC oscillator, only needs baudrate accuracy.

Reply to
Jan Panteltje

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.