Introduction: The Reading Railroad

This instructable will teach you how to set up a systematic railroad design by using MatLab coding and various parts from the Arduino instruction board.

Step 1: Supplies

For this project you will need:

One computer

MatLab 2016

3D printer

Arduino Board consisting of:

Flex Sensor

Pressure Sensor

Two lights of your color choice

29 wires

2 330 ohms resistors

2 10 ohm resistors

One breadboard

USB cord

Step 2: Design the Circuitry for Desired Outputs and Inputs

As seen in the pictures above, the wiring for this project is rather simple. The LED lights only require one wire and one 330 ohm resistor per light. The flex sensor and the pressure sensor have the exact same wiring. Each one only requires one 10 ohm resistor as well as 3 wires per sensor. Finally, the piezo buzzer only requires two wires. Before any sensors, lights, or buzzers are put in, make sure to connect the 5V to the positive and the GND to the negative.

Step 3: Develop Coding to Satisfy Desirable Outcome

Once connected to the Arduino board via your USB cord, you have to create a Matlab code that will give you your desired outputs after your desired inputs. The inputs consisted of the flex sensor voltage as well as the pressure sensor voltage. You have to test run the sensors with the train to find the point the voltage reads when put through the project. In other words, you have to find how much flex the train causes in the sensor and how much force/pressure it has on the track. You then set your boundaries at those points. If either if statement is satisfied, then the outputs consist of 2 LEDs, a buzzer, and 2 message boxes from Matlab depending on your inputs.

Step 4: Observe Visual Outputs From Train

If the if statement for the flex sensor is satisfied, then a red LED light will turn on as well as a message box popping up saying "The train is arriving!".

If the if statement for the pressure sensor is satisfied, then a yellow LED light will turn on as well as a message boxing saying "Warning: the train is leaving the station!". After this box pops up, it alerts the worker at the station and if they press 'OK', then a buzzer will sound alarming the potential passengers at the station.

Step 5: Final Setup

To finish the project, you have to set it up as a whole. The pressure sensor will be placed after the Pink Train Station as shown and the Flex Sensor will be placed in the green holder as shown before the Train Station. Place your lights on top of the Train Station.

That's the end of the tutorial, enjoy your new Reading Railroad!