Monthly Archives: December 2014

Some of the Best Raspberry Pi Add-Ons

To most people, the Raspberry Pi or the RBPi Single Board Computer is only a cheap desktop. That is because by the time you have added a monitor, a keyboard, a mouse and the SD card, it would have cost as much as a cheap laptop and would still be a lot less powerful.

However, the real innovation of the RBPi lies not in its cost, but in its form factor. You can run the tiny RBPi on a few batteries or solar cells and use its exposed General Purpose Input and Output pins. This trio of combinations does not have any precedents in computing, at least not in the price range of the RBPi.

Being a new type of device, the RBPi is a lot easier to understand with some of the readily available components that connect to it to enable some function or to add some feature.

Most of these add-on components are not from large companies, but developed by hobbyists who saw the need for and filled it. One of these add-on components is the multi-purpose LED display Pi Lite. This is a simple board full of LEDs allowing people to use the RBPi to turn them on or off individually. This has made the RBPi SBC different from the regular PC and forced people to think differently for using it in its particular niche.

Pi Lite has 126 red LEDs, with a white LED version on its way. You plug the board into the GPIO pins on the RBPi. Pi Lite nearly covers the main RBPi board and has about the same form factor. Of course, you need a little configuration to enable the board to use the RBPi serial port, but that is well documented.

You send commands to the Pi Lite via a minicom terminal. Once connected over the serial port, anything sent over will scroll across in beautiful red light. Not only can you send text, you can also send commands preceded by three-dollar signs. You can turn all pixels on or off, display horizontal and vertical graphs and manipulate individual pixels.

You can improve the connectivity of your RBPi by expanding its ports. As the GPIO pins are exposed, any circuitry can be added to the RBPi. That may cause accidents and fry your RBPi very easily. Although there are several add-on boards that provide access and protection to the RBPI GPIOs, Quick2Wire has a board that uses the I2C and SPI features of the RBPi.

These are the Inter-Integrated Circuit and Serial Peripheral Interface and the board comes in two parts. The main board provides the I2C and SPI ports, adds protection for the RBPi and voltage selectors. Additional boards provide more GPIO ports including analog inputs and outputs that RBPi lacks. You can daisy-chain the boards to allow even more ports to be added to the RBPi.

To control the ports, you need to program the board with the Python programming language. For this, you may have to install the python3-setuptools package. You can find additional details of the above two add-on boards in openmicros.org and Quick2Wire.com.

The Raspberry Pi Command Line Interface

Being Linux based, the tiny Single Board Computer Raspberry Pi or RBPi has a graphical user interface familiar to regular computer users. Again, as most users of Linux will be familiar with, RBPi also has a command line interface where you have to type in the commands you want the SBC to execute. Well, a graphical user interface does have its merits and although the command line interface is a little more intimidating to the uninitiated, it is not a very difficult beast to tame.

One of the major advantages of the command line interface is its scope and speed – it easily accomplishes and most often surpasses what can be achieved with the graphical user interface, and does it faster as well. For most day-to-day tasks, however, the graphical interface is enough and has many useful applications including a web browser, test editor and file manager.

For those who want to delve deeper and learn more about how the SBC actually works, the command line interface is the way to go. Most of the work is done by opening up a Terminal or Shell and typing within it.

As the name suggests, the command line interface is an entirely text-based interface. You type in the commands that you want the SBC to execute, and it gives you a response. Although in the beginning, it will seem a little confusing, it is more like interacting in a natural way, just as we converse with another person. Once mastered, interacting with a computer via the command line interface will let you learn much more about it in the future.

You begin by opening up a Virtual Terminal/Console. Why is the name Terminal used? This is a legacy from the past when computers were gargantuan beasts, centrally located, with remote terminals distributed to the users. When you click on the LXTerminal on the Raspbian desktop, a small bordered box opens up, with ‘pi@raspberrypi $’ written inside it. The box is the terminal and inside it is the command prompt. The command prompt shows the name of the user – ‘pi’, the name of the computer – ‘raspberry’, also called the domain name, and the ‘$’ signifies that pi is a regular user and not the root or superuser (for root, the prompt would change to ‘#’).

The command prompt shows that your RBPi is now ready and waiting for you to type in your command. For example, you can see where you are by asking the computer to Print the Working Directory, by entering ‘pwd’ and hitting Enter. The SBC will most likely return – ‘/home/pi’, unless you have changed your username.

You can change the directory with ‘cd ..’, the computer knows that it has to return to the parent directory – ‘/home’. You may verify this with another ‘pwd’. With the command List Files or ‘ls’, you will be able to see all the files residing in the directory. Use a flag ‘-a’, to list the hidden files or all the files in the directory. Now the command becomes ‘ls -a’. Use ‘ls -l’ to see more information about the files.

For more information and for learning the command line, visit the website linuxcommand.org

What are IGBTs?

An IGBT or the Insulated Gate Bipolar Transistor is an amalgamation of a MOS and a bipolar transistor. It combines the best performances of both devices – the easily driven MOS gate and the low conduction loss of the bipolar. This effective device is quickly displacing most power bipolar transistors that were an obvious choice for high voltage and high current applications. IGBTs offer a balance in tradeoffs between conduction loss, switching speed and ruggedness. Manufacturers are now tweaking IGBTs to work successfully in the areas of high frequency and high efficiency that so long were the sole domain of power MOSFETs. In fact, barring applications that require very low currents, the industry trend is to replace power MOSFETs and power bipolar transistors with IGBTs.

When choosing an IGBT for a specific application, answering a few questions will usually narrow down the selection. Zeroing in on the most appropriate device will require a better understanding of the terms and graphs published by the manufacturers. These questions will be:
• What will be the operating voltage? Select IGBTs with VCES rating of at least 120% of the voltage that has to be blocked.
• Will the switching be hard or soft? A Punch-Through or PT type IGBT is best suited for soft switching because tail current reduces.
• What current does the device require to handle? In the part number of an IGBT, the first two numbers are a rough indication of the usable current. When looking for a device to work with hard switching applications, the selection usually depends on usable frequency versus current graph of the device. However, a certain amount of derating may be needed for which you could start with the IC2 rating.
• What is the speed you require to switch? For maximum possible speeds, a PT type IGBT is more suitable. Again, for hard switching applications, refer to the frequency versus current graph of the device.
• Will the device have to withstand short-circuit conditions? If you are driving motors, the device will certainly have to withstand shorts with low switching frequencies. Most often, short circuit capability is not required for switch mode power supplies.

A generic N-channel IGBT is fundamentally an N-channel MOSFET on a p-type substrate. PT type IGBTs usually have an additional n+ layer. Therefore, the operation of an IGBT is similar to how a power MOSFET works.

When you apply a positive voltage from the emitter to the gate terminal, electrons are drawn towards the gate in the body region. When the gate-emitter voltage is equal to or above the threshold voltage, electrons drawn towards the gate form a conducting channel across the body region, allowing current flow from the collector to the emitter or electron flow from the emitter to the collector.

The flow of electrons causes positive ions or holes to flow from the p-type substrate into the drift region near the emitter. Therefore, IGBTs can have simplified equivalent circuits such as:

The price for lower on-state voltage is the IGBT may latch up if operated outside the datasheet ratings. This is a failure mode where the IGBT cannot be turned off by the gate.

Latest Trends in Sensors – Miniaturizations and Combinations

We see various sensors in smartphones and other gadgets. So far, most of the sensors were available only as discrete solutions – one sensor for one parameter. The latest trend is to combine several sensors into one package, cutting the overall cost of the sensors.

It is now commonplace to find several sensors in a package, for example, gyroscopes and accelerometers. In fact, now the majority of the market is for combo sensors of this type, and such combination sensors are a very important trend on the technology side.

Another trend catching on fast is miniaturization. As cell phones grow thinner and more goodies are increasingly packed within them, miniaturization of sensors is enabling some of innovative sensor packages and devices. Starting with the X-Box Contact, which brought in various sensors for delivering rich fidelity, we see them moving in into mobile devices as well.

Today, you can visualize fitness as seeing the key vital signs, and the visibility of biometrics is fast becoming a reality. Sensor miniaturization along with the enhanced fidelity of devices is allowing device manufacturers and service providers experiment with devices for offering and fulfilling compelling specific needs.

The MEMS sensor from Bosch has combined pressure, temperature and humidity measurement in a single component. This sensor, BME280, is meant for use in handsets and wearables. It provides greater control and is useful for people interested in fitness and sports. The humidity sensor senses and measures relative humidity ranging from 0-100%, between -40°C and +85°C and with a response time of less than one second. With an accuracy of plus or minus 3%, a hysteresis of 2% or more, the temperature reading of the sensor has an accuracy of 0.5% Celsius.

The pressure sensor of BME280 makes indoor navigation very simple. The device is sensitive to pressure changes of plus or minus one meter of altitude difference with a resolution of 1.5 cms and a relative accuracy of plus or minus 0.12 hPA. The 8-pin LGA packaging of BME280 measures 2.5×2.5 mm, a height of 0.93 mm and has I2C and SPI serial digital outputs. Bosch provides the BSH1.0 algorithm for developers to place a function for temperature compensation in the device.

Miniaturization can be seen in the new generation of sensors for infrared sensing that are now entering the smartphone bandwagon for night vision and surveillance. At CES this year, people really welcomed the idea of scanning the environment at night. For example, walking out to the car at night feels much safer if the area can be seen beforehand.

FLIR Systems Inc., have fitted an infrared sensor to one of their smartphone jackets. It is a heat camera, and the jacket is suitable for thermal imaging attachment for the iPhone 5 and the 5S. The screen displays temperature in different colors. For example, the hottest temperatures are shown in yellow, while the colder ones have a more purple hue. This is a very useful attachment for detecting insulation or moisture leaks in the home and for spotting people or wildlife at night. You can record video of heat images or its photographs at low resolutions.

Do wirewound resistors suppress noise?

Specially designed wirewound resistors are used as noise suppressors in automotive ignition systems for reducing RFI or Radio Frequency Interference caused by electrical discharges. These resistors are usually placed in the leads and or caps of spark plugs and in the rotor of the distributor.

A gasoline engine generates high frequency electromagnetic Interference or EMI. This is commonly referred to as RFI or Radio Frequency Interference that comes primarily from the high-voltage side of the automotive circuit. At these places, the ignition system produces sparks at the coil that converts the battery voltage into high-voltage pulses. These pulses appear at the distributor, which routes the high voltage to the appropriate plug. Here, the spark ignites the air/fuel mixture in the combustion chamber producing the power that drives the crankshaft. Diesel engines do not have spark plugs as the air/fuel mixture is compressed to ignite and hence, diesel engines produce negligible EMI/RFI.

The high-voltage ignition pulses have a very rapid current change that generates an electromagnetic field around the ignition system. When electricity bounds through air, it passes through the air molecules, ionizing some of its atoms. As these atoms de-ionize, they release a tremendous amount of RFI. Although the frequencies are random and appear only for fractions of a second at a time, they affect almost any type of electronic device installed nearby to some degree.

Not only do these disturbances interfere with telephone and radio communications, they can even disrupt engine functioning and ABS control electronics. This type of interference sounds like a huge amount of crisps, crackles and rattles in radio receivers in communication systems.

International legislation requires manufacturers to reduce these disturbances to an acceptable level. That means the RFI must be reduced to a level so that there is no appreciable interference with the functioning of receivers not on the vehicle itself. Interference Suppression Regulations describe the RFI damping characteristics that manufacturers are required to follow, for example, VDE 0874 to 0879, CISPR or Council Directive 72/245/EEC, and usually differs from country to country.

Manufacturers usually track down the sources of RFI and limit it either at its source or filter it out before it can reach the instruments. The simplest and easiest method of prevention is by installing resistive spark plugs, resistive leads or ignition suppressor resistors. These contain internal impedance to dampen unnecessary emissions from the ignition system. Some manufacturers resort to redesigning the grounding circuit or installing feed-through/bypass capacitors.

Conventionally, spark plug leads usually carry a resistance of 6 to 15 Kohms per meter, and that makes them poor transmitters of RFI. However, electrical ignition systems may be sensitive to varying resistances in the spark-plug leads due to different lengths and can give mixed signals to the control module. Therefore, it is preferable to have solid-core wires with noise-suppressor resistors screwed onto brass fittings at the ends. This helps to maintain an equal resistance on each cylinder.

Use of noise suppressors is the best solution for reducing RFI. These resistors are designed for specific ignition systems and have the finest damping characteristics that do not cause disturbances to the ignition pulses. It usually suffices to place the resistors in the rotor of the distributor, in the spark plug caps or in the leads.

Why Does An Inductor Need A Fly-Back Diode?

An inductor usually stores energy when current flows through it, and releases it once the current flow stops. When the power supply to an inductor is suddenly reduced or removed, the inductor generates a voltage spike, which is also referred to as an inductive fly-back. Any current flowing through the inductor cannot change instantly and is limited by the time constant of the inductor. This is similar to the time constant of a capacitor, which limits the rate of change of voltage across its terminals.

The time constant of an inductor is the product of its inductance in Henries and the resistance present in the circuit. Usually, all current can be considered to have been dissipated within five time constants once the inductor has been disconnected. The process of inductive fly-back is best explained with an example – a 10H inductor in series with a 10Ω resistor, is charged long enough through a closed switch so that maximum amount of current is now flowing through the circuit.
When the switch is suddenly opened, the current flow has to come to zero within five seconds (five time constants). However, the switch opens far faster than five seconds, which implies current flow through an open switch – an impossible situation.

However, this can be explained by considering the switch to be bridged by air resistance of an extremely high value – 40,000,000 MΩ. Therefore, the inductor, in trying to keep the current flowing through the circuit will send a minute amount of current through this big air-resistor. According to Ohm’s law, every resistor will have a voltage drop commensurate with the current flowing through it. To maintain the current flow in the same direction, the inductor will have to change the polarity of the voltage across itself.

At the instant the switch opened, the current through the circuit would have been about 99% of the maximum current. Such a current multiplied by the extremely high resistance of the air gap will result in a huge voltage. Such a large voltage drop is possible because the inductor has stored energy, which it will use to create a very large negative potential on one side of the gap. That ensures the current flow will match the dissipation curve of the inductor. This is the origin of the huge fly-back voltage spike associated with the sudden disruption of current through an inductor.

The fly-back voltage generated by an inductor can be potentially damaging. Not only can the arc generated damage the insulation of the inductor, it can damage the switch or component being used to open or close the circuit. The arcing effect has been dramatically captured in this short video.
The use of a fly-back diode precludes the possibility of damage from an inductive fly-back. The diode provides a path for the inductor to drive the current flow once the circuit has been opened. As long as the circuit is closed, the diode is reverse biased and does not contribute to the functioning of the circuit.

When the switch opens, the inductor has a path to maintain the current flow through the diode. As the inductor reverses its polarity, it forward biases the diode, which then conducts current for the five time constants, until the current reduces to zero. That prevents the voltage spike.

What Are Switch-Mode Power Supplies?

Linear power supplies, once quite common, have now been mostly replaced by switch-mode power supplies (SMPS). The liner power supplies typically had a dissipative regulator – a voltage control element – usually a transistor that dissipated power equal to the difference between the unregulated input voltage and the fixed output voltage times the current flowing through it. The dissipative element prevented the linear power supplies from reaching high efficiencies.

On the other hand, the switching regulator in a switch-mode power supply behaves more like a continuously variable power converter. That allows the difference of the input and output voltages to affect the efficiency of the switch-mode power supply only marginally. Therefore, the switching regulator acts as a non-dissipative regulator, since the regulating device always operates either in a cut-off mode or in saturation.

Typically, the SMPS chops the input DC supply at a high frequency using an active device such as a power MOSFET or BJT and feeds the chopped voltage to the converter transformer. As the chopping frequency is high, the transformer is made of a ferrite core that can handle such high frequencies. Another advantage in keeping the operating frequency high is that the size of the magnetics decreases. The output of the converter transformer is rectified and filtered before being useful for the load. A part of the output voltage is fed back to the regulating/drive circuitry of the switching element to achieve regulation.

An SMPS usually has an oscillator that switches the control element on and off. When switched on, the control element pumps energy into the primary of the converter transformer. As the switching element switches off, the magnetic field associated with the energy in the converter transformer creates a secondary voltage in the output winding of the transformer. This voltage is rectified, filtered and fed to the load.

The frequency of switching, or the duty cycle of the oscillator is varied to control the energy fed into the converter transformer and consequently the output power delivered. An SMPS operates at a high efficiency since only the energy necessary to maintain the load current is pumped in, leading to minimal power dissipation.

The higher frequency of operation of an SMPS, typically in KHz/MHz, drastically reduces the physically massive power transformer (hallmark of a linear power supply) and the corresponding power line magnetics meant for filtering. That reduces the overall size of the power supply and this is evident from the tiny wall-wart power supplies available for, say charging smartphones.

SMPS are designed for specific applications. They are available in different topologies such as DC to DC converters, forward converters, fly-back converters and self-oscillating fly-back converters. Although the principle of operation remains the same for all, the manner in which the switching operation works is the main difference between the various topologies.

Usually, SMPS employ a method called the pulse-width modulation or PWM to control the average value of the output voltage. The area under the output waveform defines the average voltage of the repetitive pulse waveform. As load increases, the output voltage tends to fall. On sensing this, the feedback/control circuit modifies the PWM to increase the voltage to the required level.

What Are Diacs And Triacs Used For?

When you switch on your fan or light, chances are you also have a dimmer controller to control the speed of the fan or the intensity of the incandescent or LED light. Typically, dimmers are useful only where alternating currents are used, because they have components that allow only part of the waveform to reach the appliance. That means the appliance receives only part of the energy supplied and hence runs slower or glows dimly. Dimmers accomplish this AC waveform chopping or phase control with the help of two active components – a diac and a triac.

A diac is a bi-directional diode, equivalent to two zener diodes connected back-to-back. The diac is designed to break over at a specific voltage. When the voltage applied (in either polarity) to the diac is less than this break over voltage, the device continues in a high resistance state allowing only a minor leakage current.

As the applied voltage crosses the break over voltage (in either polarity), the diac starts conducting with a negative characteristic. That means, as break over occurs, the current flow increases and there is a corresponding voltage drop across the device. According to Ohm’s Law, an increase in current typically leads to a larger voltage drop, provided the resistance remains constant. However, since the diac shows a drop in voltage with increased current at break over, its resistance must have decreased. This is the reason for stating a diac exhibits negative resistance at break over.

The triac operates similar to two thyristors connected in reverse parallel but with their gates in common. Therefore, a triac can conduct in both directions when a voltage of either polarity is present across it and it has been triggered on by its gate terminal. The polarity of the gate pulse is immaterial for initiating conduction of a triac.

By controlling the gate pulse to occur at a specific position in the voltage waveform applied to the triac, it can be made to conduct for only a part of the entire cycle. This allows delivery of a fraction of the voltage to the appliance.

In a dimmer circuit, a diac is used to trigger the triac. Typically, a capacitor is allowed to charge via a variable resistance from the supplied AC voltage. As the capacitor charges through the resistor, the voltage on the capacitor rises until it reaches the breakdown voltage of the diac. The diac then conducts and triggers the triac, which, in turn, applies the remaining voltage of the cycle to the load/appliance. As the supply AC voltage crosses over, the triac switches off automatically, until again triggered by the diac.

If the resistance is large, the capacitor charges slowly and voltage on the capacitor takes more time to reach the breakdown voltage of the diac. That triggers the triac later in the waveform, preventing a major part of the voltage waveform from reaching the appliance. If the capacitor is allowed to charge faster, by keeping the resistance smaller, the triac triggers early in the cycle, and more voltage can reach the load.

Give Your Raspberry Pi an Intelligent Power Switch

Whether you use a desktop or a laptop computer, one of its features is the intelligent power supply that shuts down the system once it detects that the software has sent the shutdown command. To switch the system on, you need only press a small button. The Raspberry Pi, or the RBPi, being a low-cost single board computer, does not have this feature. After shutting down the OS, you have to unplug the power cable physically from the RBPi.

With large numbers of community projects springing up around the credit-card sized SBC, the RBPi can also enjoy the features of an intelligent power supply. This is the Pi Supply project, which sits between the actual power supply and the RBPi, adding its own intelligence as necessary. Pi Supply takes its power from the micro-USB charger and powers the RBPi.

When the RBPi issues a ‘sudo halt’ command, Pi Supply detects the shutdown command and switches off the power to the SBC at a safe moment. To switch the power back on, simply press a button on the Pi Supply, and your RBPi springs back to life. You do not need to plug/unplug the micro-USB connector anymore. With power supply issues being one of the biggest headaches for SD card corruption, the Pi Supply is a very handy project.

The Pi Supply provides a single window solution to all the power management problems your RBPi currently faces. This intelligent ATX style power supply switch is a revolutionary solution for the RBPi, since you do not need to disconnect any power supply wire from the wall-wart to the RBPi. Turning power on/off to the RBPi is now possible simply by touching one of the two buttons on the Pi Supply.

Once your work with the RBPi is over, you simply issue the command ‘sudo halt’. Once the OS has safely and fully shutdown, the Pi Supply will cut the power to the RBPi. If you would like to resume working, touch the on button, and the Pi Supply will restore power to the RBPi.

The second button on the Pi Supply is meant for a hard power off. In case of emergency, pressing this button will immediately cut the power to your RBPi. However, this button must only be used when absolutely necessary, as when your SBC has crashed or is in the frozen state and is refusing any attempts of revival. Note that use of this button increases the risk of file corruption on your SD card, if operated at the wrong moment.

One of the most amazing features of the Pi Supply is that it is able to distinguish between ‘sudo halt’ and ‘sudo reboot’. That means not only can Pi Supply shut down the power supplied to your single board computer when you give the halt command, but it can also reboot your SBC when you want, without you touching a single button or removing a single connector. That makes it almost as intelligent as the ATX power supply of your desktop.

MIPS Creator CI20: Challenge for the Raspberry Pi?

Although the Raspberry Pi or the RBPi did bring a revolution in the world of tiny computers that can teach children the intricacies of computer programming with inexpensive ease, not all are happy about its capabilities. There are two main points of contention with the credit-card sized single board computer – the low amount of RAM and the lack of onboard storage.

A quick recap of the RBPi’s specifications shows that it uses a system on a chip (Broadcom BCM2835). This includes the 700MHz processor (ARM1176JZF-S) and a GPU (Videocore IV). Initially, the board shipped with 256MB of RAM, but later up-gradations had 512MB in the Models B and B+. There is no built-in storage device and RBPi uses the SD card for booting and persistent storage. The latest model B+ has four USB2.0 ports, one Ethernet port, one 15-pin MIPI camera interface, one composite video output, one HDMI output and one audio output on 3.5mm jack. The 40-pin expansion header has 27 GPIO pins.

Now, there is a more powerful computer in the market to challenge the RBPi. Moreover, it is available free. The MIPS Creator CI20 is a development board from Imagination Technologies and it can run Linux distributions such as Gentoo, Arch and Debian 7.

The CI20 runs on a dual core processor based on the MIPS architecture and operating at 1.2GHz. The GPU, a PowerVRSGX540, is capable of running OpenGL ES 2.0.The onboard RAM size is 1GB, with 8GB onboard flash storage. The board features an SD expansion slot, one pair of USB 2.0 ports, Bluetooth 4.0, Wi-Fi and Ethernet. The expansion header features 25 GPIO pins and 2 SPI buses. You can boot the board from either the SD slot or the flash memory.

Compared with the RBPi model B+, the advantages that CI20 has are – double the RAM, a faster processor, onboard storage and built-in Wi-Fi and Bluetooth. In addition, CI20 has its power supply onboard, which the B+ does not. The disadvantages are – CI20 has only two USB ports compared to the four on the B+. In addition, the form factor of the CI20 is larger than what the B+ has.

Since the CI20 has higher capabilities such as more computing power, onboard storage and wireless connectivity, it is assumed that it will cost more than the current price of the RBPi B+ ($35). However, Imagination Technologies have not yet revealed the price of their new board. Imagination, instead of selling the initial batch of CI20s, is giving them away free to tinkerers.

Therefore, if you want to lay your hands on a CI20, you must have a grand project idea for the board. That means this giveaway is not actually meant for the hobbyists, but rather aimed at developers. However, do not be discouraged even if you are planning to create a video arcade console/home entertainment center/TOR proxy at home. It may turn out that your CI20 based home automation hub is interesting enough for Imagination and they are willing to send one of their free development boards your way.