Silícios LabPCBWay
Published © GPL3+

Human Machine Interface of a Subway System

You'll learn how to construct a human machine interface to communicate information with users of a subway system.

BeginnerFull instructions provided30 minutes860
Human Machine Interface of a Subway System

Things used in this project

Hardware components

PCBWay Custom PCB
PCBWay Custom PCB
×1
Breadboard Power Supply - UTSOURCE
×1
Power Supply 9V/2A - UTSOURCE
×1
Breadboard - UTSOURCE
×1
1kR Resistor - UTSOURCE
×1
10kR Resistor - UTSOURCE
×1
Jumper Wires - UTSOURCE
×1
16x2 LCD Display - UTSOURCE
×1
Arduino UNO - UTSOURCE
×1

Software apps and online services

Arduino IDE
Arduino IDE
Arduino Web Editor
Arduino Web Editor

Story

Read more

Schematics

Electronic Schematic of the Subway System with Turnstile

Code

Code of the Subway System with Turnstile

Arduino
#include <LiquidCrystal.h>

LiquidCrystal lcd(2,3,4,5,6,7); //LiqyuidCrystal lcd(RS, EN, DB4, DB5, DB6, DB7)

#define PinoSensor 9
#define PinoCartao 8

bool sensor = 0, cartao = 0, controle = 0, EstadoSensor = 0, EstadoCartao = 0;

void setup() 
{

  for(byte pinos = 2; pinos < 8; pinos++)//Configuracao dos pinos do LCD como saida
  {
    pinMode(pinos, OUTPUT);  
  }
  lcd.begin(16,2);            //Inicializa o display de LCD 16 x 2
  lcd.clear();//Limpa a tela do LCD
  
}

void loop() 
{
  
  // put your main code here, to run repeatedly:
  sensor = digitalRead(PinoSensor);
  cartao = digitalRead(PinoCartao);
  delay(50);

  if((sensor != EstadoSensor)||(cartao != EstadoCartao))
  {
    controle = 0;  
  }
  
  if(sensor == 0 && cartao == 0 && controle == 0)
  {
    lcd.clear(); 
    lcd.setCursor(1,0);
    lcd.print("Metro-Silicios");  
    lcd.setCursor(6,1);
    controle = 1;
  }
  
  if(sensor == 1 && cartao == 0 && controle == 0)
  {
    lcd.clear(); 
    lcd.setCursor(2,0);
    lcd.print("Insira o seu");  
    lcd.setCursor(4,1);
    lcd.print("Cartao!");  
    controle = 1;
  }

  if(sensor == 0 && cartao == 1 && controle == 0)
  {
    lcd.clear(); 
    lcd.setCursor(1,0);
    lcd.print("Aproxime-se da");
    lcd.setCursor(4,1);
    lcd.print("Catraca");  
    controle = 1;
  }

  if(sensor == 1 && cartao == 1 && controle == 0)
  {
    lcd.clear(); 
    lcd.setCursor(5,0);
    lcd.print("Catraca");  
    lcd.setCursor(4,1);
    lcd.print("Liberada");
    controle = 1;
  }

  EstadoSensor = sensor;
  EstadoCartao = cartao;
  
}

Credits

Silícios Lab

Silícios Lab

73 projects • 173 followers
Hello, I love program microcontrollers and works with electronic projects.
PCBWay

PCBWay

91 projects • 146 followers
We are a PCB and assembly manufacturer, As low as $5/10pcs and 24 hours delivery time. We are committed to helping creators build project.

Comments