Debugging is a must when coding, regardless of how big or complex a project is. And althought there are tons of debugging tools out there, most are overpowered for my needs or simply introduce unnecessary code even when in the release version.
Logging is not only a powerful debugging and maintenance tool, but also a basic security element. In this case I wanted to save telemetry data of a multirotor without sending it to my laptop. Thus I wrote a simple logger that stores everything on the on-board uSD card. Although it's not perfect, it has proven to work as expected and be quite lightweight.
Most robotic applications require Proportional-Integral-Derivative (PID) control at a low level to control several processes. Be it the speed of a rover according to the distance to its target, or the thrust of each propeller of a multirotor to hover in one place.
Regardless of how basic PID control is, it can be sometimes a bit tricky to understand and tune a PID controller.
The PIC24FJ microcontroller family feature lots of modules to perform many common operations with hardware. The problem with is is the microcontroller needs a big enough pinout for all of them.
Because this is not possible, the PIC23FJ feature remappable pins (RP) which can be assigned to different modules. How to use this function is no secret, and perfectly explained in the user reference manual. Yet I wanted to share the tiny library I have put together to handle them. The library does only cover a few modules, but can easily be modified to cover them all.
I have written an I²C driver for my PIC24FJ32GB002 which is running with FreeRTOS. It has an easy to use API and can be easily adapted to suit any other microcontroller. Also, thanks to the RTOS, many independent threads can be queued to access the I²C bus.
Another great feature is that when a thread is performing an I²C communication, which is really slow, it blocks letting another thread use the CPU. Yet this feature is currently disabled in my driver because at 400 kHz I²C speed it took the PIC24FJ32GB002 more time to dispatch a thread than to wait for the communications to end. Thus it is only useful for 100 kHz communications or for faster microcontrollers.
For simplicities sake, the driver does only detect and report comunication errors, but does no handle them. It is up to the user to do this.
I have been using this code for a while, and I am fairly pleased whith it. Yet there could still remain some hidden bugs or optimization possibilities. Any feedback is highly welcome.
Multirotors need propellers to convert rotary energy from the motor into lineal thrust. This article covers the most basic aspects and tries to give some guidelines to choose an appropriate propeller for a multirotor.
Choosing a propeller usually comes paired with choosing a motor. Its is a reiterative process where one has to check if the combination works considering mainly the weight and intended application of the multirotor.
LiPos, also known as LiPoly, are light weight and have a high capacity, this makes them perfect for multicopter applications.
To select the most suitable LiPo, the most important characteristics have to be considered.
- Pack voltage
- C rating
This article also cover some aspects related to battery charging, as well as dangers and safety instructions when handling LiPo bateries.
This articles intends to give a simplified view of and electric brushless motor. Because not all possible parameters are considered, the presented model will not be very accurate, but will suffice to compare motors with different characteristics.
The main application focus will be on quadcopters, or any other type of multicopter. The mechanical lift power that keeps a multicopter hovering heavily depends on the motor and on the propellers, which are covered in an different article. Depending on the motor-propellers combination the flying behavior of a multicopter drastically changes. Using a fast motor with little propellers allow for a fast and acrobatic flight, while a strong motor and big propellers change result in a stable flight with strong lift for extra payload.
Also, the input current of a motor depends on the propeller, which translates into mechanical load that needs to be driven. It is to be noted that more current at the same voltage corresponds to a bigger propeller.