STM32Cube code initialization for “blue pill”

 Author:   Posted on:    No comments
Lately I’ve playing around with the STM32F103 development board known as “blue pill”. Developing software for it is not as easy as for Arduino boards. The MCU contains a 32-bit ARM CPU. I have previously tried to write software for this board using HAL library, but I didn’t get the most out of it because I found the programming model rather complicated.

One of the methods to develop software for this MCU is to use ST HAL library (which uses a higher level API than other libraries for this MCU). I chose the Eclipse IDE with a set of plugins for STM32 family. There is an easier way to get the SDK and IDE with the toolchain called System Workbench for STM32 (recommended by ST too). This is the download directory where you can find all releases for the major operating systems. But before creating a blank project in SW4STM32, you should know that there is a tool which can create this project for you. Not quite blank, as you will configure the MCU with a graphical tool in a step-by-step process.

STM32Cube code initialization for “blue pill”

STM32 “blue pill” easy development with Mbed

 Author:   Posted on:    No comments
The "blue pill" is an STM32F103 based development board. Although it is less popular, the board is cheaper than an Arduino Nano. More than that, STM32F103 is a device with Cortex-M3 ARM CPU that runs at 72 MHz, 20 kB of RAM and 64 or 128 kB of flash memory. The microcontroller (MCU) has USB port, two serial ports, 16 bit PWM pins and 12 bit ADC pins. It runs at 3.3V, but some of its pins are 5V tolerant.

I tried to program this development board using both Arduino IDE and STM32 HAL, but I wasn’t quite satisfied. Arduino framework is simplified and does not take advantage of platform’s features, while HAL was quite difficult for me. Using HAL in Eclipse come with another disadvantage: direct uploading of the binary in flash didn’t work, so I had to use ST-Link tools to upload it, outside of Eclipse. Recently I heard of PlatformIO IDE. This is a development environment supplied as Visual Studio Code or Atom plugin. One of its great advantages is the support for more than 500 development boards! Although VS Code and Atom are cross platform software, they are not at all lightweight, so you’ll need rather good hardware to run them smoothly.

Another great feature of PlatformIO is that for a development board you have multiple framework options. You can program the bluepill using Arduino API, just as you would do in Arduino IDE. Or you can program it using STM32Cube API. But, there is also Mbed OS framework, which I found it to be quite easy to develop.

STM32 “blue pill” easy development with Mbed

How to Count Frequency with Arduino

 Author:   Posted on:    No comments
Counting frequency using an Arduino seemed like an easy task. But most people like to do it the easy, but wrong way: using pulseIn to measure width of a pulse. This limits the maximum frequency that can be measured to about 50 kHz. Besides that, the function samples only a cycle of the signal.

A good way of measuring frequency is by counting input signal transitions that happen in a specific amount of time. This requires knowledge of timers and interrupts. The method is more difficult to implement and to do it right you need to set some registers.

This has been done before and although it was hard to find, I discovered code that can count frequencies up to 8 MHz if the input signal has a duty cycle of 50%. The only drawback is that frequency input pin is fixed to digital pin 5. The upper range is however not limited to only a few MHz. With some extra hardware (a prescaler IC) frequencies of hundreds of MHz can be measured with enough accuracy.
How to Count Frequency with Arduino

Chucks for mini drill tools

 Author:   Posted on:    No comments
Miniature drill tools are a must have for everyone who is making his own printed circuit boards (PCB) at home. Not limited to this, drill tools have many uses as rotary tools. Although the motors you will use for DIY tools have smaller power than a Dremel tool, some of the accessories can be used for small work. You can attach cutting discs, sanding, grinding, carving and polishing attachments. What works and what doesn’t depends on the motor you use, the type of drill chuck and the material you are using it on.

Building your own miniature rotary tool is usually cheaper than buying a Dremel tool. If you want something for PCB drilling only, the motor can be very small. And small motors are found in a lot of devices (do not expect to use a motor from a CD/DVD drive for this purpose, but motors from toys, old cassette players, hair dryers, printers, scanners etc. can drill a hole through a PCB). If you are lucky enough to have a motor from battery operated vacuum cleaner or drill machine (like the 775 motor), you can build something very powerful.

Chucks for mini drill tools

Antenna switch with PIN diodes

 Author:   Posted on:    No comments
A PIN diode is a diode with a wide, undoped intrinsic semiconductor region between a p-type semiconductor and an n-type semiconductor region. At high frequencies, the diode behaves as a resistor. The high-frequency resistance is inversely proportional to the DC bias current through the diode. Therefore, if suitably biased, the PIN diode acts as a variable resistor. This kind of diode has low reverse capacitance, that will attenuate RF signal, unless the diode is forward biased. These properties make it suitable for RF switches.

The device presented here can be used to switch two antennas. It can prove useful in a number of situations. You can have a VHF and a UHF antenna, or you can have two similar antennas that are pointed in different directions for different signals. This switch does not require an extra cable and does not cause significant signal losses. A low DC voltage is sent over the coaxial cable to forward bias one diode. If the polarity of this voltage is reversed, then the other diode will be biased.

Lightweight ACARS decoders for RTL-SDR

 Author:   Posted on:    No comments
ACARS is a digital data link system for the transmission of messages between aircraft and ground stations. The transmissions usually take place in VHF band, between 130 and 137 MHz. The wide availability of cheap software defined radios makes it easy for anyone to receive and decode ACARS transmissions. Since RTL2832U based USB sticks are the cheapest SDR hardware this is what I will use for reception. There are many tutorials on this subject and most of them involve piping an audio stream from a SDR application to an ACARS decoder application. This is not reliable and takes a lot of resources. More than that, by selecting one frequency, demodulating it and sending the audio stream to ACARS decoder software you are limited to that single frequency.

But there are a few tools that work directly with RTL-SDR hardware, are free, cross-platform and perform ACARS demodulation. More important than that, the software tools you will see here can listen to multiple frequencies at once. The only requirement is that those frequencies should fit in the bandwidth of RTL-SDR (about 2.4 MHz).

Lightweight ACARS decoders for RTL-SDR