From Hackerspace Brussels
Jump to: navigation, search

a captor to detect a free parking on a map.
easy parking detection.
Thibault Ahn


[edit] Project ParkingC

[edit] Goal

"Make a low cost, fully automatic available parking detector framework."


  • User friendly android app
  • cheap captor
  • open source project

[edit] Why

It is a good solution to solve the problems of parking in the big cities and especially in Brussel.

[edit] This project will go through 3 phases:

[edit] Phase 1: Make a working prototype

[edit] Phase 2: Create an Android Software

[edit] Phase 3: Link the prototype captor and the app

We are now at the beginning of phase 1.

[edit] Description

[edit] Hardware

[edit] Captor

Arduino prototype+GPS+Ultrasound captor

A solution with one CPU and a battery of captors can be developed later.

[edit] Arduino and electronics

[edit] Hardware mods still to do


[edit] Software

The android app is developed with Eclipse Java and the plug-in for android. The lay-out is written in XML.

[edit] Software to do

  • Application on Android with Eclipse to detect on an API google map the free parking.
  • Software with Arduino to detect a free parking with a captor with gps and ultrasound.

[edit] Results

A car will park on the place and the detector will detect if the place is available or not. The user in the car will use on an android phone to check the availability of parking place around the car with a map app.

[edit] Java code

[edit] Arduino code


#include <string.h>
#include <ctype.h>
int ledPin = 13;                  // LED test pin
int rxPin = 0;                    // RX PIN 
int txPin = 1;                    // TX TX
int byteGPS=-1;
char linea[300] = "";
char comandoGPR[7] = "$GPRMC";
int cont=0;
int bien=0;
int conta=0;
int indices[13];
void setup() {
  pinMode(ledPin, OUTPUT);       // Initialize LED pin
  pinMode(rxPin, INPUT);
  pinMode(txPin, OUTPUT);
  for (int i=0;i<300;i++){       // Initialize a buffer for received data
    linea[i]=' ';
void loop() {
  digitalWrite(ledPin, HIGH);;         // Read a byte of the serial port
  if (byteGPS == -1) {           // See if the port is empty yet
  } else {
    // note: there is a potential buffer overflow here!
    linea[conta]=byteGPS;        // If there is serial port data, it is put in the buffer
    Serial.print(byteGPS, BYTE); 
    if (byteGPS==13){            // If the received byte is = to 13, end of transmission
      // note: the actual end of transmission is <CR><LF> (i.e. 0x13 0x10)
      digitalWrite(ledPin, LOW); 
      // The following for loop starts at 1, because this code is clowny and the first byte is the <LF> (0x10) from the previous transmission.
      for (int i=1;i<7;i++){     // Verifies if the received command starts with $GPR
        if (linea[i]==comandoGPR[i-1]){
      if(bien==6){               // If yes, continue and process the data
        for (int i=0;i<300;i++){
          if (linea[i]==','){    // check for the position of the  "," separator
            // note: again, there is a potential buffer overflow here!
          if (linea[i]=='*'){    // ... and the "*"
        Serial.println("");      // ... and write to the serial port
        for (int i=0;i<12;i++){
            case 0 :Serial.print("Time in UTC (HhMmSs): ");break;
            case 1 :Serial.print("Status (A=OK,V=KO): ");break;
            case 2 :Serial.print("Latitude: ");break;
            case 3 :Serial.print("Direction (N/S): ");break;
            case 4 :Serial.print("Longitude: ");break;
            case 5 :Serial.print("Direction (E/W): ");break;
            case 6 :Serial.print("Velocity in knots: ");break;
            case 7 :Serial.print("Heading in degrees: ");break;
            case 8 :Serial.print("Date UTC (DdMmAa): ");break;
            case 9 :Serial.print("Magnetic degrees: ");break;
            case 10 :Serial.print("(E/W): ");break;
            case 11 :Serial.print("Mode: ");break;
            case 12 :Serial.print("Checksum: ");break;
          for (int j=indices[i];j<(indices[i+1]-1);j++){
      conta=0;                    // Reset the buffer
      for (int i=0;i<300;i++){    //  
        linea[i]=' ';             


/* Prototype mesures ultrason avec affichage LCD By Yannick DEVOS - XV4Y

Copyright 2013 Yannick DEVOS under GPL 3.0 license Any commercial use or inclusion in a kit is subject to author approval

The display is on a 16x2 LCD Display with HD44780 compatible driver, use the traditional 4 bits interface on pins 10, 9, 8, 7, 6, 5

In order to compile this program with Arduino 1.0.1, you will need to install 2 libraries : - New LiquidCrystal

- NewPing ultrasound sensor library

Revision history : v1.00 2013-04-11

        First release

  • /
  1. include <Wire.h>
  2. include <LiquidCrystal.h>
  3. include <NewPing.h>

// **** // Here some Parameters you may change // ****

  1. define ULTRA_TRIGGER A2 // What pin we have connected the Ultrasonic range sensor Trigger pin
  2. define ULTRA_ECHO A3 // What pin we have connected the Ultrasonic range sensor Echo pin
  3. define MAX_DISTANCE 350 // Maximum distance we want to ping for (in centimeters). Most sensor are rated at 400-500cm.

// Variables unsigned long duration=0; long int distance=0;

LiquidCrystal lcd(5, 6, 7, 8, 9, 10); // You can change this settings to your convenance, please see the library documentation NewPing sonar(ULTRA_TRIGGER, ULTRA_ECHO, MAX_DISTANCE); // NewPing setup of pins and maximum distance.

void setup() {

 lcd.home ();



 lcd.setCursor ( 0, 0 );


void loop() {

 // The speed of sound is 340 m/s or 29 microseconds per centimeter.
 // The ping travels out and back, so to find the distance of the
 // object we take half of the distance travelled.
   duration = sonar.ping_median(5);  // We do 5 measurements to have a good average and filter bad measurements
   distance = ((340 * duration) / 1000)/2;

   lcd.setCursor ( 0, 1 );
   lcd.print("              mm");
   lcd.setCursor ( 0, 1 );