arrow-left

All pages
gitbookPowered by GitBook
1 of 1

Loading...

DEMO: UAVCAN node servo pwm control

How to send PWM signal using CAN bus

The idea is to control a servo motor or ESC via the CAN board using the UAVCAN protocol. This is useful to decentralize the processing from the FMU to multiple CAN boards in case of having multiple PWM units.

Next, we will show how to connect a CAN board to the Ubuntu 22.04 PC and send PWM commands.

hashtag
Hardware setup

  • (1) UCANS32K1SIC board

  • (3) USB-TTL-3V3: the GND black wire should be mounted at the top when the serial debug connector is on the left.

  • (2) Adapter board

  • (4) CAN to USB adapter board

  • (5) debug cable: to be able to communicate with the board via nutshell cmdline.

  • (6) CAN cable: mount the CAN cable at the top right connector.

  • (7) A resistor board: mount this board below the CAN cable connector

  • (8) Power supply: make sure to not exceed 5 Volts

  • (9) Servo motor for testing

hashtag
Software setup

Install drone_can_gui tool:

hashtag
Usage

  • Set up can interface

Open a terminal and type these two lines

  • Verify can interface

Check whether can0 interface figures in network interfaces list:

Double check by dumping CAN bus traffic

  • Verify pwm status

In a nutshell, check the status of PWM in your board

  • Start drone gui tool

Press ok

You should see your ucans32 device in the list of nodes:

  • Arm the vehicle

Arm the vehicle (using QGC or RC transmitter depending on your setup):

hashtag
External links:

[1]

[2]

GitHub pull requestarrow-up-right
https://github.com/DroneCAN/gui_toolarrow-up-right
dronecan_gui_tool startup
dronecan_gui_tool
dronecan_gui_tool
sudo apt-get install -y python3-pip python3-setuptools python3-wheel 
sudo apt-get install -y python3-numpy python3-pyqt5 python3-pyqt5.qtsvg git-core 
sudo pip3 install git+https://github.com/DroneCAN/gui_tool@master 
sudo ip link set can0 type can bitrate 1000000 
sudo ip link set up can0
ifconfig  
candump can0 
pwm_out status 
dronecan_gui_tool