I’m having some issues with my Nicla Vision and the OpenMV firmware. For context, I have made a transfer learning model on edge impulse following a tutorial for detecting the pointer on a gauge and classifying as a low, normal or high reading. All of that works well, but I have been trying for the past couple of days to set up a low power mode, ideally able to go low power for up to (and possibly over) an hour so it only takes a reading once an hour. For now, I’m just trying to test that it works, so I’m taking a reading once every ten seconds instead.
I read in documentation and other forums that pyb.stop(), machine.lightsleep() and sensor.sleep() are all made for this purpose, but they have all not worked for me and I can’t quite wrap my head around why. Specifically, the first two appear to malfunction and disconnect the Nicla when called, and sensor.sleep() throws “OSError: Sleep Failed”.
My guess is that either I’m doing something wrong either in set up or code, or it’s having issues because Edge-Impulse isn’t exporting on the latest OpenMV firmware version (exports as 4.3.1, encouraged to update to 4.3.2 by IDE but that somehow removes the EI model).
Code attached below, any help with this issue would be much appreciated, thanks
# Edge Impulse - OpenMV Image Classification Example import sensor, image, time, os, tf, uos, gc, pyb sensor.reset() # Reset and initialize the sensor. sensor.set_pixformat(sensor.RGB565) # Set pixel format to RGB565 (or GRAYSCALE) sensor.set_framesize(sensor.QQVGA) # Set frame size to QVGA (320x240) sensor.set_windowing((96,96)) # Set 240x240 window. sensor.skip_frames(time=2000) # Let the camera adjust. net = None labels = None rtc=pyb.RTC() def callback(): clock.tick() img = sensor.snapshot() # default settings just do one detection... change them to search the image... for obj in net.classify(img, min_scale=1.0, scale_mul=0.8, x_overlap=0.5, y_overlap=0.5): print("**********\nPredictions at [x=%d,y=%d,w=%d,h=%d]" % obj.rect()) img.draw_rectangle(obj.rect()) # This combines the labels and confidence values into a list of tuples predictions_list = list(zip(labels, obj.output())) for i in range(len(predictions_list)): print("%s = %f" % (predictions_list[i], predictions_list[i])) print(clock.fps(), "fps") rtc.wakeup(10*1000,callback) try: # Load built in model labels, net = tf.load_builtin_model('trained') except Exception as e: raise Exception(e) clock = time.clock() while(True): sensor.sleep(True)