Welcome to the Pycom forum Forum
    • \[\[global:header.categories\]\]
    • \[\[global:header.recent\]\]
    • \[\[global:header.tags\]\]
    • \[\[global:header.popular\]\]
    • Login

    Explore Pybytes | Official Documentation | Report a Firmware Bug/Issue | GitHub

    Error in the PyScan Pinout document

    Scheduled Pinned Locked Moved Expansion Board
    21 Posts 3 Posters 110 Views 3 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • G Offline
      gael cobert @robert-hh
      last edited by

      @robert-hh no it don't works :p
      i don't know what to do ...

      robert-hhR 1 Reply Last reply Reply Quote 0
      • robert-hhR Offline
        robert-hh @gael cobert
        last edited by

        @gael-cobert Just give it a break. The connector where you have P11 now, is labeled as camera connector. As long as the camera is not used, all pins should be available. So let's focus on that, but not today. I will try to use the pyscan for that test tomorrow. At the moment, I use a simple expansion board.

        G 1 Reply Last reply Reply Quote 0
        • G Offline
          gael cobert @robert-hh
          last edited by

          @robert-hh ok thank you so much for your help :) i learned a lot of things indeed. See you tomorrow.

          robert-hhR 1 Reply Last reply Reply Quote 0
          • robert-hhR Offline
            robert-hh @gael cobert
            last edited by

            @gael-cobert Could not give it a rest, so I made a shot. This setting worked, all on the camera connector:

            import epaper4in2
            from machine import Pin, SPI
            
            # SPIV on ESP32
            sck = "P9"
            miso = None
            mosi = "P10"
            dc = Pin("P3", Pin.OUT)
            cs = Pin("P19", Pin.OUT)
            rst = Pin("P11", Pin.OUT, value=1)
            busy = Pin("P15", Pin.IN)
            spi = SPI(0, baudrate=20000000, polarity=0, phase=0, pins=(sck, mosi, None))
            
            e = epaper4in2.EPD(spi, cs, dc, rst, busy)
            e.init()
            
            w = 400
            h = 300
            x = 0
            y = 0
            
            # --------------------
            
            # use a frame buffer
            # 400 * 300 / 8 = 15000 - thats a lot of pixels
            import framebuf
            buf = bytearray(w * h // 8)
            fb = framebuf.FrameBuffer(buf, w, h, framebuf.MONO_HLSB)
            black = 0
            white = 1
            fb.fill(white)
            print('print hello world')
            fb.fill(white)
            fb.text('Hello World',30,0,black)
            e.display_frame(buf)
            

            The only problem that I had was the USB of the pyscan. I never used it before, and so the driver needed am update. I skipped that and connected with telnet.

            G 2 Replies Last reply Reply Quote 0
            • G Offline
              gael cobert @robert-hh
              last edited by gael cobert

              @robert-hh said in Error in the PyScan Pinout document:

              sck = "P9"
              miso = None
              mosi = "P10"
              dc = Pin("P3", Pin.OUT)
              cs = Pin("P19", Pin.OUT)
              rst = Pin("P11", Pin.OUT, value=1)
              busy = Pin("P15", Pin.IN)
              spi = SPI(0, baudrate=20000000, polarity=0, phase=0, pins=(sck, mosi, None))

              did you try it with a piscan ? i changed my code with your example but not change ... i changed P8 to P11
              I changed other pin

              https://drive.google.com/file/d/12dhAIFz4ND_cvRy4eSzi3o79BKnx_9EB/view?usp=sharing

              robert-hhR 1 Reply Last reply Reply Quote 0
              • robert-hhR Offline
                robert-hh @gael cobert
                last edited by

                @gael-cobert Yes. I used Pyscan for that. The same 0.7 version that you have. with long male/male adapter pins.
                If that does not work, the problem may be somewhere else.

                G 1 Reply Last reply Reply Quote 0
                • G Offline
                  gael cobert @robert-hh
                  last edited by gael cobert

                  @robert-hh P11 is to the left of P13 ?

                  https://drive.google.com/file/d/12uRecBvZEub8N-LTEvIxTz0T2M0FdGH_/view?usp=sharing

                  can you give me a photo of your board ?

                  1 Reply Last reply Reply Quote 0
                  • G Offline
                    gael cobert @robert-hh
                    last edited by

                    @robert-hh said in Error in the PyScan Pinout document:

                    import epaper4in2
                    from machine import Pin, SPI

                    SPIV on ESP32

                    sck = "P9"
                    miso = None
                    mosi = "P10"
                    dc = Pin("P3", Pin.OUT)
                    cs = Pin("P19", Pin.OUT)
                    rst = Pin("P11", Pin.OUT, value=1)
                    busy = Pin("P15", Pin.IN)
                    spi = SPI(0, baudrate=20000000, polarity=0, phase=0, pins=(sck, mosi, None))

                    e = epaper4in2.EPD(spi, cs, dc, rst, busy)
                    e.init()

                    w = 400
                    h = 300
                    x = 0
                    y = 0

                    --------------------

                    use a frame buffer

                    400 * 300 / 8 = 15000 - thats a lot of pixels

                    import framebuf
                    buf = bytearray(w * h // 8)
                    fb = framebuf.FrameBuffer(buf, w, h, framebuf.MONO_HLSB)
                    black = 0
                    white = 1
                    fb.fill(white)
                    print('print hello world')
                    fb.fill(white)
                    fb.text('Hello World',30,0,black)
                    e.display_frame(buf)

                    it works !!!!!!!!

                    robert-hhR 1 Reply Last reply Reply Quote 0
                    • robert-hhR Offline
                      robert-hh @gael cobert
                      last edited by

                      @gael-cobert Wonderful. Although the display update times are pretty long. So it's more suited for signs.

                      G 1 Reply Last reply Reply Quote 0
                      • G Offline
                        gael cobert @robert-hh
                        last edited by gael cobert

                        @robert-hh yes do you know why it's so long ? ( around 3 sec )

                        i have another question, i am using atom IDE, i want to use the NFC scan, but sometimes it stop, if i click "run selected files"
                        if i transfer main.py file via FTP it don't seem to execute when the board start, it's a little bit strange

                        import epaper4in2
                        from machine import Pin, SPI
                        
                        # NFC
                        
                        from pyscan import Pyscan
                        from MFRC630 import MFRC630
                        from LIS2HH12 import LIS2HH12
                        from LTR329ALS01 import LTR329ALS01
                        import binascii
                        import time
                        import pycom
                        import _thread
                        
                        ttf_dir = 'ttf' 
                        # var NFC
                        # This is the default key for an unencrypted MiFare card
                        DEBUG = True  # change to True to see debug messages
                        
                        
                        VALID_CARDS = [[0x43, 0x95, 0xDD, 0xF8],
                                       [0x43, 0x95, 0xDD, 0xF9],
                                       [0x8C, 0x43, 0x00, 0x5C],
                                       [0x46, 0x5A, 0xEB, 0x7D, 0x8A, 0x08, 0x04]]
                        
                         
                        py = Pyscan()
                        nfc = MFRC630(py)
                        lt = LTR329ALS01(py)
                        li = LIS2HH12(py)
                        
                        RGB_BRIGHTNESS = 0x8
                        
                        RGB_RED = (RGB_BRIGHTNESS << 16)
                        RGB_GREEN = (RGB_BRIGHTNESS << 8)
                        RGB_BLUE = (RGB_BRIGHTNESS)
                        
                        counter = 0
                        
                        # SPIV on ESP32
                        sck = "P9"
                        miso = None
                        mosi = "P10"
                        dc = Pin("P3", Pin.OUT)
                        cs = Pin("P19", Pin.OUT)
                        rst = Pin("P11", Pin.OUT, value=1)
                        busy = Pin("P15", Pin.IN)
                        spi = SPI(0, baudrate=20000000, polarity=0, phase=0, pins=(sck, mosi, None))
                        
                        e = epaper4in2.EPD(spi, cs, dc, rst, busy)
                        e.init()
                        
                        w = 400
                        h = 300
                        x = 0
                        y = 0
                        
                        # --------------------
                        
                        # use a frame buffer
                        # 400 * 300 / 8 = 15000 - thats a lot of pixels
                        import framebuf
                        buf = bytearray(w * h // 8)
                        fb = framebuf.FrameBuffer(buf, w, h, framebuf.MONO_HLSB)
                        black = 0
                        white = 1
                        fb.fill(white)
                        print('print hello world')
                        fb.fill(white)
                        fb.text('bienvenue sur le système secureangel',30,0,black)
                        e.display_frame(buf)
                        
                        
                        
                        
                        
                        
                        # Make sure heartbeat is disabled before setting RGB LED
                        pycom.heartbeat(False)
                        
                        # Initialise the MFRC630 with some settings
                        nfc.mfrc630_cmd_init()
                        
                        
                        def check_uid(uid, len):
                            return VALID_CARDS.count(uid[:len])
                        
                        def print_debug(msg):
                            if DEBUG:
                                print(msg)
                        
                        def send_sensor_data(name, timeout):
                            while(True):
                                print(lt.light())
                                print(li.acceleration())
                                time.sleep(timeout)
                        
                        def discovery_loop(nfc, id):
                            while True:
                                # Send REQA for ISO14443A card type
                                print_debug('Sending REQA for ISO14443A card type...')
                                atqa = nfc.mfrc630_iso14443a_WUPA_REQA(nfc.MFRC630_ISO14443_CMD_REQA)
                                print_debug('Response: {}'.format(atqa))
                                if (atqa != 0):
                                    # A card has been detected, read UID
                                    print_debug('A card has been detected, read UID...')
                                    uid = bytearray(10)
                                    uid_len = nfc.mfrc630_iso14443a_select(uid)
                                    print_debug('UID has length: {}'.format(uid_len))
                                    if (uid_len > 0):
                                        s =  binascii.hexlify(uid[:uid_len],' ').upper()
                                        card_id = ("{:02X}"*len(s)).format(*s)
                                        print_debug('card_id : -> {} <-'.format(card_id))
                                        tst = s.decode("utf-8") 
                                        print_debug('tst : {} <-'.format(tst))
                        
                                         
                                        if(tst == "8C 43 00 5C") :
                                            print_debug('hello gael')
                                            fb.fill(white)
                                            fb.text('Hello Gaël ! :)',30,80,black)
                                            e.display_frame(buf)
                                        
                                        print_debug('Checking if card with UID: [{:s}] is listed in VALID_CARDS...'.format(binascii.hexlify(uid[:uid_len],' ').upper()))
                                        if (check_uid(list(uid), uid_len)) > 0:
                                            print_debug('Card is listed, turn LED green')
                                            pycom.rgbled(RGB_GREEN)
                                        else:
                                            print_debug('Card is not listed, turn LED red')
                                            pycom.rgbled(RGB_RED)
                                            fb.fill(white)
                                            fb.text('carte introuvable :p',30,0,black)
                                            e.display_frame(buf)
                                            
                                else:
                                    # No card detected
                                    #print_debug('Did not detect any card...')
                                    pycom.rgbled(RGB_BLUE)
                                nfc.mfrc630_cmd_reset()
                                time.sleep(.5)
                                nfc.mfrc630_cmd_init()
                        
                        # This is the start of our main execution... start the thread
                        _thread.start_new_thread(discovery_loop, (nfc, 0))
                        _thread.start_new_thread(send_sensor_data, ('Thread 2', 10))
                        
                        robert-hhR 1 Reply Last reply Reply Quote 0
                        • robert-hhR Offline
                          robert-hh @gael cobert
                          last edited by

                          @gael-cobert I cannot tell anything about the Pycom IDE with either Atom or VSCode. The seem to fail constantly.
                          I prefer to use primitive tools, like picocom | putty | beagle term for REPL, and plain ftp | filezilla or in the absence of wifi pyboard.py + mpr.py for file transfer.

                          1 Reply Last reply Reply Quote 0
                          • G Offline
                            Gijs
                            last edited by

                            @robert-hh You are correct, Im not sure yet how they messed it up, but it seems to be a mirrorring issue. From what I see, the connector is labeled from the top view, but the square pad is definitely connected to GND, instead of PWR_EN

                            I'll make sure it gets fixed, thanks!

                            1 Reply Last reply Reply Quote 0

                            Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                            Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                            With your input, this post could be even better 💗

                            Register Login
                            • 1
                            • 2
                            • 1 / 2
                            • First post
                              Last post

                            Pycom on Twitter

                            Pycom