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.

Converting a 0-12V square wave to AC

Status
Not open for further replies.

RobertISaar

New Member
hello everybody, i have a question that it seems at least a few of you can answer easily. i've seen similar questions answered though i'm not sure which parts are applicable to me situation.

i'm building an engine simulator to test out new algorithm as i write it rather than testing it on-vehicle and potentially killing something a lot more expensive than some discrete components.

the last issue i'm coming across is the signal used to generate vehicle speed. for the ECM i'm playing with, there were two possible ways to let the ECM know vehicle speed, from what i understand one was via an optical method that used an infrared LED and optical sensor that was installed in the back of a speedometer, these were used in early applications and require only the circuit to be grounded at a rate proportional to vehicle speed. the ECM provides roughly +12V and the LED/sensor combo grounds the circuit at a rate of around 4000 pulses per mile, the ECM measures the period and with proper calibration it determines vehicle speed.

later, magnetic sensors that read teeth in a reluctor were used. in my application, they were 2 wire permanent magnet generators. now, the tricky part is coming up. these sensors generated an AC signal up to about 100 volts depending on speed (not sure if peak/peak or RMS), and the hardware inside the ECM that plays with this wants to see zero-crossings for period measurements. the number of pulses per mile can vary quite a bit depending on tire size and number of notches in the reluctor, so calibration is important. here is where i have issues:

i'm using (or at least have the circuit built for it already) a 555 being fed 12 volts with a pot being used to vary the frequency between roughly 14 and 2012 Hz. this will give me 0-12Volts, but it won't give me a zero crossing event needed to simulate the magnetic sensor.

what simple(read: cheap, preferably no ICs) solution is there to convert my 0-12V signal into something that the ECM will read? it doesn't seem to take much of a voltage swing to allow the hardware to do it's job, so if i could turn 0-12V into -6 to +6 V, that would likely work, i just have no idea what kind of hardware would be needed to do so.



some more info that might help:

the two wires of the VSS are "VSS low" (connected directly to ground inside the ECM) and "VSS High", which goes through a 51K resistor, then a very small(probably .01-.1uF) cap, which connects to ground. between the resistor and cap is where the zero crossing unit is tied in.

i have a bunch of MAX232s laying around from a previous project, i was thinking i could somehow use the -10V it generates for RS232 communications for this, but i can't think of a way how to pair it with the 555 and not have the 555 attempt to send current into the MAX232 while still providing the +V portion of the signal. :confused:

i also have quite a few more 555s laying around from a different project and have been looking at trying to use that as well, since they're rated to source and sink far more current than what i'll need for this.



so, ideas? links? i'm in no way any kind of EE, so spelling/drawing things out would be greatly appreciated. i've seen some mention of running a capacitor in series with the signal the 555 generates, it would supposedly skew the 0-12V signal below 0V?
 
Is there a particular reason you don't like the series capacitor idea, because it will result in a -6 to +6 Volt waveform that crosses through zero volts. One gotcha is that the capacitor will start with zero charge on it and so will take a small, finite amount of time to achieve symmetry about zero volts. The time depends on the load the capacitor is looking into and the value of the capacitor.
 
i have no problem with it, i just have no idea how it actually works, or what kind of capacitance to use.

i've got about 100 brand new 2.2uF electrolytic caps rated for either 50 or 100 volts, if that's any place to start. they're polarized, but if i'm thinking about this correctly, that won't matter for something like this? and a lot of other smaller caps in the .01-1uF range, should 2.2 seem a bit too large.

time to achieve symmetry isn't a problem for this application, i would essentially have the tuning pot turned all the way down to the lowest freqency, then actually turn on the 555 circuit to generate the signal and adjust the pot to whatever speed i feel like "cruising" at.



seems too easy, i'm not used to it being something this simple. ;)
 
You should connect the +ve end of the capacitor to the 555, and the negative end to the input of the ECM.

It would be a good idea to add a resistor or around 100kΩ from the input of the ECM to ground. It might not be needed, but if the ECM input has a very high impedance, the DC voltage there could be anything. With the resistor, you know that the DC voltage will be zero.
 
To pass a reasonable semblance of a square wave through the series capacitor, the product of C and R (C*R) should be at least equal to 1/f, where C is the capacitor value in Farads, R is the load resistance (the ECM input resistance) in Ohms, and f is the lowest frequency of interest, in Hz. The greater the capacitor value used above that value, the more the output will look like a square wave with a flat top.

The configuration is known as a high pass RC filter or RC differentiator, and can be studied at many sites on the Internet.

As mentioned above, if the load resistance is very high you can lower it with a parallel connected resistor in front of the load resistance. If it is very low, however, you will need an impractically high value for the capacitor.

Be sure to get the units correct -- 1 Farad is a very large capacitance compared to 2.2 uF.

If you use a polarized capacitor (and you probably will need to), measure the DC voltage at the input of the ECM. If it is greater than 12V, connect the + side of the capacitor to the ECM, otherwise connect it to the 555 output.
 
Last edited:
ended up just using a single .01uF cap in series with the 555 output, the ECM reads the signal up to 180+ MPH, so i'd say it's more than functional.

i appreciate everyone's suggestions, even if they didn't get used.

now i just need to get a non-linear pot so i don't instantly jump from ~70 to 180MPH with just a tap and have 4MPH for the first half of travel.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top