Getting weird characters from Arduino

My arduino is connected to ultrasonic sensor and I am trying to read the value from it. When I tried running "tail -f > /dev/ttyACM0" my arduino is sending some weird characters that I am not able to decode

That's interesting.

i dont know whats the issue here, is it due to arduino or have to do something from myside?

Probably

AWOL:
Probably

Perhaps both ?

bidouilleelec:
Perhaps both ?

Can't rule-out that possibility

The forum guidelines may have information that you can use to make a post with sufficient information so that we have a chance of helping you.

My arduino is connected to ultrasonic sensor and I am trying to read the value from it. When I tried running "tail -f > /dev/ttyACM0" my arduino is sending some weird characters that I am not able to decode

Should I place a full stop at the end of what you have said before I put my queries or do you have something more to add?

1. Which Arduino are you talking about: NANO, UNO, MEGA, or DUE?

2. You are trying to read data from the ultrasonic sensor after uploading a sketch -- is it this sketch: "tail -f > /dev/ttyACM0"?

3. The Arduino is sending characters to where -- Serial Monitor or LCD or to your Android Smart Phone?

Actually I am using an autonomous car from AUDI where I have four arduino controllers and five ultrasonic sensors are connected to that. the arduino's are already coded and now my task is just to establish the connection and get what the arduino is sending. So I have to create a client program to do that. When I tried just to print what is actually arduino sending I got this output.

OK.

When you've got some solid details to share, please get back to us.

Even I have this information only. My task is to establish the communication and read the values send by arduino.

You'll need to share the serial protocol.

SanthoshkumarSundararaj:
the arduino's are already coded and now my task is just to establish the connection and get what the arduino is sending.

So what in the Arduino sketch is doing that sending? Serial.print() perhaps?- if so, at what speed, parity and stop bits setting?

I am new to this project so i have the kit and just to find the solution on my own. The Arduino is send the values via ACM0-ACM3 ports. then I have tried ssty but no change. I am using the right baud rate.

I have attached my Arduino sketch.

Following is the entire code:

#include <arduino_communication.h>

#include <arduino_system_front_us.h>
#include <arduino_system_center_measurement.h>
#include <arduino_system_center_actuator.h>
#include <arduino_system_rear_imu_wheel.h>
#include <arduino_system_rear_us.h>

///////////////////////////////////////////////////////////////////////////////
// Arduino version
///////////////////////////////////////////////////////////////////////////////

const uint16_t arduinoVersion = 0x0005;

///////////////////////////////////////////////////////////////////////////////
// Defining the interface
///////////////////////////////////////////////////////////////////////////////

ArduinoSystem* arduino = nullptr;
int arduino_id = -1;

///////////////////////////////////////////////////////////////////////////////
// Communication class for serial communication
///////////////////////////////////////////////////////////////////////////////

ArduinoCommunication com;

///////////////////////////////////////////////////////////////////////////////
// Static allocation for all arduino systems
///////////////////////////////////////////////////////////////////////////////
ArduinoSystem arduino_sys(com); //Dummy

ArduinoSystemFrontUs arduino_front_us(com);
ArduinoSystemCenterMeasurement arduino_center_measurement(com);
ArduinoSystemCenterActuator arduino_center_actuator(com);
ArduinoSystemRearUs arduino_rear_us(com);
ArduinoSystemRearImuWheel arduino_rear_imu(com);

///////////////////////////////////////////////////////////////////////////////
// Helper function to determine the kind of arduino system
///////////////////////////////////////////////////////////////////////////////

void get_arduino_id_and_init()
{
int voltage = analogRead(PIN_ARD_CODE);

if (is_between(ARDUINO_1_MIN_VOLTAGE, voltage, ARDUINO_1_MAX_VOLTAGE)){
arduino = &arduino_front_us;
arduino_id = arduino->get_id();

}/*else if (is_between(ARDUINO_2_MIN_VOLTAGE, voltage, ARDUINO_2_MAX_VOLTAGE)){

}*/else if (is_between(ARDUINO_3_MIN_VOLTAGE, voltage, ARDUINO_3_MAX_VOLTAGE)){
arduino = &arduino_center_measurement;
arduino_id = arduino->get_id();

}else if (is_between(ARDUINO_4_MIN_VOLTAGE, voltage, ARDUINO_4_MAX_VOLTAGE)){
arduino = &arduino_center_actuator;
arduino_id = arduino->get_id();

}else if (is_between(ARDUINO_5_MIN_VOLTAGE, voltage, ARDUINO_5_MAX_VOLTAGE)){
arduino = &arduino_rear_us;
arduino_id = arduino->get_id();

}else if (is_between(ARDUINO_6_MIN_VOLTAGE, voltage, ARDUINO_6_MAX_VOLTAGE)){
arduino = &arduino_rear_imu;
arduino_id = arduino->get_id();

}else{
arduino = &arduino_sys;
arduino_id = arduino->get_id();
Serial.print("No valid arduino found. Arduino ID: ");Serial.println(arduino->get_id());
}
}

void loop_version(int hertz)
{
static unsigned long stamp = 0;
unsigned long current = micros();

if(current - stamp > 1000000/hertz)
{
com.send_info(arduino_id, arduinoVersion);
stamp = micros();
}
}

///////////////////////////////////////////////////////////////////////////////
/// \brief Main setup function which is called at startup of arduino.
///
///////////////////////////////////////////////////////////////////////////////
void setup()
{
com.begin(115200);
delay(1000);

pinMode(PIN_ANA_LED0, OUTPUT);
pinMode(PIN_ANA_LED1, OUTPUT);
pinMode(PIN_ANA_LED2, OUTPUT);

get_arduino_id_and_init();

if(arduino->setup()){
Serial.print("Initializing arduino. Arduino ID: ");Serial.println(arduino->get_id());
digitalWrite(PIN_ANA_LED0, arduino_id & 1);
digitalWrite(PIN_ANA_LED1, arduino_id & 2);
digitalWrite(PIN_ANA_LED2, arduino_id & 4);
delay(1000);
digitalWrite(PIN_ANA_LED0, LOW);
digitalWrite(PIN_ANA_LED1, LOW);
digitalWrite(PIN_ANA_LED2, LOW);
}else{
while(true){
Serial.print("Failed to initialize arduino. Arduino ID: ");Serial.println(arduino->get_id());
arduino->receive();
blink(PIN_ANA_LED0, 100);
}
}
}

void loop()
{
arduino->update();
arduino->receive();
blink(PIN_ANA_LED0, 1000);
}

I understand very little of that, but I see there's an instance of ArduinoCommunication called com, at 115200 baud. Is that what you're reading?

(There's also a load of Serial.print()-ing going on but I didn't see a Serial.begin().)

What model Arduino is this, anyway?

I am using Arduino micro.