Google Chat: zj734465502@gmail.com
+86-0755-88291180
sales01@spotpear.com
dragon_manager@163.com
services01@spotpear.com
manager01@spotpear.com
WhatsApp:13246739196
Servo Driver Module For Raspberry Pi Pico, 16-Channel Outputs, 16-Bit Resolution.
MircoPython video example (github)
Raspberry Pi official C/C++ example program (github)
Raspberry Pi official micropython example program (github)
Raspberry Pi Pico Demo
Connect the Driver board to Pico, please take care of the direction according to the USB silk screen printing.
Please refer to Raspberry Pi's guide: https://www.raspberrypi.org/documentation/pico/getting-started/
1. Open a terminal of Raspberry Pi
2. Download and unzip the demo codes to directory Pico C/C++ SDK
sudo apt-get install p7zip-full cd ~ sudo wget https://www.waveshare.com/w/upload/3/31/Pico_Servo_Driver_Code.7z 7z Pico_Servo_Driver_Code.7z -o./Pico_Servo_Driver_Code.7z cd ~/Pico_Servo_Driver_Code
To compile, make sure you are in the c directory:
cd ~/Pico_Servo_Driver_Code/c/
Create and enter the "build" directory in the folder, and add the SDK:
where ../../pico-sdk is the directory of your SDK.
There is a "build" in our sample program, just enter it directly.
cd build export PICO_SDK_PATH=../../pico-sdk (Note: Be sure to write the path where your own SDK is located)
Execute cmake to automatically generate Makefile files
cmake..
Execute make to generate executable files, the first compilation time is relatively long.
make -j9
After the compilation is complete, the uf2 file will be generated.
Press and hold the button on the Pico board, connect the pico to the USB port of the Raspberry Pi through the Micro USB cable, and release the button. After connecting, the Raspberry Pi will automatically recognize a removable disk (RPI-RP2) and copy the main.uf2 file in the build folder to the recognized removable disk (RPI-RP2).
cp main.uf2 /media/pi/RPI-RP2/
As shown:
If your current version of Thonny does not have the pico support package, enter the following command to update the Thonny IDE.
sudo apt upgrade thonny
3. Click File->Open...->python/Pico_Servo_Driver_Code/python/servo.py to run the script.
As soon as the experimental phenomenon channel is connected to the servo, it will rotate from 0 degrees to 180 degrees, and cycle three times.
Note: The pictures below are for reference only, the steps are the same.
1. Open the corresponding C program folder.
2. Open through the "Vs" coed and select the corresponding compilation tool.
3. Click the "build" button to compile.
4. Press the "Reset" button on the Pico-Eval-Board to reset the Pico, first press the BOOTSEL button and then the RUN button and then release the Reset button, the Pico can enter the disk mode without plugging and unplugging the Pico, and the UF2 file under the build file Drag and drop to the RPI-RP2 drive letter.
5. By now, Pico starts to run the corresponding program.
You can see many definitions in DEV_Config.c(.h), in the directory: ...\c\lib\Config.
#define UBYTE uint8_t #define UWORD uint16_t #define UDOUBLE uint32_t
void DEV_Module_Init(void); void DEV_Module_Exit(void);
void PWM_initialization();
void on_pwm_wrap();
#define CHANNE_N 0xFFFF // 0x0001 means 0 channel is open, 0x0000 means all channels are closed
#define ROTATE_0 1700 //Rotate to 0° position #define ROTATE_45 3300 //Rotate to 45° position #define ROTATE_90 4940 //Rotate to 90° position #define ROTATE_135 6600 //Rotate to 135° position #define ROTATE_180 8250 //Rotate to 180° position
The experimental phenomenon is exactly the same as the c program, and will not be repeated here.