Page 7
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 Note: Hello, welcome to the SunFounder Raspberry Pi & Arduino & ESP32 Enthusiasts Community on Facebook! Dive deeper into Raspberry Pi, Arduino, and ESP32 with fellow enthusiasts. Why Join? • Expert Support: Solve post-sale issues and technical challenges with help from our community and team.
Page 8
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 • There will be a language popup in the upper right corner. Click on the menu button to choose another language. • Select the language from the inverted triangle box, and then click Done.
Page 9
• Or check out the code at Euler Kit - GitHub Content Note: Hello, welcome to the SunFounder Raspberry Pi & Arduino & ESP32 Enthusiasts Community on Facebook! Dive deeper into Raspberry Pi, Arduino, and ESP32 with fellow enthusiasts. Why Join? •...
Page 10
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 CONTENTS...
CHAPTER INTRODUCTION TO RASPBERRY PI PICO The Raspberry Pi Pico is a microcontroller board based on the Raspberry Pi RP2040 microcontroller chip. With Raspberry Pi Pico, you can learn MicroPython programming, take your first step into physical computing, or build a hardware project.
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 1.1 Features • 21 mm × 51 mm form factor • RP2040 microcontroller chip designed by Raspberry Pi in the UK • Dual-core Arm Cortex-M0+ processor, flexible clock running up to 133 MHz •...
Page 13
Raspberry Pi Pico design files • Raspberry Pi Pico STEP file Note: Hello, welcome to the SunFounder Raspberry Pi & Arduino & ESP32 Enthusiasts Community on Facebook! Dive deeper into Raspberry Pi, Arduino, and ESP32 with fellow enthusiasts. Why Join? •...
Page 14
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 Chapter 1. Introduction to Raspberry Pi Pico...
You are welcome to send us the name of the missing or incorrect component if you find one. Here is the email: cs@sunfounder.com. Basic Note: Hello, welcome to the SunFounder Raspberry Pi & Arduino & ESP32 Enthusiasts Community on Facebook! Dive deeper into Raspberry Pi, Arduino, and ESP32 with fellow enthusiasts. Why Join?
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 • Learn & Share: Exchange tips and tutorials to enhance your skills. • Exclusive Previews: Get early access to new product announcements and sneak peeks. • Special Discounts: Enjoy exclusive discounts on our newest products.
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 Note: Hello, welcome to the SunFounder Raspberry Pi & Arduino & ESP32 Enthusiasts Community on Facebook! Dive deeper into Raspberry Pi, Arduino, and ESP32 with fellow enthusiasts. Why Join? • Expert Support: Solve post-sale issues and technical challenges with help from our community and team.
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 • Special Discounts: Enjoy exclusive discounts on our newest products. • Festive Promotions and Giveaways: Take part in giveaways and holiday promotions. Ready to explore and create with us? Click [] and join today! 2.3 Resistor...
Page 19
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 As shown in the card, each color stands for a number. Black Brown Orange Yellow Green Blue Violet Grey White Gold Silver 0.01 The 4- and 5-band resistors are frequently used, on which there are 4 and 5 chromatic bands.
Page 20
You can learn more about resistor from Wiki: Resistor - Wikipedia. Note: Hello, welcome to the SunFounder Raspberry Pi & Arduino & ESP32 Enthusiasts Community on Facebook! Dive deeper into Raspberry Pi, Arduino, and ESP32 with fellow enthusiasts. Why Join? •...
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 2.4 Transistor Transistor is a semiconductor device that controls current by current. It functions by amplifying weak signal to larger amplitude signal and is also used for non-contact switch. A transistor is a three-layer structure composed of P-type and N-type semiconductors. They form the three regions internally.
Page 22
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 When a High level signal goes through an NPN transistor, it is energized. But a PNP one needs a Low level signal to manage it. Both types of transistor are frequently used for contactless switches, just like in this experiment.
Page 23
• (For Piper Make User) 2.13 Reaction Game Note: Hello, welcome to the SunFounder Raspberry Pi & Arduino & ESP32 Enthusiasts Community on Facebook! Dive deeper into Raspberry Pi, Arduino, and ESP32 with fellow enthusiasts. Why Join? • Expert Support: Solve post-sale issues and technical challenges with help from our community and team.
104=10x10^4pF Unit Conversion 1F=10^3mF=10^6uF=10^9nF=10^12pF Note: Hello, welcome to the SunFounder Raspberry Pi & Arduino & ESP32 Enthusiasts Community on Facebook! Dive deeper into Raspberry Pi, Arduino, and ESP32 with fellow enthusiasts. Why Join? • Expert Support: Solve post-sale issues and technical challenges with help from our community and team.
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 2.6 Diode A diode is an electronic component with two electrodes. It allows current to flow in only one direction, which is often called the “Rectifying” function. Thus, a diode can be thought of as an electronic version of a check valve.
• Diode - Wikipedia Chip Note: Hello, welcome to the SunFounder Raspberry Pi & Arduino & ESP32 Enthusiasts Community on Facebook! Dive deeper into Raspberry Pi, Arduino, and ESP32 with fellow enthusiasts. Why Join? • Expert Support: Solve post-sale issues and technical challenges with help from our community and team.
Page 27
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 • The memory register outputs a Bus with a parallel 8-bit and in three states. • When OE is enabled (low level), the data in memory register is output to the bus(Q0 ~ Q7).
• (For Arduino User) 5.4 - 8x8 Pixel Graphics Note: Hello, welcome to the SunFounder Raspberry Pi & Arduino & ESP32 Enthusiasts Community on Facebook! Dive deeper into Raspberry Pi, Arduino, and ESP32 with fellow enthusiasts. Why Join? • Expert Support: Solve post-sale issues and technical challenges with help from our community and team.
Page 29
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 L293D is a 4-channel motor driver integrated by chip with high voltage and high current. It’s designed to connect to standard DTL, TTL logic level, and drive inductive loads (such as relay coils, DC, Stepper Motors) and power switching transistors etc.
Page 30
(For Piper Make User) 2.12 Smart Fan Display Note: Hello, welcome to the SunFounder Raspberry Pi & Arduino & ESP32 Enthusiasts Community on Facebook! Dive deeper into Raspberry Pi, Arduino, and ESP32 with fellow enthusiasts. Chapter 2. What is Included in This Kit...
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 Why Join? • Expert Support: Solve post-sale issues and technical challenges with help from our community and team. • Learn & Share: Exchange tips and tutorials to enhance your skills. • Exclusive Previews: Get early access to new product announcements and sneak peeks.
Page 32
• (For Piper Make User) 2.13 Reaction Game Note: Hello, welcome to the SunFounder Raspberry Pi & Arduino & ESP32 Enthusiasts Community on Facebook! Dive deeper into Raspberry Pi, Arduino, and ESP32 with fellow enthusiasts. Why Join? • Expert Support: Solve post-sale issues and technical challenges with help from our community and team.
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 2.10 RGB LED RGB LEDs emit light in various colors. An RGB LED packages three LEDs of red, green, and blue into a transparent or semitransparent plastic shell. It can display various colors by changing the input voltage of the three pins and superimpose them, which, according to statistics, can create 16,777,216 different colors.
Page 34
(For Piper Make User) 2.4 Rainbow Light Note: Hello, welcome to the SunFounder Raspberry Pi & Arduino & ESP32 Enthusiasts Community on Facebook! Dive deeper into Raspberry Pi, Arduino, and ESP32 with fellow enthusiasts. Chapter 2. What is Included in This Kit...
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 Why Join? • Expert Support: Solve post-sale issues and technical challenges with help from our community and team. • Learn & Share: Exchange tips and tutorials to enhance your skills. • Exclusive Previews: Get early access to new product announcements and sneak peeks.
Page 36
• (For Piper Make User) 2.8 Light Intensity Display Note: Hello, welcome to the SunFounder Raspberry Pi & Arduino & ESP32 Enthusiasts Community on Facebook! Dive deeper into Raspberry Pi, Arduino, and ESP32 with fellow enthusiasts. Why Join? • Expert Support: Solve post-sale issues and technical challenges with help from our community and team.
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 2.12 7-segment Display A 7-segment display is an 8-shaped component which packages 7 LEDs. Each LED is called a segment - when ener- gized, one segment forms part of a numeral to be displayed.
Page 38
• (For Arduino User) 5.2 - Number Display Note: Hello, welcome to the SunFounder Raspberry Pi & Arduino & ESP32 Enthusiasts Community on Facebook! Dive deeper into Raspberry Pi, Arduino, and ESP32 with fellow enthusiasts. Why Join? • Expert Support: Solve post-sale issues and technical challenges with help from our community and team.
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 2.13 4-Digit 7-Segment Display 4-Digit 7-segment display consists of four 7- segment displays working together. The 4-digtal 7-segment display works independently. It uses the principle of human visual persistence to quickly display the characters of each 7-segment in a loop to form continuous strings.
Page 40
• (For Arduino User) 5.3 - Time Counter Note: Hello, welcome to the SunFounder Raspberry Pi & Arduino & ESP32 Enthusiasts Community on Facebook! Dive deeper into Raspberry Pi, Arduino, and ESP32 with fellow enthusiasts. Why Join? • Expert Support: Solve post-sale issues and technical challenges with help from our community and team.
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 2.14 LED Matrix Generally, LED dot matrix can be categorized into two types: common cathode (CC) and common anode (CA). They look much alike, but internally the difference lies. You can tell by test. A CA one is used in this kit. You can see 788BS labeled at the side.
Page 42
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 LED, and COL is cathode; it’s contrary for a CC one. One thing in common: for both types, pin 13, 3, 4, 10, 6, 11, 15, and 16 are all COL, when pin 9, 14, 8, 12, 1, 7, 2, and 5 are all ROW. If you want to turn on the first LED at the top left corner, for a CA LED dot matrix, just set pin 9 as High and pin 13 as Low, and for a CC one, set pin 13 as High and pin 9 as Low.
• (For Arduino User) 5.4 - 8x8 Pixel Graphics Note: Hello, welcome to the SunFounder Raspberry Pi & Arduino & ESP32 Enthusiasts Community on Facebook! Dive deeper into Raspberry Pi, Arduino, and ESP32 with fellow enthusiasts. Why Join? • Expert Support: Solve post-sale issues and technical challenges with help from our community and team.
Page 44
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 I2C Address The default address is basically 0x27, in a few cases it may be 0x3F. Taking the default address of 0x27 as an example, the device address can be modified by shorting the A0/A1/A2 pads;...
Page 45
• (For Arduino User) 3.4 - Liquid Crystal Display Note: Hello, welcome to the SunFounder Raspberry Pi & Arduino & ESP32 Enthusiasts Community on Facebook! Dive deeper into Raspberry Pi, Arduino, and ESP32 with fellow enthusiasts. Why Join? • Expert Support: Solve post-sale issues and technical challenges with help from our community and team.
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 2.16 WS2812 RGB 8 LEDs Strip The WS2812 RGB 8 LEDs Strip is composed of 8 RGB LEDs. Only one pin is required to control all the LEDs. Each RGB LED has a WS2812 chip, which can be controlled independently. It can realize 256-level brightness display and complete true color display of 16,777,216 colors.
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 Sound Note: Hello, welcome to the SunFounder Raspberry Pi & Arduino & ESP32 Enthusiasts Community on Facebook! Dive deeper into Raspberry Pi, Arduino, and ESP32 with fellow enthusiasts. Why Join? • Expert Support: Solve post-sale issues and technical challenges with help from our community and team.
Page 48
(For Piper Make User) 2.13 Reaction Game Actuators Note: Hello, welcome to the SunFounder Raspberry Pi & Arduino & ESP32 Enthusiasts Community on Facebook! Dive deeper into Raspberry Pi, Arduino, and ESP32 with fellow enthusiasts. Why Join? • Expert Support: Solve post-sale issues and technical challenges with help from our community and team.
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 Ready to explore and create with us? Click [] and join today! 2.18 DC Motor This is a 3V DC motor. When you give a high level and a low level to each of the 2 terminals, it will rotate.
Page 50
• (For Piper Make User) 2.12 Smart Fan Note: Hello, welcome to the SunFounder Raspberry Pi & Arduino & ESP32 Enthusiasts Community on Facebook! Dive deeper into Raspberry Pi, Arduino, and ESP32 with fellow enthusiasts. Why Join? • Expert Support: Solve post-sale issues and technical challenges with help from our community and team.
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 • Exclusive Previews: Get early access to new product announcements and sneak peeks. • Special Discounts: Enjoy exclusive discounts on our newest products. • Festive Promotions and Giveaways: Take part in giveaways and holiday promotions.
Page 52
• (For Piper Make User) 2.9 Lucky Cat Note: Hello, welcome to the SunFounder Raspberry Pi & Arduino & ESP32 Enthusiasts Community on Facebook! Dive deeper into Raspberry Pi, Arduino, and ESP32 with fellow enthusiasts. Why Join? • Expert Support: Solve post-sale issues and technical challenges with help from our community and team.
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 2.20 Centrifugal Pump The centrifugal pump converts rotational kinetic energy into hydrodynamic energy to transport fluid. The rotation energy comes from the electric motor. The fluid enters the pump impeller along or near the rotating shaft, is accelerated by the impeller, flows radially outward into the diffuser or volute chamber, and then flows out from there.
• (For Arduino User) 3.6 - Pumping Note: Hello, welcome to the SunFounder Raspberry Pi & Arduino & ESP32 Enthusiasts Community on Facebook! Dive deeper into Raspberry Pi, Arduino, and ESP32 with fellow enthusiasts. Why Join? • Expert Support: Solve post-sale issues and technical challenges with help from our community and team.
Page 55
• (For Arduino User) 2.16 - Control Another Circuit Note: Hello, welcome to the SunFounder Raspberry Pi & Arduino & ESP32 Enthusiasts Community on Facebook! Dive deeper into Raspberry Pi, Arduino, and ESP32 with fellow enthusiasts. Why Join? • Expert Support: Solve post-sale issues and technical challenges with help from our community and team.
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 • Festive Promotions and Giveaways: Take part in giveaways and holiday promotions. Ready to explore and create with us? Click [] and join today! 2.22 Power Supply Module A 3.3V and 5V breadboard power module with series diode and reverse polarity protection. The module can accept 6.5V to 12V input, and can generate 3.3V and +5V.
Page 57
(For Arduino User) 3.6 - Pumping Controller Note: Hello, welcome to the SunFounder Raspberry Pi & Arduino & ESP32 Enthusiasts Community on Facebook! Dive deeper into Raspberry Pi, Arduino, and ESP32 with fellow enthusiasts. Why Join? • Expert Support: Solve post-sale issues and technical challenges with help from our community and team.
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 2.23 Button Buttons are a common component used to control electronic devices. They are usually used as switches to connect or break circuits. Although buttons come in a variety of sizes and shapes, the one used here is a 6mm mini-button as shown in the following pictures.
Page 59
• (For Piper Make User) 2.13 Reaction Game Note: Hello, welcome to the SunFounder Raspberry Pi & Arduino & ESP32 Enthusiasts Community on Facebook! Dive deeper into Raspberry Pi, Arduino, and ESP32 with fellow enthusiasts. Why Join? • Expert Support: Solve post-sale issues and technical challenges with help from our community and team.
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 2.24 Micro Switch The construction of a micro switch is really simple. The main parts of the switch are: • 1.Plunger (Actuator) • 2.Cover • 3.Moving piece • 4.Support • 5.Case •...
Page 61
• (For Piper Make User) 2.3 Service Bell Note: Hello, welcome to the SunFounder Raspberry Pi & Arduino & ESP32 Enthusiasts Community on Facebook! Dive deeper into Raspberry Pi, Arduino, and ESP32 with fellow enthusiasts. Why Join? • Expert Support: Solve post-sale issues and technical challenges with help from our community and team.
(For Arduino User) 2.7 - Toggle Left and Right • (For Piper Make User) 2.5 Drum Kit Note: Hello, welcome to the SunFounder Raspberry Pi & Arduino & ESP32 Enthusiasts Community on Facebook! Chapter 2. What is Included in This Kit...
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 Dive deeper into Raspberry Pi, Arduino, and ESP32 with fellow enthusiasts. Why Join? • Expert Support: Solve post-sale issues and technical challenges with help from our community and team. • Learn & Share: Exchange tips and tutorials to enhance your skills.
Page 64
• (For Piper Make User) 2.7 Swing Servo Note: Hello, welcome to the SunFounder Raspberry Pi & Arduino & ESP32 Enthusiasts Community on Facebook! Dive deeper into Raspberry Pi, Arduino, and ESP32 with fellow enthusiasts. Why Join? • Expert Support: Solve post-sale issues and technical challenges with help from our community and team.
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 2.27 Infrared-Receiver 2.27.1 IR Receiver Module • S: Signal output • +VCC • -: GND An infrared-receiver is a component which receives infrared signals and can independently receive infrared rays and output signals compatible with TTL level.
Page 66
• (For Arduino User) 6.4 - IR Remote Control Note: Hello, welcome to the SunFounder Raspberry Pi & Arduino & ESP32 Enthusiasts Community on Facebook! Dive deeper into Raspberry Pi, Arduino, and ESP32 with fellow enthusiasts. Why Join? • Expert Support: Solve post-sale issues and technical challenges with help from our community and team.
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 2.28 Joystick The basic idea of a joystick is to translate the movement of a stick into electronic information that a computer can process. In order to communicate a full range of motion to the computer, a joystick needs to measure the stick’s position on two axes –...
Page 68
• (For Arduino User) 4.1 - Toggle the Joystick Note: Hello, welcome to the SunFounder Raspberry Pi & Arduino & ESP32 Enthusiasts Community on Facebook! Dive deeper into Raspberry Pi, Arduino, and ESP32 with fellow enthusiasts. Why Join? • Expert Support: Solve post-sale issues and technical challenges with help from our community and team.
• (For Arduino User) 4.2 - 4x4 Keypad Note: Hello, welcome to the SunFounder Raspberry Pi & Arduino & ESP32 Enthusiasts Community on Facebook! Dive deeper into Raspberry Pi, Arduino, and ESP32 with fellow enthusiasts. Why Join? • Expert Support: Solve post-sale issues and technical challenges with help from our community and team.
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 • Exclusive Previews: Get early access to new product announcements and sneak peeks. • Special Discounts: Enjoy exclusive discounts on our newest products. • Festive Promotions and Giveaways: Take part in giveaways and holiday promotions.
Page 71
• (For Arduino User) 4.3 - Electrode Keyboard Note: Hello, welcome to the SunFounder Raspberry Pi & Arduino & ESP32 Enthusiasts Community on Facebook! Dive deeper into Raspberry Pi, Arduino, and ESP32 with fellow enthusiasts. Why Join? • Expert Support: Solve post-sale issues and technical challenges with help from our community and team.
(For Arduino User) 6.5 - Radio Frequency Identification Sensor Note: Hello, welcome to the SunFounder Raspberry Pi & Arduino & ESP32 Enthusiasts Community on Facebook! Dive deeper into Raspberry Pi, Arduino, and ESP32 with fellow enthusiasts. Why Join? • Expert Support: Solve post-sale issues and technical challenges with help from our community and team.
• (For Piper Make User) 2.8 Light Intensity Display Note: Hello, welcome to the SunFounder Raspberry Pi & Arduino & ESP32 Enthusiasts Community on Facebook! Dive deeper into Raspberry Pi, Arduino, and ESP32 with fellow enthusiasts. Why Join? • Expert Support: Solve post-sale issues and technical challenges with help from our community and team.
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 • Exclusive Previews: Get early access to new product announcements and sneak peeks. • Special Discounts: Enjoy exclusive discounts on our newest products. • Festive Promotions and Giveaways: Take part in giveaways and holiday promotions.
Page 75
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 Thermistors are of two opposite fundamental types: • With NTC thermistors, resistance decreases as temperature rises usually due to an increase in conduction elec- trons bumped up by thermal agitation from valency band. An NTC is commonly used as a temperature sensor, or in series with a circuit as an inrush current limiter.
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 Note: Hello, welcome to the SunFounder Raspberry Pi & Arduino & ESP32 Enthusiasts Community on Facebook! Dive deeper into Raspberry Pi, Arduino, and ESP32 with fellow enthusiasts. Why Join? • Expert Support: Solve post-sale issues and technical challenges with help from our community and team.
Page 77
• (For Piper Make User) 2.10 Flowing LEDs Note: Hello, welcome to the SunFounder Raspberry Pi & Arduino & ESP32 Enthusiasts Community on Facebook! Dive deeper into Raspberry Pi, Arduino, and ESP32 with fellow enthusiasts. Why Join? • Expert Support: Solve post-sale issues and technical challenges with help from our community and team.
• (For Arduino User) 2.9 - Feel the Magnetism Note: Hello, welcome to the SunFounder Raspberry Pi & Arduino & ESP32 Enthusiasts Community on Facebook! Dive deeper into Raspberry Pi, Arduino, and ESP32 with fellow enthusiasts. Why Join? • Expert Support: Solve post-sale issues and technical challenges with help from our community and team.
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 • Exclusive Previews: Get early access to new product announcements and sneak peeks. • Special Discounts: Enjoy exclusive discounts on our newest products. • Festive Promotions and Giveaways: Take part in giveaways and holiday promotions.
Page 80
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 After the sensing module is wired, there is a one-minute initialization. During the initialization, module will output for 0~3 times at intervals. Then the module will be in the standby mode. Please keep the interference of light source and other sources away from the surface of the module so as to avoid the misoperation caused by the interfering signal.
• (For Piper Make User) 2.9 Lucky Cat Note: Hello, welcome to the SunFounder Raspberry Pi & Arduino & ESP32 Enthusiasts Community on Facebook! Dive deeper into Raspberry Pi, Arduino, and ESP32 with fellow enthusiasts. Why Join? • Expert Support: Solve post-sale issues and technical challenges with help from our community and team.
• (For Piper Make User) 2.6 Smart Water Tank Note: Hello, welcome to the SunFounder Raspberry Pi & Arduino & ESP32 Enthusiasts Community on Facebook! Dive deeper into Raspberry Pi, Arduino, and ESP32 with fellow enthusiasts. Why Join? • Expert Support: Solve post-sale issues and technical challenges with help from our community and team.
Page 83
• (For Piper Make User) 2.11 Reversing System Note: Hello, welcome to the SunFounder Raspberry Pi & Arduino & ESP32 Enthusiasts Community on Facebook! Dive deeper into Raspberry Pi, Arduino, and ESP32 with fellow enthusiasts. Why Join? • Expert Support: Solve post-sale issues and technical challenges with help from our community and team.
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 2.39 DHT11 Humiture Sensor The digital temperature and humidity sensor DHT11 is a composite sensor that contains a calibrated digital signal output of temperature and humidity. The technology of a dedicated digital modules collection and the temperature and humidity sensing technology are applied to ensure that the product has high reliability and excellent long-term stability.
• (For Arduino User) 6.2 - Temperature - Humidity Note: Hello, welcome to the SunFounder Raspberry Pi & Arduino & ESP32 Enthusiasts Community on Facebook! Dive deeper into Raspberry Pi, Arduino, and ESP32 with fellow enthusiasts. Why Join? • Expert Support: Solve post-sale issues and technical challenges with help from our community and team.
Page 86
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 3-axis Accelerometer The accelerometer works on the principle of piezo electric effect, the ability of certain materials to generate an electric charge in response to applied mechanical stress. Here, imagine a cuboidal box, having a small ball inside it, like in the picture above. The walls of this box are made with piezo electric crystals.
Page 87
(For Arduino User) 6.3 - 6-axis Motion Tracking Communication Note: Hello, welcome to the SunFounder Raspberry Pi & Arduino & ESP32 Enthusiasts Community on Facebook! Dive deeper into Raspberry Pi, Arduino, and ESP32 with fellow enthusiasts. Why Join? • Expert Support: Solve post-sale issues and technical challenges with help from our community and team.
Example • Play Pico with APP Note: Hello, welcome to the SunFounder Raspberry Pi & Arduino & ESP32 Enthusiasts Community on Facebook! Dive deeper into Raspberry Pi, Arduino, and ESP32 with fellow enthusiasts. Why Join? • Expert Support: Solve post-sale issues and technical challenges with help from our community and team.
CHAPTER THREE ELECTRONIC CIRCUIT There are many things you use every day that are powered by electricity, such as the lights in your home and the computer you are reading this on. In order to use electricity, you must create an electrical circuit. An electric circuit consists of metal wires and electrical and electronic components.
Page 90
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 With electricity, you can create works with light, sound, and motion. You can light up an LED by connecting the long pin to the positive terminal and the short pin to the negative terminal. The LED will break down very quickly if you do this, so you need to add a 220* resistor inside the circuit to protect it.
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 You may have questions this time: how do I build this circuit? Hold the wires by hand, or tape the pins and wires? In this situation, solderless breadboards will be your strongest allies.
Page 92
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 1. Each half-row group (such as column A-E in row 1 or column F-J in row 3) is connected. Therefore, if an electrical signal flows in from A1, it can flow out from B1, C1, D1, E1, but not from F1 or A2.
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 3.2 Beware of short circuits Short circuits can occur when two components that shouldn’t be connected are “accidentally” connected. This kit includes resistors, transistors, capacitors, LEDs, etc. that have long metal pins that can bump into each other and cause a short.
5V power supply, we need to connect a minimum of 160ohm ((5-1.8)/20mA) resistor in order not to burn out the LED. Note: Hello, welcome to the SunFounder Raspberry Pi & Arduino & ESP32 Enthusiasts Community on Facebook! Dive deeper into Raspberry Pi, Arduino, and ESP32 with fellow enthusiasts.
We recommend that you read the chapters in order. 1. Get Started Note: Hello, welcome to the SunFounder Raspberry Pi & Arduino & ESP32 Enthusiasts Community on Facebook! Dive deeper into Raspberry Pi, Arduino, and ESP32 with fellow enthusiasts. Why Join? •...
Page 96
MicroPython - Wikipedia • Reference: realpython Note: Hello, welcome to the SunFounder Raspberry Pi & Arduino & ESP32 Enthusiasts Community on Facebook! Dive deeper into Raspberry Pi, Arduino, and ESP32 with fellow enthusiasts. Why Join? • Expert Support: Solve post-sale issues and technical challenges with help from our community and team.
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 4.2 1.2 Install and Introduce Thonny IDE To program Pico with MicroPython, you need an integrated development environment (IDE), here we recommend Thonny. Python 3.7 is pre-installed in Thonny, so all you need to do is install it.
Page 98
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 3. Next, click Next and Install to finish installing Thonny. Chapter 4. For MicroPython User...
Page 99
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 4.2.2 Thonny IDE Introduction • Ref: realpython 4.2. 1.2 Install and Introduce Thonny IDE...
Page 100
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 • • A: The menu bar containing New, Save, Edit, View, Run, Debug, etc. • B: This paper icon allows you to create a new file. • C: If your Raspberry Pi Pico is already plugged into your computer, you can open files that already exist on your computer or Pico.
• The Raspberry Pi Pico interpreter is only available in version 3.3.3 or higher version of Thonny. If you are running an older version, please update. Note: Hello, welcome to the SunFounder Raspberry Pi & Arduino & ESP32 Enthusiasts Community on Facebook! Dive deeper into Raspberry Pi, Arduino, and ESP32 with fellow enthusiasts.
Page 102
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 2. Press and hold the BOOTSEL button and then connect the Pico to computer via a Micro USB cable. Release the BOOTSEL button after your Pico is mount as a Mass Storage Device called RPI-RP2.
Page 103
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 4. In the Target volume, the volume of the Pico you just plugged in will automatically appear, and in the Micropy- thon variant, select Raspberry Pi.Pico/Pico H. 4.3. 1.3 Install MicroPython Firmware on Your Pico...
Page 104
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 5. Click the Install button, wait for the installation to complete and then close this page. Chapter 4. For MicroPython User...
Page 105
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 Congratulations, now your Raspberry Pi Pico is ready to go. Note: Hello, welcome to the SunFounder Raspberry Pi & Arduino & ESP32 Enthusiasts Community on Facebook! Dive deeper into Raspberry Pi, Arduino, and ESP32 with fellow enthusiasts.
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 4.4 1.4 Download and Upload the Code Download the Code Download the relevant code from the link below. • SunFounder Euler Kit Example • Or check out the code at Euler Kit - GitHub 4.4.1 Upload the Libraries to Pico...
Page 107
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 4. Select “MicroPython (Raspberry Pi Pico)” from the interpreter selection button in the bottom right corner, but make sure that your Raspberry Pi Pico is connected to your computer via a Micro USB cable.
Page 108
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 6. Each project has its own .py file with serial numbers. To avoid increasing Pico’s usage, only select .py files and folders without serial numbers. 7. It will take a while for the file to upload after clicking Upload to.
Page 109
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 8. Now you will see the files you just uploaded inside your drive Raspberry Pi Pico. 4.4. 1.4 Download and Upload the Code...
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 Note: Hello, welcome to the SunFounder Raspberry Pi & Arduino & ESP32 Enthusiasts Community on Facebook! Dive deeper into Raspberry Pi, Arduino, and ESP32 with fellow enthusiasts. Why Join? • Expert Support: Solve post-sale issues and technical challenges with help from our community and team.
Page 111
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 3. Run the Code To run the script, click the Run current script button or press F5. If the code contains any information that needs to be printed, it will appear in the Shell; otherwise, only the following information will appear.
Page 112
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 • The third line is a command from Thonny telling the MicroPython interpreter on your Pico to run the contents of the script area - “EDITOR_CONTENT”. • If there is any message after the third line, it is usually a message that you tell MicroPython to print, or an error message for the code.
Page 113
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 Then click OK after entering the file name and extension .py. On the Raspberry Pi Pico drive, you will see your saved file. Note: Regardless of what name you give your code, it’s best to describe what type of code it is, and not give it a meaningless name like abc.py.
Page 114
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 4.5.2 Create File and Run it The code is shown directly in the code section. You can copy it to Thonny and run it as follows. 1. Create a new file Open Thonny IDE, click New button to create a new blank file.
Page 115
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 3. Select Correct Interpreter Plug the Pico into your computer with a micro USB cable and select the “MicroPython (Raspberry Pi Pico)” interpreter in the bottom right corner. 4. Run and Save the Code You need click Run Current Script or simply press F5 to run it.
Page 116
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 Note: Thonny saves your program on the Raspberry Pi Pico when you tell him to, so if you unplug the Pico and plug it into someone else’s computer, your program remains intact.
Page 117
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 Note: Regardless of what name you give your code, it’s best to describe what type of code it is, and not give it a meaningless name like abc.py. When you save the code as main.py, it will run automatically when the power is turned on.
• The second is to open the file preview directly by clicking View->**File**-> and then double- clicking on the corresponding .py file to open it. Note: Hello, welcome to the SunFounder Raspberry Pi & Arduino & ESP32 Enthusiasts Community on Facebook! Dive deeper into Raspberry Pi, Arduino, and ESP32 with fellow enthusiasts.
Page 119
Traceback (most recent call last): File "<stdin>", line 2 SyntaxError: invalid syntax Note: Hello, welcome to the SunFounder Raspberry Pi & Arduino & ESP32 Enthusiasts Community on Facebook! Dive deeper into Raspberry Pi, Arduino, and ESP32 with fellow enthusiasts. Why Join? •...
Page 120
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 4.6.2 Comments The comments in the code help us understand the code, make the entire code more readable and comment out part of the code during testing, so that this part of the code does not run.
Page 121
As long as the string is not assigned to a variable, MicroPython will ignore it after reading the code and treat it as if you made a multi-line comment. Note: Hello, welcome to the SunFounder Raspberry Pi & Arduino & ESP32 Enthusiasts Community on Facebook! Dive deeper into Raspberry Pi, Arduino, and ESP32 with fellow enthusiasts.
Page 122
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 • Exclusive Previews: Get early access to new product announcements and sneak peeks. • Special Discounts: Enjoy exclusive discounts on our newest products. • Festive Promotions and Giveaways: Take part in giveaways and holiday promotions.
Page 123
A) >>> %Run -c $EDITOR_CONTENT 5 lily Note: Hello, welcome to the SunFounder Raspberry Pi & Arduino & ESP32 Enthusiasts Community on Facebook! Dive deeper into Raspberry Pi, Arduino, and ESP32 with fellow enthusiasts. Why Join? • Expert Support: Solve post-sale issues and technical challenges with help from our community and team.
Page 124
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 4.6.5 If Else Decision making is required when we want to execute a code only if a certain condition is satisfied. test expression: statement(s) Here, the program evaluates the test expression and executes the statement only when the test expression is True.
Page 125
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 if. . . else test expression: Body of else: Body of else The if..else statement evaluates test expression and will execute the body of if only when the test condition is True.
Page 126
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 if. . . elif. . . else test expression: Body of elif test expression: Body of elif else: Body of else Elif is short for else if. It allows us to check multiple expressions.
Page 127
>>> %Run -c $EDITOR_CONTENT Above ten, and also above 20! Note: Hello, welcome to the SunFounder Raspberry Pi & Arduino & ESP32 Enthusiasts Community on Facebook! Dive deeper into Raspberry Pi, Arduino, and ESP32 with fellow enthusiasts. Why Join? • Expert Support: Solve post-sale issues and technical challenges with help from our community and team.
Page 128
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 4.6.6 While Loops The while statement is used to execute a program in a loop, that is, to execute a program in a loop under certain conditions to handle the same task that needs to be processed repeatedly.
Page 129
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 (continued from previous page) Break Statement With the break statement we can stop the loop even if the while condition is true: while > print(x) break >>> %Run -c $EDITOR_CONTENT While Loop with Else Like the if loop, the while loop can also have an optional else block.
Page 130
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 (continued from previous page) Game Over Note: Hello, welcome to the SunFounder Raspberry Pi & Arduino & ESP32 Enthusiasts Community on Facebook! Dive deeper into Raspberry Pi, Arduino, and ESP32 with fellow enthusiasts. Why Join? •...
Page 131
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 numbers [1, 2, 3, 4] numbers: sum+val print("The sum is", sum) >>> %Run -c $EDITOR_CONTENT The sum is 10 The break Statement With the break statement we can stop the loop before it has looped through all the items:...
Page 132
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 The continue Statement With the continue statement we can stop the current iteration of the loop, and continue with the next: numbers [1, 2, 3, 4] numbers: continue print(val) >>> %Run -c $EDITOR_CONTENT The range() function We can use the range() function to generate a sequence of numbers.
Page 133
>>> %Run -c $EDITOR_CONTENT Note: Hello, welcome to the SunFounder Raspberry Pi & Arduino & ESP32 Enthusiasts Community on Facebook! Dive deeper into Raspberry Pi, Arduino, and ESP32 with fellow enthusiasts. Why Join? • Expert Support: Solve post-sale issues and technical challenges with help from our community and team.
Page 134
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 4.6.8 Functions In MicroPython, a function is a group of related statements that perform a specific task. Functions help break our program into smaller modular blocks. As our plan becomes larger and larger, functions make it more organized and manageable.
Page 135
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 The return Statement The return statement is used to exit a function and return to the place where it was called. Syntax of return return [expression_list] The statement can contain an expression that is evaluated and returns a value. If there is no expression in the statement, or the return statement itself does not exist in the function, the function will return a None object.
Page 136
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 If it is called with a different number of arguments, the interpreter will display an error message. The following is the call to this function, which contains one and one no arguments and their respective error messages.
Page 137
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 Keyword Arguments When we call a function with certain values, these values will be assigned to arguments based on their position. For example, in the above function welcome(), when we called it as welcome(“Lily”, “Welcome to China”), the value “Lily”...
Page 138
• Recursive calls are expensive (inefficient) as they take up a lot of memory and time. • Recursive functions are hard to debug. Note: Hello, welcome to the SunFounder Raspberry Pi & Arduino & ESP32 Enthusiasts Community on Facebook! Dive deeper into Raspberry Pi, Arduino, and ESP32 with fellow enthusiasts.
Page 139
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 Why Join? • Expert Support: Solve post-sale issues and technical challenges with help from our community and team. • Learn & Share: Exchange tips and tutorials to enhance your skills. • Exclusive Previews: Get early access to new product announcements and sneak peeks.
Page 140
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 >>> %Run -c $EDITOR_CONTENT <class str > <class int > <class list > >>> Setting the Specific Data Type If you want to specify the data type, you can use the following constructor functions:...
Page 141
Note: You cannot convert complex numbers into another number type. Note: Hello, welcome to the SunFounder Raspberry Pi & Arduino & ESP32 Enthusiasts Community on Facebook! Dive deeper into Raspberry Pi, Arduino, and ESP32 with fellow enthusiasts. Why Join? •...
Page 142
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 Arithmetic Operators You can use arithmetic operators to do some common mathematical operations. Operator Name Addition Subtraction Multiplication Division Modulus Exponentiation Floor division print(a) print(b) print(c) print(d) print(e) print(f) print(g) >>> %Run -c $EDITOR_CONTENT 1.666667...
Page 143
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 Assignment operators Assignment operators can used to assign values to variables. Operator Example Same As a = 6 a =6 a += 6 a = a + 6 a -= 6...
Page 144
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 Logical Operators Logical operators are used to combine conditional statements. Operator Description Returns True if both statements are true Returns True if one of the statements is true Reverse the result, returns False if the result is true print(a >...
Page 145
<< >>> %Run -c $EDITOR_CONTENT >>> Note: Hello, welcome to the SunFounder Raspberry Pi & Arduino & ESP32 Enthusiasts Community on Facebook! Dive deeper into Raspberry Pi, Arduino, and ESP32 with fellow enthusiasts. Why Join? • Expert Support: Solve post-sale issues and technical challenges with help from our community and team.
Page 146
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 • Learn & Share: Exchange tips and tutorials to enhance your skills. • Exclusive Previews: Get early access to new product announcements and sneak peeks. • Special Discounts: Enjoy exclusive discounts on our newest products.
Page 147
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 Check List items Print the second item of the list: ["Banana", 255, False, 3.14] A_list print(A_list[1]) >>> %Run -c $EDITOR_CONTENT [255] Print the last one item of the list: A_list ["Banana", 255, False, 3.14] print(A_list[-1]) >>>...
Page 148
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 Add List Items Using the append() method to add an item: C_list ["Red", "Blue", "Green"] C_list.append("Orange") print(C_list) >>> %Run -c $EDITOR_CONTENT [ Red , Blue , Green , Orange ] Insert an item as the second position: C_list ["Red", "Blue", "Green"]...
>>> %Run -c $EDITOR_CONTENT 2. Output & Input Note: Hello, welcome to the SunFounder Raspberry Pi & Arduino & ESP32 Enthusiasts Community on Facebook! Dive deeper into Raspberry Pi, Arduino, and ESP32 with fellow enthusiasts. Why Join? • Expert Support: Solve post-sale issues and technical challenges with help from our community and team.
Page 150
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 To build the circuit, let’s follow the current’s direction! 1. The LED is powered by the GP15 pin of the Pico board, and the circuit begins here. 2. To protect the LED, the current must pass through a 220 ohm resistor. One end of the resistor should be inserted into the same row as the Pico GP15 pin (row 20 in my circuit), and the other end should be inserted into the free row of the breadboard (row 24).
Page 151
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 • Open the 2.1_hello_led.py file under the path of euler-kit/micropython or copy this code into Thonny, then click “Run Current Script” or simply press F5 to run it. • Don’t forget to click on the “MicroPython (Raspberry Pi Pico)” interpreter in the bottom right corner.
Page 152
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 Run it and you will be able to light up the LED. Next, we try to add the “extinguished” statement: import machine machine.Pin(15, machine.Pin.OUT) led.value(1) led.value(0) Based on the code line, this program will turn on the LED first, then turn it off. But when you use it, you will find that this is not the case.
Page 153
True: led.toggle() utime.sleep(1) Note: Hello, welcome to the SunFounder Raspberry Pi & Arduino & ESP32 Enthusiasts Community on Facebook! Dive deeper into Raspberry Pi, Arduino, and ESP32 with fellow enthusiasts. Why Join? • Expert Support: Solve post-sale issues and technical challenges with help from our community and team.
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 4.8 2.2 Display the Level The first project is simply to make the LED blink. For this project, let’s use the LED Bar Graph, which contains 10 LEDs in a plastic enclosure, generally used to display power or volume levels.
Page 155
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 In the LED Bar Graph, there are 10 LEDs, each of which can be controlled individually. Each LED’s anode is connected to GP6*GP15, and its cathode to a 220ohm resistor, and then to GND.
Page 156
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 Code Note: • Open the 2.2_display_the_level.py file under the path of euler-kit/micropython or copy this code into Thonny, then click “Run Current Script” or simply press F5 to run it. • Don’t forget to click on the “MicroPython (Raspberry Pi Pico)” interpreter in the bottom right corner.
Page 157
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 The LED Bar consists of ten LEDs that are controlled by ten pins, which means that we must define these pins. The process would be too tedious if we defined them one by one. So, here we use Lists.
Note: Hello, welcome to the SunFounder Raspberry Pi & Arduino & ESP32 Enthusiasts Community on Facebook! Dive deeper into Raspberry Pi, Arduino, and ESP32 with fellow enthusiasts. Why Join? • Expert Support: Solve post-sale issues and technical challenges with help from our community and team.
Page 159
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 Pico supports PWM on each GPIO pin, but there are actually 16 independent PWM outputs (instead of 30), distributed between GP0 to GP15 on the left, and the right GPIO’s PWM output is identical to the left.
Page 160
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 Code Note: • Open the 2.3_fading_led.py file under the path of euler-kit/micropython or copy this code into Thonny, then click “Run Current Script” or simply press F5 to run it. • Don’t forget to click on the “MicroPython (Raspberry Pi Pico)” interpreter in the bottom right corner.
When it is 32768, it will turn on half a pulse, so the LED will be half as bright when fully on. Note: Hello, welcome to the SunFounder Raspberry Pi & Arduino & ESP32 Enthusiasts Community on Facebook! Dive deeper into Raspberry Pi, Arduino, and ESP32 with fellow enthusiasts.
Page 162
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 Schematic The PWM pins GP13, GP14 and GP15 control the Red, Green and Blue pins of the RGB LED respectively, and connect the common cathode pin to GND. This allows the RGB LED to display a specific color by superimposing light on these pins with different PWM values.
Page 163
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 Code Note: • Open the 2.4_colorful_light.py file under the path of euler-kit/micropython or copy this code into Thonny, then click “Run Current Script” or simply press F5 to run it. • Don’t forget to click on the “MicroPython (Raspberry Pi Pico)” interpreter in the bottom right corner.
Page 164
PWM, we have defined color_to_duty() and interval_mapping () function to map the color values to the duty values. Note: Hello, welcome to the SunFounder Raspberry Pi & Arduino & ESP32 Enthusiasts Community on Facebook! Dive deeper into Raspberry Pi, Arduino, and ESP32 with fellow enthusiasts.
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 • Exclusive Previews: Get early access to new product announcements and sneak peeks. • Special Discounts: Enjoy exclusive discounts on our newest products. • Festive Promotions and Giveaways: Take part in giveaways and holiday promotions.
Page 166
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 Note: A four-pin button is shaped like an H. Its left two pins or right two pins are connected, which means that when it crosses the central gap, it connects two half rows with the same row number. (For example, in my circuit, E23 and F23 are already connected, as are E25 and F25).
Page 167
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 (continued from previous page) while True: button.value() print("You pressed the button!") utime.sleep(1) As soon as the code runs, the shell prints “You pressed the button!” Pull-up Working Mode The next part is the wiring and code when you use the button in the pull-up mode.
Also see the reference here: • machine.Pin Note: Hello, welcome to the SunFounder Raspberry Pi & Arduino & ESP32 Enthusiasts Community on Facebook! Dive deeper into Raspberry Pi, Arduino, and ESP32 with fellow enthusiasts. Why Join? • Expert Support: Solve post-sale issues and technical challenges with help from our community and team.
Page 169
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 When you put it upright, GP14 will get high; after tilting it, GP14 will get low. The purpose of the 10K resistor is to keep the GP14 in a stable low state when the tilt switch is in a tilted state.
After the program runs, when you tilt the breadboard (tilt switch), “The switch works!” will appear in the shell. Note: Hello, welcome to the SunFounder Raspberry Pi & Arduino & ESP32 Enthusiasts Community on Facebook! Dive deeper into Raspberry Pi, Arduino, and ESP32 with fellow enthusiasts.
Page 171
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 GP14 will get a different level, when you toggle the slide switch to the right or left. The purpose of the 10K resistor is to keep the GP14 low during toggling (not toggling to the far left and not toggling to the far right).
Page 172
After the program runs, when you toggle the slide switch to the right, “The switch works!” will appear in the shell. Note: Hello, welcome to the SunFounder Raspberry Pi & Arduino & ESP32 Enthusiasts Community on Facebook! Dive deeper into Raspberry Pi, Arduino, and ESP32 with fellow enthusiasts.
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 4.14 2.8 Press Gently Micro Switch is also a 3-pin device, the sequence of the 3 pins are C (common pin), NO (normally open) and NC (normally closed) . When the micro switch is not pressed, 1 (C) and 3 (NC) are connected together, when pressed 1 (C) and 2 (NO) are connected together.
Page 174
After the program runs, when you toggle the slide switch to the right, “The switch works!” will appear in the shell. Note: Hello, welcome to the SunFounder Raspberry Pi & Arduino & ESP32 Enthusiasts Community on Facebook! Dive deeper into Raspberry Pi, Arduino, and ESP32 with fellow enthusiasts.
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 • Festive Promotions and Giveaways: Take part in giveaways and holiday promotions. Ready to explore and create with us? Click [] and join today! 4.15 2.9 Feel the Magnetism The most common type of reed switch contains a pair of magnetizable, flexible, metal reeds whose end portions are separated by a small gap when the switch is open.
Page 176
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 Code Note: • Open the 2.9_feel_the_magnetism.py file under the path of euler-kit/micropython or copy this code into Thonny, then click “Run Current Script” or simply press F5 to run it. • Don’t forget to click on the “MicroPython (Raspberry Pi Pico)” interpreter in the bottom right corner.
Page 177
, the callback function we defined before. • machine.Pin.irq - Micropython Docs Note: Hello, welcome to the SunFounder Raspberry Pi & Arduino & ESP32 Enthusiasts Community on Facebook! Dive deeper into Raspberry Pi, Arduino, and ESP32 with fellow enthusiasts. Why Join? •...
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 4.16 2.10 Detect Human Movement Passive infrared sensor (PIR sensor) is a common sensor that can measure infrared (IR) light emitted by objects in its field of view. Simply put, it will receive infrared radiation emitted from the body, thereby detecting the movement of people and other animals.
Page 179
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 Wiring Code Note: • Open the 2.10_detect_human_movement.py file under the path of euler-kit/micropython or copy this code into Thonny, then click “Run Current Script” or simply press F5 to run it.
Page 180
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 (continued from previous page) motion_detected(pin): print("Somebody here!") pir_sensor.irq(trigger=machine.Pin.IRQ_RISING, handler=motion_detected) After the program runs, if the PIR module detects someone nearby, the Shell will print out “Somebody here!” Learn More PIR is a very sensitive sensor. In order to adapt it to the environment of use, it needs to be adjusted. Let the side with the 2 potentiometers facing you, turn both potentiometers counterclockwise to the end and insert the jumper cap on the pin with L and the middle pin.
Page 181
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 1. Trigger Mode Let’s take a look at the pins with jumper cap at the corner. It allows PIR to enter Repeatable trigger mode or Non-repeatable trigger mode At present, our jumper cap connects the middle Pin and L Pin, which makes the PIR in non-repeatable trigger mode.
0-3 meters. Note: Hello, welcome to the SunFounder Raspberry Pi & Arduino & ESP32 Enthusiasts Community on Facebook! Dive deeper into Raspberry Pi, Arduino, and ESP32 with fellow enthusiasts.
Page 183
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 Pico has three GPIO pins that can use analog input, GP26, GP27, GP28. That is, analog channels 0, 1, and 2. In addition, there is a fourth analog channel, which is connected to the built-in temperature sensor and will not be introduced here.
Page 184
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 The potentiometer is an analog device and when you turn it in 2 different directions. Connect the middle pin of the potentiometer to the analog pin GP28. The Raspberry Pi Pico contains a multi-channel, 16-bit analog-to-digital converter.
Page 185
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 Code Note: • Open the 2.11_turn_the_knob.py file under the path of euler-kit/micropython or copy this code into Thonny, then click “Run Current Script” or simply press F5 to run it. • Don’t forget to click on the “MicroPython (Raspberry Pi Pico)” interpreter in the bottom right corner.
ADC, scaled such that the minimum value is 0 and the maximum value is 65535. • machine.ADC - MicroPython Docs Note: Hello, welcome to the SunFounder Raspberry Pi & Arduino & ESP32 Enthusiasts Community on Facebook! Dive deeper into Raspberry Pi, Arduino, and ESP32 with fellow enthusiasts. Why Join? •...
Page 187
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 When the light is enhanced, the resistance of the photoresistor decreases, then its voltage decreases, so the value from GP28 will decrease; if the light is strong enough, the resistance of the photoresistor will be close to 0, and the value of GP28 will be close to 0.
After the program runs, the Shell prints out the photoresistor values. You can shine a flashlight on it or cover it up with your hand to see how the value will change. Note: Hello, welcome to the SunFounder Raspberry Pi & Arduino & ESP32 Enthusiasts Community on Facebook! Dive deeper into Raspberry Pi, Arduino, and ESP32 with fellow enthusiasts.
Page 189
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 In this circuit, the 10K resistor and the thermistor are connected in series, and the current passing through them is the same. The 10K resistor acts as a protection, and the GP28 reads the value after the voltage conversion of the thermistor.
Page 190
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 • Don’t forget to click on the “MicroPython (Raspberry Pi Pico)” interpreter in the bottom right corner. • For detailed tutorials, please refer to Open and Run Code Directly. import machine...
Page 191
(Cel, Fah)) Print centigrade degree, Fahrenheit degree and their units in the shell. Note: Hello, welcome to the SunFounder Raspberry Pi & Arduino & ESP32 Enthusiasts Community on Facebook! Dive deeper into Raspberry Pi, Arduino, and ESP32 with fellow enthusiasts.
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 4.20 2.14 Feel the Water Level Water sensor is designed for water detection, which can be widely used in sensing rainfall, water level, and even liquid leakage. It measures the water level by having a series of exposed parallel wire traces to measure the size of the water drops/volume.
Page 193
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 Code Note: • Open the 2.14_feel_the_water_level.py file under the path of euler-kit/micropython or copy this code into Thonny, then click “Run Current Script” or simply press F5 to run it. • Don’t forget to click on the “MicroPython (Raspberry Pi Pico)” interpreter in the bottom right corner.
Page 194
Note: Hello, welcome to the SunFounder Raspberry Pi & Arduino & ESP32 Enthusiasts Community on Facebook! Dive deeper into Raspberry Pi, Arduino, and ESP32 with fellow enthusiasts. Why Join? • Expert Support: Solve post-sale issues and technical challenges with help from our community and team.
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 4.21 2.15 Two Kinds of Transistors This kit is equipped with two types of transistors, S8550 and S8050, the former is PNP and the latter is NPN. They look very similar, and we need to check carefully to see their labels. When a High level signal goes through an NPN transistor, it is energized.
Page 196
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 In this circuit, when the button is pressed, GP14 is high. By programming GP15 to output high, after a 1k current limiting resistor (to protect the transistor), the S8050 (NPN transistor) is allowed to conduct, thus allowing the LED to light up.
Page 197
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 Way to connect PNP(S8550) transistor In this circuit, GP14 is low by the default and will change to high when the button is pressed. By programming GP15 to output low, after a 1k current limiting resistor (to protect the transistor), the S8550 (PNP transistor) is allowed to conduct, thus allowing the LED to light up.
Page 198
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 Code Note: • Open the 2.15_transistor.py file under the path of euler-kit/micropython or copy this code into Thonny, then click “Run Current Script” or simply press F5 to run it. • Don’t forget to click on the “MicroPython (Raspberry Pi Pico)” interpreter in the bottom right corner.
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 Note: Hello, welcome to the SunFounder Raspberry Pi & Arduino & ESP32 Enthusiasts Community on Facebook! Dive deeper into Raspberry Pi, Arduino, and ESP32 with fellow enthusiasts. Why Join? • Expert Support: Solve post-sale issues and technical challenges with help from our community and team.
Page 200
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 Chapter 4. For MicroPython User...
Page 201
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 A diode (continuity diode) is used here to protect the circuit. The cathode is the end with the silver ribbon connected to the power supply, and the anode is connected to the transistor.
Page 202
By switching one end of the load circuit from pin 3 to pin 4, you will be able to get exactly the opposite operating state. 3. Sound & Display & Movement Note: Hello, welcome to the SunFounder Raspberry Pi & Arduino & ESP32 Enthusiasts Community on Facebook! Dive deeper into Raspberry Pi, Arduino, and ESP32 with fellow enthusiasts.
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 • Learn & Share: Exchange tips and tutorials to enhance your skills. • Exclusive Previews: Get early access to new product announcements and sneak peeks. • Special Discounts: Enjoy exclusive discounts on our newest products.
Page 204
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 Two types of buzzers are included in the kit. We need to use active buzzer. Turn them around, the sealed back (not the exposed PCB) is the one we want. The buzzer needs to use a transistor when working, here we use S8050 (NPN Transistor).
After the code runs, you will hear a beep every second. Note: Hello, welcome to the SunFounder Raspberry Pi & Arduino & ESP32 Enthusiasts Community on Facebook! Dive deeper into Raspberry Pi, Arduino, and ESP32 with fellow enthusiasts. Why Join? •...
Page 206
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 When the GP15 output is high, after the 1K current limiting resistor (to protect the transistor), the S8050 (NPN tran- sistor) will conduct, so that the buzzer will sound. The role of S8050 (NPN transistor) is to amplify the current and make the buzzer sound louder. In fact, you can also connect the buzzer directly to GP15, but you will find that the buzzer sound is smaller.
Page 207
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 Code Note: • Open the 3.2_custom_tone.py file under the path of euler-kit/micropython or copy this code into Thonny, then click “Run Current Script” or simply press F5 to run it. • Don’t forget to click on the “MicroPython (Raspberry Pi Pico)” interpreter in the bottom right corner.
Page 208
Note: Hello, welcome to the SunFounder Raspberry Pi & Arduino & ESP32 Enthusiasts Community on Facebook! Dive deeper into Raspberry Pi, Arduino, and ESP32 with fellow enthusiasts. Why Join? Chapter 4. For MicroPython User...
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 • Expert Support: Solve post-sale issues and technical challenges with help from our community and team. • Learn & Share: Exchange tips and tutorials to enhance your skills. • Exclusive Previews: Get early access to new product announcements and sneak peeks.
Page 210
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 Warning: One thing you need to pay attention to is current. Although the LED Strip with any number of LEDs can be used in Pico, the power of its VBUS pin is limited. Here, we will use eight LEDs, which are safe.
Page 211
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 In the ws2812 library, we have integrated related functions into the WS2812 class. You can use the RGB LED Strip with the following statement. from ws2812 import WS2812 Declare a WS2812 type object, named “ws”, it is connected to “pin”, there are “number” RGB LEDs on the WS2812 strip.
True: flowing_light() print(ws[0]) Note: Hello, welcome to the SunFounder Raspberry Pi & Arduino & ESP32 Enthusiasts Community on Facebook! Dive deeper into Raspberry Pi, Arduino, and ESP32 with fellow enthusiasts. Why Join? • Expert Support: Solve post-sale issues and technical challenges with help from our community and team.
Page 213
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 Here we will use the I2C0 interface to control the LCD1602 and display text. Schematic Wiring 4.26. 3.4 Liquid Crystal Display...
Page 214
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 Code Note: • Open the 3.4_liquid_crystal_display.py file under the path of euler-kit/micropython or copy this code into Thonny, then click “Run Current Script” or simply press F5 to run it. • Don’t forget to click on the “MicroPython (Raspberry Pi Pico)” interpreter in the bottom right corner.
If you call this statement multiple times, lcd will superimpose the texts. This requires the use of the following statement to clear the display. lcd.clear() Note: Hello, welcome to the SunFounder Raspberry Pi & Arduino & ESP32 Enthusiasts Community on Facebook! Dive deeper into Raspberry Pi, Arduino, and ESP32 with fellow enthusiasts. Why Join? •...
Page 216
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 In this circuit, you will see that the button is connected to the RUN pin. This is because the motor is operating with too much current, which may cause the Pico to disconnect from the computer, and the button needs to be pressed (for the Pico’s RUN pin to receive a low level) to reset.
Page 217
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 Since DC motors require a high current, we use a power supply module to power the motor here for safety reasons. Code Note: • Open the 3.5_small_fan.py file under the path of euler-kit/micropython or copy this code into Thonny, then click “Run Current Script”...
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 Note: Hello, welcome to the SunFounder Raspberry Pi & Arduino & ESP32 Enthusiasts Community on Facebook! Dive deeper into Raspberry Pi, Arduino, and ESP32 with fellow enthusiasts. Why Join? • Expert Support: Solve post-sale issues and technical challenges with help from our community and team.
Page 219
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 4. If water does not come out of the tube, there may be residual water in the tube blocking the air flow and needs to be drained first. Schematic In this circuit, you will see that the button is connected to the RUN pin. This is because the motor is operating with too much current, which may cause the Pico to disconnect from the computer, and the button needs to be pressed (for the Pico’s RUN pin to receive a low level) to reset.
Page 220
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 Code Note: • Open the 3.6_pumping.py file under the path of euler-kit/micropython or copy this code into Thonny, then click “Run Current Script” or simply press F5 to run it. • Don’t forget to click on the “MicroPython (Raspberry Pi Pico)” interpreter in the bottom right corner.
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 Note: Hello, welcome to the SunFounder Raspberry Pi & Arduino & ESP32 Enthusiasts Community on Facebook! Dive deeper into Raspberry Pi, Arduino, and ESP32 with fellow enthusiasts. Why Join? • Expert Support: Solve post-sale issues and technical challenges with help from our community and team.
Page 222
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 Wiring Chapter 4. For MicroPython User...
Page 223
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 • Orange wire is signal and connected to GP15. • Red wire is VCC and connected to VBUS(5V). • Brown wire is GND and connected to GND. Code 4.29. 3.7 Swinging Servo...
Page 224
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 Note: • Open the 3.7_swinging_servo.py file under the path of euler-kit/micropython or copy this code into Thonny, then click “Run Current Script” or simply press F5 to run it. • Don’t forget to click on the “MicroPython (Raspberry Pi Pico)” interpreter in the bottom right corner.
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 Finally, write the duty value into duty_u16(). 4. Controller Note: Hello, welcome to the SunFounder Raspberry Pi & Arduino & ESP32 Enthusiasts Community on Facebook! Dive deeper into Raspberry Pi, Arduino, and ESP32 with fellow enthusiasts. Why Join? •...
Page 226
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 Wiring Code Note: • Open the 4.1_toggle_the_joystick.py file under the path of euler-kit/micropython or copy this code into Thonny, then click “Run Current Script” or simply press F5 to run it.
• The Z-axis is a digital value with a status of 1 or 0. Note: Hello, welcome to the SunFounder Raspberry Pi & Arduino & ESP32 Enthusiasts Community on Facebook! Dive deeper into Raspberry Pi, Arduino, and ESP32 with fellow enthusiasts.
Page 228
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 4 pull-down resistors are connected to each of the columns of the matrix keyboard, so that G6 ~ G9 get a stable low level when the keys are not pressed. The rows of the keyboard (G2 ~ G5) are programmed to go high; if one of G6 ~ G9 is read high, then we know which key is pressed.
Page 229
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 To make the wiring easier, in the above diagram, the column row of the matrix keyboard and the 10K resistors are inserted into the holes where G6 ~ G9 are located at the same time.
Page 230
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 (continued from previous page) key.append(characters[i][j]) row[i].low() [] : return None else: return last_key None while True: current_key readKey() current_key last_key: continue last_key current_key None: current_key print(current_key) time.sleep(0.1) After the program runs, the Shell will print out the keys you pressed on the Keypad.
Page 231
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 pressed and the state of the pressed button. (If you press '3' when you press '1', the judgement is tenable.) Prints the value of the currently pressed key when the condition is tenable.
If you press the buttons '1' and '3', there will return key = ['1','3']. Note: Hello, welcome to the SunFounder Raspberry Pi & Arduino & ESP32 Enthusiasts Community on Facebook! Dive deeper into Raspberry Pi, Arduino, and ESP32 with fellow enthusiasts.
Page 233
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 Wiring Code Note: 4.32. 4.3 Electrode Keyboard...
Page 234
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 • Open the 4.3_electrode_keyboard.py file under the path of euler-kit/micropython or copy this code into Thonny, then click “Run Current Script” or simply press F5 to run it. • Don’t forget to click on the “MicroPython (Raspberry Pi Pico)” interpreter in the bottom right corner.
5. Microchip Note: Hello, welcome to the SunFounder Raspberry Pi & Arduino & ESP32 Enthusiasts Community on Facebook! Dive deeper into Raspberry Pi, Arduino, and ESP32 with fellow enthusiasts. Why Join? • Expert Support: Solve post-sale issues and technical challenges with help from our community and team.
Page 236
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 • When MR (pin10) is high level and OE (pin13) is low level, data is input in the rising edge of SHcp and goes to the memory register through the rising edge of SHcp.
Page 237
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 Code Note: • Open the 5.1_microchip_74hc595.py file under the path of euler-kit/micropython or copy this code into Thonny, then click “Run Current Script” or simply press F5 to run it. • Don’t forget to click on the “MicroPython (Raspberry Pi Pico)” interpreter in the bottom right corner.
Q7. In other words, writing the binary number “00000001” will make Q0 output high level and Q1~Q7 output low level. Note: Hello, welcome to the SunFounder Raspberry Pi & Arduino & ESP32 Enthusiasts Community on Facebook! Dive deeper into Raspberry Pi, Arduino, and ESP32 with fellow enthusiasts.
Page 239
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 This means that it needs to be controlled by 8 digital signals at the same time to fully work and the 74HC595 can do this. • 7-segment Display Schematic 4.34. 5.2 Number Display...
Page 240
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 Here the wiring principle is basically the same as 74HC595, the only difference is that Q0-Q7 are 5.1 Microchip - connected to the a ~ g pins of the 7 Segment Display.
Page 242
Write these codes into hc595_shift() to make the LED Segment Display display the corresponding numbers. Note: Hello, welcome to the SunFounder Raspberry Pi & Arduino & ESP32 Enthusiasts Community on Facebook! Dive deeper into Raspberry Pi, Arduino, and ESP32 with fellow enthusiasts.
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 • Special Discounts: Enjoy exclusive discounts on our newest products. • Festive Promotions and Giveaways: Take part in giveaways and holiday promotions. Ready to explore and create with us? Click [] and join today! 4.35 5.3 Time Counter...
Page 244
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 Then G10 ~ G13 will select which 7-segment display to work. Wiring Code Note: • Open the 5.3_time_counter.py file under the path of euler-kit/micropython or copy this code into Thonny, then click “Run Current Script” or simply press F5 to run it.
Page 246
Finally, convert and output this time value to the 4-digit 7-segment display and you’re done. • Time - MicroPython Docs Note: Hello, welcome to the SunFounder Raspberry Pi & Arduino & ESP32 Enthusiasts Community on Facebook! Dive deeper into Raspberry Pi, Arduino, and ESP32 with fellow enthusiasts. Chapter 4. For MicroPython User...
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 Why Join? • Expert Support: Solve post-sale issues and technical challenges with help from our community and team. • Learn & Share: Exchange tips and tutorials to enhance your skills. • Exclusive Previews: Get early access to new product announcements and sneak peeks.
Page 248
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 The 8x8 dot matrix is controlled by two 74HC595 chips, one controlling the rows and one controlling the columns, while these two chips share G18~G20, which can greatly save the I/O ports of the Pico board.
Page 249
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 Step 2: Connect pin 11 of the two 74HC595 together, and then to GP20; then pin 12 of the two chips, and to GP19; next, pin 14 of the 74HC595 on the left side to GP18 and pin 9 to pin 14 of the second 74HC595.
Page 250
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 Step 4: Now connect the ROWs of the LED dot matrix. The 74HC595 on the left controls ROW of the LED dot matrix. See the table below for the mapping. We can see, Q0-Q7 of the 74HC595 on the left are mapped with pin 9, 14, 8, 12, 1, 7, 2, and 5 respectively.
Page 251
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 Code Note: • Open the 5.4_8x8_pixel_graphics.py file under the path of euler-kit/micropython or copy this code into Thonny, then click “Run Current Script” or simply press F5 to run it. • Don’t forget to click on the “MicroPython (Raspberry Pi Pico)” interpreter in the bottom right corner.
Page 252
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 (continued from previous page) time.sleep_us(30) srclk.high() hc595_out(): rclk.high() time.sleep_us(200) rclk.low() while True: range(0,8): hc595_in(glyph[i]) hc595_in(0x80>>i) hc595_out() Once the program is running, you will see a x graphic displayed on the 8x8 dot matrix.
[0xFF,0xFF,0xF7,0xEB,0xDF,0xBF,0xFF,0xFF] Or, you can try drawing your own graphics. 6. Advanced Note: Hello, welcome to the SunFounder Raspberry Pi & Arduino & ESP32 Enthusiasts Community on Facebook! Dive deeper into Raspberry Pi, Arduino, and ESP32 with fellow enthusiasts. Why Join? •...
Page 254
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 Wiring Chapter 4. For MicroPython User...
Page 255
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 Code Note: • Open the 6.1_measuring_distance.py file under the path of euler-kit/micropython or copy this code into Thonny, then click “Run Current Script” or simply press F5 to run it. • Don’t forget to click on the “MicroPython (Raspberry Pi Pico)” interpreter in the bottom right corner.
Page 256
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 (continued from previous page) distance(): TRIG.low() time.sleep_us(2) TRIG.high() time.sleep_us(10) TRIG.low() while not ECHO.value(): pass time1 time.ticks_us() while ECHO.value(): pass time2 time.ticks_us() during time.ticks_diff(time2,time1) return during 10000 while True: distance() print Distance: %.2f...
Note that the ultrasonic sensor will pause the program when it is working, which may cause some lagging when writing complex projects. Note: Hello, welcome to the SunFounder Raspberry Pi & Arduino & ESP32 Enthusiasts Community on Facebook! Dive deeper into Raspberry Pi, Arduino, and ESP32 with fellow enthusiasts.
Page 258
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 A basic digital temperature and humidity sensor, the DHT11, is provided in this kit. It uses a capacitive humidity sensor and thermistor to measure the surrounding air and outputs a digital signal on the data pins (no analog input pins are required).
Page 259
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 Wiring 4.38. 6.2 Temperature - Humidity...
Page 260
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 Code Note: • Open the 6.2_temperature_humidity.py file under the path of euler-kit/micropython or copy this code into Thonny, then click “Run Current Script” or simply press F5 to run it. • Don’t forget to click on the “MicroPython (Raspberry Pi Pico)” interpreter in the bottom right corner.
{}, Humidity: {}".format(sensor.temperature, sensor.humidity)) time.sleep(1) Note: Hello, welcome to the SunFounder Raspberry Pi & Arduino & ESP32 Enthusiasts Community on Facebook! Dive deeper into Raspberry Pi, Arduino, and ESP32 with fellow enthusiasts. Why Join? • Expert Support: Solve post-sale issues and technical challenges with help from our community and team.
Page 262
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 Gyroscopes are used to measure orientation and angular velocity of a device or maintenance. Applications of gyro- scopes include anti-rollover and airbag systems for automobiles, motion sensing systems for smart devices, attitude stabilization systems for drones, and more.
Page 263
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 Code Note: • Open the 6.3_6axis_motion_tracking.py file under the path of euler-kit/micropython or copy this code into Thonny, then click “Run Current Script” or simply press F5 to run it. • Don’t forget to click on the “MicroPython (Raspberry Pi Pico)” interpreter in the bottom right corner.
%s, B: %s, Y: %s"%(mpu.gyro.x, mpu.gyro.y, mpu.gyro.z)) time.sleep(0.1) Note: Hello, welcome to the SunFounder Raspberry Pi & Arduino & ESP32 Enthusiasts Community on Facebook! Dive deeper into Raspberry Pi, Arduino, and ESP32 with fellow enthusiasts. Why Join? • Expert Support: Solve post-sale issues and technical challenges with help from our community and team.
Page 265
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 Wiring 4.40. 6.4 IR Remote Control...
Page 266
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 Code Note: • Open the 6.4_ir_remote_control.py file under the path of euler-kit/micropython or copy this code into Thonny, then click “Run Current Script” or simply press F5 to run it. • Don’t forget to click on the “MicroPython (Raspberry Pi Pico)” interpreter in the bottom right corner.
Page 267
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 (continued from previous page) data 0x16: return "0" data 0x0C: return "1" data 0x18: return "2" data 0x5E: return "3" data 0x08: return "4" data 0x1C: return "5" data 0x5A: return "6"...
Page 268
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 (continued from previous page) ir.error_function(print_error) # Show debug information try: while True: pass except KeyboardInterrupt: ir.close() The new remote control has a plastic piece at the end to isolate the battery inside. You need to pull out this plastic piece to power up the remote when you are using it.
Page 269
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 (continued from previous page) return "5" data 0x5A: return "6" data 0x42: return "7" data 0x52: return "8" data 0x4A: return "9" data 0x09: return "+" data 0x15: return "-" data...
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 Note: Hello, welcome to the SunFounder Raspberry Pi & Arduino & ESP32 Enthusiasts Community on Facebook! Dive deeper into Raspberry Pi, Arduino, and ESP32 with fellow enthusiasts. Why Join? • Expert Support: Solve post-sale issues and technical challenges with help from our community and team.
Page 271
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 Code Here you need to use the libraries in mfrc522 folder, please check if it has been uploaded to Pico, for a detailed tutorial refer to Upload the Libraries to Pico.
Page 272
This function is used to write information to the card, press Enter key to finish writing. text is the information to be written to the card. 7. Funny Project Note: Hello, welcome to the SunFounder Raspberry Pi & Arduino & ESP32 Enthusiasts Community on Facebook! Dive deeper into Raspberry Pi, Arduino, and ESP32 with fellow enthusiasts. Why Join? •...
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 Ready to explore and create with us? Click [] and join today! 4.42 7.1 Light Theremin Theremin is an electronic musical instrument that does not require physical contact. Based on the position of the player’s hand, it produces different tones.
Page 274
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 Before starting the project, wave your hand up and down over the photoresistor to calibrate the range of light intensity. The LED connected in GP16 is used to indicate the debugging time, and the LED is lit to indicate the start of debugging and off to indicate the end of debugging.
Page 275
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 Code Note: • Open the 7.1_light_theremin.py file under the path of euler-kit/micropython or copy this code into Thonny, then click “Run Current Script” or simply press F5 to run it. • Don’t forget to click on the “MicroPython (Raspberry Pi Pico)” interpreter in the bottom right corner.
After five seconds, the LED will turn off, at which point we can wave our hands over the photoresistor and play. Note: Hello, welcome to the SunFounder Raspberry Pi & Arduino & ESP32 Enthusiasts Community on Facebook! Dive deeper into Raspberry Pi, Arduino, and ESP32 with fellow enthusiasts.
Page 277
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 Wiring Code Note: • Open the 7.2_room_temperature_meter.py file under the path of euler-kit/micropython or copy this code into Thonny, then click “Run Current Script” or simply press F5 to run it.
Note: If the code and wiring are fine, but the LCD still does not display content, you can turn the potentiometer on the back to increase the contrast. Note: Hello, welcome to the SunFounder Raspberry Pi & Arduino & ESP32 Enthusiasts Community on Facebook! Dive deeper into Raspberry Pi, Arduino, and ESP32 with fellow enthusiasts.
Page 279
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 • GP17 is connected to the middle pin of the slider, along with a 10K resistor and a capacitor (filter) in parallel to GND, which allows the slider to output a steady high or low level when toggled to the left or right.
Page 280
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 Wiring Code Note: • Open the 7.3_alarm_siren_lamp.py file under the path of euler-kit/micropython or copy this code into Thonny, then click “Run Current Script” or simply press F5 to run it.
Page 281
LED will stop working. Note: Hello, welcome to the SunFounder Raspberry Pi & Arduino & ESP32 Enthusiasts Community on Facebook! Dive deeper into Raspberry Pi, Arduino, and ESP32 with fellow enthusiasts.
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 4.45 7.4 Passager Counter For large shopping malls, shopping centers, chain stores, airports, stations, museums, and public places such as exhi- bition halls, passenger traffic is an indispensable data. In airports and stations, for example, the number of people needs to be strictly controlled to ensure safety and smooth flow.
Page 283
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 • This circuit is based on the with the addition of a PIR module. 5.3 Time Counter • The PIR will send a high signal of about 2.8s long when someone passes by.
Page 284
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 Wiring Code Note: • Open the 7.4_passager_counter.py file under the path of euler-kit/micropython or copy this code into Thonny, then click “Run Current Script” or simply press F5 to run it.
Page 285
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 • For detailed tutorials, please refer to Open and Run Code Directly. import machine import time pir_sensor machine.Pin(16, machine.Pin.IN) SEGCODE [0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f] machine.Pin(18,machine.Pin.OUT) rclk machine.Pin(19,machine.Pin.OUT) srclk machine.Pin(20,machine.Pin.OUT) placePin [10,13,12,11] range(4): placePin.append(None) placePin[i] machine.Pin(pin[i], machine.Pin.OUT)
When the code is run, the number on the 4-digit 7-segment display will be added by one if someone passes in front of the PIR module. Note: Hello, welcome to the SunFounder Raspberry Pi & Arduino & ESP32 Enthusiasts Community on Facebook! Dive deeper into Raspberry Pi, Arduino, and ESP32 with fellow enthusiasts.
Page 287
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 • This circuit is based on with the addition of a tilt switch. 5.3 Time Counter • GP16 is high when the tilt switch is upright; low when tilted. Wiring 4.46. 7.5 GAME - 10 Second...
Page 288
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 Code Note: • Open the 7.5_game_10_second.py file under the path of euler-kit/micropython or copy this code into Thonny, then click “Run Current Script” or simply press F5 to run it. • Don’t forget to click on the “MicroPython (Raspberry Pi Pico)” interpreter in the bottom right corner.
You win if you manage to keep the displayed count at 10.00. The game will continue after one more shake. Note: Hello, welcome to the SunFounder Raspberry Pi & Arduino & ESP32 Enthusiasts Community on Facebook! Dive deeper into Raspberry Pi, Arduino, and ESP32 with fellow enthusiasts.
Page 291
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 • This circuit is based on the with the addition of 3 LEDs. 5.3 Time Counter • The 3 red, yellow and green LEDs are connected to GP7~GP9 respectively. Wiring 4.47. 7.6 Traffic Light...
Page 292
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 Code Note: • Open the 7.6_traffic_light.py file under the path of euler-kit/micropython or copy this code into Thonny, then click “Run Current Script” or simply press F5 to run it. • Don’t forget to click on the “MicroPython (Raspberry Pi Pico)” interpreter in the bottom right corner.
When the code runs, the green LED stays on for 30 seconds, the yellow LED stays on for 5 seconds, and the green LED stays on for 30 seconds. Note: Hello, welcome to the SunFounder Raspberry Pi & Arduino & ESP32 Enthusiasts Community on Facebook! Dive deeper into Raspberry Pi, Arduino, and ESP32 with fellow enthusiasts.
Page 295
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 This circuit is based on with the addition of an I2C LCD1602 to display the pressed keys. 4.2 4x4 Keypad Wiring 4.48. 7.7 Guess Number...
Page 296
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 To make the wiring easier, in the above diagram, the column row of the matrix keyboard and the 10K resistors are inserted into the holes where G10 ~ G13 are located at the same time.
Page 297
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 (continued from previous page) range(4): col.append(None) col[i] machine.Pin(pin[i], machine.Pin.IN) readKey(): range(4): row[i].high() range(4): if(col[j].value() key.append(characters[i][j]) row[i].low() [] : return None else: return # init/reset number # reset the result as False for lcd show...
Page 298
Note: If the code and wiring are fine, but the LCD still does not display content, you can turn the potentiometer on the back to increase the contrast. Note: Hello, welcome to the SunFounder Raspberry Pi & Arduino & ESP32 Enthusiasts Community on Facebook! Dive deeper into Raspberry Pi, Arduino, and ESP32 with fellow enthusiasts.
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 • Learn & Share: Exchange tips and tutorials to enhance your skills. • Exclusive Previews: Get early access to new product announcements and sneak peeks. • Special Discounts: Enjoy exclusive discounts on our newest products.
Page 300
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 Wiring Chapter 4. For MicroPython User...
Page 301
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 Code 1. Open the 6.5_rfid_write.py file under the path of euler-kit/micropython, then click “Run Current Script” or simply press F5 to run it. 2. After running, type EEFGGFEDCCDEEDD EEFGGFEDCCDEDCC in the Shell and then put the card (or key) close to the MFRC522 module, this way an Ode an Joy score is stored in.
Page 302
(or key), and the RGB strip will light up in a random color. Note: Hello, welcome to the SunFounder Raspberry Pi & Arduino & ESP32 Enthusiasts Community on Facebook! Dive deeper into Raspberry Pi, Arduino, and ESP32 with fellow enthusiasts.
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 • Learn & Share: Exchange tips and tutorials to enhance your skills. • Exclusive Previews: Get early access to new product announcements and sneak peeks. • Special Discounts: Enjoy exclusive discounts on our newest products.
Page 304
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 Wiring Code Note: • Open the 7.9_fruit_piano.py file under the path of euler-kit/micropython or copy this code into Thonny, then click “Run Current Script” or simply press F5 to run it.
Page 305
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 (continued from previous page) NOTE_B4 NOTE_C5 NOTE_D5 NOTE_E5 buzzer machine.PWM(machine.Pin(15)) note [NOTE_A3,NOTE_B3,NOTE_C4,NOTE_D4,NOTE_E4,NOTE_F4,NOTE_G4,NOTE_A4,NOTE_B4,NOTE_C5, NOTE_D5,NOTE_E5] tone(pin,frequency): pin.freq(frequency) pin.duty_u16(30000) noTone(pin): pin.duty_u16(0) # rgb led machine.PWM(machine.Pin(13)) green machine.PWM(machine.Pin(12)) blue machine.PWM(machine.Pin(11)) red.freq(1000) green.freq(1000) blue.freq(1000) interval_mapping(x, in_min, in_max, out_min, out_max):...
After the program runs, touch the fruit gently, the buzzer will sound the corresponding tone and the RGB light will flash once randomly. Note: Hello, welcome to the SunFounder Raspberry Pi & Arduino & ESP32 Enthusiasts Community on Facebook! Dive deeper into Raspberry Pi, Arduino, and ESP32 with fellow enthusiasts.
Page 307
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 Wiring 4.51. 7.10 Reversing Aid...
Page 308
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 Code Note: • Open the 7.10_reversing_aid.py file under the path of euler-kit/micropython or copy this code into Thonny, then click “Run Current Script” or simply press F5 to run it. • Don’t forget to click on the “MicroPython (Raspberry Pi Pico)” interpreter in the bottom right corner.
Page 309
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 (continued from previous page) distance(): timeout=10000*5/340 TRIG.low() time.sleep_us(2) TRIG.high() time.sleep_us(10) TRIG.low() timeout_start time.ticks_ms() # For timeout, re-read distance while not ECHO.value(): waiting_time time.ticks_ms() waiting_time timeout_start > timeout: return time1 time.ticks_us() while ECHO.value():...
• To avoid interfering with the LED or buzzer timing, we created a separate thread for ranging in this example. Note: Hello, welcome to the SunFounder Raspberry Pi & Arduino & ESP32 Enthusiasts Community on Facebook! Dive deeper into Raspberry Pi, Arduino, and ESP32 with fellow enthusiasts.
Page 311
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 The MPU6050 calculates the attitude angle based on the acceleration values in each direction. The program will control the servo to make the corresponding deflection angle as the attitude angle changes.
Page 312
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 Code Note: • Open the 7.11_somatosensory_controller.py file under the path of euler-kit/micropython or copy this code into Thonny, then click “Run Current Script” or simply press F5 to run it. • Don’t forget to click on the “MicroPython (Raspberry Pi Pico)” interpreter in the bottom right corner.
Page 313
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 • For detailed tutorials, please refer to Open and Run Code Directly. • Here you need to use the imu.py and vector3d.py, please check if it has been uploaded to Pico, for a detailed...
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 Note: Hello, welcome to the SunFounder Raspberry Pi & Arduino & ESP32 Enthusiasts Community on Facebook! Dive deeper into Raspberry Pi, Arduino, and ESP32 with fellow enthusiasts. Why Join? • Expert Support: Solve post-sale issues and technical challenges with help from our community and team.
Page 315
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 The MPU6050 takes the acceleration values in each direction and calculates the attitude angle. As a result, the program draws a 2x2 dot on the dot matrix based on data from the two 74HC595 chips.
Page 316
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 Code Note: • Open the 7.12_digital_bubble_level.py file under the path of euler-kit/micropython or copy this code into Thonny, then click “Run Current Script” or simply press F5 to run it. • Don’t forget to click on the “MicroPython (Raspberry Pi Pico)” interpreter in the bottom right corner.
Page 318
(if it isn’t in the center, the MPU6050 may not be level). When you deflect the breadboard, the dot will move in the direction you deflected. Note: Hello, welcome to the SunFounder Raspberry Pi & Arduino & ESP32 Enthusiasts Community on Facebook! Dive deeper into Raspberry Pi, Arduino, and ESP32 with fellow enthusiasts.
FIVE PLAY PICO WITH APP This section will guide you through building a remote project using the Sunfounder Controller APP, which means you can use your phone/tablet to control your circuit. This play is based on micropython and it is recommended to do it after completing the micropython tutorial.
Page 320
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 2. Upload the library. Reference to download the code and upload the library. But in 1.4 Download and Upload the Code this project, you need to upload ws.py from the euler-kit/esp8266/ path to the Raspberry Pi Pico.
Page 321
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 3. Run 1.1_ws_test.py file. Double click the 1.1_ws_test.py file under the euler-kit/esp8266/ path, then click run cur- rent script button or just press F5 to run it. After running the program, you will see the IP address and the start prompt in the Shell.
Page 322
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 4. Connect to ESP8266. Find my_esp8266 on the WLAN of the mobile phone (tablet), enter the password (12345678) and connect to it. The default used in 1.1_ws_test.py is mode. So after you connect, there will be a prompt telling...
Page 323
Internet access on this WLAN network, please choose to continue connecting. 5. Install Sunfounder Controller. Search for Sunfounder Controller in APP Store (or Google Play) and download it. 6. Connect to SunFounder Controller. Now open SunFounder Controller and click Disconnected in the upper right corner.
Page 324
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 Because it is AP mode, it will connect automatically here. Note: If the connection has not been successful, please make sure the 1.1_ws_test.py file is running properly and connect your device’s Wi-Fi to my_esp8266.
Page 325
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 (continued from previous page) Connected from 192.168.4.3 7. Create a controller. Click the + button in the middle of the page, then the Create controller page will pop up. Enter the name of the controller, select Blank ->...
Page 326
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 Click on area H and sclect the Slider widget. 8. Save and Run the controller. Click the Save/Edit button and the controller will be saved. At the same time it enters the working state, and the empty widget box is hidden.
3. If the connection has not been successful, or suddenly disconnect.please make sure the 1.1_ws_test.py file is running properly and your mobile device is connected to my_esp8266. Note: Hello, welcome to the SunFounder Raspberry Pi & Arduino & ESP32 Enthusiasts Community on Facebook! Dive deeper into Raspberry Pi, Arduino, and ESP32 with fellow enthusiasts.
Page 328
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 from import WS_Server import json import time NAME my_esp8266 ## Client Mode # WIFI_MODE = "sta" # SSID = "YOUR SSID HERE" # PASSWORD = "YOUR PASSWORD HERE" (continues on next page)
Page 329
This code constitutes the basic framework of APP control. Here, you need to pay attention to the following two parts: 1. Setup websocket There are two connection mode between Sunfounder Controller and Pico: One is AP mode, the other is STA mode.
Page 330
2. Responding The specific operation code of Pico and Sunfounder Controller is written on the on_receive() func- tion. Usually, we need to write the codes for APP to control Pico on the front and the codes for APP to show Pico sensor data on the back.
Finally, on_receive() will be assigned to ws.on_receive and then called by ws.loop. Note: Hello, welcome to the SunFounder Raspberry Pi & Arduino & ESP32 Enthusiasts Community on Facebook! Dive deeper into Raspberry Pi, Arduino, and ESP32 with fellow enthusiasts.
Page 332
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 (continued from previous page) ## AP Mode WIFI_MODE "ap" SSID "" PASSWORD "12345678" WS_Server(name=NAME, mode=WIFI_MODE, ssid=SSID, password=PASSWORD) ws.start() on_receive(data): print(data) # output # input ws.on_receive on_receive main(): print("start") while True: ws.loop() main() You will see the data for each area in the Shell.
Page 333
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 We can also add other control widgets, and use the same method to view the values sent by these widgets to Pico. You can get the value of the corresponding widget by just using the label. As shown below, print the...
Page 334
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 (continued from previous page) ## AP Mode WIFI_MODE "ap" SSID "" PASSWORD "12345678" WS_Server(name=NAME, mode=WIFI_MODE, ssid=SSID, password=PASSWORD) ws.start() on_receive(data): print(data[ # output # input ws.on_receive on_receive main(): print("start") while True: ws.loop() main() >>>...
Page 335
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 from import WS_Server import json import time NAME my_esp8266 ## Client Mode # WIFI_MODE = "sta" # SSID = "YOUR SSID HERE" # PASSWORD = "YOUR PASSWORD HERE" ## AP Mode WIFI_MODE "ap"...
Page 336
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 • Show Widgets Chapter 5. Play Pico with APP...
Page 337
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 Note: Hello, welcome to the SunFounder Raspberry Pi & Arduino & ESP32 Enthusiasts Community on Facebook! Dive deeper into Raspberry Pi, Arduino, and ESP32 with fellow enthusiasts. Why Join? • Expert Support: Solve post-sale issues and technical challenges with help from our community and team.
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 5.4 1.4 APP Display Widgets 1. Build the circuit. 2. Create a new controller and add the following widgets. Chapter 5. Play Pico with APP...
Page 339
Open and Run Code Directly. 4. Each time you rerun the code, you need to connect your device’s Wi-Fi to my_esp8266, then turn on SunFounder Controller and reconnect. 5. After clicking the Run/Stop button, you can try to press a button or rotate a potentiometer and see how the values of the widgets in area B and area C on the app change.
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 Note: Hello, welcome to the SunFounder Raspberry Pi & Arduino & ESP32 Enthusiasts Community on Facebook! Dive deeper into Raspberry Pi, Arduino, and ESP32 with fellow enthusiasts. Why Join? • Expert Support: Solve post-sale issues and technical challenges with help from our community and team.
Page 341
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 3. Each time you rerun the code, you need to connect your device’s Wi-Fi to my_esp8266, then turn on SunFounder Controller and reconnect. 4. After clicking the Run/Stop button, you can try to toggle these widgets and you can see the corresponding value changes in the Thonny shell.
Page 342
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 Note: Hello, welcome to the SunFounder Raspberry Pi & Arduino & ESP32 Enthusiasts Community on Facebook! Chapter 5. Play Pico with APP...
Ready to explore and create with us? Click [] and join today! 5.6 1.6 Electronic Piano In this project, we use the button widget on the SunFounder Controller as the piano keys and connect a passive buzzer to the Pico to simulate an electronic piano.
Page 344
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 3. Add a Button widget to the G area, and click the Set button in the upper right corner to change the name. 4. Add a Slider widget to the H area and set its name, maximum, minimum and initial value.
Page 345
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 5. Add a Button widget in NOPSMQR area and change their names to note C ~ note B respectively. 6. After saving, the effect of the remote control is shown below.
Page 346
• For detailed tutorials, please refer to Open and Run Code Directly. 8. Each time you rerun the code, you need to connect your device’s Wi-Fi to my_esp8266, then turn on SunFounder Controller and reconnect. 9. Now, click the Run/Stop button in the upper right corner.
Page 347
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 (continued from previous page) #melody NOTE_C4 NOTE_G3 NOTE_A3 NOTE_B3 melody =[NOTE_C4,NOTE_G3,NOTE_G3,NOTE_A3,NOTE_G3,NOTE_B3,NOTE_C4] Define the frequency of CDEFGAB and a melody here. light_led(): global brightness brightness 65535 led.duty_u16(brightness) The light_led() function is used to let the LED display the maximum brightness(65535).
Page 348
• piano: When the buttons in NOPSMQR area are pressed separately, the passive buzzer will play different notes. Note: Hello, welcome to the SunFounder Raspberry Pi & Arduino & ESP32 Enthusiasts Community on Facebook! Dive deeper into Raspberry Pi, Arduino, and ESP32 with fellow enthusiasts.
This is a smart watering system, it will detect the current temperature and humidity of the environment and show them on the SunFounder Controller. When you press the pump button on the APP, it will replenish water for the plants.
Page 350
Open and Run Code Directly. 4. Each time you rerun the code, you need to connect your device’s Wi-Fi to my_esp8266, then turn on SunFounder Controller and reconnect. 5. After clicking the Run/Stop button in the upper right corner. You will see the current temperature, humidity and water level value on the SunFounder controller.
Page 351
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 water for the plants. Note: • If the motor is still spinning after you click the Stop button, you need to reset the RUN pin on the Pico with a wire to GND at this time, and then unplug this wire to run the code again.
Page 352
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 (continued from previous page) motor1A.low() motor2A.low() ws.on_receive on_receive Here, the on_receive() function can be divided into 3 parts. • start pumping: When the button in area G is pressed, let the pump start working.
Page 353
3. Set it name to main.py, this way the Raspberry Pi Pico will run this code automatically. Note: Hello, welcome to the SunFounder Raspberry Pi & Arduino & ESP32 Enthusiasts Community on Facebook! Dive deeper into Raspberry Pi, Arduino, and ESP32 with fellow enthusiasts.
Page 354
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 Ready to explore and create with us? Click [] and join today! Chapter 5. Play Pico with APP...
We recommend that you read the chapters in order. 1. Get Started Note: Hello, welcome to the SunFounder Raspberry Pi & Arduino & ESP32 Enthusiasts Community on Facebook! Dive deeper into Raspberry Pi, Arduino, and ESP32 with fellow enthusiasts. Why Join? •...
Page 356
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 Introduction the Arduino Software (IDE) Double-click the Arduino icon (arduino.exe) created by the installation process. Then the Arduino IDE will appear. Let’s check details of the software. Chapter 6. For Arduino User...
Page 357
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 1. Verify: Compile your code. Any syntax problem will be prompted with errors. 2. Upload: Upload the code to your board. When you click the button, the RX and TX LEDs on the board will flicker fast and won’t stop until the upload is done.
Tools -> Board / Port if any is incorrect. 15. The editing area of the IDE. You can write code here. Note: Hello, welcome to the SunFounder Raspberry Pi & Arduino & ESP32 Enthusiasts Community on Facebook! Dive deeper into Raspberry Pi, Arduino, and ESP32 with fellow enthusiasts.
Page 359
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 2. Search for Pico and click install button. 3. Once the installation is complete, you can select the board as Raspberry Pi Pico. 6.2. 1.2 Setup the Raspberry Pi Pico...
Page 360
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 4. Now open a example - blink. 5. Click on the upload icon to run the code Chapter 6. For Arduino User...
Page 361
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 6. When the compiling message shown in the figure below appears, press BOOTSEL immediately and connect Pico to the computer with a Micro USB cable. 6.2. 1.2 Setup the Raspberry Pi Pico...
7. After the Done Uploading appear, you will see the LED on the Pico blinking. Note: Hello, welcome to the SunFounder Raspberry Pi & Arduino & ESP32 Enthusiasts Community on Facebook! Dive deeper into Raspberry Pi, Arduino, and ESP32 with fellow enthusiasts.
Page 363
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 6.3.1 Add libraries A library, gathering some function definitions and header files, usually contains two files: .h (header file, including function statement, Macro definition, constructor definition, etc.) and .cpp (execution file, with function implementa- tion, variable definition, and so on).
Page 364
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 Step 3: When you see Library added to your libraries. Check “Include library” menu, it means you have added the library successfully. Please use the same method to add other libraries then.
Step 4: Paste all the libraries copied before to the folder. Then you can see them in libraries folder. Note: Hello, welcome to the SunFounder Raspberry Pi & Arduino & ESP32 Enthusiasts Community on Facebook! Dive deeper into Raspberry Pi, Arduino, and ESP32 with fellow enthusiasts.
Page 366
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 6.4.1 Open & Run Code Directly 1. Open Code For example, 2.1_hello_led.ino. Double click on it. 2. Select the board as Raspberry Pi Pico. 3. Click on the upload icon to run the code...
4. After the Done Uploading appear, you will see the LED blinking. 2. Output & input Note: Hello, welcome to the SunFounder Raspberry Pi & Arduino & ESP32 Enthusiasts Community on Facebook! Dive deeper into Raspberry Pi, Arduino, and ESP32 with fellow enthusiasts.
Page 368
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 Let us follow the direction of the current to build the circuit! 1. Here we use the electrical signal from the GP15 pin of the Pico board to make the LED work, and the circuit starts from here.
Page 369
An interval between on and off is required to allow people to see the change, so we use a delay(1000) code to let the controller do nothing for 1000 ms. delay(1000); Note: Hello, welcome to the SunFounder Raspberry Pi & Arduino & ESP32 Enthusiasts Community on Facebook! Dive deeper into Raspberry Pi, Arduino, and ESP32 with fellow enthusiasts. Why Join? •...
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 6.6 2.2 - Display the Level The first project is simply to make the LED blink. In this project let’s use the LED Bar Graph, which is made up of 10 LEDs packaged into a plastic case, generally used to display power or volume levels.
Page 371
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 The LED Bar Graph contains 10 LEDs, each of which is individually controllable. Here, the anode of each of the 10 LEDs is connected to GP6~GP15, and the cathode is connected to a 220ohm resistor, and then to GND.
Page 372
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 Code Note: • You can open the file 2.2_display_the_level.ino under the path of euler-kit/arduino/2. 2_display_the_level. • Or copy this code into Arduino IDE. • For detailed tutorials, please refer to Open & Run Code Directly.
Note: Hello, welcome to the SunFounder Raspberry Pi & Arduino & ESP32 Enthusiasts Community on Facebook! Dive deeper into Raspberry Pi, Arduino, and ESP32 with fellow enthusiasts. Why Join? • Expert Support: Solve post-sale issues and technical challenges with help from our community and team.
Page 374
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 Each GPIO pin of Pico supports PWM, but it actually has a total of 16 independent PWM outputs (instead of 30), distributed between GP0 to GP15 on the left, and the PWM output of the right GPIO is equivalent to the left copy.
Page 375
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 Code Note: • You can open the file 2.3_fading_led.ino under the path of euler-kit/arduino/2.3_fading_led. • Or copy this code into Arduino IDE. • For detailed tutorials, please refer to Open & Run Code Directly.
5) { analogWrite(ledPin, value); delay(30); Note: Hello, welcome to the SunFounder Raspberry Pi & Arduino & ESP32 Enthusiasts Community on Facebook! Dive deeper into Raspberry Pi, Arduino, and ESP32 with fellow enthusiasts. Why Join? • Expert Support: Solve post-sale issues and technical challenges with help from our community and team.
Page 377
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 The PWM pins GP13, GP14 and GP15 control the Red, Green and Blue pins of the RGB LED respectively, and connect the common cathode pin to GND. This allows the RGB LED to display a specific color by superimposing light on these pins with different PWM values.
Page 378
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 Code Here, we can choose our favorite color in drawing software (such as paint) and display it with RGB LED. Note: • You can open the file 2.4_colorful_light.ino under the path of euler-kit/arduino/2.
Page 379
0, 255); blue delay(1000); Note: Hello, welcome to the SunFounder Raspberry Pi & Arduino & ESP32 Enthusiasts Community on Facebook! Dive deeper into Raspberry Pi, Arduino, and ESP32 with fellow enthusiasts. Why Join? • Expert Support: Solve post-sale issues and technical challenges with help from our community and team.
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 • Learn & Share: Exchange tips and tutorials to enhance your skills. • Exclusive Previews: Get early access to new product announcements and sneak peeks. • Special Discounts: Enjoy exclusive discounts on our newest products.
Page 381
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 Note: We can think of the four-legged button as an H-shaped button. Its left (right) two feet are connected, which means that after it straddles the central dividing line, it will connect the two half rows of the same row number together.
Page 382
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 Now, when you press the button, the Serial Monitor will print “You pressed the button!”. How it works? To enable Serial Monitor, you need to start serial communication in setup() and set the datarate to 9600.
Page 383
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 Serial.begin(115200); • Serial For button, we need to set their mode to INPUT in order to be able to get their values. pinMode(buttonPin, INPUT); Read the status of the buttonPin in loop() and assign it to the variable buttonState.
So just change this code to if (buttonState == LOW). Note: Hello, welcome to the SunFounder Raspberry Pi & Arduino & ESP32 Enthusiasts Community on Facebook! Dive deeper into Raspberry Pi, Arduino, and ESP32 with fellow enthusiasts.
Page 385
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 When you put it upright, GP14 will get high; after tilting it, GP14 will get low. The purpose of the 10K resistor is to keep the GP14 in a stable low state when the tilt switch is in a tilted state.
After the program runs, when you tilt the breadboard (tilt switch), “The switch works!” will appear in the shell. Note: Hello, welcome to the SunFounder Raspberry Pi & Arduino & ESP32 Enthusiasts Community on Facebook! Dive deeper into Raspberry Pi, Arduino, and ESP32 with fellow enthusiasts.
Page 387
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 GP14 will get a different level, when you toggle the slide switch to the right or left. The purpose of the 10K resistor is to keep the GP14 low during toggling (not toggling to the far left and not toggling to the far right).
When the program is running, the serial monitor will show “ON” or “OFF” when you toggle the switch to the left or right. Note: Hello, welcome to the SunFounder Raspberry Pi & Arduino & ESP32 Enthusiasts Community on Facebook! Dive deeper into Raspberry Pi, Arduino, and ESP32 with fellow enthusiasts.
Page 389
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 When the micro switch is not pressed, 1 (C) and 3 (NC) are connected together, when pressed 1 (C) and 2 (NO) are connected together. • Micro Switch Schematic By default, GP14 is low and when pressed, GP14 is high.
Page 390
After the program runs, when you toggle the slide switch to the right, “The switch works!” will appear in the Serial Monitor. Note: Hello, welcome to the SunFounder Raspberry Pi & Arduino & ESP32 Enthusiasts Community on Facebook! Dive deeper into Raspberry Pi, Arduino, and ESP32 with fellow enthusiasts.
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 6.13 2.9 - Feel the Magnetism The most common type of reed switch contains a pair of magnetizable, flexible, metal reeds whose end portions are separated by a small gap when the switch is open.
Page 392
When a magnet approaches, the circuit will be closed. Just like the button in the chapter. 2.5 - Reading Button Value Note: Hello, welcome to the SunFounder Raspberry Pi & Arduino & ESP32 Enthusiasts Community on Facebook! Dive deeper into Raspberry Pi, Arduino, and ESP32 with fellow enthusiasts. Why Join? •...
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 • Festive Promotions and Giveaways: Take part in giveaways and holiday promotions. Ready to explore and create with us? Click [] and join today! 6.14 2.10 - Detect Human Movement Passive infrared sensor (PIR sensor) is a common sensor that can measure infrared (IR) light emitted by objects in its field of view.
Page 394
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 Code Note: • You can open the file 2.10_detect_human_movement.ino under the path of euler-kit/arduino/2. 10_detect_human_movement. • Or copy this code into Arduino IDE. • For detailed tutorials, please refer to Open & Run Code Directly.
Page 395
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 the 2 potentiometers facing you, turn both potentiometers counterclockwise to the end and insert the jumper cap on the pin with L and the middle pin. 1. Trigger Mode Let’s take a look at the pins with jumper cap at the corner. It allows PIR to enter Repeatable trigger...
0-3 meters. Note: Hello, welcome to the SunFounder Raspberry Pi & Arduino & ESP32 Enthusiasts Community on Facebook! Dive deeper into Raspberry Pi, Arduino, and ESP32 with fellow enthusiasts.
Page 397
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 Pico has three GPIO pins that can use analog input, GP26, GP27, GP28. That is, analog channels 0, 1, and 2. In addition, there is a fourth analog channel, which is connected to the built-in temperature sensor and will not be introduced here.
Page 398
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 The potentiometer is an analog device and when you turn it in 2 different directions. Connect the middle pin of the potentiometer to the analog pin GP28. The Raspberry Pi Pico contains a multi-channel, 16-bit analog-to-digital converter.
Page 399
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 Code Note: • You can open the file 2.11_turn_the_knob.ino under the path of euler-kit/arduino/2. 11_turn_the_knob. • Or copy this code into Arduino IDE. • For detailed tutorials, please refer to Open & Run Code Directly.
Page 400
• Now we can use this value to control the brightness of the LED. analogWrite(ledPin,brightness); Note: Hello, welcome to the SunFounder Raspberry Pi & Arduino & ESP32 Enthusiasts Community on Facebook! Dive deeper into Raspberry Pi, Arduino, and ESP32 with fellow enthusiasts.
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 6.16 2.12 - Feel the Light The photoresistor is a typical device for analog inputs and it is used in a very similar way to a potentiometer. Its resistance value depends on the intensity of the light, the stronger the irradiated light, the smaller its resistance value;...
Page 402
After the program runs, the Serial Monitor prints out the photoresistor values. You can shine a flashlight on it or cover it up with your hand to see how the value will change. Note: Hello, welcome to the SunFounder Raspberry Pi & Arduino & ESP32 Enthusiasts Community on Facebook! Dive deeper into Raspberry Pi, Arduino, and ESP32 with fellow enthusiasts.
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 • Festive Promotions and Giveaways: Take part in giveaways and holiday promotions. Ready to explore and create with us? Click [] and join today! 6.17 2.13 - Thermometer A thermometer is a device that measures temperature or a temperature gradient (the degree of hotness or coldness of an object).
Page 404
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 Note: • The thermistor is black and marked 103. • The color ring of the 10K ohm resistor is red, black, black, red and brown. Code Note: • You can open the file 2.13_thermometer.ino under the path of euler-kit/arduino/2.13_thermometer.
Page 405
This code refers to plugging Rt into the formula TK=1/(ln(RT/RN)/B+1/TN) to get Kelvin temperature. Note: Hello, welcome to the SunFounder Raspberry Pi & Arduino & ESP32 Enthusiasts Community on Facebook! Dive deeper into Raspberry Pi, Arduino, and ESP32 with fellow enthusiasts.
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 6.18 2.14 - Feel the Water Level Water sensor is designed for water detection, which can be widely used in sensing rainfall, water level, and even liquid leakage. It measures the water level by having a series of exposed parallel wire traces to measure the size of the water drops/volume.
Page 407
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 Code Note: • You can open the file 2.14_feel_the_water_level.ino under the path of euler-kit/arduino/2. 14_feel_the_water_level. • Or copy this code into Arduino IDE. • For detailed tutorials, please refer to Open & Run Code Directly.
Don’t forget to select the Raspberry Pi Pico board and the correct port before clicking the Upload button. Note: Hello, welcome to the SunFounder Raspberry Pi & Arduino & ESP32 Enthusiasts Community on Facebook! Dive deeper into Raspberry Pi, Arduino, and ESP32 with fellow enthusiasts.
Page 409
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 Let’s use LED and button to understand how to use transistor! Transistor Way to connect NPN (S8050) transistor In this circuit, when the button is pressed, GP14 is high. By programming GP15 to output high, after a 1k current limiting resistor (to protect the transistor), the S8050 (NPN transistor) is allowed to conduct, thus allowing the LED to light up.
Page 410
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 Way to connect PNP(S8550) transistor In this circuit, GP14 is low by the default and will change to high when the button is pressed. Chapter 6. For Arduino User...
Page 411
• The circuit that uses the S8550 (PNP transistor) will light up when it is released, which means it is receiving a low-level conduction circuit. Note: Hello, welcome to the SunFounder Raspberry Pi & Arduino & ESP32 Enthusiasts Community on Facebook! Dive deeper into Raspberry Pi, Arduino, and ESP32 with fellow enthusiasts.
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 Why Join? • Expert Support: Solve post-sale issues and technical challenges with help from our community and team. • Learn & Share: Exchange tips and tutorials to enhance your skills. • Exclusive Previews: Get early access to new product announcements and sneak peeks.
Page 413
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 6.20. 2.16 - Control Another Circuit...
Page 414
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 A diode (continuity diode) is used here to protect the circuit. The cathode is the end with the silver ribbon connected to the power supply, and the anode is connected to the transistor.
Page 415
By switching one end of the load circuit from pin 3 to pin 4, you will be able to get exactly the opposite operating state. 3. Sound & Display & Movement Note: Hello, welcome to the SunFounder Raspberry Pi & Arduino & ESP32 Enthusiasts Community on Facebook! Dive deeper into Raspberry Pi, Arduino, and ESP32 with fellow enthusiasts.
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 6.21 3.1 - Beep The active buzzer is a typical digital output device that is as easy to use as lighting up an LED! • Buzzer Schematic When the GP15 output is high, after the 1K current limiting resistor (to protect the transistor), the S8050 (NPN tran- sistor) will conduct, so that the buzzer will sound.
Page 417
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 The buzzer needs to use a transistor when working, here we use S8050 (NPN Transistor). Code Note: • You can open the file 3.1_beep.ino under the path of euler-kit/arduino/3.1_beep. • Or copy this code into Arduino IDE.
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 After the code runs, you will hear a beep every second. Note: Hello, welcome to the SunFounder Raspberry Pi & Arduino & ESP32 Enthusiasts Community on Facebook! Dive deeper into Raspberry Pi, Arduino, and ESP32 with fellow enthusiasts.
Page 419
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 When the GP15 output is high, after the 1K current limiting resistor (to protect the transistor), the S8050 (NPN tran- sistor) will conduct, so that the buzzer will sound. The role of S8050 (NPN transistor) is to amplify the current and make the buzzer sound louder. In fact, you can also connect the buzzer directly to GP15, but you will find that the buzzer sound is smaller.
Page 420
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 Code Note: • You can open the file 3.2_custom_tone.ino under the path of euler-kit/arduino/3.2_custom_tone. • Or copy this code into Arduino IDE. • For detailed tutorials, please refer to Open & Run Code Directly.
Don’t forget to select the Raspberry Pi Pico board and the correct port before clicking the Upload button. Note: Hello, welcome to the SunFounder Raspberry Pi & Arduino & ESP32 Enthusiasts Community on Facebook! Dive deeper into Raspberry Pi, Arduino, and ESP32 with fellow enthusiasts.
Page 422
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 Wiring Warning: One thing you need to pay attention to is current. Although the LED Strip with any number of LEDs can be used in Pico, the power of its VBUS pin is limited. Here, we will use eight LEDs, which are safe.
Page 423
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 Let’s select some favorite colors and display them on the RGB LED Strip! How it works? Declare a Adafruit_NeoPixel type object, it is connected to PIXEL_PIN, there are PIXEL_COUNT RGB LEDs on the strip.
RGB-compatible functions. • strip.gamma32() : Provides a “truer” color before assigning to each pixel. Note: Hello, welcome to the SunFounder Raspberry Pi & Arduino & ESP32 Enthusiasts Community on Facebook! Dive deeper into Raspberry Pi, Arduino, and ESP32 with fellow enthusiasts.
Page 425
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 Here we will use the I2C0 interface to control the LCD1602 and display text. Schematic Wiring 6.24. 3.4 - Liquid Crystal Display...
Page 426
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 Code Note: • You can open the file 3.4_liquid_crystal_display.ino under the path of euler-kit/arduino/3. 4_liquid_crystal_display. • Or copy this code into Arduino IDE. • For detailed tutorials, please refer to Open & Run Code Directly.
Page 427
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 lcd_AddR: The address of the LCD defaults to 0x27. lcd_cols: The LCD1602 has 16 columns. lcd_rows: The LCD1602 has 2 rows. void init() Initialize the lcd. void backlight() Turn the (optional) backlight on.
LCD • Serial Read Note: Hello, welcome to the SunFounder Raspberry Pi & Arduino & ESP32 Enthusiasts Community on Facebook! Dive deeper into Raspberry Pi, Arduino, and ESP32 with fellow enthusiasts. Why Join? • Expert Support: Solve post-sale issues and technical challenges with help from our community and team.
Page 429
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 In this circuit, you will see that the button is connected to the RUN pin. This is because the motor is operating with too much current, which may cause the Pico to disconnect from the computer, and the button needs to be pressed (for the Pico’s RUN pin to receive a low level) to reset.
Page 430
• This is because the motor is operating with too much current, which may cause the Pico to disconnect from the computer. Note: Hello, welcome to the SunFounder Raspberry Pi & Arduino & ESP32 Enthusiasts Community on Facebook! Dive deeper into Raspberry Pi, Arduino, and ESP32 with fellow enthusiasts.
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 Ready to explore and create with us? Click [] and join today! 6.26 3.6 - Pumping Small centrifugal pumps are suitable for projects with automatic plant watering. It can also be used to make tiny smart water features.
Page 432
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 In this circuit, you will see that the button is connected to the RUN pin. This is because the motor is operating with too much current, which may cause the Pico to disconnect from the computer, and the button needs to be pressed (for the Pico’s RUN pin to receive a low level) to reset.
Page 433
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 Code Note: • You can open the file 3.6_pumping.ino under the path of euler-kit/arduino/3.6_pumping. • Or copy this code into Arduino IDE. • For detailed tutorials, please refer to Open & Run Code Directly.
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 Note: Hello, welcome to the SunFounder Raspberry Pi & Arduino & ESP32 Enthusiasts Community on Facebook! Dive deeper into Raspberry Pi, Arduino, and ESP32 with fellow enthusiasts. Why Join? • Expert Support: Solve post-sale issues and technical challenges with help from our community and team.
Page 435
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 • Orange wire is signal and connected to GP15. • Red wire is VCC and connected to VBUS(5V). • Brown wire is GND and connected to GND. Code 6.27. 3.7 - Swinging Servo...
Page 436
Return 1 if the servo is currently attached. 4. Controller Note: Hello, welcome to the SunFounder Raspberry Pi & Arduino & ESP32 Enthusiasts Community on Facebook! Dive deeper into Raspberry Pi, Arduino, and ESP32 with fellow enthusiasts. Why Join? •...
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 • Special Discounts: Enjoy exclusive discounts on our newest products. • Festive Promotions and Giveaways: Take part in giveaways and holiday promotions. Ready to explore and create with us? Click [] and join today! 6.28 4.1 - Toggle the Joystick...
Page 438
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 Code Note: • You can open the file 4.1_toggle_the_joyostick.ino under the path of euler-kit/arduino/4. 1_toggle_the_joyostick. • Or copy this code into Arduino IDE. • For detailed tutorials, please refer to Open & Run Code Directly.
• The Z-axis is a digital value with a status of 1 or 0. Note: Hello, welcome to the SunFounder Raspberry Pi & Arduino & ESP32 Enthusiasts Community on Facebook! Dive deeper into Raspberry Pi, Arduino, and ESP32 with fellow enthusiasts.
Page 440
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 4 pull-down resistors are connected to each of the columns of the matrix keyboard, so that G6 ~ G9 get a stable low level when the keys are not pressed. The rows of the keyboard (G2 ~ G5) are programmed to go high; if one of G6 ~ G9 is read high, then we know which key is pressed.
Page 441
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 To make the wiring easier, in the above diagram, the column row of the matrix keyboard and the 10K resistors are inserted into the holes where G6 ~ G9 are located at the same time.
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 Note: Hello, welcome to the SunFounder Raspberry Pi & Arduino & ESP32 Enthusiasts Community on Facebook! Dive deeper into Raspberry Pi, Arduino, and ESP32 with fellow enthusiasts. Why Join? • Expert Support: Solve post-sale issues and technical challenges with help from our community and team.
Page 443
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 Code Note: • You can open the file 4.3_electrode_keyboard.ino under the path of euler-kit/arduino/4. 3_electrode_keyboard. • Or copy this code into Arduino IDE. • For detailed tutorials, please refer to Open & Run Code Directly.
Page 444
Serial.print(touchStates[i]); Serial.println(); 5. Microchip Note: Hello, welcome to the SunFounder Raspberry Pi & Arduino & ESP32 Enthusiasts Community on Facebook! Dive deeper into Raspberry Pi, Arduino, and ESP32 with fellow enthusiasts. Why Join? • Expert Support: Solve post-sale issues and technical challenges with help from our community and team.
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 Ready to explore and create with us? Click [] and join today! 6.31 5.1 - Microchip - 74HC595 Integrated circuit (integrated circuit) is a kind of miniature electronic device or component, which is represented by the letter “IC”...
Page 446
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 • When MR (pin10) is high level and OE (pin13) is low level, data is input in the rising edge of SHcp and goes to the memory register through the rising edge of SHcp.
(Q0-Q7). For example, shiftout B00000001 will light up the LED controlled by Q0 and turn off the LED controlled by Q1~Q7. Note: Hello, welcome to the SunFounder Raspberry Pi & Arduino & ESP32 Enthusiasts Community on Facebook! Dive deeper into Raspberry Pi, Arduino, and ESP32 with fellow enthusiasts.
Page 448
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 This means that it needs to be controlled by 8 digital signals at the same time to fully work and the 74HC595 can do this. • 7-segment Display Schematic Chapter 6. For Arduino User...
Page 449
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 Wiring Table 1: Wiring 74HC595 LED Segment Display Code Note: • You can open the file 5.2_number_display.ino under the path of euler-kit/arduino/5. 2_number_display. • Or copy this code into Arduino IDE.
Page 450
Write these codes into shiftOut() to make the LED Segment Display display the corresponding numbers. Note: Hello, welcome to the SunFounder Raspberry Pi & Arduino & ESP32 Enthusiasts Community on Facebook! Dive deeper into Raspberry Pi, Arduino, and ESP32 with fellow enthusiasts.
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 6.33 5.3 - Time Counter 4-Digit 7-segment display consists of four 7- segment displays working together. The 4-digtal 7-segment display works independently. It uses the principle of human visual persistence to quickly display the characters of each 7-segment in a loop to form continuous strings.
Page 452
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 Code Note: • You can open the file 5.3_time_counter.ino under the path of euler-kit/arduino/5.3_time_counter. • Or copy this code into Arduino IDE. • For detailed tutorials, please refer to Open & Run Code Directly.
Page 453
Finally, convert this time value and let the 4-digit 7-segment display to display it. • millis() Note: Hello, welcome to the SunFounder Raspberry Pi & Arduino & ESP32 Enthusiasts Community on Facebook! 6.33. 5.3 - Time Counter...
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 Dive deeper into Raspberry Pi, Arduino, and ESP32 with fellow enthusiasts. Why Join? • Expert Support: Solve post-sale issues and technical challenges with help from our community and team. • Learn & Share: Exchange tips and tutorials to enhance your skills.
Page 455
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 The 8x8 dot matrix is controlled by two 74HC595 chips, one controlling the rows and one controlling the columns, while these two chips share G18~G20, which can greatly save the I/O ports of the Pico board.
Page 456
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 Step 2: Connect pin 11 of the two 74HC595 together, and then to GP20; then pin 12 of the two chips, and to GP19; next, pin 14 of the 74HC595 on the left side to GP18 and pin 9 to pin 14 of the second 74HC595.
Page 457
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 Step 4: Now connect the ROWs of the LED dot matrix. The 74HC595 on the left controls ROW of the LED dot matrix. See the table below for the mapping. We can see, Q0-Q7 of the 74HC595 on the left are mapped with pin 9, 14, 8, 12, 1, 7, 2, and 5 respectively.
Page 458
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 Code Note: • You can open the file 5.4_8x8_pixel_graphics.ino under the path of euler-kit/arduino/5. 4_8x8_pixel_graphics. • Or copy this code into Arduino IDE. • For detailed tutorials, please refer to Open & Run Code Directly.
Page 459
{0xFF,0xFF,0xF7,0xEB,0xDF,0xBF,0xFF,0xFF}; Or, you can try drawing your own graphics. 6. Advanced Note: Hello, welcome to the SunFounder Raspberry Pi & Arduino & ESP32 Enthusiasts Community on Facebook! Dive deeper into Raspberry Pi, Arduino, and ESP32 with fellow enthusiasts. Why Join? •...
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 6.35 6.1 - Measuring Distance The ultrasonic sensor module works on the principle of sonar and radar systems for determining the distance to an object. • Ultrasonic Module Schematic Wiring Chapter 6. For Arduino User...
Page 461
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 Code Note: • You can open the file 6.1_ultrasonic.ino under the path of euler-kit/arduino/6.1_ultrasonic. • Or copy this code into Arduino IDE. • For detailed tutorials, please refer to Open & Run Code Directly.
Note that the ultrasonic sensor will pause the program when it is working, which may cause some lagging when writing complex projects. Note: Hello, welcome to the SunFounder Raspberry Pi & Arduino & ESP32 Enthusiasts Community on Facebook! Dive deeper into Raspberry Pi, Arduino, and ESP32 with fellow enthusiasts.
Page 463
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 A basic digital temperature and humidity sensor, the DHT11, is provided in this kit. It uses a capacitive humidity sensor and thermistor to measure the surrounding air and outputs a digital signal on the data pins (no analog input pins are required).
Page 464
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 Wiring Chapter 6. For Arduino User...
Page 465
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 Code Note: • You can open the file 6.2_dht11.ino under the path of euler-kit/arduino/6.2_dht11. • Or copy this code into Arduino IDE. • For detailed tutorials, please refer to Open & Run Code Directly.
Finally, the DHT11 sampling rate is 1HZ, a delay(1500) is needed in the loop. delay(1500); Note: Hello, welcome to the SunFounder Raspberry Pi & Arduino & ESP32 Enthusiasts Community on Facebook! Dive deeper into Raspberry Pi, Arduino, and ESP32 with fellow enthusiasts.
Page 467
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 Gyroscopes are used to measure orientation and angular velocity of a device or maintenance. Applications of gyro- scopes include anti-rollover and airbag systems for automobiles, motion sensing systems for smart devices, attitude stabilization systems for drones, and more.
Page 468
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 Code Note: • You can open the file 6.3_6axis_motion_tracking.ino under the path of euler-kit/arduino/6. 3_6axis_motion_tracking. • Or copy this code into Arduino IDE. • For detailed tutorials, please refer to Open & Run Code Directly.
Page 469
Serial.print(g.gyro.y); Serial.print(", Z: "); Serial.print(g.gyro.z); Serial.println(" rad/s"); Note: Hello, welcome to the SunFounder Raspberry Pi & Arduino & ESP32 Enthusiasts Community on Facebook! Dive deeper into Raspberry Pi, Arduino, and ESP32 with fellow enthusiasts. 6.37. 6.3 - 6-axis Motion Tracking...
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 Why Join? • Expert Support: Solve post-sale issues and technical challenges with help from our community and team. • Learn & Share: Exchange tips and tutorials to enhance your skills. • Exclusive Previews: Get early access to new product announcements and sneak peeks.
Page 471
Once the program is running, when you press the remote control, the Serial Monitor will print out the key you pressed. Note: Hello, welcome to the SunFounder Raspberry Pi & Arduino & ESP32 Enthusiasts Community on Facebook! Dive deeper into Raspberry Pi, Arduino, and ESP32 with fellow enthusiasts.
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 Why Join? • Expert Support: Solve post-sale issues and technical challenges with help from our community and team. • Learn & Share: Exchange tips and tutorials to enhance your skills. • Exclusive Previews: Get early access to new product announcements and sneak peeks.
Page 473
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 Code Note: • You can open the file 6.5_rfid_write.ino under the path of euler-kit/arduino/6.5_rfid_write. • Or copy this code into Arduino IDE. • For detailed tutorials, please refer to Open & Run Code Directly.
Page 474
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 Note: • You can open the file 6.5_rfid_write.ino under the path of euler-kit/arduino/6.5_rfid_write. • Or copy this code into Arduino IDE. • For detailed tutorials, please refer to Open & Run Code Directly.
Page 475
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 • Serial.readBytesUntil Note: Hello, welcome to the SunFounder Raspberry Pi & Arduino & ESP32 Enthusiasts Community on Facebook! Dive deeper into Raspberry Pi, Arduino, and ESP32 with fellow enthusiasts. Why Join? •...
Page 476
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 Chapter 6. For Arduino User...
The underlying principle is to use CircuitPython with auxiliary libraries. 1. Get Started Note: Hello, welcome to the SunFounder Raspberry Pi & Arduino & ESP32 Enthusiasts Community on Facebook! Dive deeper into Raspberry Pi, Arduino, and ESP32 with fellow enthusiasts. Why Join? •...
Page 478
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 Note: If you see a different pop-up window, your browser version is not supported, please update your browser and try again. Find the SETUP MY PICO button, click it, and follow the prompts to configure it.
Page 479
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 In this step, you need to make sure that your Pico is unplugged from your computer, as it needs to be plugged in in a specific way in the next step. Make sure your cable can handle power and data, as many micro USB cables only have power.
Page 480
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 Now Piper Make will load the firmware to your Pico, again you need to allow save changes to the hard drive where the Pico is located. When this prompt appears, it means your Pico is set up and you can start using it.
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 Note: Hello, welcome to the SunFounder Raspberry Pi & Arduino & ESP32 Enthusiasts Community on Facebook! Dive deeper into Raspberry Pi, Arduino, and ESP32 with fellow enthusiasts. Why Join? • Expert Support: Solve post-sale issues and technical challenges with help from our community and team.
Page 482
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 Then open the new project just created. Now go to the Piper Make programming page. • START: Used to run the code, if it’s gray, it’s not connected to Pico at this time.
Page 483
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 • Tools Area: You can click DIGITAL VIEW to see the pin distribution of Pico; you can view the print infor- mation in CONSOLE; you can read data from DATA, and you can click Python to view the Python source code.
Page 484
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 The Raspberry Pi Pico’s onboard LED is at pin25, so we use the [turn pin () ON/OFF] block on the Chip palette to control it. Chapter 7. For Piper Make...
Page 485
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 7.2.2 2. Connect to Pico Now click on the CONNECT button to connect to pico, after clicking on it a new popup will appear. Select the recognized CircuitPython CDC control (COMXX) port, then click on Connect.
Page 486
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 When the connection is successful, the green CONNECT in the bottom left corner will change to a red DISCON- NECT. Chapter 7. For Piper Make...
Page 487
Then turn off pin25 every second in the cycle, and click START on the upper left again, so that you can see the onboard LED lights flashing. Note: Hello, welcome to the SunFounder Raspberry Pi & Arduino & ESP32 Enthusiasts Community on Facebook! 7.2. 1.2 Quick Guide on Piper Make...
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 Dive deeper into Raspberry Pi, Arduino, and ESP32 with fellow enthusiasts. Why Join? • Expert Support: Solve post-sale issues and technical challenges with help from our community and team. • Learn & Share: Exchange tips and tutorials to enhance your skills.
Page 489
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 7.3.2 Import the Code In Piper Make’s home page, click Import Project. Select the .png file in the path euler-kit\piper and click Import. Note that you need to download the SunFounder Euler Kit package first.
Page 490
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 Now you can see the file you imported. 2. Projects Note: Hello, welcome to the SunFounder Raspberry Pi & Arduino & ESP32 Enthusiasts Community on Facebook! Dive deeper into Raspberry Pi, Arduino, and ESP32 with fellow enthusiasts. Why Join? •...
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 • Festive Promotions and Giveaways: Take part in giveaways and holiday promotions. Ready to explore and create with us? Click [] and join today! 7.4 2.1 Blink LED For this project, we intend to make the extended LED light blink. To use extended electronic components, a solderless breadboard will be the most powerful partner for novice users.
Page 492
• [turn pin () ON/OFF]: Indicates that a certain pin is placed in a high level (ON) or a low level (OFF). • [wait () seconds]: Set the execution interval between blocks. Note: Hello, welcome to the SunFounder Raspberry Pi & Arduino & ESP32 Enthusiasts Community on Facebook! Dive deeper into Raspberry Pi, Arduino, and ESP32 with fellow enthusiasts.
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 • Festive Promotions and Giveaways: Take part in giveaways and holiday promotions. Ready to explore and create with us? Click [] and join today! 7.5 2.2 Button In this project, we will learn how to turn on or off the LED by using a button.
Page 494
[do] block, otherwise execute the blocks inside [else]. Note: Hello, welcome to the SunFounder Raspberry Pi & Arduino & ESP32 Enthusiasts Community on Facebook! Dive deeper into Raspberry Pi, Arduino, and ESP32 with fellow enthusiasts.
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 • Special Discounts: Enjoy exclusive discounts on our newest products. • Festive Promotions and Giveaways: Take part in giveaways and holiday promotions. Ready to explore and create with us? Click [] and join today! 7.6 2.3 Service Bell...
Page 496
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 • By default, pins 1 and 3 of the Micro Switch are connected together and GP14 is low. When the Micro Switch is pressed, GP14 is high. • GP15 outputs high to make the buzzer sound.
Page 497
Note: This project code is exactly the same as the previous project Button. Note: Hello, welcome to the SunFounder Raspberry Pi & Arduino & ESP32 Enthusiasts Community on Facebook! Dive deeper into Raspberry Pi, Arduino, and ESP32 with fellow enthusiasts.
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 7.7 2.4 Rainbow Light In this project, we will make the RGB LEDs display a rainbow of colors. RGB LED is equivalent to encapsulating Red LED, Green LED, Blue LED under one lamp cap, and the three LEDs share one cathode pin.
Page 499
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 • When using the same power supply intensity, the Red LED will be brighter than the other two, and a slightly larger resistor(330) needs to be used to reduce its brightness.
Page 500
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 After connecting Pico, click the Start button and the code starts to run. Pressing these buttons individually will emit a single color of light, but if two of the buttons are pressed at the same time, or all 3 buttons are pressed at the same time, the RGB LEDs will emit a variety of different colors, up to a maximum of 7.
When the buttons are pressed, the levels of the corresponding pins are pulled high, causing the RGB LED to display different colors. Note: Hello, welcome to the SunFounder Raspberry Pi & Arduino & ESP32 Enthusiasts Community on Facebook! Dive deeper into Raspberry Pi, Arduino, and ESP32 with fellow enthusiasts.
Page 502
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 • When the slide switch is toggled to the right, GP12 is high; when toggled to the left, GP12 is low. • Each of the three buttons is connected to a pull-down resistor, GP13~GP15 are low by default; when the button is pressed, GP13~GP15 are high.
Page 503
Note: If you are using a computer, you will need to plug in headphones or audio to your computer to hear the sound emitted. Note: Hello, welcome to the SunFounder Raspberry Pi & Arduino & ESP32 Enthusiasts Community on Facebook! Dive deeper into Raspberry Pi, Arduino, and ESP32 with fellow enthusiasts.
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 • Exclusive Previews: Get early access to new product announcements and sneak peeks. • Special Discounts: Enjoy exclusive discounts on our newest products. • Festive Promotions and Giveaways: Take part in giveaways and holiday promotions.
Page 505
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 • S of water level sensor is connected to GP26(A0), + to VBUS, - pin to GND. • The orange wire (signal) of the servo is connected to GP15, the red wire (power) is connected to VBUS, and the brown wire (ground) is connected to GND.
Page 506
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 After connecting Pico, click the Start button and the code starts to run. When the water level is lower than 1/3 of the water level sensor, the servo rotates to 180 degrees to simulate the inlet opening; when the water level is higher than 1/3 of the water level sensor, the servo rotates to 0 degrees to imitate the inlet closing.
Page 507
• [servo pin () set angle to ()]: Set the angle of servo pin to, the range is 0 ~ 180°. Note: Hello, welcome to the SunFounder Raspberry Pi & Arduino & ESP32 Enthusiasts Community on Facebook! Dive deeper into Raspberry Pi, Arduino, and ESP32 with fellow enthusiasts.
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 7.10 2.7 Swing Servo In this project, we use a servo and a potentiometer to simulate a steering wheel. Rotating the potentiometer will drive the servo to turn together. • Breadboard •...
Page 509
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 • You can refer to the image below to write code by dragging and dropping. • Import 2.7_swing_servo.png from the path of euler-kit\piper. For detailed tutorials, please refer to Import the Code.
Note: The voltage of A0~A2 takes the range of 0~3.3V, even if your power supply is connected to VBUS (5V). Note: Hello, welcome to the SunFounder Raspberry Pi & Arduino & ESP32 Enthusiasts Community on Facebook! Dive deeper into Raspberry Pi, Arduino, and ESP32 with fellow enthusiasts.
Page 511
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 • The LED Bar Graph consists of 10 LEDs, with the side with the label as the anode and the other side as the cathode. • The anode of the LED Bar Graph are connected to GP6~GP15. The cathode are connected to a 220 ohm resistor and then to GND.
Page 512
• [map value () from () to ()]: map a value from one range to another. Note: Hello, welcome to the SunFounder Raspberry Pi & Arduino & ESP32 Enthusiasts Community on Facebook! Dive deeper into Raspberry Pi, Arduino, and ESP32 with fellow enthusiasts.
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 Ready to explore and create with us? Click [] and join today! 7.12 2.9 Lucky Cat In this project, we use pir and servo to make a lucky cat. The PIR Module is used to detect the visitors and servo is used to imitate the beckoning motion of the lucky cat.
Page 514
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 • Import 2.9_lucky_cat.png from the path of euler-kit\piper. For detailed tutorials, please refer to Import Code. • After connecting Pico, click the Start button and the code starts to run. • When the PIR module detects a customer arrival, the servo oscillates back and forth five times and then stops.
Page 515
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 Set the rotation speed of pin15 (servo) to 15%. If GP14 is low, set the variable [prestate] to 0. When the variable [prestate] is 0 and GP14 is high (human detected), set the variable [prestate] to 1.
• [repeat () times do]: Loop through the code inside the do block a finite number of times. Note: Hello, welcome to the SunFounder Raspberry Pi & Arduino & ESP32 Enthusiasts Community on Facebook! Dive deeper into Raspberry Pi, Arduino, and ESP32 with fellow enthusiasts.
Page 517
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 Code Note: • You can refer to the image below to write code by dragging and dropping. • Import 2.10_flowing_led.png from the path of euler-kit\piper. For detailed tutorials, please refer to Import the Code.
Page 518
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 Chapter 7. For Piper Make...
Page 519
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 After connecting Pico, click the Start button and the code starts to run. When the tilt switch is placed vertically, it makes the LEDs on the WS2812 RGB LED Strip light up one by one in green, and when the tilt switch is placed horizontally, the LEDs light up one by one in the opposite direction in green.
Page 520
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 Step 3: Set the initial value of variable i to 1 (the LED near the wires), then in [repeat forever] block, use [() mod ()] to set the value of i from 0 to 7. e.g. 1 mod 8 = 1. . . 8 mod 8 =0, 9 mod 8 =1, etc.
Page 521
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 Step 4: Set all neopixels to black to make all LEDs go off, then use [updates neopixels] to make this effect update to the WS2812 RGB LED Strip. 7.13. 2.10 Flowing LEDs...
Page 522
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 • [set all neopixels to ()]: Use to set a color for all LEDs, there are 13*9 colors, the top right color is black to make LEDs to go off. • [updates neopixels]: Update the effect to the WS2812 RGB LED Strip.
Page 523
• [change () by ()]: Used to increase (positive) or decrease (negative) the value of a variable by a specific step. Note: Hello, welcome to the SunFounder Raspberry Pi & Arduino & ESP32 Enthusiasts Community on Facebook! Dive deeper into Raspberry Pi, Arduino, and ESP32 with fellow enthusiasts.
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 7.14 2.11 Reversing System For this project we used an ultrasonic module and an active buzzer to create a reversing alarm system. The ultrasonic module is used to detect the distance, and the buzzer emits different frequencies of alarm sounds depending on the distance.
Page 525
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 • You can refer to the image below to write code by dragging and dropping. • Import 2.11_reversing_system.png from the path of euler-kit\piper. For detailed tutorials, please refer Import the Code.
Page 526
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 How it Works? Read the distance (in cm) of the ultrasonic detection, and store it in the variable [distance]. When distance is less than or equal to 5, set the variable intervals to 0.1s. The variable [intervals] is the interval between buzzer sounds.
Page 527
When distance is greater than 10, set the [intervals] time to 1s. Finally, make the buzzer sound every [intervals] seconds. Note: Hello, welcome to the SunFounder Raspberry Pi & Arduino & ESP32 Enthusiasts Community on Facebook! Dive deeper into Raspberry Pi, Arduino, and ESP32 with fellow enthusiasts.
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 7.15 2.12 Smart Fan Here we make a temperature controlled smart fan with thermistor, L293D, motor, and power module. The fan rotates automatically when the set temperature is reached. • Breadboard •...
Page 529
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 • After connecting Pico, click the Start button and the code starts to run. • Click CONSLE, you will see the current temperature in Celsius. • The fan starts spinning when it is above 25 degrees, and stops spinning when it is below 25 degrees.
Page 530
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 How it Works? The voltage of A0 (GP26) is read and assigned to the variable [Vr]. These calculations convert the thermistor values into centigrade degree. Note: Here is the relation between the resistance and temperature: RT =RN expB(1/TK –...
Page 531
When the temperature is lower than 25 degrees Celsius, set GP14 and GP15 both low to stop the motor. Note: Hello, welcome to the SunFounder Raspberry Pi & Arduino & ESP32 Enthusiasts Community on Facebook! Dive deeper into Raspberry Pi, Arduino, and ESP32 with fellow enthusiasts.
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 • Expert Support: Solve post-sale issues and technical challenges with help from our community and team. • Learn & Share: Exchange tips and tutorials to enhance your skills. • Exclusive Previews: Get early access to new product announcements and sneak peeks.
Page 533
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 • Their indicators are connected to GP15 and GP13, and output high to light them up. • Define a referee button connected to GP10, when the button is pressed, GP10 goes low.
Page 534
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 Chapter 7. For Piper Make...
Page 535
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 • After connecting Pico, click the Start button and the code starts to run. • Press the referee button and the buzzer starts to sound (continuously), representing the start of the game.
Page 536
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 When flag equals to 1 for game start, then read the value of GP14 (player1); if player1 button is pressed, store the number of presses in variable [count1], and make the indicator of GP15 light up.
Page 537
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 Read the number of presses of GP12(player2) in the same way. 7.16. 2.13 Reaction Game...
Page 538
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 Print the number of presses for player1 and player2 respectively. When the referee button is pressed again, the buzzer stops working and the game ends. Chapter 7. For Piper Make...
Page 539
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 Note: Hello, welcome to the SunFounder Raspberry Pi & Arduino & ESP32 Enthusiasts Community on Facebook! Dive deeper into Raspberry Pi, Arduino, and ESP32 with fellow enthusiasts. Why Join? • Expert Support: Solve post-sale issues and technical challenges with help from our community and team.
Page 540
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 Chapter 7. For Piper Make...
CHAPTER EIGHT 8.1 Arduino 1. Code upload failed in Arduino IDE? • Check that your Pico is correctly recognised by the Arduino IDE, the port should be COMXX (Rasp- berry Pi Pico), for instructions please refer to 1.2 Setup the Raspberry Pi Pico.
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 • If you used it on Thonny first and now you want to use it on Arduino IDE, you need to 1.2 Setup the Raspberry Pi Pico. 6. If your computer is win7 and pico cannot be detected.
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 8.4 How to re-burn the firmware for ESP8266 module? 1. Download firmwre and burn-in tool • ESP8266 Firmware After unzipping, you will see 3 files. • esp8266-uart-wsserver-v1.0.2.bin: The firmware to burn to the ESP8266 module.
Page 544
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 3. Go to the Downloads folder and find the file you just downloaded, then drag picoprobe.uf2 to the RPI-RP2 storage drive. 4. The Pico will reboot and disappear from the File Manager, then Pico’s USB will be recognized as a serial port and you can see it in the Device Manager.
Page 545
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 4. Burn the firmware • Follow the steps below to burn the firmware if you are using Windows. 1. Double click install.bat to start the firmware burning. If you see the following prompt, the firmware has been installed successfully.
Page 546
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 Note: If the burn-in fails, please check the following points. – If it does not work the first time, close the window and open install.bat again. – Reset the ESP8266 module by inserting the RST to GND and then unplugging it.
Page 547
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 Note: If the burn-in fails, please check the following points. – Reset the ESP8266 module by inserting the RST to GND and then unplugging it. – Check if the wiring is correct.
Page 548
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 2. As Thonny doesn’t come with a serial port tool, you’ll need to use the Arduino IDE’s serial monitor or another serial port tool to test it. The Arduino IDE 2.0 will be used here, open it and select the port. Note that your port is different from mine.
Page 549
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 3. Click on the Serial Monitor icon to open it and select the display mode (New line) and baud rate (115200 baud). 4. Type SET+RESET, and press Ctrl+Enter to send this command. Once the firmware has been burned success- fully, you will see a string of characters + OK.
Page 550
SunFounder Euler Kit for Raspberry Pi Pico, Release 1.0 5. At this point you can go ahead and finish the project - 1.1 First-time Use the APP. Note: • The Raspberry Pi Pico here uses the serial firmware, you need to 1.3 Install MicroPython...
NINE COPYRIGHT NOTICE All contents including but not limited to texts, images, and code in this manual are owned by the SunFounder Company. You should only use it for personal study,investigation, enjoyment, or other non-commercial or nonprofit purposes, under therelated regulations and copyrights laws, without infringing the legal rights of the author and relevant right holders.
Need help?
Do you have a question about the Euler Kit for Raspberry Pi Pico and is the answer not in the manual?
Questions and answers