Introduction: Using Infrared Emitter Detectors and Sonar Signals to Assist Trains

Picture of Using Infrared Emitter Detectors and Sonar Signals to Assist Trains

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.

Step 1: Parts and Materials Used

Picture of Parts and Materials Used

In this project, we used each of these materials. Their quantities are listed in parentheses.

(1) Arduino Board

(10) Double-ended wires

(2) 10K ohm resistors

(1) 330 ohm resistor

(1) yellow LED light

(1) Piezo Speaker

(1) UltraSonic Rangefinder

(1) Infrared emitter and detector

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

Picture of 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

Picture of 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

Picture of 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:

while 1

voltage= readVoltage(a,'A0')

if voltage> .5

for i = 1:1

writeDigitalPin(a, 'D13', 1);

pause(5);

end

else voltage< .5

for i=1:1

writeDigitalPin(a,'D13',0)

end

end

end

writeDigitalPin(a, 'D13', 0);

Step 6: Ultrasonic Rangefinder Sample Code

Picture of 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:

while 1

vol= readVoltage(a,'A1')

pause(.1)

if vol<.1

playTone(a, 'D9', 1200, 2)

end

end

Comments

Swansong (author)2017-04-10

Looks good :)