Code Monkey home page Code Monkey logo

Comments (14)

Xenoamor avatar Xenoamor commented on June 15, 2024 3

Awesome, I was just looking into how best to implement this.
How do the two DACs work on the DPS5005 to control voltage and current. Is it possible to set them to two different values and it will automatically switch between CV and CC modes?

EDIT: I've posted my findings here

from opendps.

tzarc avatar tzarc commented on June 15, 2024 2

Should I just prep the PID-controlled branch I had?

from opendps.

Xenoamor avatar Xenoamor commented on June 15, 2024 1

Thinking about it do we need a voltage PID? There's already a feedback loop in the hardware and with correct calibration in #17 and with a fix for #7 we should be able to say for certain (giving a bit for calibration errors and temperature drift) what the output is.

With the calibration I don't see the mismatch between the output and what's on the display that started the discussion. Excluding the one caused by #7 which is not accounted for by the PID loop anyway. I feel like we may have come full circle here and that Manawyrm's comment was correct to start with

from opendps.

0xDBFB7 avatar 0xDBFB7 commented on June 15, 2024

Thanks for this project!

This is an essential feature for me, so I'm beginning work on this at https://github.com/BasedOnTechnology/opendps

Hopefully in the coming weeks I can get my DPS running and tune the PID constants.

Out of curiosity, is there either a loop in this code that takes a completely repeatable amount of time, or a timer running somewhere that I can use? PIDs rely on a consistent timestep per cycle.

from opendps.

kanflo avatar kanflo commented on June 15, 2024

Great, looking forward to your PR! There is a 1ms systick timer you could use to eg. add an event to the application event queue every X ms.

from opendps.

0xDBFB7 avatar 0xDBFB7 commented on June 15, 2024

@kanflo Awesome, thanks a lot!

from opendps.

kanflo avatar kanflo commented on June 15, 2024

I found a nice writeup by @dannyf00 about PID controllers the other day if you need inspiration. You could of course be a PID ninja in which case I bow respectfully ;)

from opendps.

0xDBFB7 avatar 0xDBFB7 commented on June 15, 2024

@kanflo

Sorry to bother you again. DPS5020 issue was caused by my incompetence.

Voltage PID is in and working:

https://youtu.be/vhyeJkDaF4I

I also added a CC term to the PID to make the CC behavior replicate that of my lab PSUs; that is, decrease voltage when current limit hit:

https://www.youtube.com/watch?v=WdlEo2w7u9c

There's a lot of startup overshoot with the current PID tunings; I've had the overshoot down to about 100 millivolts, but I forgot what tuning parameters caused that :(

Currently, I just have the PID function called from the mainloop; I've tried to add it as an event, but... I can't figure out how. Could you give me a pointer on how that's done?

Secondly (sorry), could you explain how the command_handler function works? I'm hoping to be able to input new PID tuning values through a command...do I need "COMMANDLINE=1" set as a flag? If I set that flag, I get a "missing ui.h" error.

Thanks again!

from opendps.

kanflo avatar kanflo commented on June 15, 2024

Cool! For adding a new command, add an entry to commands[]containing the name of the command, the handler function and number of arguments and build with COMMANDLINE=1 which should build again.

from opendps.

0xDBFB7 avatar 0xDBFB7 commented on June 15, 2024

@kanflo Huh, I didn't seem to get any response doing that. I tried sending a few of the other commands ("on", "off")with and without newlines and it didn't seem to parse it. Might be something at my end.

from opendps.

tzarc avatar tzarc commented on June 15, 2024

@0xDBFB7's branch wouldn't build for me for some weird reason, so I ended up implementing my own basic version of PID control, branched off the 10ae4b2 commit: https://github.com/tzarc/opendps/commits/pid_control

Not sure if it's any help, as I've only implemented it for CV, but perhaps it could be a reference for the proper implementation as well.

from opendps.

0xDBFB7 avatar 0xDBFB7 commented on June 15, 2024

@tzarc Really sorry about that, I got super busy and didn't want to make pull request until I had the PID tunings perfect, since overshoot would kill target boards.

My branch has a few specific changes for my setup that probably prevented the build.

from opendps.

tzarc avatar tzarc commented on June 15, 2024

No problem; mine was hacked together relatively quickly so having a safer implementation is probably best!

from opendps.

tzarc avatar tzarc commented on June 15, 2024

Pushed to the following branch, based on current master:
https://github.com/tzarc/opendps/tree/pid_v3

Only handling CV, don't have a way to test CC.

If we're cool with that, I'll make the PR.

from opendps.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.