Nano Power Inverter - Roll Your Own Style


Author Message
poida

Guru

Joined: 02/02/2017
Location: Australia
Posts: 1421
Posted: 11:47pm 06 Jul 2022      

here are the two changes.

nano_1_v7_no_bessel_smooth_stop_PID_as_soon_as_Vfb.zip
 
and

nano_1_v7_no_bessel_smooth_stop_50Hz_control_loop.zip


I based it on the 250 step ramp soft start code.

Both will require the SCR over current signal to be pulled low
to enable the inverter to run. (I think that is what you need.)
if not, make the change by commenting one line and uncommenting the other
in this part:


 // scr shutdown - without a dummy connection of D6 to ground, inverter wont run.
 if (((PINB & 0x01) == 0) || ((PIND & 0x40) == 0x40))
 // for testing, do not check scr shutdown pin, just nano2 on/off
 //if (((PINB & 0x01) == 0) )  


I forget which one you need.

Anyway, to make it run Vfb control code at 50Hz only need one line to be changed:

void loop()
{
 float ch0;

 // sample channel..
 // In the past, I low pass filtered this. not now, no need thanks to active LP filter on Vfb
 ac_output = (float)analogRead(ADC_OUT) / 1024.0; // scale 0 - 5V to 0.0 to 1.0

 if(uf == 1 && (v1low == 1) )    // this will execute at 50Hz now
     {            // it runs at near zero volt crossing of AC output    


and for the "Stop bang/bang control as soon as possible" version it's


if (oen == 1)              // slow stop? I think of it as de-gauss
         {
         if(ac_output < ac_setpoint)
           pwr += 1.0/250.0;     // bang-bang control, should AC output reach setpoint prior to PID.
         else                    // During slow start need to ensure output is tracking setpoint
           {
             pwr -= 1.0/250.0;     // should output get close enough to matter.
           sst = 251;
           }
         }
       else
         pwr -= 1.0 /250.0;      // this will execute in slow stop
       }



One thing that is a growing concern for me is the increasing evidence that the LC tank circuit that is the primary winding + choke + capacitor is ringing like a bell.
I think it's looking for any reason to resonate to destruction.
What is it's resonant frequency? I can't recall if you told us that here.
The trigger for me was reading it needed 1 minute to settle down.
OR it's a result of the PID control loop. (plus delay/freq. response of Vfb filter)