Is there a difference on Powering Expansion Board & Sipy via USB or via JST ?



  • Good evening Everyone,

    I've recently bought a Sipy + Expansion Board (actually a pack of 5), in a view to create a very simple alarm for door check with Sigfox messsage sending
    I'm reading the status of GND connected to G28 in order to check if the circuit is closed (door closed) or opened (door opened) with a simple ILS + magnet.
    All is working like a charm when the board is powered through the USB socket, but does not work while only powered via the JST + Battery. The battery is self sufficiant, but everythings looks like the expansion board is no more capable to send the message to the Sipy.. even the Sipy is working fine...

    Here below my very simple code :

    from machine import Pin,idle
    import _thread

    Door1 = Pin('G28', mode=Pin.IN, pull=Pin.PULL_UP)

    def LoopDoor1(delay, id):
    while True:
    if Door1.value() == 0:
    print("Door1 Closed")
    import('Board_Library').LEDColor(import('Parameters').LED_Green, import('Parameters').Time_50ms)
    while Door1.value() == 0:
    idle()
    if Door1.value() == 1:
    print("Door1 Opened")
    import('Board_Library').LEDColor(import('Parameters').LED_Red, import('Parameters').Time_50ms)
    while Door1.value() == 1:
    idle()

    def FiveSecondLoop(delay, id):
    while True:
    #import('sys').stdout.write('.')
    import('time').sleep(5)
    import('Board_Library').LEDColor(import('Parameters').LED_Orange, import('Parameters').Time_5ms)

    _thread.start_new_thread(LoopDoor1, (1, 1))
    _thread.start_new_thread(FiveSecondLoop, (1, 2))

    print("Board Ready")

    <<<<<<<<<<

    When powered by USB: disconnecting the wire cause the LED to be RED for few seconds, reconnection cause it to be GREEN, while every 5 seconds, the Orange is blinking.
    When powered from JST + Battery : the Orange is blinking every 5 Seconds, but no RED/GREEN while disconnecting/reconnecting the wire...

    Did i missed something ? Did i do something wrong ??
    the intention of using the JST is to prevent somebody from disconnecting the mains...
    I can obviously find a way to have a permanent USB power.. but this is not the use of JST connector..

    Thanks all for your help
    Regards
    Patrick.
    PS : the code with Sigfox has been removed.. this is not the problem topic.



  • Hello All,
    Replying to myself :-).
    I've tested with Pin G22, (instead of G28 in my initial post).. and all works as a charm..
    ... let's turn it into an advantage.. i now know when the USB is powered (from the mains) or not... and can trigger another alarm with "Power has disappeared"..

    @Pycom : if you could release/share more details on each PIN Status/Usage (it may exist already, but did not find it myself). Thanks in advance for your help.


Log in to reply
 

Pycom on Twitter