ME218A

ME218A is a Stanford class that serves as an introduction to mechatronics. We learn about practical circuit design including transistors, op-amps, LEDs, shift registers, and program a TI microcontroller in C.

During this class, we conducted many labs and one final project. The topics of the labs are as follow:

  • Measure the voltage drop and current through multiple types of transistors
  • Write drivers to control an LED interface
  • Create a circuit that can decode morse code transmitted by an IR LED

For the final project in the class, we were tasked with making an interactive game. We created “Overcooked on Mars”, a cooking game based on the video game “Overcooked”.

Website dedicated to the project

218A Game

Designing this game applied my mechatronics knowledge on a practical project. The game consists of the following components:

  • Knife that uses a potentiometer to detect a chopping motion
  • Oven door that opens with a solenoid and detects if it is closed with a limit switch
  • Bell that uses an IR beam break to detect if a hand is waved over it
  • Fire with 32 serially controlled LEDs that can light up in any pattern we program
  • Adorable little aliens that I sewed for decoration

One circuit used in the project to control the many LEDs Shiftregister Wiring

Coding excerpt used to control the shift registers

//Write an 32 bit value to the shift register
void SR_Write_32(uint32_t NewValue)
{
uint8_t BitCounter = 0;
LocalRegisterImage = NewValue; // save a local copy

// lower the register clock
HWREG(GPIO_PORTB_BASE + (GPIO_O_DATA + ALL_BITS)) &= RCLK_PASSAGE_TIME_LOW;

// shift out the data while pulsing the serial clock
//Loop through the 16 bits of data
for ( ; BitCounter < 32; BitCounter++)
{
    //Isolate the MSB of NewValue, put it into the LSB position
    //Output this value to the shift register
    if (GET_MSB_IN_LSB_32(NewValue))
    {
    HWREG(GPIO_PORTB_BASE + (GPIO_O_DATA + ALL_BITS)) |= DATA_PASSAGE_TIME_HIGH;
    }
    else
    {
    HWREG(GPIO_PORTB_BASE + (GPIO_O_DATA + ALL_BITS)) &= DATA_PASSAGE_TIME_LOW;
    }

    // raise SCLK
    HWREG(GPIO_PORTB_BASE + (GPIO_O_DATA + ALL_BITS)) |= SCLK_PASSAGE_TIME_HIGH;
    // lower SCLK
    HWREG(GPIO_PORTB_BASE + (GPIO_O_DATA + ALL_BITS)) &= SCLK_PASSAGE_TIME_LOW;

    //Shift NewValue over
    NewValue = NewValue << 1;
}
// finish looping through bits in NewValue
// raise the register clock to latch the new data
HWREG(GPIO_PORTB_BASE + (GPIO_O_DATA + ALL_BITS)) |= RCLK_PASSAGE_TIME_HIGH;
}

Close up on the game

Cute Alien