Arduino Auto Mixing System

Kristijan, open the Blink example in the Arduino IDE and parse it for each line. It will be much faster this way.

And you will know the real joy of the fact that someone can do the work for you on and off the LEDs for free every day! :slight_smile:

Studying and using someone elseā€™s code for self-education is common not only among programmers, but even AI is taught to program in this way today! You can also find Arduino programming lessons on YouTube.

7 Likes

Glister, welcome to Drive On Wood! I really like your insight into the problem statement! Oxygen sensors measure only the relative amount of oxygen in the exhaust pipe. And they donā€™t understand a damn thing about motor fuels!

If we blow clean, albeit hot enough, helium or argon into the exhaust pipe, then these sensors will try to convince us that our mixture is too rich! Without a single atom of fuel in the pipe! If there is pure oxygen in the pipe, or even fluorine!, then they will sing a song about a poor fuel-air mixtureā€¦

The process of controlling the fuel-air mixture using these sensors is very similar to the method of determining the age of a rabbit by its ears and its eggs. Sometimes it is possible to do this if you feel out a lot of rabbits you know before that time, but still among people it is customary to use not indirect signs, but direct measurements: ask the Day and year of Birth, and calculate based on the current date and knowledge of arithmetic.Praise be to the human mind, granted to us by the Creator of the Universe!!! Otherwise, it would be too ticklish for men every timeā€¦ :wink:

The real purpose of oxygen sensors (except collecting money) is to save the catalyst from overheating and fire under the car. And the real purpose of the catalyst is to earn more and more money by automakers on the sale of supposedly new revolutionary technology to save inevitably decreasing fuel, brazenly covered with an imitation of caring for the environment. But people eat it too! As was already the case with freon, which is heavier than air, but manages to destroy the ozone layer, which is very highā€¦ As is happening now with the crazy idea that carbon dioxide, which is so much loved to convert all plants into pure oxygen and their own body, allegedly can cause a greenhouse effectā€¦ Carriers of less knowledge are easier to manage.

These sensors more or less work under the condition of more or less stable fuel parameters. Such as gasoline, diesel fuel, ethanol, propane-butane, methane, or at least charcoal gas. Provided that the charcoal is at least a little similar in its properties to the one that the adjuster of this system had during the setting of such an automatic regulatorā€¦

And the gas obtained from wood on the move of the car has fun on the move, and changes its composition during the movement of the car. So that the driver, apparently, was not bored on the way! :wink: And neither narrowband nor broadband oxygen sensors know about it. Neither expensive sensors (and at the same time absolutely not eternal) from Bosch, nor Chinese (and also not at all free) replicas of these sensors.

Another nail in the coffin of oxygen sensors is the regulator circuit based on the consequences: first, the engine tries to burn the gas of the wrong composition, and then, maybe, if we are lucky with a signal from such a sensor, we will know that something went wrong, either in one direction or in the other. Thus, a narrow strip of time of a good fuel-to-air ratio will be only a rare voluptuous sip for the engine. Which he will remember when he finally gets to the landfill, after continuous ordeals from a poor to a rich mixture in the work process of such a regulatorā€¦

A completely different approach looks like the idea of determining the parameters at which the fuel-air mixture based on wood gas will burn well for the desired engine operation mode we need at the next moment! I.e., we just need to build a system that will foresee the future that will happen in the engine. :wink:

To do this, you either need to know the quantitative and qualitative composition of fuel and oxidizer (and more or less hardy gas analyzers in real time for all this will cost more than a wood gasifier, the newest Mercedes and Space Shuttle combined!), orā€¦

Or directly determine the boundaries of the ratios at which the mixture of momentary composition will burn steadily! Because the poor mixture ignites badly, and the rich mixture also ignites badly. If we put two identical small burners with the same gas flow through them, then by changing the air supply to each of them, and monitoring the presence or failure of the flame, we will be able to find out the extreme limits of the fuel-air ratio we need. What will need to be configured for the engine will be somewhere in the middle.

Naturally, we will need not only two ionization flame sensors, but also two spark plugs to resume it. Although it is possible with the help of the same Arduino (there is still no escape from it on the path of small home automation), and two simple high-voltage converters, to do with just two car spark plugs, which will perform both the function of igniting the lost flame, and monitoring the presence of this flame, measuring the current consumption of each converter after the next attempt ignition of the flame.

I would be very happy to collect and try out this idea in practice, but I hate to keep new thoughts secret inside my head for a long time! Probably because they are very bored in the void ā€¦ :wink: In fact, discussing new ideas with other people long before they are implemented is very useful to eliminate the weaknesses of these ideas.

8 Likes

Hello Marat, I rarely read such a good article as yours, itā€™s perfectly written, you gave good examples, it looks like it was written by an expert, an electrician, a programmer, a person with a good idea and knowledge, thank you, you enrich this forum a lot. :+1::clap:

7 Likes

Marat,
Thank you for your thoughts on this subject.
Being that my application is for the generation of power for battery bank charging, I am searching for a fuel/air regulation system that can modulate when unattended to account for small changes in load.
This system does not have to be a feedback loop from an O2 sensor, I am open to any fairly simple form of sensing and automation. One thing that interests me is the sensing of differential pressures in the intake manifold. One sensor at the entrance, and one on the engine side of the throttle valves.
Much the same as some have done using diaphragms in their vehicles.
The vacuum tells the controller that the engine is under more or less load, but it cannot quantify the current mixture of air/gas.
However, if we know that the optimal mix for an engine is 51% / 49% then we can manually set that mixture when at the operating speed of the engine/generator (1800 rpm in my case).
Any deviation from that speed would be sensed by the differential sensors and depending on the reading the amount of fuel can be temporarily added or reduced.
It may be necessary to automate both the air and gas valves.
A very interesting and enjoyable problem.
I am still in the learning phase of this journey :slight_smile: One of the best places to be.

4 Likes

Yes every fuel has its own scale. On the gasoline scale the stoich mixture for woodgas will read higher on wood / char gas around 15.5 / 15.7. I believe you can change the fuel scales on the AEM. Ive never played with that but I will when I resume next controls development.

Always remember the best code is the code that is already written!

7 Likes

Glister, what kind of fuel will your gasifier run on?

Firewood or charcoal? Automation of the charcoal gasification process is much easier, and maybe itā€™s worth using a ready-made @Matt Ryder solution to get a quick result?

Own research is undoubtedly very interesting, but itā€™s a long way. And in the amount of money spent, including money, this way is much more expensive than a broadband oxygen sensor.

Another question is if you want to automate the process of gasification of firewood - very few people do this. But the prospect of putting 75% of the success of this type of gasification into the Arduino program is a very worthy goal! Which is especially nice to do here on DOW! :wink:

7 Likes

Marat,
I am not sure which fuel to settle on.
I do see the benefits of charcoal.
I have been watching Mattā€™s excellent videos of how to build the Ammo Can Gasifier.
That unit seems to match my engine size quite well.
Regarding automation, I am more concerned about maintaining the proper engine fuel mixture than the automation of the gasifier, although I would like to control future larger versions by monitoring burn temperature, air inlet flow, and wood chip/charcoal feed. But that is far off at this point.
I have been building small off grid generators for 10 years but they used diesel or alternative liquid fuel systems. I have programmed many Arduino and RasPi automation projects, but where my knowledge lacks is in this area of gasification and fuel mixture control.
Fortunately there is a lot of smart people and discussion on this forum where people can learn.

@Matt Ryder,
I noticed that you do not use any auto throttle system on your Ammo Can units when powering a generator. Is that because you found through experimentation that it is not needed?
And thanks kindly for the great videos that you have produced. :slight_smile:

5 Likes

Yeah the Charcoal systems dont really need it. They run pretty stable but you do at times need to make minor adjustments. So charcoal could benefit from an automixer as well. On a small scale wood gas system I wont bother to operate one without this system. Not worth my frustration restarting a stalled out gasifier system along with the power inconsistencies.

3 Likes

So for those who are looking for a scientific research please search for the below

Monitoring the Air-fuel Ratio (AFR) of a
Biomass Gasification Process with an
Arduino Uno 3 and a Narrow Band
Lambda Oxygen Sensor


The idea is the same that mentioned already with the use of Arduino and lambda sensor but this research might add some value to the topic.

Personally I m still far from this point but I would consider it.

3 Likes

If they find a way to get it to work with the narrow band sensors, those are a bit cheaper then the wide band ones. One of the issues with any sensor is finding the right documentation to interface with the sensor. They are mostly made or licensed from Bosch, who seemingly keeps a pretty tight lid on them.

I personally still donā€™t like the 8-bit arduinoā€™s. Megasquirt I believe still does use them and relevant sections might be able to be found poking through their ino files. I didnā€™t look for it.

I still havenā€™t really gone through Kristianā€™s code, yet. I have two other much higher priority projects.

3 Likes

Just for fun, if you have nothing else to do, here are a couple of narrow band O2 sensor bench tests that I did several years ago, just to become familiar with how they work:

test 1

test 2

Pete Stanaitis

9 Likes

Narrow bands will not work there is not enough resolution available and they do not produce a stable signal. These are for fuel mapping not fuel mixing. For a fuel mixer you must use a wide band sensor or you will be wasting your time and money. Narrow bands will not work for this nor is this what they are designed for.

8 Likes

Im disagreeing. When I was looking at these a few years ago, it looked like the difference was the wide band had multiple overlapping ranges.

1 Like

Im not just looking at use them I HAVE used both. The narrow bands are for mapping not monitoring. They are not constantoly monitored. Knock sansior fires, ECM says oh crap check the O2Sensor. Is the reading ok? no change, if not make change if to many reads are the same send out a fault code.

But hey dont take my word for it, Ive only developped a working unit over 10 years agoi and have played with multiple narrow bands with the same results. Narrrow band sensors hardly have ā€œ1 voltā€ resolution. That is not enough. the 5 volt lambda range is barrely enough and if you can get one to work you have done something above and beyond most others. Wood gas mixing is very precise and if the controller over shoots, is slow or is all over the place it wont work. Your will just stall or be under powered.

Its one of the reasons there are multiple sensors on newer cars. One is not reliable enough.

Im done with all this anyways. The charcoal units dont need this.

I really dont understand how saving 50 dollars justifies completely re inventing this when the wide band units are proven and developed. Plus even if you do get a narrow band to work. The wide band will always be supperior. Spend the extra 50 dollars and build something that is proven and works. Those kits are not expensive anymore. You can get the complete kit for a hundred dollars on Amazon.

8 Likes

Sorry, that was my bad. I meant to say ā€˜iā€™m NOT disagreeingā€™, nor was there any implying you should or would do anything.

4 Likes

Sorry I just get really annoyed when people want to jump thru all these crazy hoops just to save 50 bucks when there are already solid codes and builds available that are proven.

5 Likes

Sometimes it is just because you can or the challenge of trying. Apparently there are github projects that created the controllers like this:

Which probably doesnā€™t save as much, but it could be integrated with the microntroller and motor controls on a single board which eliminates wiring.

6 Likes

Guys the below was produced by Chatgpt AI, while I was looking for alternatives to arduino AFR auto mixing. It probably has inconsistencies but I think itā€™s worth having a look

:fire: Full Servo-Based AFR Control System :fire:

:wrench: Overview

This system replaces the hybrid (solenoid + vacuum actuator) method with a servo motor for direct air intake control. The oxygen sensor provides real-time feedback, ensuring precise AFR adjustments to stay within the 1.2 - 1.4 AFR range.

:pushpin: Components Required

:one: Servo Motor (MG996R or similar, strong enough for airflow control)
:two: Servo Tester Module (Manual + Auto control)
:three: SPDT Switch (Switch between Manual & Auto Mode)
:four: Wideband Oxygen Sensor (0-5V Output)
:five: Voltage Divider (10kĪ© + 10kĪ© resistors) ā€“ Scales 0-5V to 0-2.5V
:six: 12V Power Source
:seven: Potentiometer (Built-in in Servo Tester Module) ā€“ Fine-tunes response

:zap: Wiring & Connections

:one: Oxygen Sensor Wiring

  • Signal Output (0-5V) ā†’ Voltage Divider (Top Resistor)
  • Ground ā†’ Circuit Ground (GND)

:two: Voltage Divider (Scaling 0-5V to 0-2.5V for Auto Mode)

Voltage Divider Pin Connection
Top Resistor (10kĪ©) Connect between Oxygen Sensor Output (0-5V) and SPDT Switch Center Pin.
Bottom Resistor (10kĪ©) Connect between SPDT Switch Center Pin and GND.
Middle Node (Between Resistors) Connect to Servo Tester Input (Auto Mode).

:three: SPDT Switch (Manual / Auto Mode Selector)

SPDT Switch Pin Connection
Common (Center Pin) Connect to Servo Tester Input.
Position 1 (Manual Mode) Connect to Potentiometer Output.
Position 2 (Auto Mode) Connect to Voltage Divider Middle Node.

:four: Servo Tester Module Wiring

Servo Tester Pin Connection
Power (VCC) Connect to 5V (or 12V depending on model).
Ground (GND) Connect to Circuit Ground.
Signal Output (PWM) Connect to Servo Motor Signal Wire.

:five: Servo Motor Wiring

Servo Wire Connection
Red (VCC) Connect to Servo Tester Power Output.
Black (GND) Connect to Circuit Ground.
Yellow (PWM Signal) Connect to Servo Tester Signal Output.

:dart: Setting AFR to 1.2 - 1.4

Manual Mode

:white_check_mark: Use the potentiometer in the Servo Tester Module to manually adjust airflow.
:white_check_mark: Turn the knob until AFR stabilizes at 1.3 (ideal syngas-air mix).

Auto Mode

:white_check_mark: Flip the SPDT switch to Auto Mode so the oxygen sensor takes control.
:white_check_mark: The servo adjusts airflow dynamically based on AFR readings.
:white_check_mark: If AFR fluctuates too much, fine-tune the potentiometer for smoother response.

:hammer_and_wrench: Fine-Tuning for Stability

  • If AFR drops too low (<1.2) ā†’ Servo opens air intake slightly.
  • If AFR rises too high (>1.4) ā†’ Servo closes air intake slightly.
  • Use the potentiometer in Auto Mode to adjust servo sensitivity.

:rocket: Final Notes

:white_check_mark: No vacuum actuators or solenoids needed ā€“ direct servo control.
:white_check_mark: SPDT switch lets you toggle between Manual & Auto Mode.
:white_check_mark: Potentiometer remains active in Auto Mode for fine-tuning.

3 Likes

that is pretty much it. The devil is in the details of the O2 sensor itself. and whether it is plausible to make a cheaper and easier system.

The bosch wide-band sensor switches ranges and they want you to buy their sensor controller chip to go with and since it switches ranges, you need to control the ranges somehow, but the last time I looked it essentially doubled the price or more for buying a single unit.

The motor is the same thing. and quite possibly the servo motor is the best option. But I am seeing small pancake stepper motors for 7 bucks, and drivers for 3 bucks, and you already have to have a microcontroller for the program to adjust itā€¦ My mind wanders down that path. :slight_smile:

3 Likes

But it would not make sense to use a $2 muscle wire spring (analog) for this?
Rindert

2 Likes