Friday, 2 June 2017

arduino tft(www.mcufriend.com) module home autoamtion

Here Is the code:  for complete libraries you can  Here


 You can get the 2.4" display from any online store, please feel free to ask any queries.
The output on your display will be similar to the above picture

#include <Adafruit_GFX_AS.h>

#include <TouchScreen.h>
#include <MCUFRIEND_kbv.h>
MCUFRIEND_kbv tft;

#define LCD_CS A3
#define LCD_CD A2
#define LCD_WR A1
#define LCD_RD A0
#define LCD_RESET A4

#define YP A1
#define XM A2
#define YM 7
#define XP 6

TouchScreen ts = TouchScreen(XP, YP, XM, YM, 300);  

#define TS_MINX 20
#define TS_MINY 120
#define TS_MAXX 200
#define TS_MAXY 940

#define  BLACK   0x0000
#define BLUE    0x001F
#define RED     0xF800
#define GREEN   0x07E0
#define CYAN    0x07FF
#define MAGENTA 0xF81F
#define YELLOW  0xFFE0
#define WHITE   0xFFFF


uint16_t g_identifier;
void setup(void) {
  Serial.begin(9600);
  pinMode(13, OUTPUT);
  pinMode(12, OUTPUT);
  tft.reset();
  delay(10);
 
 g_identifier = tft.readID(); // some times tft.begin(0x9341); will also used but for tft like this won't work with this command.(www.mcufriend.com)
  
    tft.begin(g_identifier);
  tft.fillScreen(WHITE);
  tft.setRotation(0);
  tft.setTextSize(3);
  tft.setTextColor(BLACK);
  tft.setCursor(20, 15);
  tft.println("LED-Control");
  //tft.setRotation(0);
  tft.setTextSize(3);
  tft.setTextColor(BLACK);
  tft.setCursor(100, 210);
  tft.println("BY");
  tft.setTextSize(3);
  tft.setTextColor(BLUE);
  tft.setCursor(100, 240);
  tft.println("N.B.L.V");
  tft.setTextSize(3);
  tft.setTextColor(BLUE);
  tft.setCursor(100, 280);
  tft.println("PRASAAD");

 
//ON-BUTTONS-TEMPLATE
  tft.fillCircle(40, 90, 25, GREEN);   // tft.sahpe( x, y, w, h, colour)
  tft.setTextSize(2);
  tft.setTextColor(BLACK);
  tft.setCursor(10, 83);
  tft.println("  1");
   tft.fillCircle(40, 150, 25, GREEN);   // tft.sahpe( x, y, w, h, colour)
  tft.setTextSize(2);
  tft.setTextColor(BLACK);
  tft.setCursor(10, 143);
  tft.println("  2");
 
//OFF-BUTTONS-TEMPLATE
  tft.fillCircle(120, 90, 25, RED);
  tft.setTextColor(BLACK); 
  tft.setCursor(90, 83);
  tft.println("  1");

  tft.fillCircle(120, 150, 25, RED);
  tft.setTextColor(BLACK); 
  tft.setCursor(90, 143);
  tft.println("  2");
}

#define MINPRESSURE 10
#define MAXPRESSURE 1000

void loop()
{

TSPoint p = ts.getPoint();
  pinMode(XM, OUTPUT);
  pinMode(YP, OUTPUT);
    p.x = map(p.x, TS_MINX, TS_MAXX, 0, 240);
    p.y = map(p.y, TS_MINY, TS_MAXY, 0, 320);
   
  if (p.z > MINPRESSURE && p.z < MAXPRESSURE)
  {
 
    }

  if (p.z > 0)
  {
    //this part will read the x,y coordinated of your tft display brought from (www.mcufriend.com)
     Serial.print("\tY = "); Serial.print(p.y);     
     Serial.print("\tX = "); Serial.print(p.x);
     Serial.print("\tPressure = "); Serial.println(p.z);
   }
   tft.setTextSize(2);
  if (p.y > 50 && p.y < 100 && p.x > 300 && p.x < 500)
  { 
        digitalWrite(13, HIGH);
         Serial.print("\tLED1 ON");
          tft.setTextColor(WHITE);
       tft.setCursor(160, 103);
        tft.println("1 OFF");
       
         tft.setCursor(160, 103);
         tft.setTextColor(GREEN);
        tft.println("1 ON");
         delay(1000);
        
      }

   if (p.y > 50 && p.y < 100 && p.x > 600 && p.x < 1000)
   {
        digitalWrite(13, LOW);
        Serial.print("\tLED1 OFF");
        tft.setTextColor(WHITE);
       tft.setCursor(160, 103);
       tft.println("1 ON");
       delay(100);
        tft.setCursor(160, 103);
        tft.setTextColor(RED);
       tft.println("1 OFF");
         delay(1000);
       
      }  
   if (p.y > 100 && p.y < 150 && p.x > 300 && p.x < 500)
   { 
        digitalWrite(12, HIGH);
        Serial.print("\tLED2 ON");
        tft.setCursor(160, 143);
       tft.setTextColor(WHITE);
       tft.println("2 OFF");
        tft.setCursor(160, 143);
        tft.setTextColor(GREEN);
         tft.println("2 ON");
         delay(1000);
      
      }
   if (p.y > 100 && p.y < 150 && p.x > 700 && p.x < 1000)
   {
        digitalWrite(12, LOW);
        Serial.print("\tLED2 OFF");
        tft.setCursor(160, 143);
       tft.setTextColor(WHITE);
       tft.println("2 ON");
        tft.setCursor(160, 143);
        tft.setTextColor(RED);
         tft.println("2 OFF");
         delay(1000);
      
      }  

  
       
    delay(1000); // is to stabilize the x,y coordinates
}

Saturday, 29 October 2016

DIRECT TORQUE CONTROL FOR DOUBLY FED INDUCTION MACHINE-BASED WIND TURBINES UNDER VOLTAGE DIPS AND WITHOUT CROWBAR PROTECTION

This letter proposes a rotor flux amplitude reference generation strategy for doubly fed induction machine based wind turbines. It is specially designed to address perturbations, such as voltage dips, keeping controlled the torque of the wind turbine, and considerably reducing the stator and rotor over currents during faults. In addition, a direct torque control strategy that provides fast dynamic response accompanies the overall control of the wind turbine. Despite the fact that the proposed control does not totally eliminate the necessity of the typical crowbar protection for this kind of turbines, it eliminates the activation of this protection during low depth voltage dips.

Block Diagram:
for matlab files click here :Here

Wednesday, 26 October 2016

Fuzzy controller based FC-TCR System for Flitering purpose



 Fuzzy controller based FC-TCR System for Flitering purpose


Simulation diagram:


output wave forms:

MAT LAB SIMULATION WAVE FORMS




Fig 1 Wave-forms without compensation for light loads VR>VS as the reactive power generated is greater than absorbed

                                                                      


Fig 2 Wave-forms without compensation for heavy loads VR<VS as the reactive power   absorbed is greater than generated



For more documents and simulation files please click here  Here




Saturday, 8 October 2016

installing Openpilot in CC3D after flashing Cleanflight

Lot of people will face a definite problem with cleanflight, even i too so i switch to openpilot which reults in better performance of flight. If you want you can reflsh the cc3d with open pilot, even after you flshed the cc3d with cleanflight 

follow these simple steps

1. Load the boot loader into the cc3d FC ,you can get it here   click here 
2.Connect usb cable to your FC.
3.Burn the hex code.
4.Now to update firm ware, go to open pilot gui, click on update and erase the board options like.
5.Disconnect usb cable and it (open pilot) will ask you to connect the cable again.
6.Now it will load the latest firmware automatically.

How to Change CC3D Flight controller OS

CONVERT CC3D OS
 OPENPILOT TO CLEANFLIGHT/BETAFLIGHT

CC3D
  1. Remove Props and pull apart Quad
  2. Download OpenPilot GCS 15.02.02, You may also need the STM32 Virtual Com Port driver.
  3. Install the Cleanflight Configurator from the Chrome Web Store.
  4. Download Cleanflight 1.10 firmware .bin or Latest Betaflight CC3D BIN File from hereNOTE: You need .bin file – so thats why we have put Cleanflight 1.10 ONLY, versions after this do not have .bin file.
    For difference on Cleanflight vs Betaflight view this article.
  5.  On openpilot and open the firmware tab. Click rescue then plug in your Quad to computer via USB (no power)
  6. Click open and select .bin that you downloaded.
  7. Click the checkbox, I know what I’m doing!
  8. Click Flash
  9. WAIT TILL 100%
  10. IMPORTANT! Leave USB plugged in and power the board via esc input
  11. Click boot (in same firmware window), motors will beep and wait till blue light on the cc3d is steadily blinking
  12. Close openpilot
  13. Unplug everything
  14. Open cleanflight
  15. Power your Quad and plug usb back in now.
  16. Click connect. (if it fails, try changing the port)
  17. Congrats! You now are on Cleanflight. To connect your Quad to Cleanflight you always need to use power now, plug in your battery!
  18. Place Quad on flat surface and under setup, click calibrate accelerometer.
  19. Change minimum throttle to 50 above what your receiver shows on Receiver tab. (usually 1000, so put 1050)
  20. Click Save and reboot
  21. Now goto your PID tuning.
  22. Change PID Controller to LUXFloat
  23. Click SAVE
  24. Now change the following
    Change roll rate to 0.70
    Change pitch rate to 0.70
    Change YAW rate to 0.40
    TPA should be 0.00
    TPA breakpoint should be 1500
  25. Now goto receiver tab, and check all your transmitter channels are correct, they usually are different and you will need to reconfigure.
  26. I have the FlySky FS-R6A receiver, so for me, I had to move the following.
    Ch 1 moved to Ch3
    Ch 3moved to Ch 5
    Ch 4 moved to Ch 1
    Ch 5 moved to Ch 4
    (You may need to swap Ch 2 and Ch 4 around if your pitch and roll is incorrect.
  27. Now on the right (still receiver tab) change throttle to 0.50, throttle EXPO to 0.00, RC rate to 1.00, RC expo 0.00 – Save
  28. Now you want to set up your AUX Switches, open the Modes Tab.No mode selected = ACRO+ / Rate mode by default.Altitude mode = Angle Mode
    Rattitude  mode = Horizon Mode
    If you your switch only has two positions it would look something like this.

    0 = Horizon Mode
    1 = Acro/RateIf you have a switch that has 3 positions it may look like this.
    0
     = Angle
    1 = Acro/rate
    2=Horizon   
  29. If you have more than six channels you may want to setup ARM as a switch, as well as a buzzer, or lights.
  30. Now save your settings. By moving your switches you should be able to test the setup. Green = mode activated, grey means Acro/Rate mode.
  31. Now we need to calibrate ESC,  go to the motor tab. remember, you should have removed props at the start, if you didnt, DO THIS NOW.
  32. Unplug battery
  33. Slide Master to MAX
  34. Plug in battery, wait for beeps.
  35. Slide Master to MIN
  36. ESC Calibration is now complete, however you must test that it has worked corectly.
    Arm copter, and all motors should spin at 0 throttle. If only some do, you need to redo the above steps until they are all spinning correctly.
  37. You now need to swap motor configuration as cleanflight configuration is different as per below.
    LEFT is openpilot RIGHT is Cleanflight


  38. cleanflight-motor-direction54da3c8a6ab4457e8f1b5df20ab563714_rotor_quad
  39. Copy and paste the below into the CLI tab.
    mixer custommmix resetmmix 0 1.0, 1.0, -0.93-1.0
    mmix 1 1.0, -1.0-0.93, 1.0
    mmix 2 1.0, -1.0, 0.93, -1.0
    mmix 3 1.0, 1.0, 0.93, 1.0
    save
  40. Your cc3d will reboot. Give it a test flight! Make sure you are open space in case you missed a step and it crashes.

Friday, 7 June 2013

WELCOME



Hi every one,My name is prasad,an Engineer (Electrical) from Andhrapradesh India.


“My past is everything I failed to be.” 


I always love to work with electronics, it has been taken an years to learn all the stuff that i'm going to post in my blog.hope fully if you are interested to learn,it will take while to learn all of it.


"If "U" then "I" will"