Raspberry Pi – mounting USB drive

Raspberry PI, by default, has only one memory available – an SD card that also holds the kernel itself. Unless you are using a large SD, eventually, you will run out of space -especially if you are dealing with media files or playing with the camera module. The easiest and cheapest way of expanding memory is to use a USB Flash drive. If you are accessing PI from the terminal screen, then probably one of the built-in USB ports is free, and you can attach a drive directly to it; otherwise, use USB HUB – better with an external power option.

Continue reading

Setting up Tiva C Launchpad project template with Sourcery Codebench and Eclipse

Tiva C series TM4C123G (MCU:TM4C1233H6PM)Launchpad is updated version of Stellaris Launchpad LM4F120 (MCU: LM4F120H5QR). Practically this is due to TI’s choice to change the name of the product line. Such action led to some confusion, especially for software developers. This means that software libraries had to be renamed, software tools adapted, and so on. Since this work is most renaming things from one point, this is an easy task; from another point, it may be tricky to check all corners. So if you just into Texas Instruments ARM Cortex microcontrollers, it is better to start with the Tiva C series and forget Stellaris. Otherwise, this might get confusing to switch from one to another. At the moment, TivaWare 1.1 still has some issues due to migration, but most things should work fine. Let’s try to create a project template for Eclipse IDE and Sourcery Codebench Lite GCC compiler tools. First, you need to download and install Eclipse with CDT C/C++ tools (Eclipse Indigo includes this). Next, you need to install the latest Mentor Sourcery Codebench Lite. Also, download and extract TivaWare for the C series, where all libraries and examples are located. To Flash microcontroller, download LM Flash Programmer. Other…

Continue reading

Capacitors Embracing the Green Revolution

One of the pressing concerns of our age is the environmental crisis. With the progressing technological evolution, the need for energy conservation and harvesting has increased. Harvesting energy is not an easy task, and most of the time, generating energy creates pollution in the environment. To deal with it, the international community has changed its approach. It is now focused on identifying the areas where energy is being wasted and rectifying those issues instead of producing more energy. The low power factor is one of those aforementioned issues. Power factor is a measure of lag in current concerning voltage. Its value varies from zero to one.  This lag creates a component of electrical power that is not being used and keeps oscillating between generation and consumer ends. This circulation of power dissipates energy in the form of heat and creates extra load on the generation’s end. A power factor issue arises due to inductive loads, such as electric motors, fans, etc. Now the power companies have started to penalize industries with high inductive loads and a shallow power factor. The industries are taking initiatives to increase their power factor. There are two methods of power factor correction. One is using…

Continue reading

Raspberry Pi camera module

raspberry pi camera

Recently I’ve received a Raspberry pi camera board. So decided to make a post about it. Raspberry PI comes with two interesting connectors onboard. One is between Ethernet and HDMI, and another is near GPIO. The one closer to the Ethernet connector is CSI (Camera Serial Interface) bus interface. This interface is common in mobile phones with cameras. This interface is specially designed for high data rates that are necessary for transferring pixel data. The camera board is a small (25mm x 20mm x 9mm) board where a fixed-focus 5MP camera module (OV5647) is assembled. The camera connects to Raspberry Pi via a 15cm ribbon cable. Camera module is capable of producing 1080p images at 30fps or 720p at 60 fps and 640x480p at 60/90 fps. Obviously, such images and fps require a high-speed interface and processing. So CSI is connected directly to Raspberry Pi GPU, which can process images without ARM intervention. This is why the camera module is a much better choice than the USB camera, which occupies the main processor and slows down the whole system. GPU processing also benefits with fast H264 video encoding and JPEG compression capabilities.

Continue reading

Experiment with Joule thief circuit

joule thief

Joule thief circuit is popular among electronics enthusiasts. It has many implementations but probably the most common is a very minimalist voltage booster based on NPN transistor, coil, resistor, and LED. Its primary intent is to squeeze the remaining juice of dying batteries to light a LED. Since a pile of dying batteries keeps growing, I decided to give it a try. Instead of building the real circuit blindly, I decided to understand what is going on inside the circuit. So I made this circuit on the LTSpice simulator. You may find some difficulties when adding a transformer to the circuit, there is an excellent video on how to do this.

Continue reading

Simulating MOSFET based bidirectional 3.3V to 5V logic level shifter

clamping diode

Different logic levels are a common problem in various circuits. For instance, Arduino boards come powered from 5V or 3.3V. Raspberry Pi is powered at 3.3V, and it accepts and generates 3.3V signals on its GPIO. This is fine until you need to connect the 5V peripheral to a 3.3V device. This can be a simple LCD. Of course, you can get 3.3V LCDs, but this is not always the solution. Sometimes it is handy to build a voltage level converter. It can be a special buffer IC like SN74LVCC3245A. These work great as bidirectional voltage translators. But in many cases, there is no need for another IC in your circuit. Hobbyists like to go with simpler solutions. The simplest way is to use resistors, where signal levels differ. The fact is that in most cases, devices have clamping diodes on the inputs that are meant to protect a further circuit from over-voltages. For instance, clamping diode inside a 3.3v device will try to limit the input voltage to 3.3V. This is why a series resistor necessary to limit the current flowing through the diode. Using resistors doesn’t guarantee safe operation. First of all, you must be sure that the…

Continue reading

Building more complex commands using Raspberry Pi terminal

Probably this would be unwise to go through a long list of available Unix commands. It is quite long, and there is no reason to point out each of them here. You can take a look at some basic ones in the following list. It is more important to learn how to use them and get the desired result by building more complex commands. Commands can also be combined into a single line using piping. In this case, the output of one command becomes the input of the next one, and so on. Let’s go with a few examples. We all know that Raspberry Pi comes with Python installed. So we should expect to find lots of .py files here: sudo find / -name *.py this throws us a large list of file names: Finding and displaying files that way is useless. Viewing is even more painful. Let’s say we simply want to count all .py files. For this, we use the same command, but instead of throwing the list to the terminal, we feed it to another command that does the counting of lines (we get every file in a new line):

Continue reading

Linux command structure

Previously we looked at simple terminal commands like ls, cd. We know that ls output all files in the working directory. But in practice, command without options and parameters is almost useless. You may need to list special files or list files from the specified directory in more complex situations without going to it. This is why UNIX commands are run with options and parameters command [options] [parameters] There can be more than one option and parameter for a single command. For instance, we used a cd .. command to go to the previous directory. Dots .. are nothing more than parameters. Let’s see what parameters we have with the ls command. ls -l It displays a list of files in a long format. You can see that we get much more information by adding a simple option -l. Let’s say we want to display files in a long format from a different than a working directory. Then we need to type in the path to the directory as a parameter.

Continue reading

Diving in to Raspberry Pi shell

Raspberry Pi terminal commands

Computer users today are so attached to graphical interfaces. Sometimes it seems that people help computers to do the tasks. Can you imagine how many mouse clicks are required to do something simple? This is visible when the task is cyclic like “find, sort, delete.” Sometimes you find yourself just clicking the mouse and not seeing the result. What you would do half a day clicking the mouse can be performed with the single command line. The question is how to be that smart and feel like a fish in the water in front of the command prompt, shell, or bash – call it however you want. It is a system program that accepts typed commands from used and performs tasks. If you look deeper at almost any program with the graphical interface, you will see that it is only a nice skin that hides the same commands that run when the user clicks buttons. No graphical interface can cower all features of shell commands. So if you start dealing with Linux, then start being a friend to the terminal. Historically Unix computers even didn’t have a graphical interface, so all tasks were performed from the terminal screen. This is…

Continue reading

Getting used to Raspberry Pi

raspberry pi model b

It’s been quite some time since my Raspberry Pi Model B arrived. All I’ve done is tried to run several things, blink GPIO with examples found on the Internet, set up a desktop computer for my daughter with TuxPaint. I never was a big fan of Linux; on the desktop computer, I always use Windows for my daily tasks. With cheap single-board computers like Raspberry Pi, people looked at Linux from a different perspective. We can notice an increased interest in Linux, how to do this, and this. Who works with Linux long time? It is just another computer where they can work with it and make cool things right away. But for us like me, it’s a good chance to get to know Linux better and learn a few tricks.

Continue reading