Openmv H7 : FATAL ERROR:Failed to detect the image sensor or image sensor is detached

I don’t know what I do, when I connected my openmv H7 with an micro usb-cable, It took me a long time to connect. After the connection was successful, sensor is displayed as “none” through the prompt in the lower right corner of IDE(2.8.1). In ERRORLOG, it displays: fatal error: failed to detect the image sensor or image sensor is detached. I tried to erase the internal file system but it didn’t work.

Was it working before ? You can try to remove the sensor and reattach it maybe it’s not seated properly.

Yeah, 5 days ago it worked, then I installed openmv on my robot. Maybe there was some collision during the installation。
I don’t know how to reattach the sensor. Could you give me some help?

Oh,I’m sorry that I have encountered another problem. When I use H7 or H7 plus, I always encounter “busy… Please wait”. I have to try to connect several times before I connect successfully. Maybe caused by data cable?

Just remove the screws on the back, remove it and reattach it.

I’m not sure could be a software issue or it could be the USB cable, you should try a different one just make sure it’s a data cable.

ok, i’ll try it, thanks

I found that when I run my own program, it will cause error “busy… Please wait”, but when I run the examples, it will not.

sensor.reset() # Reset and initialize the sensor.
#sensor.set_pixformat(sensor.GRAYSCALE) # Set pixel format to RGB565 (or GRAYSCALE)
sensor.set_pixformat(sensor.RGB565)
sensor.set_framesize(sensor.QQVGA) # Set frame size to QQVGA (160x120)
sensor.skip_frames(time = 2000) # Wait for settings take effect.

#sensor.set_auto_exposure(False)
sensor.set_auto_gain(False)
#sensor.set_auto_whitebal(False)
clock = time.clock()

uart = UART(3,115200)
uart.init(115200, bits=8, parity=None, stop=1) # init with given parameters

check_show = 1

class cameraIntrix:
fx = 176.678601967044
fy = 176.620350566926
cx = 79.4448592563810
cy = 57.5003872195640

THRESHOLD = (0, 80)
RED_THRESHOLD = (25, 80, 20, 60, 0, 50)

def get_line():

ROI = [0, int(cameraIntrix.cy)-50, 160, 100]
target_point = [999, 999]
robot2ground = 56.2  # H
robot2cam_shaft = 78.5 # X
shaft_len = 13  # R
camera_angle = 30 / 180 * 3.14159 

blobs = img.find_blobs([RED_THRESHOLD], x_stride = 7, y_stride = 7, roi = ROI)

if blobs:
    largest_blob = 0
    maxY = -1
    for i in range(len(blobs)):
        if blobs[i].cy() > maxY:
            maxY = blobs[i].cy()
            largest_blob = i

    img.draw_rectangle(blobs[largest_blob].rect())
    img.draw_cross(blobs[largest_blob].cx(), blobs[largest_blob].cy())
    target_point = [blobs[largest_blob].cx(), blobs[largest_blob].cy()]
    print("x", blobs[largest_blob].cx(), "y", blobs[largest_blob].cy())

    #向左为正,向右为负
    global shiftX
    global robot_shiftZ
    centerZ = ( shaft_len * math.sin(camera_angle) + robot2ground ) / math.cos(camera_angle)
    shiftX = (cameraIntrix.cx - target_point[0]) / cameraIntrix.fx * centerZ
    shiftZ = centerZ / (1 + ( (target_point[1] - cameraIntrix.cy) / cameraIntrix.fy * math.tan(camera_angle)) )
    robot_shiftZ = shiftZ * math.sin(camera_angle) + robot2cam_shaft + shaft_len * math.cos(camera_angle)
    print("old", math.atan(shiftX / robot_shiftZ) / 3.14159 * 180)
    robot_shiftZ = robot2cam_shaft + shaft_len *  math.cos(camera_angle) + centerZ * math.sin(camera_angle) - ((target_point[1] - cameraIntrix.cy) / math.cos(camera_angle))

    print("shiftX", shiftX, "robot_shiftZ", robot_shiftZ)

def sending_data(angle):
global uart
#frame=[0x2C,18,cx%0xff,int(cx/0xff),cy%0xff,int(cy/0xff),0x5B]
#data = bytearray(frame)
data = ustruct.pack(“<bbfbb”,
0x41,
0x54,
float(angle),
0x74,
0x61)
uart.write(data)
print(data)

angle = 0

shiftX = 999
robot_shiftZ = 999

while(True):

clock.tick()
img = sensor.snapshot()

get_line()

if shiftX != 999:
    angle = math.atan(shiftX / robot_shiftZ) / 3.14159 * 180

print("angle:", angle)

sending_data(angle)

last_angle = angle

print("fps : ", clock.fps())

You must be missing some initialization or something please follow the examples. I can’t read what you posted, I can’t figure out where code starts and where it ends. Please edit and fix your post.