I wanted to connect an Arduino Nano to either my Pi 3B+ or my Zero W, preferably my Zero. When I connected my Nano to my Pi Zero and ran a simple script with the Python 3 serial library, it didn't work. I did the same with a 3B+, which didn't work either. I then tried connecting a normal Arduino Uno which worked just fine with both the Pi. I tried looking up the issue, but I didn't find any solutions related to connecting a Nano to any kind of Raspberry Pi. I think it might have something to do with the drivers because my Windows laptop recognizes my Nano.
A shortened version of my Python script:
import serial
from time import sleep
string = ""
sleep(2)
arduinoSerialData = serial.Serial('/dev/ttyACM0', 9600)
sleep(2)
#print statements are for debugging
while(True):
sleep(1)
arduinoSerialData.write(b's')
sleep(1.3)
string = arduinoSerialData.readline().decode('ascii')
string = string[0]+string[1]+string[2]+string[3]
f = open("soil.txt","w+")
f.write(string)
f.close
print(string)
I'm using a standard Arduino Uno and Nano with the given serial cable.
Note: I'm using the "Arduino IDE Linux ARM 32 bit" on my Pi to code the Arduino. It recognizes and works with my Uno but not with my Nano, which led me to believe it was a driver issue.