output constant value #1896
-
Hi,
|
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 1 reply
-
I would suggest to use a dedicated library for motor control instead: they are usually using PWM. If you want to experiment with this library for this purpose I would suggest the following options:
|
Beta Was this translation helpful? Give feedback.
-
Thanks for the swift answer pschatzmann! I am not using a motor. I am controlling a high voltage device, where an 0 to 5v input voltage gives 0 to 40 kV output voltage. Though I only need half of it, so input 2.5V max is fine. The input voltage should be stable and slowly changing, when I update [Acc_V_End] it via esp32 wifi. It should not go to zero between copier.copy() commands. I am not really sure if I understand how this library works, but that is why i call the copier.copy() command twice in the thread. Thanks in advance! p.s. my loop() function is also quite crowded, this is why i am using a thread....
|
Beta Was this translation helpful? Give feedback.
-
I suggest that you stick with the standard Arduino functionality: this makes it much simpler! The ESP32 analogWrite() uses PWM. On other microcontrollers you can also use analogWrite() to write to the dac pins. I guess for your purpose PWM would be good enough, but you might need to use a RC (resistor-capacitor) filter to get a stable voltage if the high frequency PWM is disturbing. |
Beta Was this translation helpful? Give feedback.
-
Hi using esp32 internal dac is only 8bit, giving too small output precision (40000/256) for my needs.
|
Beta Was this translation helpful? Give feedback.
I would suggest to use a dedicated library for motor control instead: they are usually using PWM.
If you want to experiment with this library for this purpose I would suggest the following options: