I haven't scoped, but I'm pretty sure you are correct about high freq PWM working fine- the stock (miata in this case) computer uses PWM. I just put up with the racket for now, it's fine at idle and (somehow) actually does regulate RPM like it should. I'm going to rip it out one of these days, the miata has a thermowax valve (what where they thinking?) for warm-up in addition to the PWM valve and the idle set screw.
well with the circuit I designed with the op-amp, it's got an active low pass filter at around 90 Hz, which means that as long as you have a PWM speed that's a bit faster than that, it'll cut off the high speed junk from the PWM switching, and leave you with just a cleaaaan signal.
If 1% step accuracy could be attained at 150 Hz, then you could probably plug that signal straight into the op amp and run this circuit from the Megasquirt no sweat.
One of the major benefits I've found with driving the idle valve off of clean DC voltage instead of trying to switch it on and off very quickly is that you don't get the 50 or 60 volt spiking that you get trying to switch an inductor (like a motor/solenoid) on and off really quickly. This would be much less noisy, and might play nicer with the rest of the MS.
matt_fulghum wrote:if it would be helpful, I'll begin hacking away at putting in the CAN code, as I plan to start doing CAN device development for the MS very soon.
The CAN code is and always has been there.
However, last time I tried it the base MS2 CAN code didn't work for me, so the MS2/Extra port of it won't work for sure.
I could be way off base here but if the valve wants a steady DC voltage, how about placing a (determine size here) capacitor across the leads of the valve? I've done that when controlling PC fans with a PWM signal. The signal at the valve will look more like a DC with oscillations than a square wave.
I'm curious myself as I am also putting stuff together on a Mazda (miata).
As for the noise, was it a small whine like sound or something bigger?
well I've ditched the whine by putting the PWM signal through an active low pass filter with a 2.47x gain... that gives just about the right voltage going into the second stage, which controls the valve itself.
Basically, for about 8 dollars of parts, you can get a DC voltage out from the PWM signal. it works really well, at least in my testing...
I'm getting some crazy 800+ kHz oscillations at the output though. It doesn't effect the operation of the valve it seems, but I'm working on getting rid of them anyway. In doing some reading it seems like it might be the internal capacitances of the TIP120 doing nasty things with the feedback.
Oh, I get it now. Low pass = integrator. So with the right component values, you can integrate the normal MS PWM to an analog voltage. Then amplify and feed to the valve.
But- if you put a diode and capacitor on the valve, don't you get a switch mode power supply type deal (buck converter) that achieves the same result, using the inductance of the valve itself? I think I'm going to try a large cap and see if that shuts it up. Or perhaps an inductor and cap in parallel with the valve... Or an inductor in series, and diode in parallel. I'll have to think about this.
The noise is no small wine, it's like a big, mad hornet under your hood. I can't here it with the hood on though.
with the op amp drivers, there's no more whine (because the valve stays in one position, like it should). I managed to get rid of most that oscillation garbage. I just had to put a 1 nF cap across the base resistor for the TIP120 as a speedup cap to deal with the capacitance of the transistor itself. It didn't COMPLETELY get rid of all of it, but it's not nearly as big as before.
With the proper caps and resistors on the low pass, you could probably drive it perfectly fine off of the Megasquirt's faux-PWM output. The issue still is however that with the timer code as it is, the valve has pretty poor resolution at any reasonable speed. (I'm not sure you could happily low pass a 78 Hz signal, and with the 156 Hz output, you're running at 2% step accuracy. ick.)
matt_fulghum wrote:with the op amp drivers, there's no more whine (because the valve stays in one position, like it should). I managed to get rid of most that oscillation garbage. I just had to put a 1 nF cap across the base resistor for the TIP120 as a speedup cap to deal with the capacitance of the transistor itself. It didn't COMPLETELY get rid of all of it, but it's not nearly as big as before.
With the proper caps and resistors on the low pass, you could probably drive it perfectly fine off of the Megasquirt's faux-PWM output. The issue still is however that with the timer code as it is, the valve has pretty poor resolution at any reasonable speed. (I'm not sure you could happily low pass a 78 Hz signal, and with the 156 Hz output, you're running at 2% step accuracy. ick.)
I'm running with the higher speed output right now, 2% accuracy is still enough to control the speed accurately on my engine...
The one on my engine (the 1.8L DOHC block from Mazda, used in the Miata, Protege LX, and Ford Escort GT) is (I believe) a rotational solenoid, and with anything less than about 180 Hz, it begins to totally freak out, jittering in between positions. Any higher than that, and the code starts to lose more and more accuracy.
Using that circuit I provided earlier from the idle valve output on the MS, at 78 Hz, and with a retune of the low pass filter (to filter out anything higher than, say, 50 Hz) should provide a clean, consistent voltage to the valve. I'll post a revised schematic tonight with the changes done to it that you'd need to set the low pass to a lower frequency (it's at about 88 Hz atm, which wouldn't cancel out the junk from a 78 Hz signal).
Also note that the switching transients from driving the transistor off of a PWM signal can go up to 50 or so volts. With the clean DC voltage, you don't get the switching transients because the voltage is a nice smooth curve.
What mazda valve are you using out of curiosity? I have used the Miata one, one from the Protege and one from the RX-7 and none of them needed to go over 60hz. All three work great and the RX-7 and miata even has A/C.
1984 Mazda RX-7 GTM Class (BP Engine + BW-EFR 8374 Turbo Full COP/Sequential on MS3+MS3x)
1986 Toyota 4Runner (22RE running on MS2-Extra 3.2.1)
I previously had a different aftermarket ECU on the car (99 miata) and at key-on without cranking the car, you could definitely hear a middle pitch whine from the idle valve that isn't there with the stock ECU.
With the car running, it was drowned out by other things. Not the same racket that is described earlier but that is a 95 vs. a 99 and lots changed in 99. I never looked at the signal outputs though.
matt_fulghum wrote:Using that circuit I provided earlier from the idle valve output on the MS, at 78 Hz, and with a retune of the low pass filter (to filter out anything higher than, say, 50 Hz) should provide a clean, consistent voltage to the valve.
That's all well and good, except that I'm pretty sure that most if not all of these valves are designed for PWM operation not steady voltage.
meaning that they will stick? from a lack of vibration and peak force? or what?
as on the average, a steady 6v will supply the same power to the device as a 50 50 12v. other than my comment at the top i'm not sure i understand how it could matter, can you enlighten me?
With PWM you get full effort for part of the time so small openings in particular are more reliable.
12% duty cycle might open a valve 12%, but 1.5v probably wouldn't do anything.
The idle valve on my car is most definitely a rotary solenoid, which are designed to be operated with a voltage between 0 and 12 volts. (Beyond 12 volts, it doesn't move any further). The stock ECU drives it with PWM, yes, but it is at a very high frequency so it smooths out to be effectively a normal DC voltage.
If the frequency is too low (as 158 Hz was for mine), it snaps back and forth, and quivers. Mine did this up to about 1 kHz, and even at that point, it still audibly hums. With a constant DC voltage from a bench supply, the valve operates smoothly, with no noise or jitter.
Soooooo yeah. It's NOT a servo, therefore it does NOT need a PWM signal.
For reference, this is the valve I'm talking about: