Infrared protocol analysis with PC soundcard

 Author:   Posted on:   Comments
Infrared communication is widespread among electronic devices that use remote controls. Because of this, there are more protocols in use and the data (bytes) sent to the device depend on manufacturer. This post will show you how to view the waveform of an infrared signal emitted by a remote control, how to analyze and decode it. Then it will be possible to reproduce it. In this way you can program your universal remote control or your mobile device (smartphone with IR transmitter) with the right code for the best results. Instead of using an oscilloscope for signal analysis, due to the low frequency of the IR carrier an ordinary soundcard will be used.

Infrared protocol analysis with PC soundcard

High quality scanning vs. small file size

 Author:   Posted on:   Comments
This post will not talk about scanning only, but about the whole process of turning a sheet of paper, a magazine or a book into a high quality digital document of the smallest possible size. Nothing will be lost during the conversion as lossless compression will be used and OCR will be run on documents. A low quality scan is hard to read (impossible to run OCR). A high quality scan must preserve as much detail as possible, must have the correct page size (when printed at 100%, the resulting copy should be exactly the same size as the original), must load as quick as possible on low-end devices and shouldn't eat the whole drive space. Software processing of the raw image from scanner plays a very important role. Yet, if the image from scanner has a low resolution, further processing is useless and may have negative results. All software used in this tutorial is free (some apps are open-source). But let's start with the basics.

High quality scanning vs. small file size

Draw electronic schematics using LibreOffice

 Author:   Posted on:   Comments
Draw is a powerful vector graphics drawing software. It is part of the free office suites LibreOffice and Apache OpenOffice.

There are a lot of free EDA software solutions but none of them allows users to 'customize' the schematics as they want (for example part colors - outline, background, including high resolution images in the schematic etc.). This tutorial will cover some aspects of drawing schematics in Draw. Similarly, schematics can be drawn in any other graphics software (for example Inkscape, even GIMP and Scribus).

Make a bootable Windows USB from Linux

 Author:   Posted on:   Comments

Ubuntu has already an application called Startup Disk Creator, but this can only be used to make Linux bootable USB drives. To make a Windows bootable USB there is an application called WinUSB but it hasn't been updated for a while.

The following guide has been updated and works on any Linux distribution as long as it has GRUB and GParted installed and can make bootable USB for any Windows version newer than Vista: Windows Vista, Windows 7, Windows 8, Windows 8.1 and Windows 10. UEFI boot is only supported for Windows 7 x64 and newer.

Before starting, let's mention that there are two types of boot methods. There is the MBR code type where the bootable executable is stored in a reserved section at the beginning of the storage device. And there is the EFI type, where the boot loader executable file is stored at a standard path in an FAT32 filesystem.

You must decide in advance what you will use. There are some variables for each boot type. If you have no idea what to use, the most common setup that works with unmodified Windows sources, is msdos partition table with fat32 filesystem and flag the partition with boot. In this way you will get both an MBR and UEFI bootable drive.

  Partition table Filesystem Partition flag
MBR bootable msdos ntfs / fat32 boot
UEFI bootable msdos / gpt fat32 boot / msftdata *

* msdos should be flagged with boot and gpt should be flagged with msftdata.

UEFI can only boot FAT32 drives! If you need to make an NTFS UEFI bootable flashdrive to remove the 4 GB maximum file size restriction of FAT32 see this: UEFI NTFS: Bootable Windows USB from Linux.

Make a bootable Windows USB from Linux (Ubuntu)

If you prefer, here is the video version of what is about to follow:

1. Format USB drive

This is the first step. GParted has a nice GUI and it is easy to use for this. So, plug in your USB flashdrive and start GParted (root permissions required). Select the USB drive and unmount it, otherwise you won't be able to format it.

Warning! Selecting the wrong device will result in data loss!
GParted main window screenshot emphasizing device

GParted main window. The first thing to do is select the USB drive.

USB drive partition right click menu screenshot

Right-click the USB drive partition and select Unmount

You must re-create the partition table by going to the Device menu then select Create Partition Table. Choose msdos (or gpt if you want an UEFI only bootable drive) and click Apply.

GParted Partition Table dialog screenshot

The Partition Table dialog.

Right click the unallocated space and select New. Make a primary NTFS or FAT32 partition and give it a label too. The label must be as strange as possible because the bootloader will identify the bootable partition by this and you should not use windows like I did in the video! If the filesystem is FAT32 use only uppercase letters. For example: WUSB1840 would be a good label (W for Windows, USB for USB flash drive and 18:40 is the time I was writing this). Remember the label as you will need it later.

If you have a customized Windows with install.wim larger than 4 GB you should definitely go for NTFS. Otherwise, if you choose FAT32, you could get the flashdrive bootable from UEFI too.

GParted new partition dialog

New partition dialog

Apply all pending operation from Edit menu - Apply all operations or click the button on the main window.

Right click the partition and choose Manage flags. If you chose the msdos partition table tick boot. If you chose the gpt partition table, msftdata should already be checked.

GParted main window - Apply button emphasized screenshot

The Apply button from the main window of GParted

2. Copy Windows files

Quit GParted and use the file manager to copy all files from Windows ISO to USB stick. Mount the ISO using Open with - Disk Image Mounter (if you use Nautilus as a file manager). If that fails you can use Furius ISO Mount and loop-mount the ISO.

Select all files Ctrl+A and Copy to USB drive which will be automatically mounted when you click on it at /media/<username>/<drive_label>.

After the copy process is finished, look in the USB root folder for the boot directory. If it is uppercase, rename it to lowercase.

3. Make it bootable

If you used NTFS filesystem and MSDOS table, only method A is available. If you used FAT32 and MSDOS table, you can apply method A, B or both. If you used GPT partition table, only method B should be followed.

A. MBR bootable

GRUB will be used for that. Open a Terminal and run:

sudo grub-install --target=i386-pc --boot-directory="/media/<username>/<drive_label>/boot" /dev/sdX


  • /media/<username>/<drive_label> with the path where USB drive is mounted;
  • /dev/sdX with the USB drive, not the partition (e.g. /dev/sdb)
Warning! Selecting the wrong device (/dev/sdX) may result in bootloader corruption of the running operating system!

Wait for it to finish. If everything is OK, you should see:

Installing for i386-pc platform.  
Installation finished. No error reported.

Now, create a text file and write the following in it:

menuentry "Start Windows Installation" {
    insmod ntfs
    insmod search_label
    search --no-floppy --set=root --label <USB_drive_label> --hint hd0,msdos1
    ntldr /bootmgr

menuentry "Boot from the first hard drive" {
    insmod ntfs
    insmod chain
    insmod part_msdos
    insmod part_gpt
    set root=(hd1)
    chainloader +1

Replace <USB_drive_label> with the label from step 1 (you can place it between quotes if it contains a space, although it is not recommended to use spaces in drive label). Save the file as grub.cfg and put it on the USB drive in the boot/grub folder.

That's it. The USB drive is now bootable from BIOS and can be used to install Windows on your PC. The first time you boot from it in MBR BIOS or CSM mode select Start Windows Installation.

B. UEFI bootable

Not all Windows versions are supported. Windows 7 on 64 bits, Windows 8 and newer versions should work.

After the copy process is finished, look in the USB root folder for the efi/boot directory. If there's a bootx64.efi or bootia32.efi file there, then you're done. You can boot from your USB in UEFI mode.

If the OS you are making a bootable USB for is Windows 7, browse the efi/microsoft folder and copy the entire boot folder from this path one level up in the efi folder. Merge folders if boot already exists.

Here is what to do if you don't have the bootx64.efi file in efi/boot folder. Browse the mounted Windows ISO image into the sources folder. Open install.wim (or install.esd) with your archive manager (you will need 7z installed). Go to the path ./1/Windows/Boot/EFI and extract the file bootmgfw.efi anywhere you want. Rename it to bootx64.efi and put it on the USB drive, in the efi/boot folder. If you can't find bootmgfw.efi in install.wim then you probably have a 32 bit Windows ISO or other types of images (recovery disks, upgrade versions).

You can now boot from your USB in UEFI mode.


1. doesn't exist

grub-install: error: /usr/lib/grub/i386-pc/ doesn't exist. Please specify --target or --directory.

Install the grub-pc-bin package with sudo apt install grub-pc-bin and run the grub-install command again.

2. Embedding errors

If you get embedding errors (something like filesystem 'x' does not support embedding or Embedding is not possible), be sure you are installing GRUB to USB device and not USB partition. Most likely you typed /dev/sdb1 instead of /dev/sdb (sdb is just an example here). If it still doesn't work, try zeroing the USB drive (at least some sectors at beggining) or use a different USB flash drive.

3. Blocklists

Sometimes, GRUB will not want to install on some flash drives. Try to force it by adding --force argument to the grub-install command.

4. Alternate root partition selection

The root partition selection may fail if your USB flash drive partition has the same label as one of the partitions on the target computer. The best way of setting the root partition is by UUID.

Launch again GParted and select the USB flashdrive. Right click the partition and select Information. Note the UUID field.

GParted partition information UUID

Partition UUID

In grub.cfg, replace the line:

search --no-floppy --set=root --label <USB_drive_label> --hint hd0,msdos1


insmod search_fs_uuid
search --no-floppy --fs-uuid --set root <drive_UUID>

where you will replace <drive_UUID> with the UUID you got from GParted.

Still getting errors? If you want an useful answer, please post a comment with the complete grub-install command and the error message.


Change DPI in Ubuntu

 Author:   Posted on:   Comments
By default Ubuntu assumes you use a 96 DPI monitor. But nowadays pixel density keeps increasing as monitors with high resolution became accessible. There is no straightforward option in Ubuntu with Unity to change the default DPI which is considered to be 96 DPI (run in  a terminal xrdb -query). But there are two parameters which control the user interface DPI (this affects font rendering too) and font rendering only.

The parameter that controls user interface and fonts DPI is scaling-factor and the font rendering parameter is text-scaling factor. These parameters can be modified by the Displays application, by GNOME Tweak Tool and by Unity Tweak Tool, but none of these allows you to set a value with 3-4 decimals.

Computer PSU start circuit with bicolor LED

 Author:   Posted on:   Comments
There are a lot of tutorials on the internet on how to turn a computer PSU into a bench top power supply. Most of them involve adding a load on the 5V line and turning the PSU on by grounding the PS_ON wire via a switch. Here is a nice indicator and turn on/off switch for computer PSUs.

ATX PSUs work well under rather constant loads. So if you power up the PSU with a small load of a few tens miliamps and then connect a greater load, for example a car light bulb which may require 3-4 A, the PSU may shut down. The same happens in case of an accidental shortcircuit. You may believe that the PSU got broken or its fuse got blown. That's not true. The PSU automatically shut itself off.

Regular backups using Grive2 on Ubuntu

 Author:   Posted on:   Comments
Grive is a Google Drive client for Linux that can do two-side synchronization between Google Drive and a local folder. The synchronization is done whenever the user launches the application, either from a launcher or from command line (it is a CLI application).

By adding grive to crontab, periodic backups of important folders can be made. And no user interaction is required because the process is automated. Here is how to do it in Ubuntu. There is no system load when the process is not running, but this comes with a disadvantage: no filesystem monitoring. Any updates are made during the automatic execution of Grive.
Regular backups using Grive2 on Ubuntu

MxL5007T tuner radio

 Author:   Posted on:   Comments
MxL5007T is a tuner IC designed mostly for digital signals (DVB-T, ATSC), but it can be used for analog reception too. I will show you how I took it out from a receiver so I can use it in my projects. It has a programmable IF output and it can receive anything from 44 to 885 MHz. There is no datasheet for it, but there are Linux drivers.

MxL5007T tuner radio

Design of a TV Tuner based radio scanner

 Author:   Posted on:   Comments
Building radio frequency devices becomes difficult starting from VHF band. Moreover, tuning various stages is difficult without expensive electronics equipment. But a ready made unit can be used as the frontend of any radio receiver operating in the VHF – UHF band. That unit is the tuner coming from a TV, from a STB or from a PC card. It has the advantage of covering a wide spectrum of frequencies at a reasonable reception quality well above homemade radio receivers.
In order to build a TV tuner radio scanner you need, of course, a tuner. Also you must be able to build some detectors (demodulators) for the common analog modulation schemes. Some frequency mixers need to be built too. Although designed for analog modulation, the scanner is able to demodulate digital signals using the PC sound card as input. The whole constructional project is not difficult because it is modular and you don’t have to build all modules to get it working with a specific RF signal. Let’s take a simple example: if you are interested in receiving broadcast FM radio stations, you only need a simple FM detector that can take as input the tuner’s intermediary frequency. Of course, if you want to improve it you can add a stereo and RDS decoder. On the other hand, if you are interested in digital aviation signals, you’ll need a detector with a tunable local oscillator to overcome tuner large frequency step and a tunable IF filter. To maintain the modular design of the project, you could make this from two modules: a frequency downconverter with the tunable oscillator and filter followed by a fixed frequency detector. In the end, the main point of building this is obtaining the same results as with Realtek SDR devices and SDR#. The functional schematic of the scanner is shown in the figure below.

Radio scanner functional blocks
Functional schematic of the scanner. Don't worry, you don't have to build everything from scratch.

Render 3D realistic images of EAGLE circuit boards

 Author:   Posted on:   Comments
Did you ever wanted to see how some of your electronic projects would look before you actually build it? This post will show you how to create realistic images of your PCB designs that you can use in presentations, websites or only to get an idea of how it will look.

The process is the following: you design a PCB using CadSoft EAGLE. Then, the Eagle3D script converts the EAGLE PCB file into a POV-Ray source. This is then rendered into something like below. POV-Ray is a very high quality and very configurable renderer. To make an idea of what ic can do with the right input, see the hall of fame of images rendered with it.

There is also a video version of this and some new improvements in: [Video] Render 3D images of EAGLE PCB projects.

This post will describe:
  • How to compile POV-Ray (at the time of writing this there were no Ubuntu packages, you can now install from repositories).
  • How to use HDRI lighting to improve the quality of the rendered pictures.
  • How to compile MegaPOV, a modified version of POV-Ray 3.6.
Hexapod Interface EAGLE example project

Compile and setup PonyProg on Ubuntu

 Author:   Posted on:   Comments

PonyProg is a device programming software for the SI Prog serial interface programmer designed by Claudio Lanconelli. The latest version of the PonyProg software can be found on SourceForge, but there are no Ubuntu packages.

Here is how to compile it on Ubuntu. This post was updated for Ubuntu 16.10. First you'll have to install some development libraries:

sudo apt install build-essential libxt-dev libxmu-dev libxaw7-dev

Then download the archive from SourceForge and extract it to some folder you want (at the time of writing this, the latest version is 2.08d).