Featured Post

Site Navigation is in the Left Column

Sunday, February 23, 2025

Small Enhancements

I made a few small enhancements to the GUI.  

The graph shows two lines. The trap line tracks the temperature-pressure curve of the trap.  The tank line tracks the temperature-pressure curve of the tank.  These two lines now display in different colors.

The text for each of these lines now display in their corresponding color.

Each line now has an X on the current data point.  This helps with displaying the data if the line folds back on itself.  

A ring buffer was added to each line to track its data.  This is required due to changes in the GTK library.  The ring buffers hold each datapoint to be graphed for each line.  These ring buffers can be easily resized in code.  The current setting allows for the storage of 1000 datapoints per line.

Upgrade to GTK 3

The upgrade to the latest 3.x version of GTK has been less than impressive.  One of the issues with GTK is that even point-upgrades change functionality.  The library is very powerful but is in desperate need of version control.  

Some of the things I found no longer worked include the following:

The way images are displayed changed.  I was able to easily adapt the code to compensate for this, but the fact it changed on a point upgrade is annoying.

The way lines are dealt with has changed.  In the past, you could plot line segments one at a time.  After each line segment, you could call the stroke() function and the line would be drawn.  The existing lines would remain intact one the screen.  With the latest version, the stroke() function clears the DrawingArea each time stroke() is called.  This is by design and forces the user to track the entire graphic in code so it can be redrawn every time anything changes.  This is very inefficient when it comes to coding.

Sunday, February 9, 2025

Larger State-Transition Diagram

In the blog, you will see that the state-transition diagram is much larger than it needs to be.  

I was able to find an SVG file of that diagram which allows me to make significant adjustments to it.  The nice thing about an SVG is that it's a text file that describes vector graphics.  This allows you to expand a graphic as large as you want.  I did not need the entire state-transition diagram.  I only needed the operational zone.

I modified the original SVG so that it only displays the operational zone of the freeze dryer.  This makes much better use of the screen real estate.  I was able to make the operational zone about 4 times larger than the original diagram that used a PNG.

Update. A LOT has changed!

It has been a while since I have posted, but I HAVE been working on this project.

First and foremost, I moved to another state.  During that time I had to sell 5 properties, buy a property and get it ready for living.

NEW HOME
A large part of the new property has been remodeled (by me) but still has a ways to go.  I have completely gutted and remodeled the living room, entry way and dining room, including soundproofing the walls, correcting structural defects etc.  

I also remodeled the master bedroom, my office and the master closet.

I relaced the well pump and got the entire system working.

I renovated the 2.5 acre yard.

Cut and split (by hand) several cords of firewood.

I still have a den, a bedroom, and 2 bathrooms to remodel...most of them are complete guts.

NEW SHOP
the new property has a massive, climate-controlled shop, complete with a full bath and an explosion-proof paint booth.

With all of its grandeur, the new shop needs a lot of work.  I am looking at a full gut ad replacing sheathing.  In some areas, the plates are rotted out and studs are compromised.  Additionally, it has a 16' wide bay door with an undersized header that needs beefed up.

DEATHS
I have had 2 deaths in my family and my wife has had 2 deaths in hers.

RESOURCE CONTENTION
The project was originally started on the Raspberry Pi3b.  As the project grew and became more complex, it became clear that eh Pi3b was not up to the challenge.  It had significant issues compiling the code, particularly if I changed too many source files at one time.  I resorted to compiling the application several times in a row hoping it would get multiple object files built before it crashed.  I made it a standard to ONLY change one file at a time, if possible.  This helped, but the compilation could still take 5-10 minutes.  

I was looking at cross-compiling, but 1) it is a challenge all it own and 2) I could not really test the code without the I2C physical interface installed o the cross-compiling machine.

I was diligently trying to get a path using cross-compiling, but the Raspberry Pi5 came out before I could get a suitable strategy.

RASPBERRY PI5
I decided to buy a Pi5 but was disappointed to find out it was on back order for 3-5 months.  So I had to wait, ad wait, and wait.  One I received it, I was disappointed to find out that it came with NOTHING...not even a power supply.

So, I had to find a power supply online.  Guess what, they were all sold out, too.  The Pi5 has a low-power mode, but you really need a high-power power supply to run it at its full potential.  The power supply exceeds the power capabilities of any USB-C power module, so I had to wait.  It arrived about 2 months later.

BTW, the PI5 has dual video ports, but they require a cable that was not very common at the time.  It is basically a micro-HDMI connector.  They were also hard to find at the time.

After 8 months of waiting on the Pi5 to be useable, I started porting everything over.  I ran into other issues.  The IDE I was using would not run on the PI5 so I had to change IDEs.  The libraries I was using were not installed on the PI5 as it had newer versions installed.

I tried porting the application over to the newer versions of the libraries, but it did NOT go well.  I originally developed using GTK2, which was a bolt-on to the PI3b.  Well, that library was not installed on the PI5.  So, I decided to switch over to the latest and greatest GTK4.  Boy was that an adventure!  Apparently, the developers of the library radically change things between major revisions.  GTK4 is NOT and upgrade of GTK2, it is a total redesign, complete with no viable documentation and no viable upgrade path.

After many long hours of trying, I bastardized my PI5 by hand-installing a GTK3 version on it.  I was able to go to GTK3 (with some significant redesign.)  at this point, GTK4 is not an option.  I will never use GTK for a project again.  It was a HUGE mistake!

One of the major changes in GTK3 is in the way it handles DrawingAreas.  Someone thought it would be a good idea to require the entire drawing area to be redrawn every time you wanted a change to be made.  They made it impossible to write a custom function to write to the drawing area without doing it through an event handler.  As a result, you can no longer just draw a line on a drawing area.  You have to stage the data to draw the line, then trigger a drawing area redraw.  This triggers the on_draw handler which you then use to call another custom function that reads the draw data and draws it.  Basically, it's a hokey work around to get around the fact they do not allow you to write to a drawing area dynamically, anymore.

WIRING PI
In addition to the above, the author of the WiringPI library has stopped developing it and has killed it from his web page.  The PI5 has it installed, but it is not supported in any way.  So I decided to write my own library.

Fortunately, I abstracted WiringPi functions in my original design, so it was fairly simple to inject my library into the project.

FINALLY
As of today, the Freeze Dryer code is back up and operational running on the PI5.  

MORE ISSUES
When we moved, I had to leave behind my project refrigerator.  I have to find an old refrigerator I can cannibalize for parts.

Thursday, December 9, 2021

Identified Graphing Errata

I have identified graphing errata that happens at certain stages.  Occasionally, the graph will reset and revert back to the Kelvin temperature scale.  If the temperature units have been changed prior to that event, the graph will draw the correct temperature but at the wrong unit scale. 

At this point, this seems to be the graphing library crashing and resetting.  It is too early to tell if that's the case for certain, though.

Fixed Temperature Process Indicators

The temperature process indicators were not calculating correctly when temperature units were changed.  This has been corrected so the process indicators remain consisted through temperature conversions.

Pressure indicators were also corrected.

Final Water-State Zone Completed

I implemented the Antoine formula to calculate saturated vapor pressure at temperatures between the LGS Triple point and the critical point.

Wednesday, November 24, 2021

Triple Point Vacuum Achieved

After the boiling test, I decided to up the ante.  The ultimate test of a vacuum pump for a freeze dryer is to prove it can reach the triple point of water.

To prove this, I made some ice water.  Ice water will reach a temperature of 32 degrees F (0 degrees C.)  If I can draw a hard enough vacuum on ice water to make it boil at 32F, I can reasonably assume the vacuum pump can reach the triple point.

I was able to boil ice water in my home lab using a 2-stage oil-diffusion vacuum pump.  

A few things to keep in mind during this experiment:  

The boiling of ice water will not be as vigorous as you might expect.  That is because at that vacuum level, it takes very little water vapor to raise the pressure above the triple point.  You will likely just see a simmer.

The triple point, while reached, does NOT indicate the vacuum pump cannot go lower in pressure.  The boiling of the water continuously replaces evacuated water vapor from the chamber.  Essentially, the pressure will not go lower than the pressure that causes the water to boil until all of the water is gone.


Boiling Water at 70 Degrees F

I was able to boil water at 70 degrees F today.  This is the first test to see if the pump can reach appropriate levels of vacuum. 

Once a few bubbles rose to the top, the water broke into a vigorous boil within seconds.

It is important to note that the chamber pressure will not go lower than the pressure required to boil the water.  The boiling of the water replaces water vapor being evacuated form the chamber.

Saturday, November 20, 2021

Vacuum Pump Testing Started

 I started testing the vacuum pump to see if it could draw down lower than previous tests.

I was only able to draw about 25 inHg in previous tests.  So today, I started tracking down issues with the vacuum system.  

What I found was encouraging.  See, to be used in a freeze dryer, the pump has to draw down to 600 Pa or lower.  A rough calculation tells us the pump will need to draw down to less than 29.2 inHg.  

Sealing hoses and fittings for vacuum use can be a challenge.  A leak does not manifest itself as a drip, for instance.  It cannot be observed from outside.  Basically, everything is backwards.  

I found the vacuum canister had a design flaw in its fitting port.  I fixed that flaw.  It took some doing, but the seal is now reliable and vacuum tight.

I fixed a few hose leaks and a leaky valve packing.

Sealing most vacuum leaks can be performed like any other leak.  The difficult part is finding the leak.

I used Vacuum Grease to seal threads and hose fittings.  It is designed to do just that.  

I was eventually able to draw down to the limit of the gauge on the vacuum canister.  But it is way better than it was in previous test.  I will have to hook the vacuum sensor up to the canister to get a more accurate reading.

Monday, November 8, 2021

Water State Library Progress

I am going to develop the water-state library in two stages.  I have decided to abandon the complex state for now.  It is taking more time than I want to spend right now.  I will only focus on the simple-state aspects so the library doesn't delay the FreezeDryer project any more.

Friday, October 22, 2021

Library to Calculate the State of Water

At first, this seemed pretty simple.  After a few days working on it, it has become more complex. The scope of the library has creeped a bit.  Since I was finding myself writing a lot of code to do this, I decided to expand the scope to include scientific measurements.

The library has 2 modes:  a simple mode and a complex mode.  While in simple mode, it will return a simple answer in terms of SOLID, LIQUID, or GAS.

While in complex mode, it will return all known states of water including Ice I, Ice II, Ice III, Ice IV, Ice V, Ice VI, Ice VII, Ice VIII, Ice IX, Ice X, Ice XI, Ice XII, Ice XIII, Ice XIV, Ice XV, GAS, LIQUID, SUPER CRITICAL, SUBCRITICAL GAS, SUBCRITICAL LIQUID.

Additionally, the library will return hits on all triple points and phase lines appropriately.

You simply give it a temperature and pressure and the library will tell you what phase the water is in.

I currently have about 1/3 of the state-transition diagram programmed.  I will need to research some of the more exotic Ice phases to get it complete.

Saturday, October 16, 2021

Progress Bars Corrected

The software uses several progress bars to indicate positions in the process.  These were initially added to the GUI as place holders.  I have managed to get all of them functioning.  Some of them may need to be altered in the future, but they are offering feedback at this time.

Test Mode Complete

The testing mode was fully implemented.

It is currently implemented using conditional compilation directives.  I may change it to be dynamic in the future.

This will allow testing without the need to compile a test version of the software.

Thursday, October 14, 2021

Test Mode Progress

Purpose:

The test mode work is progressing.  Spinners have been added to the GUI to allow me to intercept the pressure and temperature sensors.  This  will allow me to manually enter readings into the program and test state transitions as temperatures and pressure changes.

Effectively, I will be able to simulate cooling and evacuation cycles etc. without having to actually wait for the unit to cool off. This will significantly reduce the time it takes to test the state transitions.

Implementation:

At the moment, I have the spinners showing when the code is compiled into a test version.  I use C++ conditional compilation to add the spinners and associated test code.  The spinners already have ranges and stepping programmed properly. Additionally, when the temperature or pressure units are changed, the spinners will automatically convert to the new units.

Next:

The next step is to insert the intercept code into the sensor code module. At that point, the software will read the spinners instead of the sensors when in test mode.

Wednesday, September 22, 2021

Designing a Software Testing Mode

To test some of the logic in the process code, I am building a testing module that will allow me to simulate temperature changes and pressure changes.  I have already confirmed the transducers are all working as planned.  But now I need to run through scenarios on the bench.


Quad Relay Library improvements

I redesigned the QR library to be easier to manage.  I converted the relay control portion into its own class that is wrapped in the QR class.  This allows one piece of code to be instantiated for all 4 relays. If modifications or features are added, this will allow them to be deployed in one location instead of 4.  It also allows the library to be easily expanded in the event the Quad Relay module is expanded to 8 relays in the future.

In addition to all of this, it makes a large portion of the code re-usable in memory.  This makes the program smaller.

Tuesday, September 14, 2021

Added Logging Improvements

Added temp and pressure units to the data log.  This was necessary in order to track changes to temperature and pressure options.  Otherwise changes in pressure units would appear to be anomalies in the data log.

I also improved the Log Library by adding the ability to write custom log headers to the log file at run-time.

Monday, September 13, 2021

HDI Updated to Include Dynamic Temperature Unit Conversion

I added the ability for the HDI to dynamically switch between temperature units.

I updated my MCP9600 library to deal with temperature unit symbology, too.

The library now supports C, F, K, and R temperature scales.

HDI Updated to Include Dynamic Pressure Unit Conversion

I have added the ability to dynamically convert the display between different pressure units.  The HDI currently uses Pa, kPa, and psi.  But my MPR library supports several other pressure units, including Pa, kPa, psi, atmospheres (both standard and technical) Torr, Bar, Bayre, inHg, mmHg, inH2O, mmH2O and others.

I added a Temperature unit symbology to the library, too.  This allows you to fetch the symbol for the the pressure you are using by function call.

Since I am using an absolute pressure transducer, I can easily convert between pressure units by a simple calculation using the conversion factors of the source unit and the target unit.