Delete every second pulse


I have a device that sends 12V pulses, like to a speedometer. Is it possible to do something with Arduino and remove every second pulse ?

And, when needed, i want it to stop removing and send all pulses.

That's an interesting question, but it is not simple for a number of reasons.

You commit a common mistake here, because you say "like to a speedometer". We need much more than that. Is it actually for a speedometer, or what is it for? Often, knowing what you really want reveals easier ways to do it. This is called the "XY Problem".

OK, these pulses are 12 V are they? Is it really 12 V, or the voltages inside a car - anything but 12 V? What is the length of the pulse, minimum and maximum and the minimum and maximum frequency of the pulses?

If the frequency is under 1 kHz, then an Arduino could likely do it beautifully - however you need circuitry to convert your 12 V pulses to 5 V for the Arduino, and back again to 12 V afterward. That depends entirely on what you intend to connect it to.

For such a simple task, you probably do not need an Arduino, simple logic devices - a flip-flop and a monostable - will do it, but when you want to fiddle all the timings and switch it on and off, well an Arduino is better.

So it's back to you! :grinning:

Ok, i'll try to explain, tho english isn't my first language so I might use wrong words....

This device reads the speed of a driveshaft, and gets 4 pulses when the driveshaft turns around one time.

These pulses are used to cut the power to the ignition of the engine when the driveshaft reaches a certain RPM. I want to remove every second pulse fopm the driveshaft so i can get more power from the engine.

And i think it will get maximum 9000 pulses / minute.

And yes, it is 12V pulses.

Once again, i might use completly wrong words.....

Right, so it is an automotive or marine engine by the sound of it, so the "12 V" is dependent on the regulation of the alternator, nominally 14 V in fact and may be subject to large surges.

9000 ppm at four pulses per revolution suggests the shaft rotates at 2,250 RPM. That seems fairly slow for a petrol engine, but I would be very concerned about the suggestion of being able to double the operating speed of such an engine. However we will not refuse to give you the information as long as you strictly promise to post detailed and clear pictures of the ensuing wreckage. :astonished:

9000 ppm is 150 pulses per second, easily managed by an Arduino. I need to know however, the duty cycle of the pulses or the minimum and maximum length; whether the voltage is mostly high or mostly low.

Keep in mind that I have answered the question "Is it possible to do something with Arduino and remove every second pulse?" - it is, but the next question is - who is going to write the code to do so? :roll_eyes:

I have no experience with automotive or "high" voltages as 12V or something like that. I think there is little work for Arduino in this. I guess it is safe to assume edge (either positive or negative) is used by the control device and duty is not important. So simple divide by two is enough to remove every other pulse. You can do it by a simple logical IC - a counter or D-latch. Use the ancient "normal" CMOS family (i.e.CDxxxx) which works up to 20V. Try Google CD4020 for example. For "restoring original pulses" you may simply use a SPDT (mechanical) switch - you connect either the original signal or output of the chosen IC to the controller input.

Ok, maybe that little 4020 will do the trick ? Guess i need some device to program it. Did that in school, but that was not in this millennium.... And a socket too i guess.

please look up the definition of REAL TIME as it applies to computers.

if your arduino is dedicated to this one task, it makes things easier to report every pulse.

look at every pluse

new_pulse = digilalRead(pin4)

pulse_counter = pulse_counter ++ ; // increments by 1 for each pulse

if (pulse_counter >= 2) { digitalWrite(pin6, high); pulse_counter = 0 ; }

this is crude and totally incomplete, but simple.

it does not shut off the pulse output, it just remains high forever, so you need to determine the length of the pulse you need.

================= another idea is to have the first trigger set your output high the next trigger set it low. you would need two pulses to act as one.


I would amend post #3 to require that the survivors post photos of the carnage.


if you want to decrease the pulse to say, 3 outputs to 4 inputs, the code gets a bit more complicated and that is where the words real time come in to play. do the pulses have any direct effect to the operation ? a engines timing chain will have the ignition spark at the very instant it is needed, no sooner, no later. by modifying the pulse, you may risk other things not working properly.

if real time is not vital, maybe you can post your pulses to be 1 revolution behind the shaft rotation ?

you could take, 1,2,3,4... time the speeds, then divide by 4, multiple by 3 and put out 1,2,3 in the same time as the shaft spins and outputs 1,2,3,4.

a different approach might be to measure the time between pulses and have your pulse output based on that time, plus some value. you would read the pulses in real time and report the time between pulses.

then you would create a pulse generator that outputs pulses based on that time, plus some value.

disel: Ok, maybe that little 4020 will do the trick ? Guess i need some device to program it.

There are no brains in this device. Just connect it right and it works. For example using CD4024 you connect Pin 1 (named "Input Pulses" in the linked Datasheed) to the original signal Pin 7 (Vss) to GND Pin 14 (Vdd) to 12V Pin 2 (Reset) to GND Pin 12 (Q1) will output the divided signal Let rest of pins unconnected. You may need some protection on power lines and/or input/output. I don't know.

Also I hope you are aware such tricking of driving circuitry may lead to many unforeseen consequences unless you do know what you are doing. Not only exceeding maximal speed possibly leading to some catastrophic failure but also more subtle problems at "legal" speeds - worse efficiency, faster ageing etc.

Since all you want to do is disable the cutout function, why not just generate 12V pulses eg with a 555 at some rate a bit below the trigger point?

Feed the speedo from the shaft in the normal way....


No, i don't want to disable the cutout. I just want to (sometimes) double the RPM on the engine, but i still want it to cut.

disel: No, i don't want to disable the cutout. I just want to (sometimes) double the RPM on the engine, but i still want it to cut.

What is the reason for the cutout to operate at the present RPM? How do you know the engine will produce more power, SAFELY, at twice the RPM? What device is this? Car, Dragster, Speedway Car, Boat, Airoplane? ? ? Tom... :)