PWM Using Timers The STM32F103C8T6 has four hardware timers that can be used to generate PWM signals to drive servos. Ninjaskit has two classes (Pulse1 and Pulse2) that wrap two of the hardware timers to produce PWM on up to four digital pins each. For Pulse1 these pins are PA0, PA1, PA2 and PA3. For… Read More »
Ninjaskit – A STM32F103C8T6 Library Ninjaskit is a high level C++ API for STM32F103C8T6 micro-controllers. GitHub Page The STM32F103C8T6 micro-controller has 64K of FLASH, 20K of RAM and ticks at up to 72Mhz. It’s quite small ( 7x7mm ), comes with a built in boot loader and is very easy to incorporate in home-made PCBs.… Read More »
When confronted by large, repetitive and tedious coding tasks it’s often better to actually write code generators. I’ve written several Python scripts for code generation for different projects and every time it has been totally worthwhile. The entire communications system used by Firetail UAV is automatically generated. Every single piece of information that is transferred… Read More »
The StaticString library is pretty easy to use, however there’s a couple of little gotchas and interesting points. The first is copying! Copying StaticStrings C-strings are just pointers to character arrays. Creating a new char pointer to the string, of course, will only ‘shallow-copy’.
char* c_s1 = "Hello";
c_s2 = c_s1;
c_s2 = 'Y';
cout << c_s2 << endl; //prints 'Yello'
Modifying c_s2 will also modify c_s1 because they are both… Read More »
There’s a lot of seasoned coders out there who are so stuck in the mindset that C is the fastest language, that they are willing to use antiquated and sometimes dangerous coding practices. I came across this on the Arduino forums recently . . . I’m using String because its easier to operate, concatenate etc… Read More »
So you want to create a remote controlled device using an Arduino? To put an Arduino between your RC receiver and servos, you’re going to need to know how to read PWM signals. Getting your Arduino to read signals from an RC receiver is an easy task if you don’t mind doing it badly. If… Read More »
Fuzzy Logic Control Some people describe fuzzy logic in mystical terms, as if it’s a magical way of making a computer think like a human. It’s not. It’s a simple way of mapping an input to an output. There’s nothing fuzzy about it. Let’s look at an example. Say you’re making an auto-throttle for an… Read More »
Using the C standard libraries for string processing is a terrible option when it comes to programming micro-controllers. The standard C string functions can be unsafe and most C string functions are prohibited by high integrity coding standards. They will also bloat compiled binaries by up to 30Kb. The Embedded Tool Kit offers a lightweight… Read More »
A while ago I had the displeasure of fixing a bug in an embedded application. Every 11hours and 55mins the micro-controller would halt. It wasn’t a hard fault, it would simply freeze. Just to fill in some background information: The target MCU was an STM32F415 and the application had made use of ST’s Cube software… Read More »
EvoPid EvoPid is a self optimising, auto-tuning PID controller from ETK. There are a number of ways to tune a PID controller. PID gains can be calculated using hard rules and previously gathered data. Methods that use this approach include the Zigler Nichols method and relay-based tuning. These methods specify a process – a means… Read More »