I'm trying to control a 28v generator output at 8 different current settings up to 100 amps but I don't want the voltage to ever go above 28v. The generator can be controlled simply by varying the field voltage. I have the hardware figured out but I'm very new to writing code. I'd like to use a PID and have 8 different setpoints that can be changed by using a combination of several digital inputs. I can use a simple current sensing shunt for a current sensor and a voltage divider to sense voltage. So if my setpoint is lets say 50 amps, the Arduino will send voltage to the field coil until the output reaches 50 amps and hold it there. If the generator load drops, the output will be limited by voltage instead of current. Any ideas on how to do this?
Write a program to detect the current using your current sensor and show the values on the Arduino Serial Monitor.
Write a separate program to measure the output voltage and display that on the Serial Monitor.
You have not told us how the Arduino will control the field current but another initial step is to write a short program that can do that - initially just based on a value built into the program.
When you can do all the parts separately it will be time to think about combining them.
I will be using a PWM controller that can handle the 5amps the generator field requires and Leonardo based Industrial Shield that has true 0-10v analog out to control the PWM controller. Like I said, I'm very new to writing code so that part will be a challenge for me but I'm good on the hardware side. I've been playing with my controller for the last couple days and have determined that this is something I can learn, It's just going to take some time. I've watched a bunch of youtube videos and it seems everyone has their own way of writing code.