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

Transmission line baluns for VHF and UHF

 Author:   Posted on:    No comments
A balun is a device that converts a balanced signal to an unbalanced signal. Depending on construction, a balun may transform impedance too and may be used for connecting signal lines of different impedances. In radio applications, baluns are used most of the time for adapting a transmission line to the antenna. This post will show you some easy to build baluns, designed for receiving antennas working in VHF and UHF radio and television bands. However, these baluns can be also used for transmitting antennas. They are easy to build because you only use cables similar to the antenna feeder cable.

Most used antenna class for all radio communications is the dipole. Since it's called a dipole, it has two connection points. Therefore it is suited for balanced signals. The antenna can be connected to a receiver using a twin lead cable. But in this case the receiver must have balanced input and similar impedance with the antenna. But the most used type of cable is the coaxial type, which is unbalanced and has a different impedance too. Let's see what are the basic types of connections between the antenna and the feeder cable.

Transmission line baluns for VHF and UHF

Simple Text Menu for ST7920 Graphic LCD

 Author:   Posted on:    1 comment
Graphic LCD displays are a good addition for any project where you want to display some data. They look better than the old fashioned 7 segment displays and even alphanumeric LCDs, but more than that, you can use them to build user interfaces and menus. In a previous post, I wrote code for displaying text on a ST7920 128x64 graphic LCD. To save space, I wrote my code from scratch, instead of using a library that draws text in graphic mode and takes up a lot of memory on small microcontrollers. This time, I will continue to add features to the initial Arduino sketch in order to create a simple menu. This menu still uses text mode for displaying items. In this way, you are forced to display a maximum of four items at a time (the display has 4 rows of 16 characters). For highlighting menu items, we'll have to switch to graphics mode and draw rectangles on the screen. I will show you how the graphics RAM of ST7920 is organized and how you can set any pixel you want. The nice thing about ST7920 is that text pixels and graphics pixels are never at the same state. Therefore, if you have written text on a row and afterwards you fill the entire pixels on that row, the text pixels will be cleared ("RGB Controller" is written in text mode, then all pixels from that row are filled - see photo below).

Simple Text Menu for ST7920 Graphic LCD

C Code for Text Mode on ST7920 Graphic LCD

 Author:   Posted on:    No comments
Graphic LCD displays are a good addition for any project where you want to display some data. They look better than the old fashioned 7 segment displays and even alphanumeric LCDs, but more than that, you can use them to build user interfaces and menus. If you interface a graphic LCD with an Arduino or compatible AVR development board, you probably heard about u8g2 library. This is a monochrome graphics display library which supports a lot of LCD controllers and screens of different sizes. It is very easy to use and comes with a lot of functions and display fonts. But this comes with a price. Text is drawn on LCD in graphics mode (this is how it renders different fonts). Combine this with the fact that in serial mode, some LCD controllers are write only. Therefore, the library must keep a part or the entire display data in RAM. This is not a bad thing, but unless you are developing some application where graphics is generated programmatically (something like a game), rather static user interfaces can be written to LCD from a ROM memory and don't need to be kept in RAM all time. And if you're creating a hardware project, you don't usually need to support different LCD controllers, as you'll not replace the LCD.

With this in mind and wanting to learn how to control a graphic LCD, I started to develop my own code. It turned out to be simpler than I thought. Simple code also means simple porting to other platforms. So I started this project with a ST7920 128x64 graphic LCD. I chose ST7920 because it supports serial protocol (SPI) and is 3.3V and 5V compatible. When I bought it I thought I could directly interface it with an OpenWRT router.

C Code for Text Mode on ST7920 Graphic LCD

Ultrasonic Tape Measure with HC-SR04 Sensor

 Author:   Posted on:    No comments
The wide availability and low price of microcontrollers makes it possible to update older analog designs to create reliable digital devices that are better and have more features. This time, using an ultrasonic sensor controlled by a microcontroller you can build an electronic distance calculator that can be used as an alternative to a tape measure for distances between 2 and 400 cm. I chose an ATmega development board (Arduino compatible) with an alphanumeric LCD to calculate and display data from the ultrasonic sensor.

The measuring device can be built entirely from ready made breakout boards and it can be powered from a 9V battery. With ATmega as its core, the device can have many features. The software supports current measurement hold and EEPROM storage. Stored measurement can be then displayed at a push of a button. The mode of operation is continuous. Measurements are performed each at 100 ms intervals and displayed on the LCD as long as the device is powered. You can pause the measurement by pressing the button assigned to HOLD function.

The device in the below photo can be built inside a case as long as the sensor's transmitter and receiver are passed through holes in the case. You will also need some holes for the display and buttons.

Ultrasonic Tape Measure with HC-SR04 Sensor