Pi: Pi Pico via a Pi uart (156.html)

Keywords: Buffer, DIP, GitHub, Pi, Pi Pico, Python, Raspberry, SDK, SN74AHC541N, Socketed, Software, Thonny, Uart, MagPi, 541

Introduction

This shows how to use a Pi Pico being controlled by a Uart on a Raspberry Pi (not by using a USB on the Pi). A main example and a tutorial to do it are included in Source 01. But a beginner should begin with Source 04 which explains SDK in detail. These materials are stored in the GitHub Software Repository. If you are new to GitHub, learn about it at Source 06 first. This is not a simple project. Be prepared to devote many hours to this learning experience. The first step will be to join GitHub.

If the Pi Pico will be connected to and controlled directly by the Raspberry Pi, the uart on the Pi is a better interface than the USB port.

If you haven't yet bought a Pi Pico, order one, then learn about GitHub and the Pico SDK while you are waiting for it to arrive. You should also buy a breadboard, some male rails to solder to the Pi Pico, an electronics breadboard (with a pi GPIO interface) and a USB cable to connect to the Pi for early learning. The cost will be about US$30.00 Order these materials now before you really need them!

Pi Pico

(To enlarge .....Click it)
thumb: PiPico.jpg
PiPico.jpg

(To enlarge .....Click it)
thumb: PiPicoPinOuts.jpg
Pi Pico PinOuts


GitHub

If you are new to GetHub, begin with Source 06- Hello World and GitHub.

Pico SDK (Software Development Kit)

This Software Development Kit (SDK) (Source 03) resides at the GitHub Repository from which it can be downloaded. Source 02 describes how to download and use the SDK. Source 01 explains how to program the pico when it is connected to the UART of a Raspberry Pi. Source 04 is documentation about the SDK for the Raspberry Pi Pico including an introduction and many examples. An index to the examples is at Source 05. One of the examples explores the uart. You should begin with Source 04. Do not go to source 04 until you know how to use GitHub. Then begin learning about the Python programming language. Python and its Raspberry "brother" named Thonny are easier to learn than C/C++.

Buffer for the Pi Pico

The Pi Pico is very sophisticated but it does not provide much power. The total current that can be supplied via its GPIO pins is very limited (less than 50 mA total for all 23 of the possible GPIO output pins). That would permit each output pin only 2 mA, which is not enough to light up a LED very brightly. Any one GPIO pin can readily supply up to 8 mA, but absolutely no more than 16 mA. Drain more than 31 mA from a single Pi Pico GPIO pin and you will probably destroy the internal electronics driving that pin. Therefore, a buffer is needed. The SN74AHC541N tri-state octal buffer and the tri-state octal buffer SN74HC541N also exists (each costs under US$1.00 from Mouser in 2022).

A good buffer is the SN74AHC541N (Source 09) which costs CAD$0.69 when bought from Mouser (Source 08) in quantities of 10 or more. This 541 is a High Speed AHC IC that is electronically compatible with the Pi Pico and the Raspberry Pi GPIO pins, both of which use HC logic. It is a state-of-the-art (as of 2015 and even in 2021) non-inverting HC octal Buffers/Drivers gate with 3 state outputs. Its main specifications are shown below. Note that this buffer can provide up to 20 mA from each of its pins. This means that each of its 8 output pins can light a LED by driving it through 330 ohms with a Vcc of 3v3. (Probably 500 ohms would be safer). This is roughly the same output spec as for the Raspberry Pi GPIO pins when outputting. This buffer can operate with a supply voltage (Vcc) from 5v0 to 3v3 or even lower. This is an excellent HC buffer IC gate.

(To enlarge .....Click it)
thumb: SN74AHC541N.jpg
SN74AHC541N Specifications


(To enlarge .....Click it)
thumb: SN74AHC541N_img.jpg
SN74AHC541N image


(To enlarge .....Click it)
thumb: SN74AHC541N_Pins.jpg
octal gates


(To enlarge .....Click it)
thumb: SN74AHC541N_flow.jpg
SN74AHC541N logic flow



The 541N is an octal gate of DIP format (through-hole not surface mount), that can pass a signal across the gate (from any of the 8 input pins on one side to a nearby pin on the other side). Two of these could buffer up to 16 GPIO pins of the Pi Pico. If you mount these in sockets, a burnt-out buffer gate can easily be replaced, which is a cheap safety measure for the Pi Pico. BUFFERS IN SOCKETS ARE RECOMMENDED for the Pi Pico. Furthermore it is very, very fast and has Three-States. WOW !!!

There are more than 8 GPIO pins on one side but only 7 on the other side of the Pi Pico (if your circuitry uses all 3 available analog input pins.) These analog input pins are in high demand (because analog input logic is missing entirely from every model of Raspberry Pi). The lack of analog input on the Pi is maybe its worst deficiency (from an electronics interface point of view). The Arduino is less sophisticated than the Pi but the Arduino does provide analog input.

This means two socketed SN74AHC541N buffer ICs and some very simple wiring could safely drive 8 LEDs on each side of the Pi Pico. WOW Again !!!. Much more is said about the Pi Pico GPIO Gate Output problems in Source 10 by the Webmaster.

MagPi Magazine

Many Pi Pico projects are describled in Issue #103 of the MagPi magazine ( Source 11 ). Issue #103 (Source 12) will be about Home Automation with Raspberry Pi and Pico.

References

Books/Newspapers

Books/Newspapers 01: none

YouTube Videos

Source V01: na by on

Web Sources

Web Source S156:01: Raspberry Pi / pico-examples / pico-sdk / uart from aslampr07 on GitHub on 2021B Feb 22
Web Source S156:02: Getting started with pico RP2040 microcontroller manual by Raspberry Pi Association
Web Source S156:03: Pico SDK (Headers, libraries for programming the RP2040 GitHub Pico SDK
Web Source S156:04: Raspberry Pi Pico SDK (Software Development Kit) by Raspberry Pi (Trading) Ltd
Web Source S156:05: Index to Pico SDK Examples by Raspberry Pi (Trading) Ltd
Web Source S156:06: Hello World on GitHub by GitHub
Web Source S156:07: Raspberry Pi Pico BOARD Datasheet by Raspberry Pi Association
Web Source S156:08: Ti SN74AHC541N IC at Mouser Electronics
Web Source S156:09: Ti SN74AHC541N IC Data Sheet from ti (Texas Instruments)
Web Source S156:10: Pi: New Raspberry Pi Products c2021 by D@CC c2021
Web Source S156:11: Pi: MagPi # 103: Easy Pico Projects by Raspberry Pi 2021
Web Source S156:12: Pi: MagPi # 104: Home Automation . . . by Raspberry Pi 2021

WebMaster: Ye Old King Cole

Click here to return to ePC Articles by Old King Cole

Created 2021 B Feb 22
Updated 2021 D Apr 16
(c) ICH180R2 Corp

/156.html