Author Topic: OpenStill: A modular distillation controller based on the ESP32 devboard.  (Read 9778 times)

0 Members and 1 Guest are viewing this topic.

Offline Hooch

  • Posts: 97
Those were some lofty ideals I posted there...  I haven't had much time to physically work on it due to family.   Now that doesn't stop the wheels from spinning.

The reality is that the there is a lot of background stuff you don't notice going on when you implement ncurses.  The whole purpose of ncurses is to provide a translation matrix between the programmers side functions to the terminal side capabilities.  The vast majority of the code is for handling those terminal definitions nicely.  When your program  invokes the ncurses library, the TERM environment variable dictates what is loaded into the translation matrix.

Now that is not something that will play nicely in the ESP32 environment since we don't really have a disk environment to load  terminal definitions from.  There is hinted that in the printouts of old, there contains switches that allow you to compile the library self contained into the program with the translation matrix already loaded, which would be perfect for running on an ESP32.

So I'm off on a quest for that info...

Offline ketel3

  • Admin
  • Posts: 1377
  • Eparrot.org
Along this project it seems to get more and more complicated ,do you think at the end it is makeable ,buildable for others with less knowledge ,and custumizeable ?
In other word is it a matter of loading the sketch and done or do one need real knowledge ?
Better bad weather than no weather

Offline Hooch

  • Posts: 97
K3:

The point of this is to make it easy.  To do this you need to be able to communicate your desires to the program.  This means a user interface.  I've looked at a number of different programs that are intended to do this, but they tend to require a lot of hard coding because of memory constraints of an embedded processor.   They also tend to all mirror the same action/response methods. 

The UI requirement has been done to death by many different groups.   It may be backwards but I am implementing the 'IX UI environment from 20+ years ago because it is solid code and does what I want.

Quote
,do you think at the end it is makeable ,buildable for others with less knowledge ,and custumizeable


How I envision it working is that the code is the code.  It can be distributed just like a bios update, so download a file, plug in a blank ESP32 device, and run the program.  After that, there are many tools in the Espressif toolbox that allow the device to update itself. 

I'll be honest you do need some knowledge to build something.  solid electrical knowledge so you know how to implement an electrically complete circuit.  You need to understand what a pullup resistor does, why you need a chip select line,   and how a device bus is implemented.  (Tie all the same lines together of all the devices.)


What I am glossing over is that the code already knows about all the devices you can connect to the ESP32 (at least what I have programmed it to understand).  The internal guts of OpenStill are just a global variable array, and there are "programs" or built in logic that uses those global variables to accomplish it's task.  Likewise all the pin configurations and the operations are saved on the flash so it can restart properly after a reset.  You can implement a flash card as you want,  when you add one as a module, it adds functionality like reading in pin configurations, and all customizable screen widgets.  That way the display can be whatever language you wish to translate to.

So the job for the implementer is make sure that all the mandatory devices are implemented for the "program" you want to run by assigning devices to the ESP32 pins.

You then use a terminal program to connect to the ESP32 through the usb/com port and it is plugged into a breadboard or a something more finished.  Since it is blank device, it will also broadcast itself as a open access point called "OpenController(n)" the n part is if for some reason there is an AP already named OpenController.  Connect to this wireless network and telnet to the default gateway will give you the exact same screen as the console port.

Since we are configuring a brand new device, if there are available AP's to connect to it will prompt you to authenticate to one.

Assuming it can connect, it will try to get a .240 address from the AP.  This is to make things easy since the most technical thing you need to do on an ongoing basis is establishing a telnet session to its ip address. 

I'm waiting on a microsd card socket so I can test some flash capabilities. I want to try and reuse the existing flash data pins and use GPIO15 as chip select output.  Then it will be able to read files that you can edit/put on from a pc.   This makes it easy to do for example a temperature sensor has many "windows".  A DS sensor has many variables, rom code bus gpio, resolution, read cycle timing, calibration offset, number of errors in addition to the current and historically trended temperature readings.  So that window 1 is just the 78.04  the reading in float while window 5 can be 87.5% ABV.  windows 10 can be a ascii character blob that changes colour based on the reading. 
You can overlay windows so that would allow you to simulate boiler heatup and alarm conditions.   Think of it like when they film animation.  There is a background then you add little images on top of each other to get the whole picture. 

Hopefully it is not going to blow up.   






Offline ketel3

  • Admin
  • Posts: 1377
  • Eparrot.org
PFFFFF do you realy think I can follow all you have tried to explane seriously ? ;D

But you know what .....that is not needed at all in my opinion?
I do not understand the whole working of a personal computer and still I'm able to operate it and you know what sometimes it does exactly what I want,at other days well it stays a computer afterall.

So if it is a matter of soldering some bits and pieces together it is buildable for sure, if it is put into a kind of user manual and step by step building plan like Shifu has made after Edwin presented his fine Eparrot,some can actualy build it.

It gets complicated at the moment people have to change things into the code to customize as long as changes can be made true a terminal ,a laptop,tablet or whatever display it will be ok.

In case not all fits in one go several! Downloads could do the trick

A download for a LM
A downloiad for a CM
A download for a VM
A downloiad for a potstill

OR if it fits ALL in one but if this is a practical,solution who knows.

Please keep us updated ,I personaly like to follow it very much.



Better bad weather than no weather

Offline ShiFu

  • eParrot.org
  • Admin
  • Posts: 1984
I like where you are going with this, Hooch. And looking forward to the your first demo.
Just like K3, I'm hoping we are both smart enough to follow along.
It is so easy for me to get lost in the details and lose sight of the big picture.
Stay calm and follow the screaming people.

Offline Hooch

  • Posts: 97
It has been a lot of fun the past few days stuff is soaking in!  To get Ncurses and all the associated tools to work might not be sooo bad, but tedious.  I watched a TV series called Limitless which has the main character who can safely take a  pill to become a super genius temporarily, otherwise he is just average joe.  In an episode where he has to  figure out how some unhackable device was hacked. 

So it starts off with him looking at this this pill, saying to himself, I can do this, how hard can it be, looks easy in the movies.. The next scene three weeks later is him spinning in his chair with pencils in his nose, something I have done myself at those points in time , as he narrated a video montage of about it all being about waiting...

I was laughing till it hurt because it was soooo true.

You're waiting for:
the file to download
the file to unzip/unpack
the file to install
the computer to reboot
the compiler to finish compiling
the linker to finish linking
the flasher to finish flashing

I was living the dream because for lolz I made and uploaded all the examples that bits of will exist in OpenStill like the telnet client, and all the wifi examples.   I needed to put a big juicy capacitor on the 3.3 to ground (I used the flash capacitor salvaged from a disposable camera) and worked like a charm, I had problems earlier with brownout resets.

Do you need to know how it all works to do this? NO.    You do have to have to have a functional template (a bunch of files in a directory) all examples are done that way.  Its DOS like to do the building.  To start you must always run

make menuconfig  This is where you configure which serial port is connected to the ESP32 to flash it, and constant variables like wifi name and password.

make flash monitor - This compiles all the code 7 minutes if everything is recompiled, then it flashes it for 30 seconds , I need to hit the boot button for it to upload to the flash otherwise it times out after 30 seconds and you have to make flash again...

And more waiting...

I can't do the ncurses thing this weekend since I'm going away.  I have to install ncurses brand new again on the msys2 machine, then use that to configure a private build that is meant to crosscompiled.  Then a tweak to change the input and output to through the serial port.

Then I can make and have nice pretty input and output so I can glue all the bits together with code.   

K3.  could you flesh out what the control points are on those still types.  I'm not sure what you consider Az.  I use one valve to control the cooling and that controls the output. 


Offline RippoZero

  • Posts: 3
Saw you mentioned using the heatup time to estimate boiler content. If you measure the quantity of output from the still you can use this formula to find it: F = D/(1-(xD-xF)/(xD-xB))

The variables are:
D - Amount of distillate removed from still.
xD - Alcohol concentration in D. (96% ABV if you're a cowboy).
xF - alcohol concentration in the feed at start of run.
xB - Alcohol concentration in boiler now.

You'll need a sensor in the boiler but i'm sure this is more reliable. You can probably twist it to find the current boiler content to.