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
DAC Capable Pins
-
- Posts: 39
- Joined: Sun Jun 05, 2022 10:37 pm
- Location: Tübingen, Germany
- Github Username: mi-hol
Re: DAC Capable Pins
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)
Michael
--------
Benelli Tornado 900 Tre
Benelli TNT 1130 (rebuilding)
- 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
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
Always looking for C/C++/Java/PHP developers! Please help us see https://rusefi.com/s/howtocontribute
Re: DAC Capable Pins
Thanks Michael. That's great!mi-hol wrote: ↑Wed Jan 03, 2024 1:21 amHi 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
So I have two use cases on one of my cars.AndreyB wrote: ↑Wed Jan 03, 2024 2:22 amWhat'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.
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.
- 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
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
Always looking for C/C++/Java/PHP developers! Please help us see https://rusefi.com/s/howtocontribute
Re: DAC Capable Pins
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.AndreyB wrote: ↑Wed Jan 03, 2024 4:28 pmWould an RC-filter work? At the moment Lua is limited at 1KHz PWM until https://github.com/rusefi/rusefi/issues/5811
Thanks for the reality check. Makes way more sense to do it with PWM->RC in this case