Any questions you have before you begin buying, building and installing.
By pc1010
#38075
Hello.
I have a speeduino running quite nice in my 1.3 with added boost and I'm happy with it but there is someone would say simple thing that I can't get right. I have a stepper motor that controls idle and I can only get it to work in open loop. The ultimate goal is to have it in closed loop, but no matter what parameters I enter (mainly P and I terms) the engine starts at 1500 RPM, then RPM drops near to 0 and one more time to 1500 finally stall. In open loop when I tune steps over temperature I can for example start the engine to have 900 RPM and next time (even in a minute) I start I have 1300. Looks like it could be a homing problem. The driver isn't overheating, I checked it. Could someone give me a suggestion what could be wrong? Or maybe advice how to set homing right.
Any help greatly appreciated ;)
By stum
#38077
Look forward to some experts thoughts on this. I too have chased my tail on Stepper Idle control. with similar experiences. Start it up. Set it. Move the Idle settings All good. Turn it off and restart...…. and its idle speed is some where else, up, down.... all over. I've currently got mine unplugged. Just idles cold and at 1200 warm. I have not tried the latest firmware, but the one before, and a number before that. Cheers.
By pc1010
#38078
So it looks like I'm not the only one with this problem. Maybe I'll do like you did for the moment because for now it drives me nuts :evil:
By stum
#38079
Just had a thought while I was out, Earlier on there was some talk of adding in the idle stepper into the hardware testing. Im not sure if this was done. And I have never checked. As it is hard to diagnose and set the min steps and step time, and home steps when the engine is running. All our problems could be related to these settings. As im sure there must be some users that have had success.
By theonewithin
#38080
Have a stepper in my bike.

Haven't bothered with closed loop as yet but works wonderfully on open loop and do not have any issues with changing RPM after restart unless I power the ECU using USB and no 12v.

No 12v no stepper control.
By 126p
#38084
I see that I'm not the only one with the problem.
I have very stable rpm on idle, without stepper motor.

I tested stepper motor by enabling and disabling open loop mode in TS settings.
I see that in 'normal' mode the stepper is closing. When I chose 'inverted', it is opening.

My problem is that even in open loop mode, sometimes on idle the engine is spinning higher than it should. Turning the engine off an on is fixing this.
In closed loop it works better, I have high revs, then, after few seconds, everything goes to normal.

I event wrote a small piece of code to test the stepper using serial console:
Code: Select all
diff --git a/speeduino/comms.h b/speeduino/comms.h
index a3e8772..a2b15f1 100644
--- a/speeduino/comms.h
+++ b/speeduino/comms.h
@@ -1,5 +1,8 @@
 #ifndef COMMS_H
 #define COMMS_H
+
+#include "globals.h"
+
 //These are the page numbers that the Tuner Studio serial protocol uses to transverse the different map and config pages.
 #define veMapPage    1
 #define veSetPage    2//Config Page 1
@@ -44,6 +47,7 @@ const char pageTitles[] PROGMEM //This is being stored in the avr flash instead
   };
 
 void command();//This is the heart of the Command Line Interpeter.  All that needed to be done was to make it human readable.
+void processStepperCommand(bool forward);
 void sendValues(uint16_t offset, uint16_t packetlength,byte cmd, byte portnum);
 void receiveValue(int offset, byte newValue);
 void saveConfig();
diff --git a/speeduino/comms.ino b/speeduino/comms.ino
index e8e2f8b..4dd6974 100644
--- a/speeduino/comms.ino
+++ b/speeduino/comms.ino
@@ -34,17 +34,6 @@ void command()
       writeAllConfig();
       break;
 
-    case 'b': // New EEPROM burn command to only burn a single page at a time
-      cmdPending = true;
-
-      if (Serial.available() >= 2)
-      {
-        Serial.read(); //Ignore the first table value, it's always 0
-        writeConfig(Serial.read());
-        cmdPending = false;
-      }
-      break;
-
     case 'C': // test communications. This is used by Tunerstudio to see whether there is an ECU on a given serial port
       testComm();
       break;
@@ -104,6 +93,14 @@ void command()
       }
       break;
 
+    case 'f': // move stepper forward
+      processStepperCommand(true);
+      break;
+
+    case 'b': // move stepper backward
+      processStepperCommand(false);
+      break;
+
     /*
     * New method for sending page values
     */
@@ -356,6 +353,8 @@ void command()
          "T - Displays 256 tooth log entries in binary\n"
          "r - Displays 256 tooth log entries\n"
          "U - Prepare for firmware update. The next byte received will cause the Arduino to reset.\n"
+         "b - Move stepper backward.  Syntax:  b+<numberOfSteps>\n"
+         "f - Move stepper forward.  Syntax:  f+<numberOfSteps>\n"
          "? - Displays this help page"
        ));
      #endif
@@ -367,6 +366,50 @@ void command()
   }
 }
 
+void processStepperCommand(bool forward) {
+        //A 2nd byte of data is required after the 'f' or 'b' specifying the number of steps.
+    cmdPending = true;
+    byte numberOfSteps;
+
+    if (Serial.available() > 0)
+    {
+        numberOfSteps = Serial.read();
+        //This converts the ascii number char into binary.
+        if (numberOfSteps >= '0') { numberOfSteps -= '0'; }
+
+        numberOfSteps = numberOfSteps * 10;
+
+        int stepperDirection = STEPPER_BACKWARD;
+        char* directionString = (char*)"backward";
+        char* directionForward = (char*)"forward";
+
+        if(forward) {
+          stepperDirection = STEPPER_FORWARD;
+          directionString = directionForward;
+        }
+
+        Serial.print("Stepping ");
+        Serial.print(numberOfSteps);
+        Serial.print(" steps ");
+        Serial.println(directionString);
+
+        digitalWrite(pinStepperDir, stepperDirection); //Sets stepper direction to backwards
+        digitalWrite(pinStepperEnable, LOW); //Enable the DRV8825
+
+        for(byte i=0;i<numberOfSteps;i++){
+          digitalWrite(pinStepperStep, LOW);
+          delay(100);
+          digitalWrite(pinStepperStep, HIGH);
+        }
+
+        digitalWrite(pinStepperEnable, HIGH); //Disable the DRV8825
+
+        Serial.println("Stepping done");
+        
+        cmdPending = false;
+    }
+}
+
 /*
 This function returns the current values of a fixed group of variables
 */

By ric355
#38086
126p wrote: Sat Sep 28, 2019 7:39 am I see that I'm not the only one with the problem.
I have very stable rpm on idle, without stepper motor.

I tested stepper motor by enabling and disabling open loop mode in TS settings.
I see that in 'normal' mode the stepper is closing. When I chose 'inverted', it is opening.

My problem is that even in open loop mode, sometimes on idle the engine is spinning higher than it should. Turning the engine off an on is fixing this.
In closed loop it works better, I have high revs, then, after few seconds, everything goes to normal.

I event wrote a small piece of code to test the stepper using serial console:
The inverted mode is for situations where the wiring is the opposite to what was expected. It just saves having to change the wiring around. Choose the mode that results in the stepper being homed (the pintle is against the seat that that no air flow can occur) when the number of steps is at zero in your open loop table.

For the moment, I suggest you stick to open loop until you are sure that you have it working properly.

The main issue with steppers is that they don't provide any positional feedback, so you never know if commanding the stepper to move actually results in it moving.

I suggest you first carry out some testing to see if it is indeed a stepper position issue. Use your open loop configuration, and always take data logs. Start the engine hot, with it idling where you expect it to. Shut off the engine, remove the stepper, and measure how far the pintle is projected. Now replace the stepper and do the same test but you are now looking for your 1300rpm situation. Re-measure the stepper. Is it the same measurement or a different measurement? This will tell you if the stepper is causing more air flow or if that flow is coming from somewhere else (such as a vacuum leak somewhere). Compare the logs from the two events; is the iac load the same? If it is, and the measurement was not the same, that tells you the ECU is commanding the same position but the stepper is not reaching it. If it is different, that tells you the ECU is commanding a different position so you need to look for why that is. For example, is your coolant temperature consistent.

Some things to make sure you have done right;

- Adjust the current pot on the stepper driver as per instructions in the wiki.

- Measure the range of your stepper motor, ensure the homing steps are set just above this number, and ensure that your open loop stepper curve does not have any values in it that exceed the range.

- Ensure the stepper moves in the correct direction when zero steps are requested (it should close off the air bleed). You can verify this using the open loop curve. Just remove the stepper from its housing but leave it connected. With the ignition on, alter the open loop curve at the position of current coolant temperature. The stepper should respond and you can see whether it moves in the correct direction. Be careful not to shoot the pintle out of the end of the stepper as you may be searching for it for many hours.

- Ensure your open loop curve is representative of the direction of the stepper. You want close to zero steps on a hot engine, and more steps when cold. The exact range is obviously engine specific; I am trying to explain that the curve should be in the "downwards" direction if that makes sense.

- Check all loom connections. A bad connection will obviously disrupt things.

- Check you have good battery voltage and there is no significant voltage drop to the stepper.

If you need a procedure for measuring the range of the stepper let me know and I will add one.
User avatar
By PSIG
#38092
I would add some prerequisites. First and foremost, Speeduino closed-loop idle control will not work satisfactorily without the entire tune being very well adjusted and stable. Everything and every setting, from injector dead time corrections to idle ignition timing. It's meant as a joke of sorts, but isn't far from the truth that the engine must be tuned to the point that CL idle is not needed, as it must be very stable for CL idle to then automatically compensate for odd variables. CL idle will not "fix" a poor idle tune, and will usually make it worse. ;)

One way to set-up for CL Idle: I prefer to start and do initial tuning with the IAC closed and inoperative. I set warm idle tune (fuel and spark) regulating idle speed with the throttle stop. Once that is all running well and stable across the entire area, I enable OPEN-loop idle, home it and set for 50 steps open from the seated home position. The idle will now be too high, and I bring it back down with the throttle stop. It should now be idling happy at 50 steps (about 1/3 effective flow range). If the throttle stop is at minimum (any less and the blade would contact the bore :x) but still high idle, then reduce steps to a low idle. Or find your vacuum leak. ;) That's your baseline.

From here, I test for how many steps give about how many rpm change (allows setting cranking and cold startup idle targets), and how many steps open will give increases in rpm (finds effective range). At some point adding steps will not add rpm, and the airflow is at maximum through the valve. Find that point and enter it as the homing steps, which is also your effective range limit. Adjust your startup settings for a solid cranking, starting, and warmup with appropriate rpm on each. If all goes well, you are done and only want CL idle for odd compensations, not basic idle stability. Now you're ready to try closed-loop with a tune that's ready for it.

If your CL idle surges, it is likely either running on an incomplete tune, or set for over-control. Tuning PID generally begins with all zero settings, increasing P until it barely surges, then add some D to stabilize. Repeat. In order to improve response time and proximity to the rpm target, carefully add a tiny amount of I which acts like a booster, so be conservative. You can read about PID tuning all day and that's good; but the quickest teacher is trying it, slowly and incrementally, one variable at-a-time.

There are many ways to approach CL idle tuning, and this is just one. Tune methodically and with-purpose, always considering what you are trying to accomplish with each test or change.

David
User avatar
By V6vintage
#38127
I chased my tail trying to adjust idle PID settings for weeks and weeks. It turned out that the VE cells 'below' the region where my idle is were too low, making the engine run lean-drop RPM-increase MAP, and then repeat. I made these richer and it now settles down to idle very nicely. this was difficult to find in the logs so i tuned it by ear (or hearing aids in my case!)

I should add that AutoTune (VE Analyse Live) adjusted these cells in the first place - which goes to show that AutoTune isn't always the final solution when tuning an engine.

I've been tinkering with Speeduino / Tunerstudio for about two years now and still consider myself a complete beginner!
User avatar
By PSIG
#38128
V6vintage wrote: Sun Sep 29, 2019 7:39 pm I chased my tail trying to adjust idle PID settings for weeks and weeks. It turned out that the VE cells 'below' the region where my idle is were too low, making the engine run lean-drop RPM-increase MAP, and then repeat. …
I've been tinkering with Speeduino / Tunerstudio for about two years now and still consider myself a complete beginner!
Indeed, a full-tune must be from the cranking threshold (default 400 rpm) and up, so it's tuned well for when loads pull it down (headlights, trans engagement, hard decel, etc), it is stable and recovers without any IAC assistance. That isn't always easy to do, and sometimes requires creative tuning techniques and a lot of attention to factors such as ignition timing. We are all learning new stuff here every day, so you fit-in well! 8-)

David

Always going to be one, I have completed 3 convers[…]

Do i have to do something in arduino software ? i […]

STM32 development

Not yet, I have been too busy to look into it but […]

Hola a todos Actualizo!!! Me es grato comunicaros[…]

Still can't find what you're looking for?