RT1062 stops working when detecting AprilTags on battery power


I recently purchased two RT1062 units to evaluate for a robotics project. I programmed one of the cameras to look for AprilTags and produce a PWM signal when one is found. The RT1062 runs this program just fine when I am connected to the IDE, but it will stop working after 30 or so seconds while running on a 5V-regulated battery. The RT1062 LED is a purple color while the code is working and turns a bluish-white when it stops.

I am not sure if this is a software or hardware issue. A snippet of my code (below) is basically your AprilTag example code with a few lines thrown in to generate PWM signals. Do you know why the RT1062 might run this code well with the IDE, but not when powered by a battery? I’m probably doing something wrong in my code.

# Initialize PWM pin
pwm2 = PWM("P4")         # create PWM object from a pin
pwm2.freq(100)          # set frequency
duty_cycle = 1
pwm2.duty_u16(duty_cycle)             # set duty cycle to zero

# Function to map tag position to duty cycle
def map_duty_cycle(x_pos):
    # Map x position range [0, 320] to duty cycle range [0, 100]
    #return int(546*(120-abs(x_pos-120))) #HQVGA
    return int(819*(80-abs(x_pos-80))) #QQVGA

while True:
    img = sensor.snapshot()  # Capture a new image
    tags = img.find_apriltags(families=tag_families)

    if len(tags) == 0:
        duty_cycle = 10   # set duty cycle close to zero
        # Detect AprilTag(s) in the image
        for tag in tags:  # defaults to TAG36H11 without "families".
            img.draw_rectangle(tag.rect(), color=(255, 0, 0))
            img.draw_cross(tag.cx(), tag.cy(), color=(0, 255, 0))

            # Extract tag information
            tag_id = tag.id()
            tag_center_x, tag_center_y = tag.cx(), tag.cy()

            # Map tag position to duty cycle
            duty_cycle = map_duty_cycle(tag_center_x)

            # Update PWM duty cycle

            # Delay time

Hi, the power LED on the right side of the board maps the LED components to the following:

GREEN - Power Good - It has VIN or USB
RED - Battery is charging
BLUE - VIN is supplied and being drawn from.

When you say it’s running from a 5V battery, you mean you are supplying that to VIN? If so, the LED should be just blue/green.

If you are supplying 5V to the LIPO battery connector, that’s definitely damaging the device. The power LED should not turn red(charging)/purple(VIN+Charging) unless a battery is attached.

Thank you for your reply.

Yes, I am supplying 5V to VIN. In one of the photos below, the RT1062 is powered by the battery source and its power LED is blue but the blue LED in the breadboard not was not on, indicating that the camera is not detecting my AprilTag (which I was holding in front of it, at a distance it should clearly be visible from). In the minute or so before I took the photo, the RT1062’s power LED and breadboard LED were both blue, indicating that the AprilTag was identified.

In the other photo, I have the RT1062 running while connected to the IDE. The blue LED on the breadboard always lights up when the AprilTag is held in front of the camera. It doesn’t cease to work after 30-60 secs.

Mmm, 9V Batteries as the one you are using aren’t the best at handling a large current draw. The system pulls about 160mA while active. The voltage may be sagging while running.

If you attach a multimeter to the battery it’s probably putting out less than what you think and the voltage most likely falls too low causing the system to crash.

I’d suggest a lipo battery which are able to provide a larger amount of current without voltage sagging.

The behavior you are talking about is consistent with the behavior of these types of batteries when you draw current at large quantities from them for a long time.