-
Notifications
You must be signed in to change notification settings - Fork 56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PWM outputs #96
Comments
The PWM output has a problem I think. Maybe I'm wrong. Get me Jack Rickard On Tue, Dec 15, 2015 at 8:44 PM, Collin Kidder [email protected]
http://www.EVTV.me http://EVTV.me Electric Vehicle Television - KickinGas - One Car at a Time. |
Yes, you are correct. The outputs are low side and switch ground so PWM is completely backward of what you would normally expect. High duty cycle corresponds to a lower average voltage and lower duty cycle raises the average voltage. So, for voltage sensitive gauges the whole thing is backward. For gauges that count pulses it can work as normal as you would still get the correct number of pulses, just with reverse polarity. I think that would still work OK. A somewhat bigger issue is how irritating it is if you need a frequency controlled gauge. Controlling the frequency of the PWM outputs isn't a lot of fun. It's much simpler when you can just control the duty cycle. |
In ArduinoDue branch SystemIO::handleTick() (around line 100) I use PWM to output the estimated SOC to a DOUT. It is reversed due to the MOSFET. Works pretty fine for my digital fuel gauge with a resistor and capacitor to smoothen out the PWM to an analog signal. |
Thanks for the heads up. Yes, I can see how you've implemented it. Using analogWrite works fine but as you know it's inverted and also does not support setting the frequency. Normally you don't need to change frequency but I had an application where I had to. I've still got that code in a private branch, perhaps I'll see what it would take to bring it into mainline. |
GEVCU5 boards are capable of PWM on the outputs but there is currently no support for this functionality in software. It would be nice if it were possible to set up a PWM map on the GUI interface that allows the end user to calibrate the PWM output to how their gauge works.
The text was updated successfully, but these errors were encountered: