Connection to Grove Serial Camera Kit

Hello,

I request your help to connect my rpi 4 to my serial camera Grove-Serial_Camera with groovepi

i try to connect my camera to the RPISER port and the SERIAL port but the result is the same : i was unable to receive anything from the camera

i try multiple connections but all failed :

  • with python

import serial

try:
serialPort = serial.Serial("/dev/ttyAMA0", 9600, timeout = 2)
print “Port opened, with sync”
bytes_sent = serialPort.write(“AA0D00000000”)
print "bytes sent : ", bytes_sent
while True:
line = serialPort.read(6)
print line
serialPort.close()
except IOError as e:
print "Error ", e

the result : no data received :
"
pi@dex:~/prg/MyRobot $ sudo python test.py
Port opened, with sync
bytes sent : 12

"

I send “sync” command according to camera protocol but i never received “ack”

i try to disconnect the camera from the rpiser port and connect instead a gps grove module that i have on the same port and i receive data :
"
pi@dex:~/prg/MyRobot $ sudo python test.py
Port opened, with sync

790,
M,M$G
PGGA,0
00*79
"
So i think the issue is not grove and not rpi configuration, but i think the command that i send was never received or is incorrect

i try also in java and with “cu” command without sucess

If someone have an idea to help me etablish connection with my camera, it will be great :slight_smile:

ok, i resolve myself this issue

the working code :
import serial

try:
serialPort = serial.Serial("/dev/ttyAMA0", 9600, timeout = 2)
print “Port opened”
for i in range(15):
bytes_sent = serialPort.write(serial.to_bytes([0xAA]))
serialPort.write(‘0D’.decode(‘hex’))
serialPort.write(serial.to_bytes([0x00]))
serialPort.write(serial.to_bytes([0x00]))
serialPort.write(serial.to_bytes([0x00]))
serialPort.write(serial.to_bytes([0x00]))
print "bytes sent : ", bytes_sent
while True:
line = serialPort.read(6)
print line
serialPort.close()
except IOError as e:
print "Error ", e

Also, i tried in java with pi4j but the 1.0 version is bugged, the 1.2 resolve this issue, because in 1.0 the api allows to write char but is not correct. in 1.2, the api allows to write byte

Topic to close :slight_smile: