Arduino Manager Development for All

It should work with any of them provide the i2c bus stuff is set up right. :slight_smile:

The banana pi will probably work with a dongle. To get the on board working, the easiest thing to do is use the banana pi kernel (and modules) Or you could just recompile your own kernel with the right drivers and such. I donā€™t know how long that will takeā€¦it takes forever on the B.Iā€™m using straight raspbian, and I am not used to packages being so far out of date.

I usually use Fedora, but armv6 isnā€™t supported anymore. The pi2, and the bananapiā€™s should be supported.

No I tried that too, Its like it cant find it.

The Bpi M-1 works no problem, but the M-2 is a no go. I have no idea what kernel is. :smile:

kernel is the thing that controls the whole system. :slight_smile: It is the scheduler, has the device drivers, filesystem drivers, network drivers, etc.

Try all the usb ports. :slight_smile: I am guessing there are 2 different buses being used and only one of them is recognized, and it might actually be an issue with the bootloader software. :slight_smile:

1 Like

Yeah I did all that too. I contacted the guys over at TinyOne and they said wifi is not supported yet for the M-2.

here is their reply

ā€œIt will be implanted as it is community supported. Right now the current image for Raspbian does not support wifi, however android doesā€

Oh! you can use the android kernel and bootloader. You just have to switch out the root filesystem. That is probably over your head. But that is how things like CyanogenMod, and getting linux to run on the nook, chromebook, etc all work.

Raspberry PI Arduino
GPIO 0 (SDA) <ā€“> Pin 4 (SDA)
GPIO 1 (SCL) <ā€“> Pin 5 (SCL)
Ground <ā€“> Ground

You need to double check the pins for your boards.

It is a cheap hack to get it to work,I think it only works with 1 master and 1 slave.

The pi and the arduino use different voltages so
Technically I should be using a logic level shifter like

My arduino Mega came with a LCD.

That last code is working!!! This is exactly what Ive been wanting. All we had to do was map the delay to the input of the 02 sensor. So I have it mapped from center of the two thresholds going one way and inverted it going in the other direction.

So what it is doing is when things are close it will move nice and slow but if things go way out of wack it will respond very fast and then taper down as it gets close to the parameters we are trying to meet.

I also installed the 4.9 sensor for the most part all the lag is gone and Im happy with it.

I will start work on a tutorial with this code. You will need to use the wideband AEM kit however. The nice thing about the kit is you will have the readout. This will make things easier for starting and creating a set point.

Thats next on my list :fire:

Very good info, ok I will get one on order. Im an electronics addict now :fire:

which code? there are like 3 of themā€¦lol

Haha yeah was I thinking Chris might add a section in the library for Arduino code once the creator is ready to endorse it.

I am planning more to add. Potentiometer timers for grate and hopper agitators, thermocouple readouts, flare ignitors etc.

Ill post the latest code here. It is very simple just a single ā€œIf Elseā€ statement that is it besides the manual mode.

#include <Servo.h> 
 
Servo myservo;  // create servo object to control a servo 
 
 //VG 02 Wide Band Mixture Controller V1.3
//Craeted by Matt Ryder, Vulcan Gasifier LLC May 5, 2015
  //Last edit; June 22, 2015 
  
  // This code requires an AEM O2 sensor kit with LSU 4.9 sensor Part # 30-4110

// These constants won't change:
const int O2SensePin = A1;    // pin that the O2 sensor is attached to
const int O2SwtPin = A2;   //Pin Auto Mode Switch is attached to
const int O2ManPin = A0; // Reads the O2 Manual Adjust Potentiometer on pin A1


  
const int RichCon1 = 490;  // Threshold limit for Rich gas condition



const int LeanCon1 = 530;    //Threshold limit for lean gas condition


int pos = 0;    // variable to store the servo position
int val;    // variable to read the value from the analog pin 
int lastpos = val;     // variable to store the servo last position
int O2SwticthState = 0;         // variable for reading the Fuel Mixer Mode status

void setup() 
{ 
  myservo.attach(9);  // attaches the servo on pin 9 to the servo object 



      // Need to create a set point for servo start position after manual tuning
  {
  val = analogRead(O2ManPin);  // reads the value of the potentiometer (value between 0 and 1023) 
  val = map(val, 0, 1023, 0, 180);     // scale it to use it with the servo (value between 0 and 180) 
  myservo.write(val);                  // sets the servo position according to the scaled value 
  lastpos = val;                       // sets lastpos to equal the position of the manually set position
  delay(10);                           // waits for the servo to get there 
 
  }
} 
   
void loop() 
{
    // read the state of the pushbutton value:
  O2SwticthState = digitalRead(O2SwtPin);
   // read the value of the O2 sensor:

   int sensorReading = analogRead(A1);

  if (O2SwticthState == LOW)
  {
  val = analogRead(O2ManPin);  // reads the value of the potentiometer (value between 0 and 1023) 
  val = map(val, 0, 1023, 0, 180);     // scale it to use it with the servo (value between 0 and 180) 
  myservo.write(val);                  // sets the servo position according to the scaled value 
  lastpos = val;                       // sets lastpos to equal the position of the manually set position
  delay(10);                           // waits for the servo to get there 
  
  }
    else 
    {
         
         delay (10);
    
 
  }
  

     if  (sensorReading <= RichCon1)
  {                                   
         lastpos = lastpos +1;
         myservo.write (lastpos);
    val = map(analogRead(O2SensePin), 0, 510, 0, 150);
    Serial.println(val);
    delay(val);                 
  }        
  
   else  if  (sensorReading >= LeanCon1)
  {                                
          lastpos = lastpos -1;
         myservo.write (lastpos);
   val = map(analogRead(O2SensePin), 1023, 510, 0, 100);
  Serial.println(val); 
    delay(val);                      
  } 

    else {
         delay (10);
         }
         
         
}

Here is a video I did today on our test unit with this code running. I love this little DC unit, the foreman grill is a good test it is 1500 watts with both burners on. However they turn on and off and ever changing the load. The machine will run all day just like in the video. I also created some rich and lean events cutting of the gasifiers intake with the ball valve. This also has the simple fire add on running. There is much more to learn there, I will be building a charcoal reactor for this unit to add a second stage reduction system.

2 Likes

Hey Sean,

I am running your code on the bench. One issue is it is only working in one direction.

But from what I am seeing now it is very smooth in its operation. But anyways I need to know what parameters need to be tweaked. This code is a bit over me head :smile:

I sent you updated code. I think it was not working when it was way off the low value.
I found another bug with the moving avg part of the code, and added comments. At the very least it will act differentā€¦ :slight_smile:

These can all be tweaked safely:

//O2GAP is the space both Ā± around the calculated ā€œidealā€
#define O2GAPHIGH 30
#define O2GAPLOW 30
//O2INTERVAL is the delay time between iterations of the loop.
#define O2INTERVAL 30
//O2MACOUNT is the number of values used for the moving avg calculationā€¦should be a power of 2.
#define O2MACOUNT 8
//O2WAYOFF do a much faster correction if the sensor reading and the pot setting differ by more then these value
#define O2WAYOFFHIGH 75
#define O2WAYOFFLOW 75
//O2WAYOFFMISSES is how many times in a row the value can be in the ā€œway offā€ range before a huge correction
#define O2WAYOFFMISSES 1
//O2WAYOFFCORRECTION the number of steps of the correction if we are way off.
#define O2WAYOFFCORRECTION 5

I did start playing with gap highs and lows. I set them closer to the middle in the 500 to 650 range and for the more extreme they are set around 450 and 750.

It doesnā€™t use a fixed value for the ideal like yours does. The ideal is calculated on the fly by whatever the avg is when you quit pressing the button. with these numbers it is
#define O2GAPHIGH 30
#define O2GAPLOW 30
#define O2WAYOFFHIGH 75
#define O2WAYOFFLOW 75

for a 1 step correction it is:
greater then ideal + 30 or less then ideal -30

for the bigger 5 step correction it is:
greater then ideal + 75 or less then ideal -75

It roughly corresponds to what you had for values when I looked at your code.

All right Ill get the other loaded up and see what happens. I do like how smooth it is.

Let me know how it is working. I am trying to scrounge some pots for a test to eliminate the logic errors before you test.

V4 is probably going to eliminate the manual mode switch. There isnā€™t really a need for it that I see.

You need the manual pot to start the engine. Its easier to manually adjust at start up. The raw gas gives false readings and takes longer to get started = burned up starter

Its also a nice thing to have for trouble shooting.

But your code might work better than mine. But Id still put it in for troubleshooting, you can always start in auto mode.

Yeah, I am aware of that issue. I was going to put in like a 30 second time delay from the last pot adjustment before it goes into autorun mode. It uses the pot to determine the ā€œidealā€ anyway if you need to adjust during the run, you donā€™t have to hit the button, you can just move the pot and it will react and work like it is designed to do.