Skip to content

Self-Leveling Table

Progress Report #4

Updates

  • Received power supply and verified working.
  • Progress on final table assembly
  • Completed integration testing with Arduino + L298N + Actuators + Power Supply.
  • Completed pseudocode:
#include <L298N.h>
#include <MPU6050_tockn.h>
#include <Wire.h>

int levelInitial(void);
bool testIntegrity(void);

int main(void)
{
    bool level = true;

    bool leg1Maxed, leg2Maxed, leg3Maxed, leg4Maxed = false;


    mpu6050.update();

    if(AngleX() <= 1 && AngleX() >= -1 && AngleY() <= 1 && AngleY() >= -1)
    {
        level = false; 
    }

    if(level == false)
    {
        levelInitial();
    }
}

int levelInitial(void)
{
    mpu6050.update();
    while (AngleX > 1)
    {
        Raise Leg1 and Leg2;
    }
    while (AngleX < -1)
    {
        Raise Leg3 and Leg4;
    }
    while (AngleY < -1)
    {
        Raise Leg1 and Leg3;
    }
    while (AngleY > 1)
    {
        Raise Leg2 and Leg4
    }
}

bool testIntegrity(void)
{
    bool stable;
    for (int i = 1; i =< 4; i++)
    {
        mpu6050.update();
        record oldValues;
        move legi
        mpu6050.update();
        record newValues();
        if (newValues = oldValues)
        {
            stable = false;
        }
    }

    return stable;
}   

Next Steps:

  • Final Assembly.
  • Algorithm optimization and fine-tuning.
  • Aesthetic and safety refinements.