Help needed with speed of input pulses.

Hi all, I'm not sure I'm in the right forum. if not kindly accept my apologies and point me in the right direction please.

I'm planning a project and just wanted to check if anyone knows the rate at which an arduino leonardo can handle logic inputs? I'll be sending pulses to an input pin every 5.4 milliseconds possibly quicker. Does anyone have an idea of the millisecond limit?

I hope that made sense?

Thanks in advance.

Handled properly, detecting 5.4mSec pulses can be done easily.

jbste:
I'll be sending pulses to an input pin every 5.4 milliseconds possibly quicker.

As there will be a pulse every 5400 microsecs the important question is what work does the Arduino need to do during the interval between pulses?

...R

Robin2:
As there will be a pulse every 5400 microsecs the important question is what work does the Arduino need to do during the interval between pulses?

...R

Hi Robin, the device I'm making will operate a servo motoring a motorbikes power valve setup. The servo motor will start operating when the input is detected at 30 millisecond and will have completed 360 degree turn of the stepper by the time 8 millisencond pulse is detected. I hope that makes sense?

In essence I'm detecting an input, processing the interval between inputs and operating a servo motor according to the input interval.

Thanks

Just so I'm clear:

  • this is a two-stroke engine (Yamaha?)
  • the pulses will be sourced from the ignition circuit
  • 30mS corresponds to 2000RPM; 8mS to 7500RPM and the 5.4mS figure is a maximum expected speed of ~11,100RPM
  • the valve will be idle until the engine reaches 2000RPM at which point it will be rotated an amount corresponding to engine RPM; it will be fully actuated by 7500RPM

If the above is basically correct there is no reason you couldn't map valve position to RPM; the timing of those signals is well within the capabilities of an AVR Arduino.

You use both "servo" and "stepper" terms; which is it? If it is a stepper is there any feedback so the controller can know the current position of the valve?

Blackfin:
Just so I'm clear:

  • this is a two-stroke engine (Yamaha?)
  • the pulses will be sourced from the ignition circuit
  • 30mS corresponds to 2000RPM; 8mS to 7500RPM and the 5.4mS figure is a maximum expected speed of ~11,100RPM
  • the valve will be idle until the engine reaches 2000RPM at which point it will be rotated an amount corresponding to engine RPM; it will be fully actuated by 7500RPM

If the above is basically correct there is no reason you couldn't map valve position to RPM; the timing of those signals is well within the capabilities of an AVR Arduino.

You use both "servo" and "stepper" terms; which is it? If it is a stepper is there any feedback so the controller can know the current position of the valve?

Hi Blackfin, you're right in your understanding and you explained it better than I did :slight_smile: The power valve of the two stroke Yamaha uses a servo motor, sorry for confusion. I'm uncertain at this point whether the servo will need more than one full revolution to fully open the power valve, I'll know that after a bit of experimentation.

The issues I have is the voltage that comes from the pulser coil (pickup) is stated at 12v, could that 12v be fed directly to the Arduino IO or would it have to be regulated to 5v?

I'll be using an Audio Leonardo mini.
Thanks again

Hi Blackfin, you’re right in your understanding and you explained it better than I did :slight_smile: The power valve of the two stroke Yamaha uses a servo motor, sorry for confusion. I’m uncertain at this point whether the servo will need more than one full revolution to fully open the power valve, I’ll know that after a bit of experimentation.

I have an Aprilia Tuono that has (well, had…) an exhaust valve that was controlled by a servo. Full closed to full open was only about 90-degrees but due to the forces required there’s a gear reduction between the motor and the cables. It’s possible they’re using a 360-degree (or possibly a continuous) servo setup.

The issues I have is the voltage that comes from the pulser coil (pickup) is stated at 12v, could that 12v be fed directly to the Arduino IO or would it have to be regulated to 5v?[/quote]

You definitely need to condition that signal down to Arduino levels and to help filter noise etc. If you connect it directly and it’s 12V you will damage the Arduino.

Blackfin:
I have an Aprilia Tuono that has (well, had...) an exhaust valve that was controlled by a servo. Full closed to full open was only about 90-degrees but due to the forces required there's a gear reduction between the motor and the cables. It's possible they're using a 360-degree (or possibly a continuous) servo setup.

The issues I have is the voltage that comes from the pulser coil (pickup) is stated at 12v, could that 12v be fed directly to the Arduino IO or would it have to be regulated to 5v?

You definitely need to condition that signal down to Arduino levels and to help filter noise etc. If you connect it directly and it's 12V you will damage the Arduino.

Think I'll use a 7805 regulator, that way I'll get a 5 volts at the IO pin and no damage to the Arduino.

Any ideas what the code should look like to read input from pulser and output to servo motor?

A Vreg is a bad choice for a level converter. It may not switch cleanly. For automotive applications, the interface circuits are pretty much cut and paste - but basically a resistive divider protected by diodes and transorb's and filtered with caps.

jbste:
Think I'll use a 7805 regulator, that way I'll get a 5 volts at the IO pin and no damage to the Arduino.

Any ideas what the code should look like to read input from pulser and output to servo motor?

I don't think your 7805 idea will work. It's just a voltage regulator. You need signal conditioning. Part of the problem with designing something like this is not knowing that the input and output signals look like.

Or what's generating them. Are you're looking at the negative-side of an ignition coil or the logic-level output of an ECU that drives a coil driver circuit?

What is the nature of the output signals? Is the servo expecting an RC_style servo output or does it run like a DC motor with analog feedback or ... ?

When you have those details sorted I'd expect the input to be conditioned to trigger a timer input capture on the Arduino. The output could be a timer output compare if it's RC or it could be a signal to trigger an H-bridge to drive the DC motor with analog feedback to determine position. Without knowing details of how the input and outputs work that's about all I can offer.

This weird video shows something but I can't really tell what's going on (esp with that distracting background garbage...)

cd74HC4050 can take in 12V signal and output 5V signal when the chip is powered from 5V.
https://www.digikey.com/en/products/detail/texas-instruments/CD74HC4050E/376792
Don't forget 0.1uF cap from 5V pin to Gnd.

Blackfin:
I don't think your 7805 idea will work. It's just a voltage regulator. You need signal conditioning. Part of the problem with designing something like this is not knowing that the input and output signals look like.

Or what's generating them. Are you're looking at the negative-side of an ignition coil or the logic-level output of an ECU that drives a coil driver circuit?

What is the nature of the output signals? Is the servo expecting an RC_style servo output or does it run like a DC motor with analog feedback or ... ?

When you have those details sorted I'd expect the input to be conditioned to trigger a timer input capture on the Arduino. The output could be a timer output compare if it's RC or it could be a signal to trigger an H-bridge to drive the DC motor with analog feedback to determine position. Without knowing details of how the input and outputs work that's about all I can offer.

This weird video shows something but I can't really tell what's going on (esp with that distracting background garbage...)

YAMAHA HM CDI / YPVS Driven by microchip PIC16F1455 - YouTube

Just done a little more research. The pulser coil is a hall effect sensor. I just found the following code that handles hall effect sensors with the arduino:
You can just define pin 2 as INPUT_PULLUP and then you don't need the 10k pullup resistor. Make sure you define the pin before attaching the interrupt.
ie.
pinMode(2, INPUT_PULLUP);
attachInterrupt(0, magnet_detect, RISING); //Initialize the intterrupt pin (Arduino digital pin 2)
This uses the internal pullup resistor in the Arduino.

What do you think?

[color=#444444]/* This code is to be used with KY-024 Hall effect sensor
 * It displays both Analog and Digital values given by the sensor
 * Refer to www.surtrtech.com [color=#728e00]for[/color] more details
 */

[color=#95a5a6]#define Hall_Sensor A0 //A0 used with analog output, D2 with digital output[/color]
[color=#95a5a6]#define Hall_Sensor_D 2[/color]

int [color=#434f54]Val1[/color][color=#434f54]=[/color][color=#434f54]0[/color],Val2[color=#434f54]=[/color][color=#434f54]0[/color]; //Here you can store both values, the Val2 can be boolean


void setup[color=#434f54]()[/color] [color=#434f54]{[/color]
 Serial.begin[color=#434f54]([/color][color=#434f54]9600[/color][color=#434f54])[/color];
 pinMode[color=#434f54]([/color]Hall_Sensor_D,INPUT[color=#434f54])[/color];
 

[color=#434f54]}[/color]

void loop[color=#434f54]()[/color] [color=#434f54]{[/color]
 
 [color=#434f54]Val1[/color][color=#434f54]=[/color]analogRead[color=#434f54]([/color]Hall_Sensor[color=#434f54])[/color]; //We [color=#434f54]read[/color] both values and display them raw on the serial monitor
 Serial.print[color=#434f54]([/color]Val1[color=#434f54])[/color];
 [color=#434f54]Val2[/color][color=#434f54]=[/color]digitalRead[color=#434f54]([/color]Hall_Sensor_D[color=#434f54])[/color];
 Serial.print[color=#434f54]([/color][color=#7f8c8d]"\t"[/color][color=#434f54])[/color];
 Serial.println[color=#434f54]([/color]Val2[color=#434f54])[/color];
[color=#434f54]}


I wonder if I could use something like this without any voltage regulator. I would be sensing the rising edge only of the pulser signal as a logic high then processing that singnal and operating the servo motor between the rpm ranges of 2000 and 7500rpm.
Just trying to get my head around the coding and the electronics.

I have the electronics sorted for the CDI unit. I now just want to process the pulser signal for power valve operation.

Please share your thoughts.[/color][/color]

I wouldn't really feel comfortable committing to code or parts suggestions without:

a) seeing an oscilloscope trace of the pulser output to ensure it's a logic-level signal compatible with an Arduino digital input and, if digital, how the frequency relates to RPM and,

b) an understanding of what the output signal needs to be to drive the servo from one extent to another and to hold any position in between

I'm sure an Uno or whatever could do the work but I can't recommend anything without more technical info.