Tyler Patterson, Angie Graven, Bonnie Armstrong
The use of an Arduino board and Matlab proved to be a simple and effective method to assist a train in many ways. The simplicity and versatility of the Arduino board is surprising. There are so many add-ons and uses for the board, that it was difficult to choose what the best and most interesting type of assistance would be without choosing something extremely complex. Overall, we chose to focus on collision warnings, sounds, and lighting control. With little to no experience using the Arduino, our group configured two inputs and two outputs that could assist a train on many separate occasions. These inputs and outputs cause the train to sense something that may be on the tracks, and when it gets dangerously close, an alarm sounds, and they also detect when the train has entered a tunnel, and this causes lights to come on.
Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.
Step 1: Parts and Materials Used
Step 2: Problem Statement
Our project is designed to combat simple, yet important, issues in an easy and innovative way. We thought about when trains enter tunnels and how dark it must become. This could be unnerving for any passengers who may be on board, because they wouldn't be able to see very well for the duration of the tunnel, which might be quite long. It could also be dangerous for the trains conductor, who may require a well-lit control panel in times of emergency. Another problem that we believe to be extremely important is collision detecting. The train needs to be able to detect if something is on the train tracks, or dangerously close to the train tracks, long before the train gets there. We decided to use a sonar detector to alert the conductor of a possible upcoming collision.
Step 3: Infrared Emitter and Detector Input and Output
We decided to use the infrared emitter and detector to activate a light when the train enters a tunnel. The emitter and detector will be fixed at the entrance to the tunnel directly across from one another. As the train passes through them, the light is activated and will stay lit until the last car of the train has passed. As soon as the last car has passed, the light will stay on for a little while longer, then turn off. This allows for the train to pass completely through the tunnel before the lights turn off again.
Step 4: Ultrasonic Rangefinder Input and Output
Using the ultrasonic rangefinder, our group was able to detect objects at certain distances. As the distance between the train and the object is decreasing, the voltage is also decreasing. Once the voltage gets below a certain point, an alarm sounds on the piezo speaker that would alert the conductor of the object and would allow him enough time to stop the train. Obviously, the small sonar detector doesn't have the range it would need for an actual train, but it works just fine for model trains!
Step 5: Infrared Emitter and Detector Sample Code
This code, using Matlab, will activate the light when it passes through the emitter and detector, and will last for five seconds after the train has completely passed (five seconds seemed long enough for a model train's tunnel).
For copy and paste purposes:
if voltage> .5
for i = 1:1
writeDigitalPin(a, 'D13', 1);
else voltage< .5
writeDigitalPin(a, 'D13', 0);
Step 6: Ultrasonic Rangefinder Sample Code
This code, using Matlab, will cause a tone to sound on the piezo speaker for two seconds or for as long as the voltage through the ultrasonic rangefinder is less than .1.
For copy and paste purposes:
playTone(a, 'D9', 1200, 2)
Participated in the
Microcontroller Contest 2017