Garage Parking Sensor
Hi everybody, my Dad's car doesn't have parking sensor. So I decide to make it and stop hand signaling my father each time he was going to parking. The device has two parts:
-Tx Module: it's the sensor with a comunication module that send message to the other part inside the car where the variable distance is showing in a display.
-Rx Module: Receive data from the sensor in the garage and show it on a display. This module can be feed by a 9v Battery and keep in the glovebox.
Materials:
-2xArduino Board "I used Uno"
-RF 315MHz or 433MHz transmitter-receiver module .
-jumper wires
-HC – SR04
-2 BreadBoards
-2 batteries 9v
-lcd 16x2
Ultrasonic Sensor
This is the sensor that I used in the device. It's easy to use with this simple library that you must add to your arduino IDE.
RF 315/433 MHz Transmitter and Receiver Module
This a cheap and easy module for arduino. To use with this simple library that you must add to your arduino IDE:
www.seeedstudio.com/depot/images/product/VirtualWi...
Transmitter :
Working voltage: 3V - 12V fo max. power use 12V
Working current: max Less than 40mA max , and min 9mA
Resonance mode: (SAW) Modulation mode: ASK
Working frequency: Eve 315MHz Or 433MHz
Transmission power: 25mW (315MHz at 12V)
Frequency error: +150kHz (max)
Velocity : less than 10Kbps So this module will transmit up to 90m in open area .
Receiver :
Working voltage: 5.0VDC +0.5V
Working current:≤5.5mA max
Working method: OOK/ASK
Working frequency: 315MHz-433.92MHz
Bandwidth: 2MHz Sensitivity: excel –100dBm (50Ω)
Transmitting velocity: <9.6Kbps (at 315MHz and -95dBm)
TX MODULE(Schematic)
TX MODULE(Arduino Code)
//TX CODE
/*SimpleSend This sketch transmits a short text message using the VirtualWire library connect the Transmitter data pin to Arduino pin 12 */
#include
#include
Ultrasonic ultrasonic(9,8); // (Trig PIN,Echo PIN)
int d;// Initialize the variable distance
void setup()
{
// Initialize the IO and ISR
vw_setup(2000); // Bits per sec
}
void loop()
{
char b[3]; //declaring character array
String str; //declaring string
d=ultrasonic.Ranging(CM);/cm o inc
if(d<10){
send("STOP ");
}
str=String(d); //converting integer into a string
str.toCharArray(b,3); //passing the value of the string to the character array
send(b);
delay(100);
}
void send (char *message)
{
vw_send((uint8_t *)message, strlen(message));
vw_wait_tx(); // Wait until the whole message is gone
}
RX MODULE(Schematic)
RX MODULE(CODE)
//RX CODE
/*
SimpleReceive
This sketch displays text strings received using VirtualWire
Connect the Receiver data pin to Arduino pin 11
*/
#include
#include
byte message[VW_MAX_MESSAGE_LEN]; // a buffer to store the incoming messages
byte messageLength = VW_MAX_MESSAGE_LEN; // the size of the message
LiquidCrystal lcd(7, 6, 5, 4, 3, 2);
// Variables globales:
char cad[100];
int pos = 0;
void setup()
{
lcd.begin(20, 4); // LCD Configuration, 4 línes 20 characters cada una.
lcd.setCursor(0, 0);
lcd.write("Booting");
delay(1000);
pos=0;
lcd.clear();
lcd.write("Loading code");
delay(1000);
pos=0;
lcd.clear();
lcd.write(".");
delay(900);
lcd.write(".");
delay(900);
lcd.write(".");
delay(900);
pos=0;
lcd.clear();
lcd.write("Instructables");
delay(900);
Serial.begin(9600);
Serial.println("Device is ready");
// Initialize the IO and ISR
vw_setup(2000); // Bits per sec
vw_rx_start(); // Start the receiver
}
void loop()
{
byte buf[VW_MAX_MESSAGE_LEN];
byte buflen = VW_MAX_MESSAGE_LEN;
int i;
int k= VW_MAX_MESSAGE_LEN;
if (vw_get_message(buf, &buflen)) // Non-blocking
{
Serial.print("Received: ");
for (int i = 0; i < buflen; i++)
{
Serial.write(buf[i]);
}
Serial.println();
}
if( vw_get_message(buf, &buflen) )
{
if(pos < 4)
lcd.setCursor(0, pos);
else
{
pos=0;
lcd.clear();
}
lcd.write("Distance:");
for (i = 0; i < buflen; i++)
{
lcd.write(buf[i]);
pos++;
}
lcd.write("cm");// CM or INC
}
}