Posts

Showing posts from June, 2022

Crude low frequency counters with Raspberry Pi Pico

Image
Crude low frequency counter Used two state machines to generate two square waves as signal sources. Frequency counter measured these two frequencies. Frequency counter input       Pico pin 20 (GPIO-15) 40 Hz sq.wave signal source on      Pico pin 21 (GPIO-16) 25 kHz sq.wave signal source on    Pico pin 22 (GPIO-17) 25 kHz was maximum frequency that could be measured. With 25 kHz input, reading varied from 25000 Hz to 25004 Hz Number of interrupts   in one second  were counted to get frequency. MicroPython code: ##################### # Filename CrudeFc1.py import time from machine import Pin import  rp2 # global variable H2L = 0 # Interrupt handler (ISR) def h2l( void ):     global H2L     H2L = H2L + 1           def frequency():     global H2L     fin.irq ( handler = None ) # Int. disabled     H2L = 0     fin.irq ( handler = h2l, trigger=Pin.IRQ_FALLING ) #Int. enabled     time.sleep(1)  # gate time of ONE SECOND     fin.irq ( handler = None ) # Int. disabled     return(H2L)       ###

Raspberry Pi Pico basic health check

Image
Health check of newly arrived Raspberry Pi Pico  Pico micro-controller board arrived a few days ago. Cost at doorstep was Rs.449/- ( May 2022). It came with soldered header pins and USB cable. A few codes were tried on it as basic health check of the newly arrived board.  Checking was carried out on a Raspberry Pi 4 B ( 8 GB RAM ) PC. Codes used in testing were taken from examples of different sites and discussion groups. I am new to Python! File rp2-pico-latest.uf2 was downloaded on Desktop. $ cd Desktop  ~/Desktop $ wget -c https://micropython.org/download/rp2-pico/rp2-pico-latest.uf2                Pico was wired up on a small breadboard and was connected with Raspberry Pi PC with USB cable.  A push to make switch was added between RUN and GND . Thonny Python IDE was started on Raspberry PI. Thonny was switched to regular mode (top right corner). Thonny version number (right bottom corner, Python 3.9.2 in my PC) was clicked to select interpreter. MicroPython(Raspb