Accelerometer wake-up with FiPy/Pytrack



  • I'm having an issue with waking my FiPy/Pytrack using the accelerometer. After it goes to sleep, when I move the board, it looks like it wakes up, but the LED just starts flickering green and I can't connect to the board anymore. I have to go through a safe-boot to be able to access the board again.

    I've reduced the code to this:

    from pytrack import Pytrack
    from LIS2HH12 import LIS2HH12
    import pycom
    
    py = Pytrack()
    
    pycom.heartbeat(False)
    
    py.setup_int_pin_wake_up(False)
    py.setup_int_wake_up(True, True)
    
    acc = LIS2HH12()
    acc.enable_activity_interrupt(2000, 200)
    
    py.setup_sleep(60)
    py.go_to_sleep()
    

    What am I doing wrong?



  • @peterv Hmmmm!!!
    Try connecting directly to a decent power supply.
    I suspect the FiPy needs more power than can be supplied from the USB port on some PCs.
    Others have been able to rectify strange behaviour by using an external power supply. I recall seeing a note about this somewhere.



  • Connected with a USB cable to the computer.



  • @peterv How are you powering the board/module?
    I assume you are using a seperate power supply capable of a reasonable level of current?



  • Yeah, all firmware and library are latest. Even with the sleep I get the flickering green LED. Starting to wonder if I have a bad board.



  • Are the firmware of both is updated? Also you may look if you have the last Pycom Libraries.

    Assuming that you don't have anything else on boot.py than the UART and main program. The code is correct except that you are not allowing the board to keep awake and as soon as it wakes up send it directly to sleep.

    Try this:

    from pytrack import Pytrack
    from LIS2HH12 import LIS2HH12
    import pycom
    import time
    
    py = Pytrack()
    
    pycom.heartbeat(False)
    
    if py.get_wakeup_reason() is 1: # WAKE_REASON_ACCELEROMETER = 1
        time.sleep(2) #Two seconds of delay
    
    py.setup_int_pin_wake_up(False)
    py.setup_int_wake_up(True, True)
    
    acc = LIS2HH12()
    acc.enable_activity_interrupt(2000, 200)
    
    py.setup_sleep(60)
    py.go_to_sleep()```

Log in to reply
 

Pycom on Twitter