Introduction: Python/Arduino Serial Controller: Homemade Blast Furnace
What started as a simple project to make a small firing container for ceramics experiments spiraled out of control into a scrap-constructed, CPU controlled, Oxygen-injected miniature blast furnace.
The finished project combines a GUI interface, I/O firmware, analog control circuitry, chemistry and thermodynamics.
The core of this project is the Python-Arduino serial interface, in which I include the flexible control code and the data collection/GUI software. I would like to present this project as a particular instantiation of this flexible framework as the controller of a somewhat difficult system. I would like people to take away from this project the utility of the python controller, and ideally use that section of code as a tool in their own projects. This is the reason I include the flexible version of the software/firmware, which is far overpowered for this particular project. I intend the presentation of the Blast Furnace project as an example case for how to use the serial controller.
The software level is a python executable, incorporating the zelle graphics module to support the GUI, and pySerial to support the serial communication protocol. The software includes a communication layer that encapsulates the Serial protocols, and a control layer (GUI, file processing and interfacing).
The firmware level is a short program which receives serial data from the CPU and implements the commands as a switch-based I/O board. The Microcontroller used is an Arduino Nano.
The Hardware level includes electronic, chemical, and structural elements, including the furnace itself, the safety stand, an electrolysis pool, Thermocouple and associated circuitry, switching circuits, and a drip feed for fuel injection.
The primary fuel for the furnace is 90% commercially available isopropyl alcohol. The electrolysis pool uses an electrolyte solution of saturated Epsom salt (MgSO4) in water.
In the following sections, I will discuss the construction and operation of each individual section, and conclude with the construction of the complete device.
Step 1: Serial Connection
The whole apparatus is controlled via serial port from a PC. Coordinating serial communication between the CPU and the MCU, which run on different clocks, is the most difficult part of the project. In practice, coordination was accomplished by consistent use of transmit-receive-transmit-receive blocks, where neither the PC nor the MCU can progress until each transmission to the MCU is acknowledge, and receipt of any return data from the MCU is recorded by the PC.
The serial communication protocol consists of a 4-byte command from the master (the PC) and a 2-byte return from the MCU. An example transmit-receive action would look like this:
PC: '255'-'101'-'11'-'0' A start byte ('255') followed by command-data-address transmissions
MCU: '9999'-'0' a receipt acknowledge ('9999'), followed by return data.
This example tells the MCU to set digital output pin 11 low; the MCU collects no data, so it just returns '0'.
The command byte is cast to an integer by the MCU, and sorted by a simple switch/case block. The data byte contains any pertinent data for the action called for by the command, which is usually a pin designation. The address byte is mostly unused, but is added in for ease of use in cases where two data parcels are required to use an MCU function, such as PWM (or analogWrite() in Arduino) which \requires both a pin and a value. This scheme is easier and simpler to coordinate than a 2-transmission protocol for such aberrant functions.
The software implementation is attached, as well as the Firmware for Arduino. Both sets of code are commented for comprehension.
(Note that the python file requires pySerial)
Step 2: Hardware (Electronic)
The MCU is the core electronic device, and the exclusive digital circuit involved, facilitating the communication of the commands from the user, via the PC, and the implementation of those commands in hardware. The analog electronics for the project include a set of switching circuits, power supplies, and the thermocouple amplifier.
There are three switches incorporated. Each consists of a low-side transistor switch (enabling MCU control) which controls a relay. Each device: fan, fuel feed electromagnet, and electrolysis pool, has an isolated power supply, isolation being necessary meet the supply needs and
reduce line variations for the more sensitive switching elements. The fan and electromagnet switches are simple MOSFET low side switched which control their relays directly. The relay for the electromagnet is a larger relay designed to switch wall power, as the electromagnet operates directly from 110 VAC. The electrolysis pool is controlled with a MOSFET and PNP switch to supply more current to the relay, which has a higher power rating than the other relays, due to the high power consumption of the electrolytic cell.
The thermocouple circuit is a simple x100 amplifier circuit, into which the thermocouple voltage is the input. The thermocouple is put in series with a 1M Ohm resistor, to stabilize the current response. I could have used a pre-packaged thermocouple amplifier, which would have better stability, but for the temperatures involved accuracy is not a major concern, and the thermocouple itself is old and fairly unstable to begin with. In the future, I hope to deal with this issue but the main use of the thermocouple is to track relative temperature changes, for which the current setup is adequate.
There are a total of five power supplies for this project: one for the MCU, CPU, and thermocouple amplifier, one for the switching circuits, and one for each control device. The CPU is a laptop in this case, and it's supply is a standard laptop power supply, which powers the MCU and thermocouple amplifier over USB power. The switch circuit supply is a basic custom-built supply made from a scavenged transformer, a bridge rectifier, a capacitor and a 7805 +5V regulator, and has a high enough power supply capability to allow all 3 relays to be active at the same time. The electrolysis power supply is a old 19V laptop power supply, the only modification to which is the replacement of the barrel jack with wire leads. The fan supply is a modified 'wall-wart' phone charger, to which a stiffening capacitor was added. And the fuel feed electromagnet is directly run of 110 VAC wall power.
Step 3: Hardware (Structural/Mechanical)
The furnace itself requires some special architecture. The stand was welded from scrap steel, and has a circular ring for the furnace to sit in, a narrow channel for insertion of a glass safety screen removed from a scanner, and a beam for the fuel feed to rest on. The glass screen/fuel feed supports are angle iron and the beam is quarter inch bar with holed drilled for the lashing to hold the fuel feed.
The fuel feed is composed of an old syringe, which is mounted on a section of pilot light tubing. The tubing is screwed onto a gas stop-cock, which is then connected to another section of pilot tubing that leads into the furnace. The mechanism by which the feed is controlled uses an electromagnet, which is secured to the side of the base of the syringe. A steel ball bearing is dropped into the syringe, which blocks the gravity feed normally. The electromagnet draws the bearing to the side when engaged, allowing the fuel (isopropyl alcohol) to flow at a rate determined by the stop-cock.
The glass screen in included so that in the case of leakage or blow-back, the operator is not directly exposed to the flame. Additionally, the screen passively blocks heat and fuel sputter, keeping it from effecting any sensitive equipment.
The furnace chamber is the simplest structural element, mainly because it was the first component of the project built. It is also completely constructed out of scavenged materials. The pit of the furnace is a small ceramic flowerpot, the base of which has had glass poured into it. This makes for a highly thermally resistant chamber and is ideal for the fuel to pool in. The cone is the body from an old paint drying heat gun, and it;s shape make it ideal for funneling the rising hot air into a concentrated area. It also has a grid built into it, which is useful for placing a crucible in the heat.
Step 4: Hardware (Chemical)
The electrolysis pool is constructed from a graduated cylinder, which acts as the tank for the electrolyte. Into this, a test tube is submerged. The test tube had a hole cut into the top, and medical gas tubing is slipped over the hole. The O2 electrode is slipped into the tube, and the H2 electrode outside of the tube. This way, when current is applied to the electrodes, the Oxygen gas is captured in the test tube, and the hydrogen gas is free to escape. In implementation, the medical tube which carries the Oxygen is bound to a section of pilot light tube, which is run into the side of the fan chamber. When the fan is on, the Oxygen flows with the air injection into the furnace chamber.
The electrolyte used is a saturate solution of MgSO4, or Epsom salt. This is preferable to using NaCl salt because the electrolysis does not produce chlorine gas, which would be a very bad waste product to produce.
Because the production of metal-ion compounds would be unwanted, I use graphite electrodes. Rather than purchase relatively expensive electrodes from laboratory supply companies, I use the 'leads' from mechanical pencils, which I attach to alligator clip leads. There is exposed metal from the leads, so to reduce metal action during the actual firings, I extend the graphite far below the metal, so that the graphite sticks are much closer to one another than the metal leads are.
The fan in an old processor-cooling fan, which is secured to a wooden platform. A length of thin PVC pipe forms the barrel of the fan, which allows the oxygen to blend with the air as it is pushed into furnace chamber. The fan is not connected directly to the chamber, hence the angle of the barrel, which allows the air flow to be directed into the base of the chamber. The platform can be positioned for an angle of attack that produces the best results in the furnace, temperature wise. The positioning if the fan is more of an art than a science and comes with experience. It usually works best when angles so that a vortex is formed in the blast cone.
Step 5: Interfacing and Data Collection
*note that the software files here are broken up into individual sections.
The interface is a layer of python code that acts above the serial control protocol. The serial control allowed by the first layer Serial protocol software and the firmware is much more flexible than one would require for this project: I began writing the python code to allow a program to run on the PC, using the computing resources of a CPU, to interact with the outside world. With the code as given in Step 1, the PC can control all the digital pins, PWM through the analogWrite() command, and take analog data off of A0 (or any analog pins with modification of the firmware). Additionally, the firmware can be updated to run any segment of Arduino C code by simple adding an additional case/break block to the master switch block. Consequently, it is possible to change I/O structure on the fly (via the addition of a case/break block containing a pinMode() statement), or add any number of useful features. I chose to keep the firmware relatively simple for this project, only supporting the basic commands, because I knew I would not need to access any higher functions during furnace runs.
Furthermore, to make the higher-tier coding more readable, I added a set of functions that encapsulated all I/O functions specific to this project, such as fanOn() and fanOff() for the fan controls, to allow the GUI code to run without directly having to call the serial control programs. This allowed independent testing of the encapsulation codes (i.e. I could test fanOff(), and once it worked, i did not have to worry about coordination issues when I called it from the GUI software).
The collection of the thermocouple data is no different from the control mechanisms: it uses an encapsulation function to collect analogRead() data, and save the data (for later analysis and on-the-fly graphical display). The thermocouple data capture function also encapsulates the data collection functions, so that data is recorded and the run record is updated each time a measurement is taken.
The GUI functionality is enabled by the Zelle graphics package, an easy to use, low power graphics package for python. I chose the Zelle package over more sophisticated python graphics options for it's ease of use and relatively low system resources requirements. The GUI is setup as a master while() loop, in which the window is periodically polled with checkMouse(), allowing the program to perform autonomous actions (such as reading the thermocouple every so often) while waiting for user input. The window also displays the entire run's as-time graph of thermocouple data, which is updated every time a new reading is taken.
At the end of a run, the record for the run is saved in a text file by a simple python file.write procedure. Throughout the run, every time a measurement is taken, the statistics for that particular time: the time at which the recording is made, the thermocouple read, fan state, oxygen supply state, and number of fuel additions, are appended to a list. When the data saving function is called, this list is written into a text file so that the run can be further analyzed later.
Step 6: Assembled Device and Safety Precautions
(The images are the best at conveying the assembled device, I think)
*I have attached the complete python code below, in it's fully assembled form.
I assembled the device fully, outside for safety reasons. The steel table on which everything sits was a lucky find earlier this year, and is not of my own construction. It is handy, however.
Also included in the setup but not shown are the syringes full of alcohol for fuel. I used a 10mL syringe for the feed, and keep the fuel stockpile away from the main furnace for safety reasons. I filled 10 10mL syringes with alcohol, and I add them one by one during the firing, again for safety reasons. Also, I keep the electrolyte in a 100mL syringe until I am ready to begin the oxygen injection, mainly as an organization help, so that while I adjust the fan (which is directly attached to the electrolysis pool), I don't risk spilling the electrolyte.
I always keep a fire extinguisher handy , just in case. I highly advise keeping one nearby at all times there are high temperatures involved, because even if a fire breaks out, and you control it with another fire retardant or safety measure, the sense of security given by the presence of the extinguisher as a last resort will help you keep your head in an emergency.
I also like to keep a pair of vise-grips nearby, in case I need to move something hot. I like to keep welding gloves on hand also, but I try not to use them unless necessary, because the loss of dexterity in thick gloves can sometimes be more dangerous than the risk of burning your hands.
Lastly, whenever an object is being heated, I keep a bucked of water nearby so that it is easy to quench the object if necessary. For the first run, I was testing the effectiveness of the electrolytic cell, so I did not have a bucket around, since I did not plan to hear any objects. Often times I will also keep a bottle of water with a small hole pricked in the lid, so that a controlled stream of water can be used if necessary, or to test metal objects to see it they are hot. Also: remember the cardinal rule of forging safety: Hot metal can look exactly like cold metal .
Step 7: Full Scale Test Run
(The video below shows an example of a full-scale run)
The full scale run I performed with the entire device and am posting here was to test the effectiveness of the oxygen injection. I have been running the furnace for a while now, but it has been manually controlled in the past, and I did not have the oxygen injection. I use hand sanitizer as the ignition mechanism: some is lit and allowed to drip into the pit, igniting the primer fuel.
The procedure I follow for beginning a run is as follows:
1) Check that all safety measures are in place:
-There is a fire extinguisher within easy reach
-The glass screen is in place
-All combustibles are removed from the furnace area
-The fuel stores are at least 5 feet from the furnace
2) Check functionality of all components: fan, fuel feed, thermocouple, and O2 injector
3) Add ignition fuel (10mL alcohol, into furnace pit)
4) Check positioning of thermocouple, fan and fuel feed line
5) Begin ignition:
-Place quarter sized amount of hand sanitizer on furnace chamber grate
-Ignite hand sanitizer, wait for it to drip
6) Once ignition has been achieved, activate the fan
7) Initiate a vortex in the chamber by adjustment of the fan
8) Add the electrolyte to the electrolysis tank
9) When ready to begin the firing proper, activate O2 production
From here on out, the experiment is run as planned, with thermocouple readings taken automatically and as desired, and fuel additions made at the operator's discretion. I have found that keeping the furnace hot is not terrifically difficult, but requires some practice to become proficient.
The results of this test run were excellent and somewhat surprising. I was expecting the Oxygen injection to have very little effect on the overall temperature in the furnace, based on small scale electrolysis experiments which produced very little gas. However, when fully scaled up, the results were highly significant: a nearly 30% increase in average temperature! The graph above presents the data from the run, showing a visual confirmation of the effect. I was pleasantly surprised at the results. The image has the activity during the significant time periods labeled.
Step 8: Future Work
This project is to a milestone point (full automation of control and successful oxygen injection), but it is by no means complete. I have several improvements I would like to make. Furthermore, the flexibility and power of the serial control protocol is not fully taken advantage of in the current implementation, and I would like to expand the control structures to accommodate advanced features, such as PWM fan speed control, DAC O2 production rate control, and advanced thermocouple measurement techniques. I also hope that people who can see a use for the serial control protocol will take the code presented here and use it for their own projects, and in the process improve upon the system.
The first improvement I would like to aim for is the ability to re-try old runs, for improved repeatability and for procedural techniques for producing specific results. This would require probably a new front end program running on top of the prior basis software, designed exclusively to run a pre-programmed run from a file.
I would also like to experiment with different fuels than drugstore alcohol. Once I have the capability to repeat the same run, it would be beneficial to have one general experimental run to test various fuel blends, exposing the fuel under test to a sequence of controlled conditions.
Additionally, adding the capacity for an electronic ignition rather than manual ignition would be helpful, as it would make the activation process more controllable and thus allow for more control over repeated runs. I had previously experimented with electron ignition using resistive heating elements, but the alcohol fuel was insufficiently volatile for even the highest temperature attempts at this ignition mechanism. It is possible that using an alternate primer fuel could enable this kind of electronic ignition, which is an option I will experiment with in the future.
Lastly, I would like to add a complete emergency shutoff device to the apparatus, which would allow rapid elimination of the flame in case of an accident, and Ideally cool down the chamber rapidly as well. I have considered both a sprinkler-type system and an inert gas system. This improvement will probably be the farthest down the line of the future work I have discussed here.
In conclusion, I would like to invite anyone who thinks of a potential use for the serial connection protocol to feel free to take my code and edit it as they see fit, and to feel free to contact me with questions or comments regarding the protocol, or any applications thereof. I hope that my discussion of this project has adequately shown the implementation of the protocol, and has engaged any reader who has taken the time to look at he work to think about new ideas for their own projects.
Participated in the
6 years ago
working on something similar (not a blast furnace), but I do need to record temperature, save data and plot the graph in real time. Thank you for this instructable, it is very helpful. I will try to make it work for multiple TCs, although I am not sure if that will prove to be troublematic with the serial comm.
Great read, thanks again for the helpful material
7 years ago
I love the combination of Python and the Arduino. So I have created a collection about it. I have added your instructable, you can see the collection at: >> https://www.instructables.com/id/Arduino-and-Pytho..
9 years ago on Step 8
Very cool, I am wanting to make a heat treating furnace/oven for steel and this would be awesome to have it automated. For a starter, an electronic ignighter from a gas grill may work. Just add another relay to turn it on and off.
10 years ago on Step 4
for electrodes that is
10 years ago on Step 4
You can also use the centers of batteries I believe.
11 years ago on Introduction
Hi - the two blastFurnace links above don;t work. Any chance of reposting them. Cheers. Nice project ;)
Reply 11 years ago on Introduction
I believe you that the links didn't work for you, but they still work for me. Did they not download for you? If they downloaded but were weird, it might be because they're in rich text format. Let me know if you're still having trouble, I'd like to fix it if I can!