Amazing Mechatronics

From Wiki - Scioly.org
Jump to navigation Jump to search

Amazing Mechatronics is a Division B and Division C trial event in which competitors must use their knowledge of mechatronics to debug and program using Arduino microcontrollers. It was run as an official event at the 2017-2019 North Carolina state tournaments, as well as all 2019 North Carolina regional tournaments, the 2019 Wisconsin state tournament, and the 2019 Virginia state tournament.

The Event

The event is run in two parts. The first part takes the form of a test, and the second requires teams to complete as many projects as possible from a given list posted at the event. In the test, students are shown a diagram of a circuit or given an Arduino microcontroller that does not work as intended. Students must troubleshoot the problem and provide the solution, and the problem can be either in hardware or software. The test is limited to a list of specific topics outlined in the rules, and all projects will cover the same range of topics. Any materials required at stations will be provided at the event. Students are also allowed to bring two 8.5" x 11" double-sided handwritten note sheets.

Arduino

Hardware

There are many different Arduino models, but the most popular one is the Arduino Uno.

Arduino Uno R3
Specification Value
Microcontroller Atmel ATmega328
Clock Speed 16 MHz
Flash Memory 32 KB, of which 0.5 KB is used by the bootloader
SRAM 2 KB
EEPROM 1 KB
Output Voltage 3.3V, 5V
Digital I/O Pins 14 (Pins 3, 5, 6, 9, 10, and 11 also support pulse-width modulation)
Analog Input Pins 6
Input Voltage 7-20V
Length 68.6 mm
Width 53.4 mm
Weight 25 g

Programming for the Arduino

Arduinos are programmed using a special variant of C++. Many of the basic parts of the Arduino language are common across many programming languages.

Arduino Code Structures
Structure Purpose Example Code
Function Put code to run in a function. Blocks of code meant to run together should be put in their own function. void setup() {

// put code to run here

}

For Loop Put code that you want to run for a set number of times in a for loop. for(int i = 0; i < 10; i++) {

// put code to run here

}

While Loop Put code that you want to run while something is a certain way in a while loop. while(someCondition == true) {

// put code to run here

}

If/Else/Else If Statement Put code that you want to run if something is a certain way in a if/else/else if statement. if(someNumber == 0) {

// put code to run here

}

else if(someNumber == 1) {

// put code to run here

}

else {

// put code to run here

}

Switch A switch makes it easier to organize different outcomes or cases. switch (someNumber) {

case 0:

// put code to run here

break;

case 1:

// put code to run here

break;

default:

// put code to run here

break;

}

Arduino Variables
Variable Possible Values
int Integers from -32,768 to 32,767, inclusive.
byte Integers from 0 to 255, inclusive.
long Integers from -2,147,483,648 to 2,147,483,647, inclusive.
string Letters, words, and phrases. Strings should be surrounded by double quotes (e.g. "This is a string").
char Special characters, as integers between 0 and 255, inclusive.
float/double Decimal numbers, up to 6-7 digits of precision.
boolean True or false.

More detailed and extensive information is available at the official Arduino Reference.

Tinkercad Circuits

All competitors must use an Arduino Uno and a breadboard, with no battery allowed. Common components are: LEDs, photoresistors, temperature sensors, potentiometer, piezos, buttons and switches.

Digital Components

LEDs

There are two types of LEDS, regular LEDS, and RGB LEDs. The former is one of the most common components in the event, and one of the easiest to work with. LED stands for light emitting diode. To wire it you need: a resistor, a breadboard, an Arduino Uno, and four wires. First, ground the LED by connecting a wire from the negative rail on the breadboard to one of the grounds on the Arduino, do the same thing to get a power source, except the wire comes from the positive rail and goes to 5 volts (5v).

Scoring

Each part of the event counts for 50% of the total score. Points are awarded for correct answers, with each question being of the same worth. Ties are broken by who completed their first circuit, in the second part, first.

External Links