PID control for DC motor with optical encoder

 Author:   Posted on:    No comments

In the previous post I gathered information about a cartridge slide unit taken from an old inkjet printer. As I found out, the printer used a common DC motor to move the cartridges on X axis, however with the addition of an optical encoder with strip, the cartridges could perform precise movements. So, I want to interface this to Arduino. Original printer electronics such as motor drivers were of no use (proprietary ICs without public datasheets).

I had to drive the motor with a L298N H-bridge module and for the encoder I built a PCB which replaced the original one used in printer. The software is not as simple as you may think. I just can't turn on motor until the reading of encoder equals the desired position. Suddenly stopping the motor will not result in a sudden stop of the sliding block. Due to inertia, it continues to move a bit, even with the motor electrically shorted. The proper approach requires a PID (proportional-integral-derivative) control algorithm which adjusts motor speed using PWM.

The motor with optical encoder wired to Arduino

The motor with optical encoder wired to Arduino

Optical encoder motor control for printer slide unit

 Author:   Posted on:    No comments

I disassembled an old inkjet printer without working cartridges. Buying replacement ink cartridges was not worth because the price of both black and white and color ink cartridges equals the price of a new printer. I couldn't throw away the printer without taking any usable electronic and mechanic parts from it. To my surprise, the cartridge holder is placed on a metallic sliding unit that seemed interesting.

Cheap design though. Plastic block sliding on metal axis, but since it did its job in the printer, it may work elsewhere too. However, instead of using a stepper motor to control the sliding unit, the manufacturer has chosen a closed loop system with a regular DC motor and an optical encoder with a strip. That's the approach for most home-use printers. When looking for a way to control such a system with Arduino I didn't quite found something that worked.

Optical encoder motor control for printer slide unit

The printer slide unit with a custom encoder PCB

Fixing a broken rotor coil of 775 motor

 Author:   Posted on:    No comments

I powered a 775 motor and strange things happened. The motor was new, never used before. In less than 10 seconds while it was supplied with voltage, it looked as if something was attempting to block the axis from spinning, I heard crackling noise from the motor then smelled some smoke. Not good... yet it was still spinning. It's worth mentioning the context in which this happened. I was testing a power supply I'm building, and because something went bad the 12 V motor received 30 V with plenty of current (about 7 A). I would expect it to fail under these circumstances, but not in this way and not as fast. Overheated rotor coils and short-circuited windings is what should have happened.

Yet the motor was completely cold and still spinning when I powered it again (this time from 12 V). A short piece of copper wire came out of it - something bad has happened inside. So, I ended up with a partially broken motor. The next thing I did was to open up the case.

775 motor case opened

775 motor case opened

Compile SPLAT! RF coverage software on 64-bit Windows

 Author:   Posted on:    No comments

SPLAT! is a cross-platform, open-source software that can be used to analyse a radio link between two locations and to generate coverage maps of RF transmitters. Coverage maps are calculated using Longley-Rice Irregular Terrain Model (ITM) algorithm. SPLAT! can predict RF coverage for any frequencies between 20 MHz and 20 GHz. It is thus useful for ham radio, broadcast radio, terrestrial television and wireless networks. Although it is cross-platform, up-to-date binaries for Windows are hard to find. On the other hand, for Linux users, it is available in the repositories of the major distributions.

I wrote in a previous post about SPLAT! and how to compile it with MinGW. At that time, the compiler package I used was only available for 32-bit architecture. Since most systems are now 64-bit, I had to use a different compiler package to get 64-bit SPLAT! binaries. Here is the good news: you can either follow this tutorial or you can jump to the end of this post and grab the precompiled binaries (SPLAT! is licensed under GPL v2).

Compile SPLAT! RF coverage software on 64-bit Windows

Play audio streams on OpenWrt (Internet Radio)

 Author:   Posted on:    No comments

I own some old ADSL modems that are no longer suitable for modern networks. OpenWrt can be installed on them, but they are limited by hardware to 100 Mbps LAN and 54 Mbps WiFi. Therefore, using these devices as routers, network attached storage or anything else that requires high transfer speeds is no longer wanted. Fortunately, OpenWrt comes with many software packages available to install using its included package manager.

One of the tasks that are suitable for most low-speed OpenWrt routers is audio playing. However, there are some hardware requirements. You need a router on which you can install OpenWrt firmware. It must have at least 8 MB flash storage memory and, the most important: at least one USB port. I haven’t heard of routers with audio output, yet there are plenty with USB ports (for GSM modem or USB storage). With an USB sound card and proper software, you will be able to play audio from any OpenWrt router. In this post I will talk about internet radio streams. However, if you have an extra USB port or you plan to use a hub, you may also play music files from USB drive.

USB audio card plugged in the USB port of the router

USB audio card plugged in the USB port of the router

WiFi Analyzer with ESP8266 and ILI9341 LCD

 Author:   Posted on:    No comments

This WiFi analyzer can help you identify all wireless access points (AP) in your area, providing you with detailed information about each of them. You can identify potentially unused channels and find the best place to install your router. You can use any smartphone for this task since there are a lot of apps that will scan for WiFi networks. However, I did this with NodeMcu, an ESP8266 development board.

ESP8266 has some advantages over my Android phone: it scans faster and it finds more access points. The phone comes with the advantage of 5 GHz band support, yet for the simple task of scanning WiFi, the analyzer app needs permission to access location of the device. Building an analyzer with ESP8266 requires a way of showing the information. I used a 2.8” color LCD display, with 240x320 pixels, based on ILI9341.

WiFi Analyzer with ESP8266 and ILI9341 LCD