Hi guys. My name is Bernardo, from Argentina.
I am on a speed radar project for private neighborhoods.
The materials I use are:
-Arduino uno
-HB100 by limpkin
-LCD display 12x2
-Battery 12v 7ah
I have tried several codes, using libraries, or not. Inside the house it works, running or walking, but when I take it to the street, sometimes it works, sometimes it doesn’t. Is it a hardware or code problem? Or is the sensor not suitable for this project?
Code
#include <FreqPeriod.h>
#include <Wire.h> // libreria de comunicacion por I2C
#include <LCD.h> // libreria para funciones de LCD
#include <LiquidCrystal_I2C.h> // libreria para LCD por I2C
LiquidCrystal_I2C lcd (0x27, 2, 1, 0, 4, 5, 6, 7); // DIR, E, RW, RS, D4, D5, D6, D7
double lfrq;
long int pp;
void setup() {
Serial.begin(9600);
FreqPeriod::begin();
lcd.setBacklightPin(3,POSITIVE); // puerto P3 de PCF8574 como positivo
lcd.setBacklight(HIGH); // habilita iluminacion posterior de LCD
lcd.begin(16, 2); // 16 columnas por 2 lineas para LCD 1602A
lcd.clear(); // limpia pantalla
Serial.println("FreqPeriod Library Test");
}
void loop() {
pp = FreqPeriod::getPeriod();
if (pp) {
//Serial.print ("period: ");
//Serial.print(pp);
//Serial.print(" 1/16us / frequency: ");
lfrq = 16000400.0 /pp;
//Serial.print(lfrq);
//Serial.print(" Hz ");
//lcd.setCursor(0,0);
Serial.print(lfrq/19.49);
Serial.println( "km/h");
lcd.print(lfrq/19.49);
lcd.print( "km/h");
delay(200);
lcd.clear();
}
}
I want it to work like in this video
And the code that Markus shares, I modified it to show on the display, it works running or walking (at a distance of 3 meters), but with cars it does not seem to work.
At that time I was with 9v batteries, now it is with 12v directly to arduino (I would be missing a stepdown)