Hi Guys,
I'm currently building a Radar-device to see the speed of cars passing my house.
Since my daughter was born, I'm a little less tolerant about speeding ![]()
EDIT: Look at the end first, I guess I found the source of the problem, but I'm not smart enough to solve it...
At the end of the day, it will be installed at a Raspberry Pi, but actually I'm doing some testing and for this task I use some Arduino-Uno. (Which is the reason I need to use SoftSerial).
So I have bought a radar-sensor from Aliexpress, it sends the measured speeds via serial.
That works fine when I copy the output from the soft-serial to the serial-console.
This is my hand at the sensor (++++ / ---- is the direction):
AltSoftSerial Test Begin
v (km/h) is 2.380----
v (km/h) is 2.197----
v (km/h) is 2.380----
v (km/h) is 2.197--/-
v (km/h) is 2.197++++
v (km/h) is 2.197++++
v (km/h) is 2.197++++
v (km/h) is 2.197++++
v (km/h) is 2.197++++
v (km/h) is 2.197++++
v (km/h) is 2.197----
v (km/h) is 2.197----
v (km/h) is 2.197----
v (km/h) is 2.197----
v (km/h) is 2.197----
v (km/h) is 2.197--/-
v (km/h) is 2.197++++
v (km/h) is 2.197++++
v (km/h) is 2.197++++
v (km/h) is 2.197++++
v (km/h) is >.197++++
v (km/h) is 2.197++++
v (km/h) is 2.197++++
v (km/h) os 2.197++++
v (km/h) is 2.197++++
v (km/h) is 2.197++++
v (km/h) is 2.197++++
v (km/h) is 2.197----
v (km/h) is 2.197----
v (km/h) is 2.380----
v (km/h) is 2.197----
v (km/h) is 2.197----
v (km/h) is 2.197++++
v (km/h) is 2.197++++
v (km/h) is 2.380++++
v (km⸮h) is 2.197++++
v (km/h) is 2.197----
v (km/h) is 2.197++++
This is the code I use:
#include <AltSoftSerial.h>
AltSoftSerial altSerial;
void setup()
{
 Serial.begin(9600);
 Serial.println("AltSoftSerial Test Begin");
 altSerial.begin(115200);
 }
void loop() {
 char c;
Â
 if (altSerial.available()) {
  c = altSerial.read();
  Serial.print(c);
 Â
}
}
Then I'd like to display it to the (20 by 4) I2C-display:
#include <AltSoftSerial.h>
#include <LiquidCrystal_I2C.h>
AltSoftSerial altSerial;
LiquidCrystal_I2C lcd(0x27,20,4);Â // set the LCD address to 0x27
void setup()
{
//LCD Initialisieren
 lcd.init();
 lcd.backlight();
 lcd.home();
 lcd.clear();
 Serial.begin(9600);
 Serial.println("AltSoftSerial Test Begin");
 altSerial.begin(115200);
 }
void loop() {
 char c;
 String RADAR;
Â
 if (altSerial.available()) {
  c = altSerial.read();
  Serial.print(c);
  RADAR = c;
}
//lcd.setCursor ( 0, 0 );Â Â Â Â // go to the next line
//lcd.print(RADAR);
}
Here goes the serial-output:
AltSoftSerial Test Begin
v⸮(mh) is 2190-⸮--
(m⸮[⸮⸮&⸮1?7,--,
v (om/h) is&⸮197-
--
v (hm⸮h) is 2⸮19----
v (km/h( ip ⸮.197+(++
v (kl/h) ip ⸮.187++(+
v (kl/h( is 2380++++v ⸮[⸮[⸮⸮6⸮,X6--,-
v (k
/h( ip 3.103
--,
v ⸮[⸮[⸮⸮
The display also only shows garbage. (It shows in one symbol 3 horizontal lines, nothing else)
But even when I use the display at all (Hello world / or whatever), the serial-console only shows garbage.
Any idea?
EDIT: I have added a delay of 100ms after the LCD prints:
I can see that single characters are sent to the display and console as well.
Unfortunately I did not know that there is no incoming string but single-characters only.
So let me change the question: How can I assemble the single-chars into a string which ends with each line-feed?! And the other question here below...
And besides, any good idea how I can "disassemble the char into the speed-number (float) and some bool for the direction?!
Regards,
Maeffjus
