ukanduit's blog View Details

# MPPT for F5E

Posted by ukanduit | Dec 27, 2017 @ 04:45 PM | 2,768 Views
Here is the latest code for my mppt:

Code:
```
/*MPPT v6.3 for F5E RC Solar Airplane
pin2 solar voltage coming off a divider. 1.1v max. 300k and pin2 across 47k to ground
pin3 rc input comeing from rx
pin4 rc output going to esc
December 2017
Sergey Vekli and Ted Luginbuhl
__  __
Reset -|o \/  |- VCC
3 Rx -|ATTINY|- 2 Solarvoltage
4 ESC -| 45/85|- 1
GND -|______|- 0
*/
#define Vmpp 0.55  // good setting: 0.84 for 12 cell and .55 for 8 cell. If too low motor will be faster at less than full throttle.
#define VmppLOW 0.63 // low throttle mpp voltage. 0.97 seems to be good for 12 cell and .63 for 8 cell.Set so that motor cuts off when parallel with suns rays.
#define STEPdown 2 //default 2  If too high throttle will oscilate, if too low esc will reset
#define STEPup 1
#define iterations 15 //default 15. This is how many times the algo averages the array voltage.
#define transition 150 // point at wich transition takes place from Vmpp to VmppLOW between 110 and 230. Default 150.If too high it will kick in too soon and mimick Vmpp set too low.
#define LOW  false
#define HIGH true
int x = 0;
int Vcell = 0;
int VMPP = 0.00;
int VMPPlow = 0.00;
boolean cur_level = LOW;
void setup()
{
// set pins mode
pinMode(4, OUTPUT); //going to esc
pinMode(3, INPUT); //coming from rx
//convert Vmpp to adc levels
VMPP = Vmpp * 925;
VMPPlow = VmppLOW * 925;
//set freq```