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

Crossfade Bicolor LED with PS/2 Touchpad

 Author:   Posted on:    No comments
Some while ago, I found a Processing example that would crossfade an Arduino connected bicolor LED depending on mouse position over a window with a gradient. Since I had a touchpad from an old netbook, I decided to use a hardware approach: interface this to Arduino and use it to change LED color by swiping left or right. Horizontal swiping will change the duty factor of PWM signals that light the LED.

This is a simple project that can be built with other kind of input devices like potentiometer or joystick. But, my purpose was to get that touchpad working. I had to use a logic analyzer to determine its pinout. Luckily, since it uses PS/2 protocol, it sends some bytes without connection to a host device. The PS/2 protocol is well documented and pretty easy. ATmega microcontrollers used by Arduino boards don't have hardware support for this protocol, therefore it must be implemented in software. Some searching revealed a lot of libraries for PS/2 devices, but not all worked for me. This may be because the touchpad I used is pretty old and may not support all protocol features.

Crossfade Bicolor LED with PS/2 Touchpad

TSA5523 Tuner Modules from PC TV Cards

 Author:   Posted on:    No comments
Some of the previous posts show methods of generating analog video with microcontrollers and RF modulation of it using ready made modules. Analog video is no longer in use in most parts of the world. TV tuner cards for analog signals are no longer manufactured and old ones are difficult or impossible to install on newer computers because there are no drivers. Despite this, analog video capture devices are cheap and widely available. Most are USB dongles, with video and audio inputs, no tuner.

Since I had some old TV tuner cards that were no longer compatible with my PC or had poor performance, I decided to take the tuners out of them. To my surprise, different tuners from different manufacturers looked pretty much the same on the inside. All of them used the same integrated circuits. The tuners I found are actually complete receivers, with included demodulator. This means you can get analog audio and video straight from the module pins. There are also modules with FM support, with stereo decoder.

In the photo below, you can see two tuners. The top one has FM radio support. You can see that it's similar to the other, but the rightmost compartment has some additional filters for FM IF.

Tuners from TV cards
Tuners from TV cards

USB Power Supply for Breadboard

 Author:   Posted on:    No comments
Breadboards are very useful for quickly building electronic circuits. But these circuits require power. The popular breadboard power supply you will find on the market is powered from more than 8 V by an AC-DC adapter. They can provide both 5V and 3.3V from linear 1117 regulators. These regulators can supply a maximum of 800mA, but because they work in linear mode and the PCB is not well built for heat dissipation, the current you can draw from such a device is very limited.

While trying to interface a gas sensor and a TV card tuner to an Arduino, I found that I had troubles powering them. Each of the mentioned devices need about 200mA. Both Arduino and the breadboard power supply use linear voltage regulators to provide 5V. I tried to use the breadboard power supply, but the regulator became hot immediately. Being fed with 12V, the 1117 regulator needed to dissipate (12 - 5) x 0.2 = 1.4 W. That's a lot for its small package.

I needed a better power supply. And I want it for breadboard projects. USB seems to be a pretty good power source, being able to provide at least 500mA. So I designed my own power supply. Since is USB powered, I thought it would be a good idea to have an USB port where I could plug development boards, without needing another computer USB port.

USB Power Supply for Breadboard

Program Arduino Pro Mini with CH341A dongle

 Author:   Posted on:    No comments
Arduino Pro Mini is a development board based on ATmega168 or ATmega328 microcontroller. Unlike other members of the Arduino family, this board does not have an USB port for PC connection. To program it, you need an USB to serial TTL converter. There are many choices here, and the Arduino Pro Mini has a pinheader port that matches the pinout of FTDI USB serial breakout boards. ATmega MCU doesn't need all serial port pins. It requires serial data pins RxD and TxD and also DTR, which is connected to reset pin.

CH340 is another USB serial interface. It can be found at the core of the cheapest USB serial adapters, but these dongles are difficult to connect to Arduino because there is no power pin and no exposed DTR pin. The power pins on the CH340 USB breakout board are used with jumpers to select voltage levels (3.3V or 5V).

CH341A is a complex interface chip which adds parallel, I2C or SPI interface. It is used by memory programmers. However, by setting a jumper, it works as an usual USB to serial adapter. I will be using here a popular device based on CH341A, the black MiniProgrammer, to program an Arduino Pro Mini compatible board.
Program Arduino Pro Mini with CH341A dongle

Measure RPM with Slotted Optical Switch

 Author:   Posted on:    No comments
Building an RPM counter is very easy with an optical switch and a way of counting pulses generated by the switch. A microcontroller, a frequency meter and even a logic analyzer can be used for this. Here, I will be using the cheapest and popular method: an Arduino. Optical switches are devices made of an emitter LED, usually infrared type and a receiver diode. Between the IR emitting LED and the receiver there is a slot. An opaque piece can pass through this slot and block IR beam. This will be detected by the receiver diode and its output will change state.

The piece that will block IR light will be a flange with a slot (a cutout area from the disc). When this passes through the switch's slot, the light reaches the receiver diode. Therefore, rotations are translated into a digital signal with a constant duty factor, dependant on flange configuration. The frequency of this signal needs to be measured and converted into RPM.

775 motor fitted with optical switch
775 motor fitted with optical switch

I2C Analog TV Modulator controlled by Arduino

 Author:   Posted on:    11 comments
Analog video is getting replaced by digital signals which provide better resolution and picture without noise or interference. But, analog video signal is easy to generate with simple hardware and then it can be FM modulated for broadcasting over a wire. I2C controlled RF modulators are common modules in obsolete VCRs and set top boxes. Most of them cover the entire UHF band and support multistandard sound carrier frequencies. Once taken out of its device, the modulator needs a microcontroller to set up its frequency and other parameters.

Using an Arduino board with LCD and keypad shield a full featured modulator can be built. Arduino can be used to generate video too, but a single board can't use I2C and generate video in the same sketch. You'll need different boards if that's what you want to do.

I used for this project a Samsung RMUP74055AD modulator with MBS74T1AEF controller. Some searching reveals the same IC is also used by Tena TNF0170U722 modulator. Some datasheets will come up too, if you search for them. Anyway, these modulators are 5V devices.

RMUP74055AD UHF RF modulator
RMUP74055AD UHF RF modulator

Arduino Thermometer with... TV Output

 Author:   Posted on:    1 comment
Analog video is getting replaced by digital signals which provide better resolution and picture without noise or interference. Although receivers for digital signals are cheap and popular, devices for generating such signals are expensive and intended for professional use only. On the other hand, analog video is easy to generate with simple hardware. You can even broadcast it over RF (on wire, not on air) with common modulators (standalone devices or modules from video game consoles, set top boxes, VCRs etc.).

An easy way to generate video signal is by using a microcontroller and some resistors. I'll use for this purpose an Arduino board (ATmega 328p) with the TVout library. The video signal is of low resolution and black&white. But it can be used to display data on a TV screen. If you no longer own a TV with analog video input, an USB capture card can be used. TVout library is interrupt based, therefore will interfere with some of other interrupt dependent microcontroller features.

Thermometer with TV Output
Thermometer with TV Output

Compute Heat Index with Arduino and DHT Sensor

 Author:   Posted on:    No comments
The heat index is a parameter that takes into account temperature and relative humidity, to determine the apparent temperature or the human perceived equivalent temperature. Heat index was developed in 1978 by George Winterling and was adopted next year. It is also known as humiture, according to Wikipedia contributors.

To compute this index, you need to know current temperature and relative humidity. An easy way to find both is by using an Arduino development board with a DHT sensor (DHT11, DHT22). These sensors measure temperature and humidity and send it to the microcontroller using a digital protocol. Thus, there is no need for calibration. You can read the values directly from the sensor module.

However, you should take into account that the accuracy of these sensors is not the best. DHT11 has an accuracy of +/-5% for humidity and +/-2 degrees Celsius for temperature. DHT22 (AM2302) is slightly better with an accuracy of +/-2% for humidity and +/-0.5 degrees Celsius for temperature. More than that, DHT22 has extended ranges for both temperature and humidity.

Compute Heat Index with Arduino and DHT Sensor

Audio Amplifier with Common Transistors

 Author:   Posted on:    No comments
Here is the schematic of a small audio amplifier that can provide up to 300mW to an 8 ohm load and can be used in low power devices like battery powered radios. This circuit can be an alternative to the LM386 IC. Due to the simplicity of the schematic, the circuit can be built also on breadboard, for those of you who want to experiment and learn how an amplifier works.

The design is straightforward. A common small signal NPN transistor (like BC547, 2N2222, 2N3904, S8050) drives a balanced power amplifier made of similar transistors. The output transistor pairs can be BC327 with BC337 or S8050 with S8550. They must handle peak currents of 300-400mA (this is why BC547/BC557 or 2N3904/2N3906 should not be used here).

The amplifier can be powered from a 9V battery or from a 12V power source. The circuit draws a current of about 170mA. The quiescent current is less than 10mA.

Audio amplifier with common transistors build on breadboard
Audio amplifier build on breadboard