Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Square wave generation for automotive dashboard

Menticol

Active Member
Hi! I'm currently adapting a motorcycle dashboard to use with a computer video game, using a raspberry pi.

At first replicated this circuit shown in Youtube. Its 12V square wave was not able to make the tachometer needle move.
1721677484513.png


Switched the Arduino for the Raspberry pi due limitations of Arduino's tone() function and even ordered a new dashboard (thinking the one I had was DoA) to no avail.

My bad luck ended when I found this great post by user Robmack that explains how this type of tachometers do require a a negative offset to work. After implementing the circuit and fiddling with the duty cycle, it worked perfectly.

diag.png


IMG_20240721_013921.jpg


However, my questions are:

1. What's the technical name for Robmacks solution?
2. His solution it's heavily dependent on duty cycle and frequency, under some parameters it stops working. Is there another way to induce a positive or negative offset on a frequency-variable square wave signal? Thought about a Ad9833 module, but it does require an OP-AMP with a negative power supply, maybe for my application is an overkill?

Yellow channel represents the output from my TIP125, the purple one the tachometer-out output, shifted by the aforementioned resistor and capacitor technique.

oscillos.png


Thank you for your time
 
Last edited:
Solution
Negative ;) I'm just trying to understand how the zener diode version of the circuit works, and why adding a resistor and a capacitor to a existing square wave can trick the Chinese tachometer into believing it's receiving a negative voltage instead of the original +12 - 0 pulses
Hello

Some time ago I had similar question for one of my projects.

I explained it to myself this way:

Pic1.png


Seuuence:

1)Pulse rising edge
AC current can pass through capacitors. So when +12V rising edge of HIGH pulse arrives to left side of the capacitor, it's right side also became +12V at the same time.

Or one can say capacitor allows deltaV = +12V to pass from left to right side.

2)Pulse HIGH plato
Right after rising edge, there is HIGH...
The tacho is possibly intended to work with a two wire inductive (reluctance) sensor, that has one side grounded so the signal is centred around 0V.

If that is the case, it probably needs a reasonably symmetrical signal, so somewhere near 50-50 duty cycle?

A larger coupling cap may also help, possibly 1uF?

Typical waveforms for different type of engine pickups - the two terminal reluctance type is the right one:

main-qimg-2e558621cc7e696e75bbec29f68f5f53
 
Are you trying to measure the tach pulse freq or its equivalent V ?
Negative ;) I'm just trying to understand how the zener diode version of the circuit works, and why adding a resistor and a capacitor to a existing square wave can trick the Chinese tachometer into believing it's receiving a negative voltage instead of the original +12 - 0 pulses
 
Last edited:
The tacho is possibly intended to work with a two wire inductive (reluctance) sensor, that has one side grounded so the signal is centered around 0V.

If that is the case, it probably needs a reasonably symmetrical signal, so somewhere near 50-50 duty cycle?

A larger coupling cap may also help, possibly 1uF?

Typical waveforms for different type of engine pickups - the two terminal reluctance type is the right one:

main-qimg-2e558621cc7e696e75bbec29f68f5f53
Thank you for sharing the graphs! they makes sense.

Just by curiosity I followed your advice and tried with a bigger cap to see what happens with the tacho: and it stops working. The original signal (channel 1, yellow) shifts upward and the modified one with the capacitor and the resistor (purple) stays the same. You are right regarding the frequency. When the frequency goes up the tachometer stops working, and I need to wiggle the duty cycle to return it to the working condition. The capacitor / resistor trick is highly dependent on the frequency and duty cycle, but I would like to learn why.
 
Last edited:
If you are trying to measure freq just code for edge, rising or falling. And use a set of
diodes to clamp waveform to PI or Arduino logic levels :

1721688303920.png


Something like above, cap not needed if noise levels low. The Schottkys can be simple
silicon diodes like 1N914, the R tailored circuit loading on source sensor.


Regards, Dana.
 
If you are trying to measure freq just code for edge, rising or falling. And use a set of
diodes to clamp waveform to PI or Arduino logic levels :

View attachment 146488

Something like above, cap not needed if noise levels low. The Schottkys can be simple
silicon diodes like 1N914, the R tailored circuit loading on source sensor.


Regards, Dana.
Thank you Dana! Unfortunately this is not what I'm looking for on this project, but will keep it at hand if necessity for it comes up in the future.
 
Negative ;) I'm just trying to understand how the zener diode version of the circuit works, and why adding a resistor and a capacitor to a existing square wave can trick the Chinese tachometer into believing it's receiving a negative voltage instead of the original +12 - 0 pulses
Hello

Some time ago I had similar question for one of my projects.

I explained it to myself this way:

Pic1.png


Seuuence:

1)Pulse rising edge
AC current can pass through capacitors. So when +12V rising edge of HIGH pulse arrives to left side of the capacitor, it's right side also became +12V at the same time.

Or one can say capacitor allows deltaV = +12V to pass from left to right side.

2)Pulse HIGH plato
Right after rising edge, there is HIGH plato of the pulse at left side of the capacitor. But HIGH plato is DC, and capacitors block DC, so there is no current flows through the capacitor during this time, and right side of the capacitor does't charging more.

Or one can say capacitor does not allow Vplato = +12V to pass from left to right side.

But the same time right side of the capacitor (charged during rising edge) begin to discharge through load resistance, and have enough time to drop, say, to +2V.

3)Pulse falling edge
Left side of the capacitor drops from HIGH +12V to LOW 0V, so change in voltage on left side is -12V;
But capacitor tries to keep voltage across itself as before (Capacitor opposes to voltage changes, inductor opposes to current changes),
so right side of the capacitor also undergo -12V change. So right side of the capacitor is 2V-12V = -10V now!

Or one can say capacitor allows deltaV = -12V to pass from left to right side.

This process is duty cycle and frequency dependent and load dependent because right side of the capacitor must have enough time to discharge, so when falling deltaV = -12V pases from left to right side, voltage on right side already low enough to become negative
 
Solution
Hello

Some time ago I had similar question for one of my projects.

I explained it to myself this way:

View attachment 146492

Seuuence:

1)Pulse rising edge
AC current can pass through capacitors. So when +12V rising edge of HIGH pulse arrives to left side of the capacitor, it's right side also became +12V at the same time.

Or one can say capacitor allows deltaV = +12V to pass from left to right side.

2)Pulse HIGH plato
Right after rising edge, there is HIGH plato of the pulse at left side of the capacitor. But HIGH plato is DC, and capacitors block DC, so there is no current flows through the capacitor during this time, and right side of the capacitor does't charging more.

Or one can say capacitor does not allow Vplato = +12V to pass from left to right side.

But the same time right side of the capacitor (charged during rising edge) begin to discharge through load resistance, and have enough time to drop, say, to +2V.

3)Pulse falling edge
Left side of the capacitor drops from HIGH +12V to LOW 0V, so change in voltage on left side is -12V;
But capacitor tries to keep voltage across itself as before (Capacitor opposes to voltage changes, inductor opposes to current changes),
so right side of the capacitor also undergo -12V change. So right side of the capacitor is 2V-12V = -10V now!

Or one can say capacitor allows deltaV = -12V to pass from left to right side.

This process is duty cycle and frequency dependent and load dependent because right side of the capacitor must have enough time to discharge, so when falling deltaV = -12V pases from left to right side, voltage on right side already low enough to become negative
Brilliant explanation! It was precisely what I was looking for, thank you. Looks like the only option for proper load/freq/duty independent wave shape and offset control, would be the op amp
 
After looking at the linked page:
Looks to me the tacho requires a negative going pulse to trigger, not a negative voltage.
So the input to the tacho should be normally high (12v) and go low (~0v) for a millisec or so.
 
After looking at the linked page:
Looks to me the tacho requires a negative going pulse to trigger, not a negative voltage.
So the input to the tacho should be normally high (12v) and go low (~0v) for a millisec or so.

Not sure about the tacho, maybe! AFAIK is connected to the negative side of the CDI / motorcycle ignition module.

But the speedometer function definitely works exactly as you describe! Take a look at this capture of the speedometer cable, while a moved a magnet near the sensor coil by hand

Looks like I'm gonna need a different approach than the one I used with the tacho, for generating this one with my raspberry pi pico, yuck!

1721708022625.png
 
Last edited:

Latest threads

New Articles From Microcontroller Tips

Back
Top