Advertisement

Quick Links

SunFounder pico_4wd_car
www.sunfounder.com
Sep 21, 2022

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the Pico-4wd car and is the answer not in the manual?

Questions and answers

Summary of Contents for SunFounder Pico-4wd car

  • Page 1 SunFounder pico_4wd_car www.sunfounder.com Sep 21, 2022...
  • Page 3: Table Of Contents

    CONTENTS 1 Get Started 1. Install Thonny IDE ......... . 2.
  • Page 5 We have provided sample code based on MicroPython so you can get started quickly. In addition, you can also use an app - SunFounder Controller - to DIY your own control methods! Let’s Play! Here is the Email: cs@sunfounder.com.
  • Page 6 SunFounder pico_4wd_car • 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. Source Code CONTENTS...
  • Page 7 SunFounder pico_4wd_car SunFounder Pico-4wd Car Code Or check out the code at CONTENTS...
  • Page 8 SunFounder pico_4wd_car CONTENTS...
  • Page 9: Get Started

    CHAPTER GET STARTED In this section, you will learn all the hardware and software configurations needed to get Pico-4wd up and running, and it is recommended that you read them in order. 1.1 1. Install Thonny IDE Before you can start to program Pico with MicroPython, you need an integrated development environment (IDE), here we recommend Thonny.
  • Page 10 SunFounder pico_4wd_car 3. Next, click Next and Install to finish installing Thonny. Chapter 1. Get Started...
  • Page 11: Install Micropython On Your Pico

    SunFounder pico_4wd_car 1.2 2. Install MicroPython on Your Pico MicroPython is a software implementation of a programming language largely compatible with Python 3, written in C, that is optimized to run on a microcontroller. MicroPython consists of a Python compiler to bytecode and a runtime interpreter of that bytecode. The user is pre- sented with an interactive prompt (the REPL) to execute supported commands immediately.
  • Page 12 SunFounder pico_4wd_car 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. 3. In the bottom right corner, click the interpreter selection button and select Install Micropython.
  • Page 13 SunFounder pico_4wd_car 4. In the Target volume, the volume of the Pico you just plugged in will automatically appear, and in the Mi- cropython variant, select Raspberry Pi.Pico/Pico H. 1.2. 2. Install MicroPython on Your Pico...
  • Page 14 SunFounder pico_4wd_car 5. Click the Install button, wait for the installation to complete and then close this page. Chapter 1. Get Started...
  • Page 15: Upload The Libraries To Pico

    Congratulations, now your Raspberry Pi Pico is ready to go. 1.3 3. Upload the Libraries to Pico Before using Pico-4wd Car, you need to upload its related libraries in Raspberry Pi Pico. 1. Download the relevant code from the link below.
  • Page 16 SunFounder pico_4wd_car 3. In the top navigation bar, click View -> Files. 4. Switch the path to the folder where you downloaded the code package before, and then go to the pico_4wd_car_main/libs folder. Chapter 1. Get Started...
  • Page 17 SunFounder pico_4wd_car 5. Select these 3 files, right-click and click Upload to, it will take a while to upload. 6. Now you will see the files you just uploaded inside your drive Raspberry Pi Pico. 1.3. 3. Upload the Libraries to Pico...
  • Page 18: Test The Modules

    SunFounder pico_4wd_car 1.4 4. Test the Modules This chapter is suitable for usability testing of the modules before assembly; or for final commissioning and mainte- nance of the Pico-4wd after assembly has been completed. 1.4.1 Power up the Pico RDP In order to make the module work, you need to power up the Pico RDP and turn the power switch to ON.
  • Page 19 SunFounder pico_4wd_car 1.4.2 Test the Motors 1. Connect the 4 motors according to the diagram below. 2. Select Correct Interpreter Plug the Pico into your computer with a micro USB cable and select the “MicroPython (Raspberry Pi Pico).COMXX” interpreter in the bottom right corner.
  • Page 20 SunFounder pico_4wd_car 4. Click the Run current script button or just press F5 to run it. Now, you can see the four motors work in a regular pattern. If you complete the assembly, this code will make the Pico-4wd perform five movements: forward, backward, left, right and stop.
  • Page 21 SunFounder pico_4wd_car 1.4.3 Test the Ultrasonic Module 1. Connect the ultrasonic module as shown below. 2. Run the test_sonar.py file under the path pico_4wd_car_main/tests. 1.4. 4. Test the Modules...
  • Page 22 SunFounder pico_4wd_car After running the code, the distance of ultrasonic detection will be displayed in the Shell. If the distance changes when your hand is in front of the ultrasonic module, the module is working properly. 1.4.4 Test the RGB Boards 1.
  • Page 23 SunFounder pico_4wd_car After the code is run, the 24 LEDs (all on the 3 RGB boards) to emit red, green, blue and white light in turn. 1.4.5 Test the Grayscale Sensor Module 1. Diagrammatically connect the Grayscale Sensor Module. 1.4. 4. Test the Modules...
  • Page 24 SunFounder pico_4wd_car 2. Run the test_grayscale.py file in pico_4wd_car_main/tests. Chapter 1. Get Started...
  • Page 25 SunFounder pico_4wd_car Upon running, you will see that the values in the Shell change when you place the grayscale module at a height of about 1cm above the different surfaces, indicating that it is working properly. In general, the value for white surfaces > the value for black surfaces > the value for overhanging (grayscale module 10cm above the ground).
  • Page 26 SunFounder pico_4wd_car 1.4.6 Test the Speed Module 1. Follow the diagram below to connect the Speed Module. 2. Run the test_speed.py file in pico_4wd_car_main/tests. Note: The Thonny IDE contains a line graph tool, please open it by clicking View > Plotter in the navigation bar to help you see how the printed values are changing.
  • Page 27 SunFounder pico_4wd_car After the code runs, when you back and forth put the jammed paper into the U-shaped slot on the speed module/take it out. The Shell in Thonny IDE will print the current speed. If you have already mounted it, this code will make the Pico-4wd move forward at variable speed and print out the motor power (as a percentage) and the travel speed (cm/s).
  • Page 28 SunFounder pico_4wd_car 2. Run the test_servo.py file in pico_4wd_car_main/tests. Insert a rocker arm first to observe the rotation of the servo. After clicking on the Run button, the servo will rotate left and right once and then stop at 0°.
  • Page 29: Assemble The Car

    SunFounder pico_4wd_car Note: For the next chapter, 5. Assemble the Car, the servo must be held at 0°, so after this code run, do not turn the servo shaft until the car is complete. In the event that you accidentally turn the servo shaft, remove the rocker arm, run this code again, and then reassemble the servo.
  • Page 30 SunFounder pico_4wd_car 2. Go to the pico_4wd_car/examples path and double click on move_forward.py to open it. This is a very simple example, which will let the car go forward. 3. Observe whether the wheels of the car are driving forward and marked the wrong motor.
  • Page 31 SunFounder pico_4wd_car 5. Run again move_forward.py, if the car is driving correctly, the calibration is completed. 1.6. 6. Examples...
  • Page 32 SunFounder pico_4wd_car 1.6.2 Don’t Push Me Let us give Pico-4wd a little self-protection awareness and let it learn to use its own grayscale module to avoid rushing down the cliff. In this example, the car will be dormant. If you push it to a cliff, it will be awakened urgently, then back up, and shake its head to express dissatisfaction.
  • Page 33 SunFounder pico_4wd_car 2. Go to the pico_4wd_car_main/examples path and double click on donot_push_me.py to open it. 3. Click the Run current script button or just press F5 to run it. 1.6. 6. Examples...
  • Page 34 SunFounder pico_4wd_car After the code runs, if you push it to a cliff, it will be awakened urgently, then back up, and shake its head to express dissatisfaction. Note: If the result is not satisfactory, please modify the fourth line car.
  • Page 35 SunFounder pico_4wd_car • Select Raspberry Pi Pico in the popup window that appears. • Set the file name to main.py. 1.6. 6. Examples...
  • Page 36 SunFounder pico_4wd_car • After clicking OK, the Raspberry Pi Pico will have an additional main.py file. • Afterwards, you can unplug the USB cable, turn on the power switch on the car, and the script main.py will begin running. Chapter 1. Get Started...
  • Page 37 SunFounder pico_4wd_car How it Work? 1.6. 6. Examples...
  • Page 38 SunFounder pico_4wd_car 1.6.3 Line Track Let Pico-4wd walk on its exclusive avenue! Tape a line on a light-colored ground (or table) with black insulating tape. Run this script and you will see Pico-4wd track the line to forward. Warning: When pasting this line, there should be no sharp turns so that the car does not drive off the path.
  • Page 39 SunFounder pico_4wd_car 2. The following value should be modified based on the results of the Test the Grayscale Sensor Module section. It should be between the values of black and white surfaces. For example, in my tests, black surfaces generally around 3000 and white surfaces are around 20000, so 10000 is the appropriate threshold value.
  • Page 40 SunFounder pico_4wd_car 4. Set the file name to main.py. If you already have the main.py file in your Pico, it will prompt to overwrite the main.py file. #. Now you can unplug the USB cable, place the car on the taped line, turn on the power switch and it will track the...
  • Page 41 SunFounder pico_4wd_car line. The script also includes some lighting effects: when the Pico-4wd is going straight, the taillight (the RGB panel on the tail) will light up green; when turning, one side of the taillight will light up yellow. During sharp turns, one side of the taillight will light up red.
  • Page 42 SunFounder pico_4wd_car 1.6.4 Follow Your Hand Here, Pico-4wd will follow your hand moving forward. How to do? 1. Open the follow_hand.py file under the path of pico_4wd_car_main\examples. Chapter 1. Get Started...
  • Page 43 SunFounder pico_4wd_car 2. Click File -> Save as or press Ctrl+Shift+S to save donot_push_me.py to the Raspberry Pi Pico as main.py. 3. Unplug the USB cable and turn on the power switch. When you put your hand in front of it, it will follow.
  • Page 44 SunFounder pico_4wd_car How it works? Chapter 1. Get Started...
  • Page 45 SunFounder pico_4wd_car 1.6.5 Obstacle Avoid Let Pico-4wd do a challenging task: automatically avoid obstacles! When an obstacle is detected, instead of simply backing up, the radar scans the surrounding area and finds the widest way to move forward. How to do? 1.
  • Page 46 SunFounder pico_4wd_car 2. Click File -> Save as or press Ctrl+Shift+S to save donot_push_me.py to the Raspberry Pi Pico as main.py. 3. Unplug the USB cable and turn on the power switch. When you place it on the ground, it avoids the obstacles and keeps going.
  • Page 47 How it Works? 1.6.6 Control the Car 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 Pico-4wd car. 1. Setup SunFounder Controller 1.
  • Page 48 SunFounder pico_4wd_car 3. We have preset controller for Pico-4wd, you can choose it directly. 4. Define a name for this Controller and click Confirm. Chapter 1. Get Started...
  • Page 49 SunFounder pico_4wd_car 5. Now that you are inside this preset controller, click the Grayscale Values widget’s Settings button to change its reference value. 6. The following thresholds should be modified based on the values obtained in the Test the Grayscale Sensor Module section.
  • Page 50 In order for Pico-4wd to be able to run specific scripts without being connected to a computer, and then be controlled by SunFounder Controller. You need to save the specific script to the Raspberry Pi Pico with the name main.py, as follows.
  • Page 51 1. Open the app_control.py file under the path of pico_4wd_car_main\examples, then click “run current script” button or just press F5 to run it. 2. If you run the code, you will see this IP in the shell; remember it, as it may be used to connect to SunFounder Controller later on.
  • Page 52 SunFounder pico_4wd_car 4. Set the file name to main.py. If you already have the same file in your Pico, it will prompt to overwrite it. Now you can unplug the USB cable, turn on the power switch of Pico-4wd, and Pico-4wd will automatically run this main.py script.
  • Page 53 2. The default connection mode in app_control.py is . So after you connect, there will be a prompt telling you that there is no Internet access on this WLAN network, please choose to continue connecting. 3. Now go back to SunFounder Controller, when you click the Connect button, it will automatically search for robots nearby.
  • Page 54 SunFounder pico_4wd_car 4. Click on the my_4wd_car. Note: • You need to make sure that your mobile device is connected to the my_4wd_car LAN. • If it doesn’t search automatically, you can also manually enter your car’s IP to connect.
  • Page 55 SunFounder pico_4wd_car appear in the upper right corner. 4. Run this Controller Click the Run button to start the controller. Here are the functions of the widgets. • A: Drive the car at 0~100% power. Before controlling the car movement with the K widget, you must set the A widget to 30% or more.
  • Page 56 SunFounder pico_4wd_car Chapter 1. Get Started...
  • Page 57: Appendix

    CHAPTER APPENDIX 2.1 Introduction to Raspberry Pi Pico The Raspberry Pi Pico is a microcontroller board based on the Raspberry Pi RP2040 microcontroller chip. Whether you want to learn the MicroPython programming language, take the first step in physical computing, or want to build a hardware project, Raspberry Pi Pico –...
  • Page 58 SunFounder pico_4wd_car • 8 × Programmable I/O (PIO) state machines for custom peripheral support • Supported input power 1.8–5.5V DC • Operating temperature -20°C to +85°C • Castellated module allows soldering direct to carrier boards • Drag-and-drop programming using mass storage over USB •...
  • Page 59: Introduction To Pico Rdp

    SunFounder pico_4wd_car • Raspberry Pi Pico product brief • Raspberry Pi Pico datasheet • Getting started with Raspberry Pi Pico: C/C++ development • Raspberry Pi Pico C/C++ SDK • API-level Doxygen documentation for the Raspberry Pi Pico C/C++ SDK •...
  • Page 60: Schematic And Structure Drawing

    SunFounder pico_4wd_car Here is the schematic of the Pico RDP: PDF Pico RDP Schematic. 2.3 Schematic and Structure Drawing Schematic • Grayscale Module • RGB Board • Pico RDP • Speed Module Structure Drawing • Lower Plate • Upper Plate •...
  • Page 61: Thonny Ide Introduction

    SunFounder pico_4wd_car 2.4 Thonny IDE Introduction • Ref: • A: The menu bar that contains the file New, Save, Edit, View, Run, Debug, etc. • B: This paper icon allows you to create a new file. • C: The folder icon allows you to open files that already exist in your computer or Raspberry Pi Pico, if your Pico is already plugged into your computer.
  • Page 62 SunFounder pico_4wd_car Finally, select the MicroPython (Raspberry Pi Pico) interpreter again, click the save as button, and re-save the debugged code to your Raspberry Pi Pico. • The G, H and I arrow icons allow you to run the program step by step, but can only be started after clicking on the Degug icon.
  • Page 63: Faq

    CHAPTER THREE 3.1 Q1: NO MicroPython(Raspberry Pi Pico) Interpreter Option on Thonny IDE? • Check that your Pico is plugged into your computer via a USB cable. • Check that you have installed MicroPython for Pico (2. Install MicroPython on Your Pico).
  • Page 64: Q2: Cannot Open Pico Code Or Save Code To Pico Via Thonny Ide

    SunFounder pico_4wd_car 3.2 Q2: Cannot open Pico code or save code to Pico via Thonny IDE? • Check that your Pico is plugged into your computer via a USB cable. • Check that you have selected the Interpreter as MicroPython (Raspberry Pi Pico).
  • Page 65: Thank You

    CHAPTER FOUR THANK YOU Thanks to the evaluators who evaluated our products, the veterans who provided suggestions for the tutorial, and the users who have been following and supporting us. Your valuable suggestions to us are our motivation to provide better products! Particular Thanks •...
  • Page 66 SunFounder pico_4wd_car Chapter 4. Thank You...
  • Page 67: Copyright Notice

    FIVE 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.

Table of Contents