Uavcan for Hobbyists - RC Groups
Shop our Airplanes Products Drone Products Sales
Thread Tools
Apr 12, 2017, 04:45 PM

Uavcan for Hobbyists


project web page:

12. Oct. 2017: I've just decided to declare the UC4H project as "working", and have left some notes which you may want to read:

Hey folks,

I'd like to show you first steps in a project I've named Uavcan for Hobbyists, which aims at connecting things like a GPS+magnetometer module to a Ardupilot/Pixhawk via CAN bus, Uavcan specifically.

Uavcan is around for quite a while now, but not really. Only very few devices are available, such as the Zubax GPS or the Orel 2 Sapog ESC, and these are (IMHO) clearly intended for professionals, price-wise for sure, and not for us tight-with-money hobby DIYers.

However, how many of us have grumbled at these dammed I2C lines for an external magnetometer, especially if one got the infamous Drotek wires? This I2C connection I found the least reliable, and I don't like the many wires going from the Pixhawk to the GPS&compass module, and if it's only for aesthetics. A Zubax GPS is also clearly way beyond what I'm willing to invest. So, I thought, a small adapter which bridges from Uavcan to I2C (for the magnetometer) and UART (for the GPS) would be cool. And cheap. The hardware would be just a CAN transceiver (2$) and a 32-bit dev board (2$). The project's ultimate goal would be to make Uavcan cheaply available to anyone.

So, about 1/2 years ago, I enthusiastically went to the Uavcan documentation and the code repository, but quickly felt overwhelmed. This Uavcan thing is really complex (at least for me). This is largely due to how CAN is fabricated. Sending mulitframe messages necessarily requires complex bookkeeping. It is also due to how Uavcan is written. Don't get me wrong, it is very obviously written by an absolute expert (Pavel Kirienko). But that is the problem, for hobby programmers like me. It is, IMHO, really sophisticated code. In addition, for any such project one needs some "development tools", here a USB-CAN sniffer, in order to be able to test and debug. These are available, but the prices are shocking - I'm not going to spend 80$ just for such a thing. No way. So, the project's challenge suddenly increased enormously, as it in addition required developing a cheap debug tool. The end of the story: I simply gave up. Luckily, few days ago Pavel released a slimmer functional library, Libcanard v0.1. And the project got a fresh restart.

At this point I really have to express my deep thanks to Pavel, for the tremendous work he put into the Uavcan ecosystem, and for not giving up answering my questions. Thx, sir!

Time to talk about the project. As starting platform I'm using a low-cost Hobbyking GPS+compass module, a NT breakout board (but any other STM32F1 dev board does it too, I simply had this around), a f103 dev board (available for 2-6$), two usb-ttl adapters (each 1-3$), and two diodes and some resistors. I'm not yet using CAN transceivers, I fake them with the diodes, but adding them is really a piece of cake (and they are cheap too, SN65HVD230 modules are 2$). The NT module + the compass on the GPS unit build the Uavcan magnetometer node (name: uc4h mag node). The f103 dev board + usb-ttl adapter build the SLCAN USBCAN adapter (name: uc4h SLCAN adapter). The 2nd usb-ttl adapter connected to the NT module is there only for debugging purposes (so that I can see what both ends are doing). Writing the SLCAN adapter code was in fact simple, a long afternoon job. The code for the mag node I found much more challenging, and it is in fact not yet in a state where I would attach it to a copter and go flying. But: It is working, sufficiently so for a proof of concept.

The next step would be to connect the uc4h mag node to a Pixhawk running Ardupilot. Should be simple in principle, I "only" have to learn how all that Uavcan works there. Also, some little pieces still need to be sorted out, getting the frame correct, calibration working, etc. pp.. Then, it would be time to fly ... I also obviously would want to add the Uavcan-UART bridge part, to also have the GPS connected by Uavcan. And finally, some cute little hardware modules would be nice too ... Still some things to do, but the hard part has been done.

Last edited by OlliW; Nov 14, 2017 at 04:06 AM.
Sign up now
to remove ads between posts
Apr 12, 2017, 05:04 PM
Registered User
Very interesting project , compliments !

I had often problems with I2C bus and compass , so your device would be welcome .

I bought a couple of Zubax and the compass works perfectly , unfortunately not all the flight control have CAN bus.

If you need some help to make the hardware a friend of mine works in a pcb factory and he has also quite experience with CAN bus for automotive applications.
Apr 15, 2017, 12:57 PM
pcb for uc4h node layouted and ordered
not as small as it could be, it's mainly for test&dev

first attempts to connect to Pixhawk/ArduCopter were not successful, I didn't got the Pixhawk to do uavcan: No idea what's up
EDIT: Issue identified ... it's the AuvX2:
Last edited by OlliW; Apr 19, 2017 at 04:38 PM.
Apr 20, 2017, 04:12 PM
some progress

since the issue with the AuavX2 got identified now, I successfully could connect all three items, the uc4h magnetometer node (configured to Uavcan ID 42), the AuavX2 (which is by default configured to Uavcan ID 10), and the uc4h slcan adapter via the Uavcan bus. Things work (mostly) as expected: The uc4h magnetometer is seen correctly in MissionPlanner, and I could calibrate it properly. So, this looks G O O D!

Unfortunately, I do not have yet sufficiently many CAN transceivers (they are on order), so I still had to use the pseudo transceiver trick, but I think that's just a momentary nuisance and not a real issue.

I also had issues with MissionPlanner in as much as it did never complete the calibration with the other magnetometers enabled (external on i2c and internal), it only allowed me to do the calibration when I disabled the other two. Also, I do not yet understand what the dev id is composed of.

Anyway, important step forward, IMHO.
Jul 04, 2017, 05:10 PM

I had abandoned this project for quite a while now, since I had serious issues with "instable" behavior of my flight controller in conjunction with my DIY nodes, and gave up at this point (see here:

If one gets stuck with a project, it is sometimes not a bad idea to let it rest for a while. I wanted to resume, however, since recently I could free quite some substantial resources in my STorM32 gimbal controller, such that it has now the muscles to handle UAVCAN, which opens the path to make it a uavcan gimbal controller.

I can't say for sure what THE solutions was to resolve the "instabilities" I had earlier, but since the moment I'm using a TJA1051 CAN transceiver on my AUAV-X2 flight controller instead of the SN65HVD230, all these issues are gone. It actually seems that only one TJA is needed in the line, i.e. all except of one can be SN65HVD230 transceivers, already then the signals on the oszi look textbook like, in contrast with using only SN65HVD230. Anyway, whatever the correct conclusion is, since I have that TJA installed, things seem to work.

Although not of much importance, I also nicied up my hardware. As indicated before, I made pcb's for the uc4h-slcan-adapter and the uc4h-node bridge, pictures below. It's however also possible to use cheap CAN transceiver, STM32, and usb-ttl modules, which allows us to build them at a cost of 4.90$ and 3.70$, respectively.

In plain text, you can convert any of your gps to a UAVCAN gps for merely 3.70$! I think this qualifies as cheap and DIY.

All bench tests ran very well. So, I started with first out-door test today, which also went well. So, I guess I can start to prepare for flight test. As well as getting serious about uavcan-izing the STorM32.

Cheers, Olli
Jul 04, 2017, 06:53 PM
Registered User
Nice Olliw

Almost all of us have gone to the limit that the serials give us.
Jul 04, 2017, 09:18 PM
Fly No Evil
davidbitton's Avatar
An SN65HVD230 is in the Naza M V2 PMU
Jul 08, 2017, 08:29 AM
next step forward

STorM32 goes UAVCAN

The new STorM32 v3.x boards have a CAN transceiver on-board, obviously with the intention to support uavcan. This has happened now. Adding the respective code was actually quite simple, I only had to handle the received CAN frames per interrupt. Libcanard by itself isn't very suitable for that (if one is concerned about performance), but it was trivial to extend.

Sadly, to the best of my knowledge, ArduPilot doesn't yet support any gimbal related UAVCAN messages ... so besides the heartbeat and reading the uc4h-gpsmag node's messages I couldn't do much. Maybe I find a tweak.

Cheers, Olli
Jul 09, 2017, 12:13 AM
the next addition to the array of uc4h modules, a uavcan power module

it's a bit of a digression, since it's not as DIY as the uc4h node and uc4h slcan adapter modules, but it's something I wanted to have ... this so to say completes the uc4h suite of modules LOL
Aug 04, 2017, 01:59 PM

after a long period of "silence" but lots of work in the background, the uc4h project has reached a mile stone today

I did the first real flight using (only) the uc4h gps-mag node ... and, it went well

To reach that point I had to build a new copter. My old one was just too small and cramped. From the pics you easily will recognize what it became LOL. Also, I had to give up my original plan to have the uc4h gps-mag node enabled in addition to the usual gps and two magnetometers, but to configure things such that its gps and compass is not used but their data recorded. However, this didn't worked out for reasons (bugs?) described elsewhere. So, I decided to go with a single gps+mag configuration and to swap it out. To do that with minimal intrusion I installed both gps+mag units on the copter, but in a first flight had connected only the normal gps+magnetometer unit, and in a subsequent flight only the u4ch gps-mag node. I had some trust in my code and was confident that it will work out well. Nevertheless, it's a fantastic thing to actually see this demonstrated in a real flight.

And again: Pavel, THANKS so much, sir, for all your support!

Cheers, Olli

log file:
Aug 05, 2017, 12:57 PM
and the next story to tell

my uc4h powerbrick node is a great success so far :slight_smile:

I think this brick has some top-notch features:
(A) Uavcan:
well, obviously, ...
(B) 5.3V by low-noise 42V, 3.5 A switch regulator:
I use the LT8610A, that's a member of the SRs used by the ACSP- series of AUAV/mRo. So, you'll agree, top-notch.
(C) 100A current Hall sensor:
no lousy resistor shunt, hall sensor should be state-of-the art. I've used the ACS770, which is the predessor of the widely used ACS758, with slightly better specs. I was considering also to use a ACS780/1 because of it's significantly smaller size. It has also the advantage of a 3.3V version. But it's small size has also its cost (e.g. I think the ACSP7 is not perfectly designed).
(D) LDO stabilized power for the current Hall sensor:
that's actually a point which I think the ACS modules so far have overlooked (I just know about Mauch and ACSP7), the ACS is ratiometric. That means that if its power supply varies also the current sensor signal varies proportionally. If the ACS is now directly powered from the 5.3V source that means that if one draws significant power on the 5.3V line (such as 2A), the voltage drops by e.g. 0.3V or 6% in my tests, also the current on the main line will be measured incorrectly by 6% - which is IMHO quite a lot. So I've added a LDO for the ACS.
(E) Precise Charge Calculation:
This is another unique feature. Since the UC4H power brick has it's own microcontroller, it can determined the consumed charge (mAh) much more precisely than would be possible otherwise. This is so because it can measure the current at a much higher rate and thus track current fluctuations much more precisely. Specifically, the node's firmware measures the current at 1 kHz, which is several 100 times faster than with the currently available power bricks.

the only disadvantage: it is not really tiny (but obviously it's the first test version)

the pieces start to fall in place ...

cheers, Olli

below pictures of the module
some test "data" here:
Last edited by OlliW; Aug 14, 2017 at 03:01 AM.
Aug 08, 2017, 10:24 AM
first release v0.19 uploaded, and some info created

Binaries for the uc4h slcan adapter and uc4h gps-mag node can be found here:

Some info on the project and build schemes:

The uc4h SLCAN adapter can be build for as little as $4.71, and the uc4h GPS-magnetometer node for as little $3.70 (exclusive PGS+compass module. That's DIY, isn't it . However, as part of the project I've also designed some PCBs, two-layered SMD of 0604 size, which are simple enough to be build but are probably somewhat more useful, as has been shown already in the above.

as teaser, some pics of schemes and builds
Last edited by OlliW; Aug 09, 2017 at 12:55 AM.
Aug 14, 2017, 01:52 AM
yesterday another "mile stone" was reached, I did the first successful flights using the UC4H power brick.

This is actually a big step. I was shying away from doing my own switching regulators for quite some time now, because of all the potential pitfalls one may encounter. But it seems I did that carefully enough. I could not detect any negative effect of the uc4h power brick.

The current AC3.6-dev master doesn't yet support the relevant UAVCAN message, but there is a PR by EShamaev ( So, I downloaded master and added the changes of that PR myself, and surprisingly enough all works nicely. I went a bit further and added a new UAVCAN message GenericBatteryInfo. It's great advantage is that the UC4H power brick allows for a much more accurate determination of the consumed charge (mAh), and with that message this ability is used.

For further details see

Here the setup:
Aug 14, 2017, 01:53 AM
I'm not sure that's of interest to anyone (I'm a bit entertaining myself here LOL), but just in case:

I've also reworked the pcb layouts for the SLCAN adpater, gpsmag node, and power brick, removing few tiny bugs and making the latter two slightly smaller and "better". I'm going to order them the next days, but I of course could order more of them. So:

In case anyone wants a pcb, pl leave a note. timeout

This are the current v1.0 versions of the boards (the SLCAN adapter and the node are populated only on one side):
Last edited by OlliW; Aug 21, 2017 at 12:02 AM.
Aug 14, 2017, 11:41 AM
As always great work and thanks for posting your progress.
Latest blog entry: Index to Articles

Thread Tools

Similar Threads
Category Thread Thread Starter Forum Replies Last Post
Question Tools and specifically hobby knifes for arthritic hobbiests maxadventure The Builders Workshop 2 Jun 13, 2012 09:12 PM
Discussion You might be a Hardcore R/C hobbiest if... graphixman Dock Talk 55 Jun 18, 2008 09:58 AM
Competitions for Hobbiest andyg UAV - Unmanned Aerial Vehicles 21 Jul 04, 2005 12:37 PM
Need some advice from Ducted fan Hobbiest.. XiiiXiii Fuel Jet Talk 6 Mar 31, 2004 02:03 PM