ARIEL NUNES BRAZ GOMESFernando F de Carvalho
Published

Sensor for parking spaces V2

A parking sensor made with Arduino and Neopixel !

BeginnerFull instructions provided1 hour2
Sensor for parking spaces V2

Things used in this project

Hardware components

Arduino UNO
Arduino UNO
×1
Jumper wires (generic)
Jumper wires (generic)
×30
Flora RGB Neopixel LEDs- Pack of 4
Adafruit Flora RGB Neopixel LEDs- Pack of 4
×1
Rotary Potentiometer, 250 kohm
Rotary Potentiometer, 250 kohm
×1
Resistor 220 ohm
Resistor 220 ohm
×1
Ultrasonic Sensor - HC-SR04
SparkFun Ultrasonic Sensor - HC-SR04
×1
RGB Backlight LCD - 16x2
Adafruit RGB Backlight LCD - 16x2
×1

Software apps and online services

Arduino IDE
Arduino IDE

Story

Read more

Schematics

Sensor for parking spaces V2 Scheme

made on https://www.tinkercad.com

Code

Sensor for parking spaces V2

Arduino
I use 3 librarys, 2 for LCD and 1 for NeoPixel.
#include <LiquidCrystal.h>
#include <Adafruit_NeoPixel.h>

#define numLeds 1
#define pinNumber 6

#define TRIGGER_1 8
#define ECHO_1 7

Adafruit_NeoPixel pixels = Adafruit_NeoPixel (numLeds, pinNumber, NEO_GRB + NEO_KHZ800);

LiquidCrystal lcd(12, A5, A4, A3, A2, A1);

//Ultrasonic sensor_L(10, 9);
//Ultrasonic sensor_R(8, 7);

unsigned long temp = 0;
float distancia = 0;

void setup() {
  
  pinMode(ECHO_1, INPUT); //Pino ECHO de saída
  pinMode(TRIGGER_1, OUTPUT); //Pino TRIGGER de entrada
  
  pixels.begin();
  lcd.begin(16, 2);
  lcd.clear();
  
}

void loop() {
  
  digitalWrite(TRIGGER_1, HIGH);
  delayMicroseconds(10);
  digitalWrite(TRIGGER_1, LOW);
  
  temp = pulseIn(ECHO_1, HIGH, 20588);
  
  distancia = temp/58.0;
  
  if(distancia<10.0){
    lcd.print("VAGA - LIVRE");
    pixels.setPixelColor(0,pixels.Color(0, 255, 0));
  }
  else{
    lcd.print("VAGA - OCUPADA");
    pixels.setPixelColor(0,pixels.Color(255, 0, 0));
  }
  
  delay(500);
  lcd.clear();
  pixels.show();
  
  
}
 

Credits

ARIEL NUNES BRAZ GOMES

ARIEL NUNES BRAZ GOMES

1 project • 2 followers
Fernando F de Carvalho

Fernando F de Carvalho

5 projects • 2 followers
Thanks to Othon Gonzaga.

Comments

Add projectSign up / Login