Posts

Connecting a Thermal Printer to a Raspberry Pi B+ with a Server-Side GUI

Image
What is a Thermal Printer? Thermal printers are commonly used for printing receipts in stores. They operate using special thermal paper that reacts to heat, allowing the printer to create images or text without needing ink. These printers are widely available for purchase online. When connecting a thermal printer to a Raspberry Pi, it's crucial to use an adapter with the correct amperage; otherwise, you may encounter issues like faded prints or no output at all. What I Did I successfully connected a thermal printer to a Raspberry Pi and configured it to periodically request new content from a server. I utilized a Python library to print images, barcodes, and formatted text. To make the printer more versatile, I developed a web-based GUI that allows users to create content for the printer. The features include formatted text input, a basic canvas for drawing, and a Sudoku generator with adjustable difficulty levels.      

Using the LG G3 Circle Case SDK to Create a Demo Application

Image
What is the Circle Case? LG offers a unique accessory for its G3 model—a special case with several advanced features. This case supports NFC technology, wireless charging via the Qi standard (available in the European market), and includes a circular cutout on the front cover. This circular window allows users to interact with about one-third of the display using a customized GUI, providing quick access to certain apps and functions. LG G3 SDK To help developers leverage the circle case's features, LG released a lightweight SDK. The core functionality revolves around detecting the opening and closing of the case using a hidden magnet within the case and a sensor behind the screen. The SDK provides a broadcast receiver to capture these events. Here's a basic example of how you can use this in your app: public class QCircleActivity extends Activity { // [START]declared in LGIntent.java of LG Framework public static final int EXTRA_ACCESSORY_COVER_OPENED = 0; public s...

Controlling an Owi Robotic Arm with Raspberry Pi Using Keyboard, WebSockets, and OpenCV

Image
How It All Started I recently received a Raspberry Pi (Model B+) as a gift for my 27th birthday. Naturally, the first thing I did was explore the GPIO (General Purpose Input/Output) pins that can be programmed. I quickly discovered the RPi.GPIO Python library, which supports GPIO manipulation, and I began experimenting with some basic circuits—toggling LEDs, working with an RGB LED, generating speaker beeps, and more. A few months earlier, a colleague had shown me a webpage featuring robotic arms that caught my attention. The closest retailer selling robotic arms was in the Czech Republic, and they only had one model available—the Owi robotic arm. So, I decided to get it and combine it with my Raspberry Pi. Connecting the Owi Arm to the Raspberry Pi The first challenge was connecting the Owi robotic arm to the Raspberry Pi. The model I purchased came with a joystick controller, so I had to figure out how to connect it to the Raspberry Pi. After a few hours of searching, I found a video...

Generating a Heat Map Using iBeacons with an Android Application

Image
Introduction About a month ago, I had the opportunity to experiment with iBeacons on the Android platform. My initial task was to implement a proximity trigger for one of our Android apps at work. As we delved deeper into the project, we became curious about obtaining more precise data, such as generating a heat map. Searching for Solutions I began by searching for existing projects and apps that could generate a heat map based on actual distances from iBeacons. Unfortunately, I couldn’t find a precise solution in the Play Store. After visualizing the raw accuracy data on a graph (as shown in the image below), I discovered a helpful page that confirmed some of my findings. Here are my key observations: The raw data from iBeacons is not as accurate as I initially expected. Accuracy varies depending on the orientation of the iBeacon relative to the smartphone. Beyond a certain distance, the margin of error increases significantly. For more precise data, you need to set the transmit inter...

Hint

What Is It? Switching between different programming languages and projects daily can be challenging. To make things easier, I decided to create a quick-access utility for storing and retrieving code snippets, examples, and notes. The new features you learn from various frameworks are often useful later—if not for yourself, then for your coworkers. While Googling is an option, it often takes up valuable time. My solution? A small utility that lets you access your notes in less than 2-3 seconds. Recently, I’ve been working extensively with PostgreSQL, so I decided to build this tool using this reliable open-source database. What Can It Do? This utility allows you to quickly search for syntax examples across multiple programming languages. It’s designed to help you find what you need with minimal effort. How Does It Work? The utility is command-line-based and currently supports space-separated search terms. Here’s how it works: Command Line Interface : You enter your search directly into ...

Automatic Tool for Cropping Bills from Scans

Image
What Is It? At work, we’re developing a project aimed at small and medium-sized businesses that goes beyond simple accounting. It includes many innovative features, but today I want to focus on one in particular: the automatic processing of bills and invoices. Users can take advantage of this feature via a mobile client (Android, iOS) or a web application. The Challenge We encountered an issue where users were scanning multiple bills together in a single image, rather than following the "one image - one document" rule. This made it difficult to process the documents correctly. To address this, I developed a script that automatically detects and crops these multi-bill images into separate, individual images. The Algorithm To separate and crop the bills from a scanned image, I used a series of simple image preprocessing methods: Resize : The image is resized to a standard dimension for consistency. Morphological Operation (IMOPEN) : This step helps in removing noise and refinin...

Creating a Custom Log Helper for the CodeIgniter Framework

Over the past few months, we've been working extensively with the PHP CodeIgniter framework. One thing that consistently slowed me down during debugging was the repetitive process of logging variables. Every time I needed to log a variable, I found myself typing out log_message('error', $your_variable) —a lengthy 18 characters every single time! And that’s just for basic variables. If I wanted to log a boolean, object, or array, the process became even more time-consuming, often requiring additional if statements or extra formatting. To simplify this process, I decided to write a small custom log helper. This helper makes logging easier by automatically handling different variable types, allowing for faster and more efficient debugging. If you’re working with CodeIgniter and find logging as tedious as I did, you might find this helper useful too. <? if ( !function_exists('l') && !function_exists('l2') && !function_exists('ge...