UAVCAN: CANbus for the rest of us

CANbus has been used by DJI from nearly their beginnings but it has not been available for Ardupilot users. What is CANbus? It is a network to connect smart devices that is message-based. You can think of it as a little internet for the multirotor.

I did a comparison of Mini-Pixhawks and found every one had different pin-outs for each connector, even when they were using the same physical connector and it was being used for the same device, like GPS. No wonder users have problems buying and connecting simple required accessories for a multirotor build. It is absurd and a pain.

CANbus can eliminate all that pain. CANbus was designed by Robert Bosch for the automotive industry decades ago. The new implementation for unmanned vehicles by Pavel Kirienko called UAVCAN brings CANbus to the Pixhawk community and OlliW’s UC4H project brings it to the DIY community with low-cost adapters to interface commonly used M8N based GPS/Mags, a beautiful UAVCAN Power module with Hall sensor for accurate voltage and current measurements, and he has added UAVCAN to his STorM32 gimbal controller board.

UAVCAN can bring to DIY a standard way to connect all your devices to your flight controller. One connector, the JST-GH, is easy to click into place and remove and it won’t fall out. The cables are all the same four-wire configuration for all your devices and they are daisy chained together. No more having to have all the cables to all the devices go all the way back to the flight controller.

Even more importantly, each device on the UAVCAN bus is a smart device. They send out messages that can be monitored by a bus sniffer called a SLCAN. This allows you to monitor, configure and test every device on your UAVCAN network from one utility, Pavels UAVCAN GUI.

So let’s take a look at UAVCAN GUI. UAVCAN GUI is available for Windows, Linux and MAC.

First, you need a SLCAN sniffer. Like the one OlliW designed for his UC4H, UAVCAN for Hobbyists project or Pavel’s own Babel.

These usb devices attach to your UAVCAN bus as just another device. UAVCAN wiring is composed of 4 wires, two canbus signal wires and 5v power and ground. But there can only be one device on the bus that supplies the bus 5v. In our case it is usually the flight controller but when you are configuring maybe a single device with your SLCAN, OlliW’s SLCAN be jumpered to be a supplier for the bus power.

The UAVCAN GUI is a powerful tool but don’t let it intimidate you. We will just use the features we need one at a time. Plug in your SLCAN to a usb port on your computer. Next, start UAVCAN and it will pop up a dialog box that allows you to set the com port your SLCAN is assigned and what speed you want to talk to the SLCAN. If you are unsure what com port your operating system assigned, simply look at the available ports in the drop-down. Note the com ports it lists, then unplug your SLCAN. The port that disappears from the list is the one you want to use. Plug your SLCAN back in and choose that port.

Next choose 1000000 as the speed in both of the next two boxes.

When you hit ok the main window of UAVAN GUI will appear.

Click on the button for “Local node ID” and leave it at 127

Note that now the descriptions of the nodes on the bus are displayed.

First notice that each node has an ID. The Pixhawk is 10 and the GPSMAg node is 44. The Zubax Orel ESC comes configured for an auto node assignment. But Ardupilot cannot assign dynamic node IDs. They won’t show up until they get a node ID. You must set the node IDs manually for the ESCs. For the ZUBAX OREL UAVCAN ESCs you can click on the main panel’s “Dynamic Node ID Server” in the lower right and it will assign a temporary node ID for the ESCs. Then you you can set static node IDs that will be the permanent IDs for the ESCs.

In the illustration above I clicked on the “io.px4.sapog” which is the name of the ESC. This opens the node properties window for the ESC. I have only one ESC connected in this example and you will see more if you have them all connected, like 4 with a QUAD.

If you click on “Fetch All” the tool will query the ESC for all its parameters. One of those parameters is called “uavcan_node_ID”. Click on this and set the value to a unique ID for each ESC. I choose 100,101,102 and 103 for the four ESCs for my Solo quad. But I could have chosen 52,87,105 and 22. They just must not be used by any other device. Click on “Store All” to save your settings. Some changes may require a reboot of the device.

The node IDs don’t have any relation to the position of the ESC in the multirotor geometry. That is set by esc_index. Set the index of each ESC to match their position in the motor order of the multirotor. In the case of an ArduCopter quad, that would be starting from the forward right motor 1,4,2,3 around clockwise.

There is another handy parameter for the ESCs and that is ctl_dir which allows you to change the rotation of the motor on that ESC.

As you can see, you get ultimate control, easily compared to traditional ESCs.

Next, we can test the ESCs and see if they are working on the ESC Panel. The smart ESCs get the throttle endpoints automatically from the flight controller.

We can use the Bus Monitor to see the devices in action and check the values in operation. Now you can actually see your devices working while installed in your multirotor or other UAV.

You can see messages above for the GPS (uavcan.equipment.gnss), the Compass (uavcan.equipment.ahrs), and the ESC (uavcan.equipment.esc)

You start recording with the video camera icon in the upper left and you can pause at any point and check the value of the device you are interested in.

Not all the needed messages are currently in Ardupilot but hopefully they will be soon. OlliW has a fork of ArduCopter with the needed messages available now that he calls BetaCopter that allows his GPS/Mag interface, UAVCAN Power Module and UAVCAN to his STorM32 gimbal controller board to be used right now!

I think you can see that UAVCAN can give you a much more integrated multirotor build, with a common bus for all your devices and a common way to configure, test and troubleshoot them. OlliW brought UAVCAN to the DIY enthusiast with his UAVCAN 4 Hobbyist project UC4H. I have successfully used OlliW’s UAVCAN devices to convert a 3DR Solo to UAVCAN.

10 Likes

Awesome! Great post.

I agree.Thanks Mike.I’ve been reading of Olli’s battles in his thread for a while now.The pace of development is stunning.

I have to really really thank kd0aij for jumping on getting this restarted into Master.

WIP: initial merge of OlliW’s betacopter36dev-v005 into ardupilot master #7167

1 Like

Real nice. Thanks for this great post!

Actually Olivier it is a pleasure to finally be able to contribute, in a small way, rather than always being a “consumer” of all the hard work you folks have shared with the rest of us.

1 Like

Mike, first of all I would like to recognize your efforts providing examples and documentation for UC4H implementations.

I’m replacing the PWM ESCs of my hobby PixHawk-based quadcopter with new DShot ones, just built build OlliW’s CAN adapter and ESC Actuator, and now configuring the actuator’s parameters via UAVCAN GUI… my primary objective is to eliminate the need for ESC calibration.

Are you familiar with OlliW’s actuator parameters, or where I would be able to find documentation? I want to ensure they are set with the highest DShot option available. I’m guessing the parameters OutA/OutB/OutC Mode would allow PWM, OneShot, DShot.

Any guidance would be much appreciated!

Luis

Hi Luis, In my original project I used Zubax ESC’. SInce then I have built OlliW’s UC4H ESC node, but the first version that did not support DShot. I have not built the second version yet. OllIW is really good about answering questions on his RCGroups forum so just write him a note and I am sure you will get an answer. I really like the new carrier he designed to make the ESC/Node a one piece unit.

It has been a great project for me and I really love the super clean build of using CANbus and OlliW’s inexpensive UC4H nodes. I really like being able to use UAVCAN GUI to troubleshoot and monitor. I have been bugging OlliW, unsuccessfully :), to build a UC4H Pixhawk with the SLCan adapter built in!

Well good luck and let us know how your project progresses.

Thanks for very helpful post!

@Anyone - is there a way of grabbing the mavlink telem data over UAVCAN? Seems like we’re pushing CAN more and more and I’m always short a serial port so would like to use the CAN connections on the PH to grab the telem stream if that’s an option?

The protocol is not really designed for continuous data transmissions. It is designed as a network between intelligent devices.

1 Like

@r4space1 That said, there is currently an open Pull Request to allow serial port tunneling (including MAVLINK) over UAVCAN.

2 Likes

More general UAVCAN q:

Does is have an acknowledge message like CAN?

I did try find the right docs but clearly am googling the wrong term sorry - just a link to correct place to look would be helpful.

http://uavcan.org/ has got everything you need

1 Like

UAVCAN is CAN, one is layered on top of the other. Like HTTP over TCP over IP.

1 Like

I wanted to add a note that OlliW has designed a universal UAVCAN node that, with different firmware, can act as an ESC interface, a GPS interface, a barometer interface, a serial tunnel interface and more. Jani at JDrones has produced a commercial version of the board and it is available on Jani’s webstore. http://store.jdrones.com/uavcan_electronics_jdrones_s/314.htm

This is great news and it brings UAVCAN via UC4H to Arducopter users at price DIY’ers can afford.

Thanks Jani!

PS In addition to this article see my note on configuring Ardupilot to use UAVCAN.

3 Likes
  • Board are jointly created with OlliW.eu, jDrones is official manufacturer for OlliW UC4H boards.
  • Every sold board also donates 1 USD for ArduPilot development

:+1::+1::+1:

1 Like

Hi all,
old post but still interesting.
Mike I read over at rcg that you wanted to build a Believer with the guts of a 3DR Solo. Did you realize it? And is it doable also for a non-programmer but technical curious like me with basic soldering skills?
And could you recommend a Can bus based plane build for mapping purposes?
I’m researching on the use of UAS for monitoring nature conservation tasks and always looking for good solutions like the combination of rc, vtx and telemetry via the Solo board.
Thanks in advance!
Best regards!
Steffen

Steffen,
No my believer is still in the box :(.
The 3DR Solo is a good source of parts for a canbus build. First you get the Pixhawk flight controller, then a hdmi high res video system and you can replace the wifi transmitter board with an inexpensive higher power unit that is plug and play on both the aircraft and the rc controller on the ground. I have seen one proof of concept that used the 3DR motherbrd for a plane so it appears to work.
Last it is cheap to buy and play with canbus.
Good luck on your experiment.