0

I am trying to connect my Pi 4 running Rasbian 2020 to an Arduino, after making all the connections I try to communicate with the Arduino by using Minicom. However, Minicom doe not respond to anything I am typing nor any of the commands such as ctrl + a.

I am running Minicom with the following command: minicom -b 9600 -o -D /dev/ttyAMA0

This is the code I have running on the Arduino:

byte number = 0;

void setup(){
Serial.begin(9600);
}

void loop(){
if (Serial.available()) {
number = Serial.read();
Serial.print("character recieved: ");
Serial.println(number, DEC);
}
}
11
  • Have you uploaded some Serial code into your Arduino and set the bit rate ? /dev/ttyAMA0 exists on your RPI ? -o is really necessary ?
    – Ephemeral
    Mar 8, 2022 at 23:36
  • Yh, I do. I just put that up. Also, yes the baud rates match. Mar 8, 2022 at 23:40
  • From this example, your condition if (Serial.available()) {} must be if (Serial.available() > 0){} , I check if it is important
    – Ephemeral
    Mar 8, 2022 at 23:47
  • available -> Returns :The number of bytes available to read., For Arduino Mega the example code is the same as you.
    – Ephemeral
    Mar 8, 2022 at 23:49
  • Try to add int bytesSent = Serial.write("hello"); in your loop before if (Serial.available()) {} to see if you see anything in minicom ?
    – Ephemeral
    Mar 9, 2022 at 0:00

1 Answer 1

2

/dev/ttyAMA0 is connected to Bluetooth so this won't work.

See How do I make serial work on the Raspberry Pi3 or later

It IS POSSIBLE to disable Bluetooth but this is unnecessary to use serial. In the unlikely event you really need a fully featured UART the Pi4 has another 4.

There is no such thing as "Rasbian 2020"

3
  • Why do you think it is unnecessary to use Serial? and What do you mean by fully-featured UART? Mar 9, 2022 at 18:24
  • @BeulahAkindele "Why do you think it is unnecessary to use Serial" is said no such thing - re read the Answer.
    – Milliways
    Mar 9, 2022 at 23:03
  • @BeulahAkindele "What do you mean by fully-featured UART" the linked Answer explains the difference between mini UART & fully-featured UART.
    – Milliways
    Mar 9, 2022 at 23:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.