DAC Capable Pins

Hardware inside and outside of the ECU
Post Reply
i_s_64
Posts: 13
Joined: Tue Mar 14, 2023 1:15 am

DAC Capable Pins

Post by i_s_64 »

Hello,

I am trying to implement DAC using LUA on my Proteus. I'm just wondering which pins are capable of 0-3.3V output

Also, I can't seem to find any references to any functions in Lua to be able to utilize DAC on the LUA Scripting page

https://github.com/rusefi/rusefi/wiki/Lua-Scripting

Which functions can I access with LUA scripting? Any examples by chance?

Thanks,

Alex
mi-hol
Posts: 39
Joined: Sun Jun 05, 2022 10:37 pm
Location: Tübingen, Germany
Github Username: mi-hol

Re: DAC Capable Pins

Post by mi-hol »

i_s_64 wrote:
Wed Jan 03, 2024 12:51 am
Any examples by chance?
Hi Alex,
example code is available on GitHub as mentioned at bottom of quoted wiki page, see:
https://github.com/rusefi/rusefi/tree/master/firmware/controllers/lua/examples
Regards
Michael
Best Regards
Michael
--------
Benelli Tornado 900 Tre
Benelli TNT 1130 (rebuilding)
User avatar
AndreyB
Site Admin
Posts: 14335
Joined: Wed Aug 28, 2013 1:28 am
Location: Jersey City
Github Username: rusefillc
Slack: Andrey B

Re: DAC Capable Pins

Post by AndreyB »

i_s_64 wrote:
Wed Jan 03, 2024 12:51 am
I am trying to implement DAC using LUA on my Proteus.
What's your use-case to want a DAC?

Proteus was not developed with DAC in mind so firmware does not have it enabled, see https://github.com/rusefi/rusefi_documentation/commit/ca5ffdb2ba5455b61b089ce8598faa3c16150e49 for more info.
Very limited telepathic abilities - please post logs & tunes where appropriate - http://rusefi.com/s/questions

Always looking for C/C++/Java/PHP developers! Please help us see https://rusefi.com/s/howtocontribute
i_s_64
Posts: 13
Joined: Tue Mar 14, 2023 1:15 am

Re: DAC Capable Pins

Post by i_s_64 »

mi-hol wrote:
Wed Jan 03, 2024 1:21 am
Hi Alex,
example code is available on GitHub as mentioned at bottom of quoted wiki page, see:
https://github.com/rusefi/rusefi/tree/master/firmware/controllers/lua/examples
Regards
Michael
Thanks Michael. That's great!

AndreyB wrote:
Wed Jan 03, 2024 2:22 am
What's your use-case to want a DAC?

Proteus was not developed with DAC in mind so firmware does not have it enabled, see https://github.com/rusefi/rusefi_documentation/commit/ca5ffdb2ba5455b61b089ce8598faa3c16150e49 for more info.
So I have two use cases on one of my cars.
The first, the car currently has a Link standalone that I'm keeping, but I would like to add DBW to the car. I need to output a 0-5V TPS signal to satisfy the need of the Link standalone. So I was going to have the Proteus do the DBW stuff, and output a 0-3.3V signal that I run through non-inverting Opamp to output to 0-5V

The other is to do the same thing to the stock oil pressure gauge in the factory cluster. The Opamp would end up doing 0-VBatt in that case

I'm sure down the road I'll run into more use cases. It's a powerful feature to work with.
User avatar
AndreyB
Site Admin
Posts: 14335
Joined: Wed Aug 28, 2013 1:28 am
Location: Jersey City
Github Username: rusefillc
Slack: Andrey B

Re: DAC Capable Pins

Post by AndreyB »

Would an RC-filter work? At the moment Lua is limited at 1KHz PWM until https://github.com/rusefi/rusefi/issues/5811
Very limited telepathic abilities - please post logs & tunes where appropriate - http://rusefi.com/s/questions

Always looking for C/C++/Java/PHP developers! Please help us see https://rusefi.com/s/howtocontribute
i_s_64
Posts: 13
Joined: Tue Mar 14, 2023 1:15 am

Re: DAC Capable Pins

Post by i_s_64 »

AndreyB wrote:
Wed Jan 03, 2024 4:28 pm
Would an RC-filter work? At the moment Lua is limited at 1KHz PWM until https://github.com/rusefi/rusefi/issues/5811
Yes you're absolutely right. An RC circuit would work since there isn't much load on the line considering I would still have to use an OpAmp to boost the output. This was originally how I was thinking of doing it, until I got caught up on reading the RusEFI changelog and noticing that DAC has been implemented. Without the DAC, it's only really two extra passive components, but a lot more flexibility on which lines I can use.
Thanks for the reality check. Makes way more sense to do it with PWM->RC in this case
Post Reply