Howdy,
I am looking for help on two hobby projects. PM cost estimate per each project. Code must be well-commented and will be shared to public's benefit.
1) First project is simpler and will warm us up before the bigger project. It is for an over-voltage clamp / motor regeneration brake resistor controller / ESTOP circuit.
Inputs:
Voltage input analog
ESTOP digital
Overtemp digital
Clamp voltage setting digital DIP slide switch combo
Outputs:
PWM output to MOSFET gate drive IC
LED: Fault, maybe others
Hardware:
One-off prototype, cost of MCU irrelevant to overall project, so can use fanciest 8-bit PIC.
PIC 8bit 16F or 18F expected, C language. Superloop.
ADC acquisition rate 1ksps minimum.
Loop time preferred on order of 10ms to catch fast overvoltage transients.
Initialize:
Set up MCU clock speed, set up ADC for continuous acquisition 1ksps.
Read DIP switch setting for OV clamp voltage.
Superloop:
If ESTOP is pressed, MCU to output 100% PWM duty, else
If overtemperature is detected at brake resistor or MOSFET, output 0% duty cycle, set LED fault, else
When ADC has completed acquisition, use LUT to determine PWM duty cycle.
Apply PWM duty cycle to output pin per LUT.
Loop.
It is a motor regeneration/braking overvoltage clamp circuit prototype, so up to let's say up to 48V is sensed by voltage divider, no action is needed, any voltage above 48V is treated as over-voltage in need of being clamped, 48V to 60V will be progressively increasing PWM duty cycle to attempt to clamp voltage, and if voltage reaches 60V, MOSFET+brake resistor will be 100% duty cycle. When regeneration voltage drops below threshold, circuit goes into standby.