Maker Pi RP2040 Installation & Validation

Show video

>> Hello! Welcome to the baqwas channel for self-paced tutorials on Internet of Things. This video demonstrates the installation and testing of the Maker Pi RP2040 robotics controller board from Cytron. >> The Objectives of this video are to: Illustrate key setup requirements for Maker Pi RP2040 robot controller board. There is a sibling board that has a surface mounted Raspberry Pi Pico whereas the current robotics controller board has only the RP2040 chip Run demonstrations without any programming since the following examples are pre-installed on the board: Play a tune during start-up Display a lighting sequence with GPIO status LEDs Run color fading with a single RGB LED that conforms to WS2812B neo-pixel standard Run DC & servo motors >> The post-fix numeral on RP2040 comes from the following nomenclature convention. Why is the chip called RP2040? 0. The initials RP is derived from Raspberry Pi 1. Number of processor cores is 2 2. Loosely which type of processor (M0+) is expressed as 0 3. The next digit is an evaluation of floor(log2(ram / 16k)) with the result equal to 4 4. The final digit is an evaluation of floor(log2(nonvolatile / 16k)) with result equal to 0. If there is no onboard nonvolatile storage then the value is 0 also. >> The key features of the RP2040 chip are: Direct Memory Access (DMA) controller Interpolator and integer divider peripherals 30 General Purpose Input/Output (GPIO) pins, 4 for analog (ADC) input use Peripherals: 16 Pulse Width Modulation (PWM) channels 2 Serial Peripheral Interface (SPI) controllers 2 Inter-Integrated Circuit (I2C or I2C) controllers 8 Programmable Input/Output (PIO) state machines 2 on-chip Phase Lock Loop (PLL) to generate USB and core clocks USB 1.1 controller and physical layer (PHY), with host and device support

>> The RP2040 chip has the following features: Core: Dual Cortex M-0+ processors, 133 MHz SRAM: 264 kB in 6 banks GPIO: 30 pins, 4 for analog (ADC) input use ADC: 4 with internal temperature sensor, 12-bit USB: 1.1 Host/Device PIO: extended peripheral support SPI Flash: 6 dedicated Dedicated hardware for commonly used peripherals >> The robotics controller board has the following key features: The microcontroller is the Raspberry Pi RP2040 dual-core Cortex M0+ at 133MHz with 264 kiloB RAM and 2MB (Q-SQP) flash memory The controller for robotics interfaces with 4 servo and 2 DC motors with individual quick test buttons (forward & reverse) for each DC motor interface There is a dual-channel H-bridge to control 2 DC motors or 1 stepper motor There are separate on-board switches for Power and Reset The shield obtains its power needs from the host microcomputer There is a dedicated power switch that controls the supply from any of the three power inputs There is a piezo buzzer with a mute switch at GP22 There are two push buttons for GP20 & GP21 pins There are two WS2812B RGB LEDs connected to GP18 There are seven ports for Grove component or sensor connections Power can be selected automatically from USB, LiPo or Vin terminal The pre-loaded programming language is CircuitPython >> There are seven Grove ports on the board. Each port is paired with two GPIO pins. All ports support Pulse Width Modulation, PWM, to control the effective power through the respective GPIO pins. All Pico Analog pins are supported. The other interfaces are: Serial Peripheral Interface, SPI, on most ports Inter-Integrated Circuit, I2C, on all ports but not on GP28 Universal Asynchronous Receive and Transmit, UART, on three ports >> The pin assignments and corresponding mnemonics are shown in the table for reference purposes. Please that some interfaces are not supported on some pins. PWM reduces the average power delivered by an electrical signal. This technique is very effective for controlling motors or other robotics devices where the switching frequency does not affect the load. SPI is a short-distance communication protocol that is faster than I2C or UART. I2C uses synchronous, multi-master, multi-slave, packet switched, single-ended serial communication. >> Serial Peripheral Interface, SPI, is a popular standard owing to some flexibility in the deployment of the data size and the underlying software library. The interface requires four logic signals: Chip Select Serial Clock Master In Slave Out Master Out Slave In A single master can control multiple slave devices. The data transmission is full-duplex resulting in higher throughput than the other interfaces on the board. Furthermore, the software requirements are simple. >> I2C uses only two bidirectional open collector or open drain lines: Serial Data Line (SDA) and Serial Clock Line (SCL) Both lines have pull-up resistors. The bus has two roles for nodes: Master Slave The bus is a multi-master bus with the potential for more than one master. All transactions begin with a START signal and end with a STOP signal. Owing to shared bus design, a fault in any one device may halt entire bus >> The RGB LED conforms to WS2812B addressable standard. Some vendors refer to the RGB LED as NeoPixel. The part consists of an integrated circuit for control and three discrete LEDs, one for each primary RGB color, in the same package. These components are encased with four exposed terminals for the connections that may be daisy chained. The RGB LED is driven by GP18 pin.

>> The Programmable Buttons are accessible from user programs. There are two buttons. One button can be accessed with GP20 pin and the the other button with GP21 pin. >> The buzzer is accessed with GP22 pin It can generate beeps and tones The tones can be controlled by specifying: Frequency Duration There is a switch to mute the buzzer >> The status LEDs display the state of the corresponding GPIO pins assigned to Grove Ports. While Grove ports have two GPIO pins assigned, the status of each pin can be individually displayed. The LED is ON (i.e. LED is lit) when the corresponding GPIO pin state is HIGH. This feature is very useful in determining pin activity when programs are running without recourse to additional components or extraneous ad-hoc code. >> There are four servo motor ports adjacent to the DC motor terminals. There are three pins for each port. Typically, the three pins are: Orange for PWM signal Red for positive direct current, and Brown or black for Ground The four PWM signal pins, one for each port, are GP12, GP13, GP14 & GP15 The PWM signal determines the rotation angle of the servo motor. This angle can vary from 0 to 180 degrees for the popular and more typical hobby servo motors depending on the PWM signal value. Of course, there are some servo motors than provide full 360 degrees rotation. >> There are two data signals for each DC motor. The two data signals correspond to the two directions of movement for each motor – forward or backward. There are two DC motors and therefore there are four pins for the data signals. The first motor uses the pins GP8 and GP9. The second motor uses the pins GP10 and GP11. Swapping the motor connection wires will reverse the motor rotation direction. The motor status LEDs indicate the status of the respective signal pins. >> The DC motor test buttons provide a simple way to check the operations of the motors. The motor will run at full speed when the corresponding button is pressed. There are two buttons for each motor – one button for the forward rotation and the other button for the backward rotation. The polarity of the motor’s connecting wires sets the rotation direction for a given connection. The buttons are marked as M1A and M1B for the first motor and M2A and M2B for the second motor.

>> The status LEDs display the state of the corresponding GPIO pins assigned for DC motor terminal opertions. The LED is ON (i.e. LED is lit) when the corresponding GPIO pin state is HIGH. These LEDs are very useful in determining pin signal values at run time. There are four LEDs for this purpose – 2 motors with 2 terminals each. >> Press and hold this button during the boot process to enter the bootloader mode. This method may be used to load firmware either from the default files or from one’s own custom platform variation. >> The Debug Port as the name implies is intended for low level debugging of the board. There are two key requirements for debugging the board: An auxiliary Pico will serve as the board-in-the-middle between the host desktop/notebook and the robotics controller board. The basic connections for this purpose are shown in the following slide. The picoprobe utility must be installed on the host computer. The OpenOCD On-Chip Debugging software may be useful for this purpose too. >> This slide illustrates the wiring connections for the board-in-the-middle method to debug the robotics controller board. The method requires an auxiliary Pico board to act as the board-in-the-middle between the host desktop/notebook computer and the robotics controller board. >> The Reset Button as the name implies sends a reset signal to the RP2040 chip. >> There are three power options for the board: Micro USB from the host LiPo battery VIN Only one power source is needed for the board and motors. All three options are controlled by a common On/Off switch. Please note that regulated VIN is recommended if at all available. For introductory learning purposes and the limited applications of the board, running the motors from the same power source as the board may be expedient. However, for longer term and more practical applications, it is strongly recommended that a separate power source be used for the motors with corresponding relay arrangements that are readily available even for these small form factor boards.

>> The micro USB connects the board to the host computer that uploads programs and firmware to the robotics controller board. Development tasks are performed on the host computer and then ensuing code is transferred to the robotics controller board through this port. The USB port is compliant with USB 1.1 standards. >> The board can optionally be powered using a LiPo battery. This mode is useful to operate the board in an autonomous mode when untethered from any host computer. >> The Vin terminal supports input voltage that ranges from 3.6 to 6 Volts DC. It connects to the regulator input. >> The On/Off switch controls power to the board. All three power sources: Micro USB LiPo Vin are controlled by this single switch. Of course, only one power source is needed by the board. >> The Power LED displays the input power status. It is OFF when no power is being used by the board even if one of the three power source is connected. When the power is turned on to the board with the On/Off switch in the On position then the LED is lit green.

>> The default firmware will perform the following demonstrations during boot-up: Play a melody Flash blue LEDs sequentially Fade colors on RGB LEDs Toggle GPIO status LEDs using GP20 & GP21 programmable buttons Press one of the four DC terminal buttons to obtain the data signal status >> This demonstration uses the piezo buzzer pin, GP22, to play a sequence of notes for a specific duration for each note. It is also possible to generate a tone at a specified frequency with the buzzer. >> This demonstration flashes the blue LED status lights sequentially. THE GPIO pins assigned to the Grove ports are matched to the LEDs as enumerated on the slide. Each Grove port has two assigned GPIO pins and there is an overlap in the assignments for two ports. In other words, there are seven Grove ports but thirteen status LEDs. >> The demonstration to fade colors on the two RGB LEDs uses pins GP20 and GP21. The states for the color fade is listed on the slide. Of course, many other variations for color fade can be easily accomplished by tweaking the RGB values, the increment or decrement and the interval.

>> The demonstration of the programmable buttons, GP20 and GP21, have the following sequence: For GP20: Turn on all blue LEDs Run all attached DC motors forward and backward at 50% stopped Rotate all attached servo motors to 0 degrees position For GP21: Turn off all blue LEDs Stop all attached DC motors Rotate all attached servo motors to 180 degrees position >> There are four buttons to perform tests on the DC motors. There are two buttons for each of the two DC motors. M1A turns the 1st motor in one direction M1B turns the 1st motor in the reverse direction M2A turns the 2nd motor in one direction M2B turns the 2nd motor in the reverse direction >> The Servo motor tests rotate the motors to start and end positions. The duty cycle is expressed as 16-bit integer value. The maximum value of the duty cycle, i.e. 100%, is applied when the value is the highest number possible for the 16-bit integer word. The duty cycle is 50% when one-half of this value is specified. >> There four different environments for development on the robotics controller board: CircuitPython MicroPython C/C++ Arduino Pico Core >> CircuitPython is a fork of MicroPython. It supports the Python core Application Programming Interface modules. The current release is 7.0.0-alpha.5. It is marked as alpha which means that one should use it with caution because: Not all planned features have been implemented Some existing features may not be available in the release candidate version Undocumented experiences are inevitable with the alpha version of any software >> MicroPython is a lean implementation of Python 3. It has a full compiler and run-time It is optimized to run on micro-controllers There are supplementary modules for low-level hardware access. It is the official Python-like environment for Raspberry Pi Pico development. >> C/C++ is supported too! There is an official, that is from Raspberry Pi Foundation, installation script for the Software Development Kit and the Integrated Development Environment. The other Integrated Development Environments include Eclipse and Clion. The Arduino Pico Core environment is gaining momentum >> This tutorial was a very simple introduction to the Cytron Maker Pi RP2040 robotics controller board. Only the built-in examples were demonstration including but not limited to: Buzzer Color Fade Status LEDs Motor tests

>> This presentation was prepared with assistance on special effects from: sufy isma at Gmail The documentation at Raspberry Pi and Cytron Technologies provided quickstart assistance Of course, none of this would have been possible without the Free Open Source Software from: Fritzing for assembly diagrams and schematics Inkscape for artwork preparation Libreoffice for documentation OBS Studio for recordings Kdenlive for non-linear editing and, of course, Ubuntu for the platform services The music is from the YouTube Audio library. It is called The Bucket List by Quincas Moreira A very big thank you to everyone! >> That’s All Folks! Thanks for taking the time to view this presentation Would love to hear from you with your feedback You are always welcome to be critical in any which way you can Until next time, bye for now!

2021-08-02

Show video