Introduction: Train Seat Availability Information System - FGC

This project is based on the implementation, on a scale,of a train that allows the people who are in the station to know which seats are free. In order to carry out the prototype, the Arduino UNO software is used together with the Processing for the graphic part.

This concept would make it possible to revolutionize the world of public transport, as it would optimize all seats of the train to the maximum, ensuring the use of all wagons, along with the possibility of collecting data and carrying out studies that are accurate, later on.

Step 1: Design 3D Model

First of all we have done a comprehensive research on train models. With all the information collected, the GTW train (produced by Stadler Rail) used on FGC (Ferrocarrils de la Generalitat de Catalunya) has been chosen.

It was later designed with the 3D software PTC Creo the model for the subsequent 3D printing.

Step 2: Printing 3D Model and Finishes

Once the train is designed, it is passed to 3D printing. Once the piece is printed, it must be polished to achieve a smooth surface.

This project can also be done with existing train models.

Once printed, the final finishes are given.

Step 3: Components

For the development of this project the following components are needed:

- FSR 0.04-4.5LBS (Pressure sensor).

- 1.1K ohms resistors

Step 4: Coding (Arduino & Processing)

Now is time to write the Arduino code that will let the sensors send a sign to the Processing software that will transmit the information graphically.

As sensors we have 4 sensors of pressure for arduino that vary its resistance according to the force that is applied to them. So the aim is to take advantage of the signal sent by the sensors (when the passengers take a sit) to change the graphic screens in Processing.

Then, we create the graphic part in which we have taken into account the graphic design of the Ferrocarrils de la Generalitat de Catalunya, to emulate the reality in the best possible way.

In processing it's been written a code that is directly connected to the arduino software, in this way, every time someone sits on a seat, it changes color, allowing the user at the train platform to know in real-time the train availability of seats.

Here you can see the coding


int pot = A0; // Connect the middle pin of pot to this pin<br>int pot2 = A1;
int pot3 = A2;
int pot4 = A3;

int lectura1;// variable for storing the pot values;
<p>int lectura2;<br>int lectura3;
int lectura4;</p><p>void setup()<br>{
  //initialize serial communications at a 9600 baud rate
}</p><p>void loop() {<br>    String s = "";
  //  //Llegir sensor1
  lectura1 = analogRead(pot); // lectura the analog value
   if (lectura1 > 10) {
   s = "1";
    else {
      s = "0";


import processing.serial.*; // this library handles the serial talk <br>String val="";
PImage s0000, s0001, s0010, s0011, s0100, s0101, s0110, s0111, s1000, s1001, s1010, s1011, s1100, s1101, s1110, s1111;
Serial myPort;  // Create object from Serial class
<p>void setup()// this runs just once<br>{
  background(0);// setting background color to black
  myPort = new Serial(this, "COM5", 9600);// giving parameters to object of serial class,put the com to which your arduino is connected and the baud rate</p><p>s0000 = loadImage ("0000.jpg");<br>  s0001=loadImage("0001.jpg");
  s1111=loadImage("1111.jpg");</p><p>s0000.resize(displayWidth, displayHeight);<br>  s0001.resize(displayWidth, displayHeight);
  s0010.resize(displayWidth, displayHeight);
  s0011.resize(displayWidth, displayHeight);
  s0100.resize(displayWidth, displayHeight);
  s0101.resize(displayWidth, displayHeight);
  s0110.resize(displayWidth, displayHeight);
  s0111.resize(displayWidth, displayHeight);
  s1000.resize(displayWidth, displayHeight);
  s1001.resize(displayWidth, displayHeight);
  s1010.resize(displayWidth, displayHeight);
  s1011.resize(displayWidth, displayHeight);
  s1100.resize(displayWidth, displayHeight);
  s1101.resize(displayWidth, displayHeight);
  s1110.resize(displayWidth, displayHeight);
  s1111.resize(displayWidth, displayHeight);</p><p>val = trim(val);<br>}
void draw()
  if (val!=null) {</p><p>if (val.equals("0001")) {<br>      image(s0001, 0, 0);
    } else    if (val.equals("0010")) {
      image(s0010, 0, 0);
    } else if (val.equals("0011")) {
      image(s0011, 0, 0);
    } else if (val.equals("0100")) {
      image(s0100, 0, 0);
    } else if (val.equals("0101")) {
      image(s0101, 0, 0);
    } else if (val.equals("0110")) {
      image(s0110, 0, 0);
    } else if (val.equals("0111")) {
      image(s0111, 0, 0);
    } else if (val.equals("1000")) {
      image(s1000, 0, 0);
    } else if (val.equals("1001")) {
      image(s1001, 0, 0);
    } else if (val.equals("1010")) {
      image(s1010, 0, 0);
    } else if (val.equals("1011")) {
      image(s1011, 0, 0);
    } else if (val.equals("1100")) {
      image(s1100, 0, 0);
    } else if (val.equals("1101")) {
      image(s1101, 0, 0);
    } else if (val.equals("1110")) {
      image(s1110, 0, 0);
    } else if (val.equals("1111")) {
      image(s1111, 0, 0);
    } else {
      image(s0000, 0, 0);
}</p><p>void serialEvent(Serial myPort)// whenever serial event happens it runs<br>{
  val = myPort.readStringUntil('\n');
  //make sure our data isn't empty before continuing
  if (val != null) {
    //trim whitespace and formatting characters (like carriage return)
    val = trim(val);

Step 5: Circuit

After all the programming, it's time to connect all the sensors with the Arduino UNO board.

The sensors are placed on 4 seats (which will later be covered by a cloth) and welded to cables that go directly to the motherboard of Arduino UNO. The signal received on the board is sent to a computer connected via USB that sends the information to Processing in real time, changing the color of the seat.

You can see a schema of the connections.

Step 6: Prototype Test

Once the code has been uploaded to the arduino board and the processing and arduino program turned on, the sensors are tested. On the screen you will see the changes in the seats due to the change of images on the display informing about the seats occupied and no.

Step 7: Real Mock-up

The real application would try to install it on trains and platforms of the FGC network to serve travelers.

Step 8: ENJOY!

You have finally made a Force Sensor Train (prototype) that allows the user at the train platform know which seat is available in real time.


Project made by Marc Godayol & Federico Domenech

Arduino Contest 2017

Participated in the
Arduino Contest 2017

Wireless Contest

Participated in the
Wireless Contest