Posts

Showing posts from February, 2023

RC522 RFID Reader

Image
 Wiring and example https://microcontrollerslab.com/raspberry-pi-pico-rfid-rc522-micropython/ https://github.com/danjperron/micropython-mfrc522/blob/master/mfrc522.py 13.56 MHz RC522 RFID Reader Module Raspberry Pi Pico VCC 3.3V RST GP0 GND GND IRQ Not connected MISO GP4 MOSI GP3 SCK GP2 SDA GP1 from mfrc522 import MFRC522 import utime reader = MFRC522 ( spi_id = 0 , sck = 2 , miso = 4 , mosi = 3 , cs = 1 , rst = 0 ) print ( "Bring TAG closer..." ) print ( "" ) while True : reader . init ( ) ( stat , tag_type ) = reader . request ( reader . REQIDL ) if stat == reader . OK : ( stat , uid ) = reader . SelectTagSN ( ) if stat == reader . OK : card = int . from_bytes ( bytes ( uid ) , "little" , False ) print ( "CARD ID: " + str ( card ) ) utime . sleep_ms ( 500 )

Pico W

Image
  Datasheet -  https://datasheets.raspberrypi.com/picow/pico-w-datasheet.pdf Pin Out

Build Micropython firmware for Pico W

sudo apt update sudo apt install cmake make gcc ubertooth-firmware-source python3 git cd ~ git clone https://github.com/micropython/micropython cd ~/micropython git submodule update --init --recursive cd ~/micropython/mpy-cross make cd ~/micropython/ports/rp2 make submodules make clean make make BOARD=PICO_W submodules make BOARD=PICO_W clean make BOARD=PICO_W ls ~/micropython/ports/rp2/build-PICO_W/ |grep firmware.uf2

Build Micropython with Pimoroni libraries for Pico - doesn't work

  https://github.com/virgesmith/pimoroni-pico/blob/main/micropython-build.md micropython build [reverse-engineered from the pimoroni-pico  github workflow ] Paths may need adjusting depending on your layout. Below assumes  micropython  and  pimoroni-pico  share an immediate parent directory. get the micropython source and initialise the submodules git clone git@github.com:micropython/micropython cd micropython/ git submodule update --init cd lib/pico-sdk/ git submodule update --init cd ../.. build the bytecode cross-compiler cd mpy-cross/ make cd .. build custom micropython for the target USER_C_MODULES  points to the custom modules in pimoroni-pico. Code below uses  PICO  (the standard pico 2040 board), other options are (replace as necessary): PIMORONI_TINY2040 PIMORONI_PICOLIPO_4MB PIMORONI_PICOLIPO_16MB cd ports/rp2/ cmake -S . -B build-PICO -DPICO_BUILD_DOCS=0 -DUSER_C_MODULES=../../../pimoroni-pico/micropython/modules/micropython...