DIY

Arduino based artificial horizon

Arduino-based artificial horizon

 Arduino-based artificial horizon Artificial horizon is an onboard gyroscopic instrument used in aviation to determine and indicate the longitudinal and lateral angles of inclination of the aircraft (pitch and roll), that is, the orientation angles relative to the true vertical.
This is exactly what Wikipedia says about this device. To put it simply, this is a device that is used to determine the position of an aircraft in relation to the horizon or the ground. It is such a device that we will do together with a home-made mate under the nickname VitoG6.
Tools and materials: -Arduino MEGA 2560; -SD1306 OLED display; -Gyroscope module MPU6050; -Mounting perforated board; -Connecting wires; -Soldering iron; -Scissors; -Breadboard; Step one: breadboard
The connection diagram is shown in the sketch.
Arduino-based artificial horizon First, the wizard assembles and checks the device on the motherboard.
Arduino-based artificial horizon Step two: assembly
After checking the work on the breadboard, the wizard assembles the device on the board. Solders connectors for display and Arduino.
Arduino-based artificial horizon Arduino-based artificial horizon Arduino-based artificial horizon Arduino-based artificial horizon Mounts a screw connector, toggle switch.
The artificial horizon on Arduino database Arduino-based artificial horizon Arduino-based artificial horizon Arduino-based artificial horizon Arduino-based artificial horizon  Arduino artificial horizon Arduino-based artificial horizon Installs Arduino and gyroscope sensor.
Arduino-based artificial horizon Arduino-based artificial horizon  Arduino artificial horizon Arduino-based artificial horizon Step three: programming
Now you need to download the code to the device. The code file can be downloaded below.

 #includere #includere #include & # 34; U8glib.h & # 34; #include #includere MPU6050 mpu6050 (cavo); U8G2_SSD1306_128X64_NONAME_F_HW_I2C u8g2 (U8G2_R2, SCL, SDA, U8X8_PIN_NONE); void setup () & # 123; u8g2.begin (); Serial.begin (9600); Wire.begin (); mpu6050.begin (); mpu6050.calcGyroOffsets (true); //taratura u8g2.setFont (u8g2_font_unifont_t_symbols); } int xship = 64; int yship = 32; unsigned long t1, dt; float x, y, z; void loop () & # 123; mpu6050.update (); dt = millis () - t1; if (dt & gt; 200) & # 123; t1 = millis (); x = mpu6050.getAngleX (); y = mpu6050.getAngleY ​​(); } int v = mpu6050.getAngleX (); int a = mpu6050.getAngleY ​​(); yship = map (v, +40, -40, 55.5); int rot = map (a, -90, + 90, 314,0); u8g2.clearBuffer (); nave (((float) rot) /100.0f); u8g2.drawTriangle (xship-62, yship, xship + 62, yship, xship, yship + 2); u8g2.sendBuffer (); ritardo (50); } void ship (float a) & # 123; int x = xship + (int) 10 * cos (a); int y = yship + (int) 10 * sin (a); int xa = xship + (int) 5 * cos (a + 2.0 * PI/3.0); int ya = yship + (int) 5 * sin (a + 2.0 * PI/3.0); int xb = xship + (int) 5 * cos (a - 2.0 * PI/3.0); int yb = yship + (int) 5 * sin (a - 2.0 * PI/3.0); u8g2.drawLine (xship, yship, xa, ya); u8g2.drawLine (xship, yship, xb, yb); u8g2.drawLine (x, y, xa, ya); u8g2.drawLine (x, y, xb, yb); }  

 Arduino-based artificial horizon Arduino-based artificial horizon Arduino-based artificial horizon Everything is ready.
 Arduino-based artificial horizon Arduino-based artificial horizon  Arduin artificial horizon about

Source:

usamodelkina.ru

Show More

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button