Author Archives: Andi

What is BIOS – and will UEFI replace it?

BIOS or the Basic Input Output System, designed by IBM for its Personal Computers has been with us for more than thirty years now. Whenever a computer is switched on, it conducts a self-check to see if it has a keyboard, a display and memories. Then it proceeds to look for a suitable Operating System. A small program, the BIOS, resident on a flash memory on the motherboard accomplishes all the above tasks. Once it has found a satisfactory operating system, it hands over the control of the computer. Those who are into programming of micro-controllers will recognize BIOS as the Monitor program.

However, the humble PC has come a long way in these thirty years. From a paltry 4/8 bit system with hardly 256bytes of RAM, PCs now work typically at 64 bits and 8/16GBytes of RAM. The evolution of Operating Systems and external threats to PCs has led to a demand for an overhauling of the BIOS. Introduction of Intel’s Itanium processors in 1998 put the final nail in the coffin of BIOS and a new Intel Boot Initiative was born. This initiative went on to become the EFI, or the Extensible Firmware Interface. In 2005, a new forum was born, UEFI, a consortium of AMD, IBM, Apple, Microsoft, Intel, and so on.

UEFI, or the Unified Extensible Firmware Interface, is a complete re-imaging of the computer’s boot environment and has almost no similarities to the BIOS that it replaces. While BIOS is basically a solid piece of firmware, UEFI is more or a programmable software interface that sits on top of the BIOS. This BIOS is shorn off most of its boot code, and the UEFI handles that while sitting in a part of the non-volatile memory, either on the motherboard, on the hard drive or possibly on a network share.

In essence, UEFI resembles more of a lightweight operating system. When switched on, the computer boots into UEFI, carries out a set of arbitrary actions and then triggers the loading of an operating system. As part of its specifications, the UEFI defines the boot and runtime services, device drivers, protocols for communication between services and extensions. There is even an EFI shell that allows execution of EFI applications.

As UEFI is a pseudo-operating system, it is able to access all the hardware on the computer, allowing you to surf the internet from the UEFI interface or backup you hard drive. There is even a full, mouse-driven GUI. With the boot data now stored on NAND flash or on a hard drive, a lot more space is available for language localization, boot-time diagnostics and various utilities.

UEFI enables secure boot in that it can sense if a malware is trying to take over your computer even before it has had a chance to boot into its OS. This no-compromise approach to security offers unparalleled capabilities to the customers while at the same time offering full and complete control over the PC. UEFI can validate firmware images before allowing them to execute, based on the PKI process. This secure boot helps to reduce the risk of boot loader attacks.

How to Measure Large DC Currents Accurately?

The market has several instruments for accurately measuring small DC currents, say up to 3A. You can also find some devices that can measure DC currents that extend beyond 50A with good accuracy. Large currents are common in photovoltaic renewable energy installations, grid energy storage, electric vehicles, to name a few. Usually, it is a common necessity for such systems to be able to predict accurately the state of charge or SOC of the associated energy storage batteries.

Usually, systems for current or charge measurements are designed to include built-in data acquisition modules such as ADCs or analog to digital converters, filters and suitable amplifiers. The arrangement is typically that of a current sensor followed by a filter/amplifier and finally an ADC. The current sensor senses the current a circuit for converting the output into a usable form such as voltage, typically follows it. The signal requires filtering to reduce the radio frequency and electromagnetic interferences. The cleaned signal may have to be amplified before being digitized. Current data samples multiplied by the appropriate time interval are accumulated for charge values.

Two sensor technologies are commonly used for measurement of large currents. The first of these techniques measures the voltage drop across a resistor (also called a current shunt) that carries the current to be measured. The voltage drop follows Ohm’s law and equals the product of the current times the resistance.

Large DC currents may cause power bus bars and cables to dissipate significant amounts of heat. As a thumb rule, designers of power installations strive to achieve less than 1% power loss from the wiring, including bus bars and heavy cables. For example, an offline storage system of batteries with output of 1KV and 1KA supplies power at 1MW. Although the dissipation of a 50W shunt is insignificant at 0.005%, the power cables and bus bars may dissipate heat upwards of several KW.

To put things in perspective, designers go by 1W per µOhm at 1KA, therefore, for a shunt with 10 µOhm resistance, a continuous current of 1KA passing through it will heat it up to 10W. Alternately, copper wire, with a diameter of one-inch, will be dissipating 12-14W of heat at 1KA for each foot, since the resistance of the wire is about 10 µOhm per foot, after correcting for resistance increase due to heating.

The second technology senses the magnetic field encircling the current carrying conductor. The device for sensing the current is generally known as the Hall-Effect current sensor. Usually, the magnetic field around the current carrying conductor is concentrated in a magnetic core, which has a thin slot and the Hall element resides here. The magnetic field is thus perpendicular to the plane of the Hall element, while the magnetic core makes it nearly uniform. Energizing the Hall element with an exciting current makes it produce a voltage proportional to the magnetic field in the core and the exciting current. This voltage, suitably amplified and filtered, is presented to the ADC.

One advantage of the second technique using Hall elements is the isolation between the current carrying conductor and the measuring electronics. Since the coupling is only magnetic, the current carrying conductor may have very high voltage potentials, which do not affect the current measuring elements.

Building a UPS with Raspberry Pi and Supercapacitors

It is always a dilemma when integrating a Raspberry Pi (RBPi) Single Board Computer into a project that works on the mains voltage and the RBPi has to turn it on or off. The difficulty is in deciding whether to power the RBPi separately or maybe power it from a UPS.

Lutz Lisseck solved the problem in an ingenious way. He was looking for a way to shut down his RBPi gracefully, after it had turned off his ambient-lamp. Since the lamp operated directly from the mains and Lutz wanted to turn it on/off from the mains power switch, he would normally have two choices. He could either use a mains wall adapter to power his RBPi or use a battery pack as a traditional UPS. He decided he did not like either, and instead opted for a third alternative, building a UPS with supercapacitors.

Lutz used two 50F supercapacitors to make his UPS. When the lamp was on, the capacitors stored enough charge to outlast the RBPi. When the SBC cuts the power, a GPIO pin senses the loss and informs the RBPi to begin its shutdown sequence. The RBPi takes about 30 seconds to shut down, and the capacitors happily power it for the time. Supercapacitors are usually rated at 2.7V; therefore, Lutz had to put them in series for the RBPi to get 5V. An alternative would be to place the capacitors in parallel and use a step-up converter to jack up the voltage. An upside to this is the capacitors will supply the RBPi for a longer time.

Since the project was a very simple one, there are some shortcomings in using the RBPi this way. First, the capacity is just about enough to shut down the RBPi in 30 seconds. However, when switched on, the capacitors take time to charge and the RBPi has to wait for about 10 seconds, before it gets adequate voltage to boot. Another drawback is that although the RBPi has only 30 seconds to shutdown, the capacitors discharge very slowly, and the system has to remain unplugged for about 10 minutes after shutdown, before it will boot up again. For this ambient-lamp project, Lutz does not consider that as a handicap.

Using supercapacitors over batteries has some advantages as well. The capacitors have a lifetime that far surpasses that of batteries. For example, you could charge and discharge supercapacitors completely several 100,000 times. Moreover, supercapacitors can be charged and discharged at rates that are not possible with a battery. A completely discharged supercapacitor can be fully charged up in just 2 minutes.

Therefore, with the supercapacitors in place, you do not need to worry about improper shutdown when the mains supply collapses. A GPIO pin on the RBPi senses when the mains voltage has been removed and the RBPi immediately begins a shutdown sequence. Whether using the supercapacitors in series or in parallel, a low value resistor (0.5-2.0 Ohms) must be placed in series with the batteries to limit the inrush current at startup. As the resistor can get hot, preferably a high wattage type should be used.

Battle the Sun with a 21W LED and a Raspberry Pi

Lighting up an LED or an array of LEDs and controlling their brightness is a simple affair with the tiny credit card sized single board computer popularly known as the Raspberry Pi or the RBPi. The RBPi runs a full version of Linux and you can use it to drive an array of bright LEDs with it. If you construct it like Jeremy Blum did – he put up the LEDs on his graduation mortar board and wore the RBPi on his wrist on his graduation day – you can be sure of getting a lot of excited remarks from friends and onlookers.

Jeremy wanted to let others interact with the LED on his cap. Therefore, he developed the idea of “Control my Cap” project. His control system consists or a wrist computer comprising an RBPi together with an LCD/button interface. That allows Jeremy to monitor the status of the cap, adjust the brightness of the LEDs, change the operation mode and toggle the wrist backlight. If there is any trouble in connecting with the LED interface, the reasons will be listed on the LCD.

The RBPi is programmed to connect automatically to a list of pre-allowed WPA-protected Wi-Fi hotspots as soon as it is booted. This allows Jeremy to set the wrist interface and the LEDs to a web-controlled mode, let the LEDs take on a static color or have them follow a rainbow color pattern. The cap has a total of 16 LEDs, rated at 350mA each, with four each of Red, Green, Blue and White in four strings. A constant current driver that has a PWM control drives each string of LEDs. A separate on-board switching controller generates the 5V for the RBPi.

As the whole project is portable, a battery powers it. Jeremy used a laptop backup rechargeable battery for his project. At full brightness, the array of LEDs consumes a total power of 21W and is easily visible is bright sunlight. With an 87 Watt-hr. capacity, the battery is able to power the cap for an entire day and more. Additionally, it has a 5V USB port, which Jeremy uses for charging his phone.

Jeremy put up a mobile website controlmycap.com to allow anyone to submit colors for the color queue of the cap to be used in the web-controlled mode. In this mode, the wrist computer grabs the 10 most recently submitted colors from the mobile site constantly, displaying them on the cap. Additionally, when using a color set for the first time, the RBPi informs the requester by a tweet that their color combination is about to be displayed. The RBPi communicates with the cap via a single USB cable, which doubles as it power supply cable as well.

Jeremy used the FoxFi app on his Samsung Galaxy S4 smartphone to generate a Wi-Fi hotspot and the RBPi was able to connect to the Internet through this. The remote webserver hosting the controlmycap.com website also stores the color requests in an MYSQL database, which the RBPi queries for updating its commands.

What Is the Life Cycle of a Process in Linux?

Processes in Linux follow patterns similar to that of humans. Just like people, processes are born and do carry out regular tasks; taking rest, sleeping in between and finally, being killed or dying. Processes, being the most fundamental aspects in Linux, are necessary to carry out tasks in the system. You create a process by running binary program executable. The binary program executable comes from a piece of code, transitions to a process, while acquiring states during its lifetime and demise.

A process in a computer operating system is an executable program in action. The executable program has machine instructions necessary to carry out a specific task. A corresponding process is born when a program is executed for carrying out a task. A programmer writes a software program using a high-level programming language such as C. This is also called ‘code’ and the programmer compiles it to create an executable program. The compilation process converts the code into a set of machine-level instructions, and it becomes intelligible to the operating system. The compiler for Linux systems is GCC or Gnu C Compiler.

The executable program remains a passive entity, until it is instructed to run or execute by the user. Then it creates a new entity called a process, which is visible by the command ‘ps’. The process is associated with three identifiers – the Process ID or PID, the Parent Process ID or PPID and the Group ID or GID.

In a Linux system, the first process to start is the ‘init’ and it has a PID of 1. All subsequent processes are init’s children, grandchildren and so on. For active process in a Linux system, the command ‘pstree’ will bring up the entire hierarchy, while ‘top’ will show the dynamic view of processes. The Linux kernel uses a scheduler and it controls the execution sequence of all the processes. Linux processes can have one of four states at any given time: running, waiting or sleeping, stopped and zombie.

A process achieves a running state when it is actually executing (running) or waiting for execution in the queue of the scheduler, which means it is ready to run or execute. For this reason, the running state is also known as runnable and is represented by R.

A process is in a waiting or sleeping state if it must wait for an event to occur or some resource-specific operation needs to complete before the process can continue to run. Therefore, depending on the circumstances, the waiting state is further subcategorized into an interruptible or S state and an uninterruptible or D state.

If the scheduler sends a stop signal to a process, the process goes into a stopped state. This might happen, for example, when the process is being debugged or analyzed and this state is represented by T.

When a process has completed its execution, but is waiting to retrieve its exit state, the process is said to be in a zombie state, designated by Z. Once it crosses the zombie state or retrieves its exit status, the process dies or ceases to exist.

Simplifying Wireless Charging – In A Box

Among the many options available for wireless charging technologies, Humavox has added another, which they call the Eterna platform. They are using RF technology within a closed container and this is good for small devices such as smart watches, connected glasses and hearing aids. They are calling their closed container the Nest and it connects with Radio Frequency to the company’s charger.

When you want to charge your device, simply put it into the box called the Nest Power Station. The box is a Faraday Cage and it is zapped with RF signals. The electronics built into the charging device receives the signals and converts them into DC energy.

Other technologies available in the market usually require a close contact between the device and the charging mat. The inductive coupling that these technologies use, works best when devices and their charging mats are in a very close contact. In contrast, it is not very important how you place devices in the charging box of the Nest Power Station. The wireless power transfer within the Nest is highly efficient and is accurately pointed towards the device under charge.

The box, being a Faraday Cage, confines the RF radiations to the insides and therefore, keeps the users safe. Humavox will be licensing this technology to OEMs or Original Equipment Manufacturers, who will be able to use it in a variety of ways in their products. Contrary to popular belief, the main driver for the wireless charging market is not the Smartphones, but a wide array of devices that are part of the Internet of Things. The present market for wireless charging is not taking off since there are three technologies competing with one another.

The Wireless Power Consortium, established in 2008, is the largest industry association with more than 125 members. It is working towards standardizing the wireless charging technology. The standard that WPC is working towards promoting is called Qi (pronounced chee). Some of the significant players in the industry are backing the alternative approaches. A proprietary approach is being pursued by the A4WP or Alliance for Wireless Power and Intel, while Broadcom, Samsung, Qualcomm and others are backing the alternative approach.

The Nest station in the Humavox technology is an RF- resonator for charging devices by putting them inside it. There are no placement or orientation restrictions. The Nest prototype is a white, plastic ball. Opening the ball reveals a small charging bowl. Charging time is about equal to that taken by a charging cord. That shows a charging efficiency of more than 90%, signifying only one-tenth the power is lost in the wireless transfer.

Using a box to charge a small device is an intuitive action for the user. Most users keep their small devices inside a box when retiring for the night or for a rest. The Nest makes it as simple as dropping the items into a box that doubles as a charger as well. There is no longer a need for wires, precise placements, a flat surface or a mat for placing devices for charging.

Capacitive Proximity Sensing Optimizes Power Use in Gadgets

Tablets and mobile phones run on batteries and have stringent power requirements. These devices benefit from the multitude of ways designers use to optimize their power consumption and enhance their battery life. The usual method is to make applications running on these devices consume as little power as possible. Significant savings ensue if the different processes within these devices go to sleep when the device is not in use, turning on and starting to run only when the user activates them by using the device.

This implies the device has intelligence for detecting the start of its usage and starting the internal processes as required. One of the simplest ways usually followed by designers is to let only the User Interface (UI) run and let all other processes sleep until the UI senses an input from the user. This is usually in the form of a button press or touch, which makes the entire device wake up and start running all the necessary processes.

Advancements in the above method are the intelligence incorporated in the device to detect the approach of the user’s hand. Now, even the UI may be allowed to sleep, keeping awake only the sensor that detects the approach of the hand. Such proximity sensors can detect human hands or any conducting object coming near them without the need of any physical contact.

A device incorporated with such a proximity sensor operates in a low-power mode until the approach of a human hand. In the low-power mode, there is no other activity or process running in the gadget other than that scanning the sensor. Once the proximity sensor detects the human hand approaching, it wakes up the device, which enters an active mode. In this mode, the UI of the device is turned on. Proximity sensors that wake up the device from its low-power mode to an active mode are called wake-on-approach sensors.

Infrared and inductive proximity sensing techniques are commonly used in the industry. However, applications such as laptops, mobile handsets, white goods and home appliances that mostly sport touch panels for their user interface, use capacitive proximity sensing because of their greater reliability and aesthetics. As soon as the user’s hand approaches the interface panel, the proximity sensor wakes up the capacitive device from its low-power mode and it starts to scan all the buttons to detect a touch.

The panel of a modern TV or tablet PC may have buttons that are nearly invisible when the device is in low-power mode. The touch panels in use today have buttons that remain nearly hidden until they are highlighted by backlighting. However, backlighting requires LEDs that gobble up power very fast even when they are of the high-efficiency types. This reduces the battery life of portable devices such as PCs, tablets and mobiles.

Wake-on-approach proximity sensing and its level of control on the device is highly application dependent. Response time and power consumption are the two key parameters governing the optimization required, where response time is optimized by scanning the sensor repeatedly and in quick succession. However, optimization of power consumption requires the scanning to be slow to allow the device more time for sleeping.

Bicycle Speed Projection Using a Raspberry Pi

A bicycle is the in-thing today considering the large amounts of pollution caused by vehicles using fossil fuels. Since one needs to use muscle power to ride a bicycle, cycling has health benefits as well. Many cities now have special lanes reserved exclusively for cyclists, and touring with cycles is one of the favorite sports people of all ages enjoy all over the world.

Cycles have been around for quite some time, and people have invented many gadgets and attachments for improving the travails of the cyclist. Earlier, the gadgets were mostly mechanical, and then electronic, now there are apps on smartphones that help in planning the route, and keeping track of so many things a rider may need. Apart from convenience, safety is another important factor that a cyclist should consider.

People who like to cycle fast usually also want to know their speed. However, glancing at a speedometer on the handlebar of your bike is not a very safe idea if you are going at high speeds. Taking your eyes off the road, even for the brief moment it takes to read the speedometer, is asking for trouble; you might hit a pothole or are doored. Well, someone had a brainwave to project the speed on to the path ahead, so the rider knows how fast he is going, without inviting trouble.

That someone is Matt Richardson, from Brooklyn and he has used a Raspberry Pi (RBPi) for making his bike speed projector as a do-it-yourself project. He has mounted the tiny Single Board Computer on his bicycle, where it reads the speed of the bike and projects it dynamically on to the ground in front of the rider, while still illuminating the way. The headlight also helps to make the rider more visible to other road users. Richard is calling his project the Raspberry Pi Dynamic Headlight.

At present, Richard’s prototype only shows the speed, but almost anything can be shown that a rider would find useful. For example, it could be used to show a turn direction or a map from a GPS program, weather info, estimated time to reach the destination, total distance covered and even proximity warnings if another vehicle approaches to close at the rear.

Although with more information displayed, chances of distraction will also increase. However, with the minimalistic data projected, this headlight is surely a great benefit to cyclists. Richardson has housed the RBPi and other electronics on a triangular piece of wood hung from the center frame of his bicycle. A pico projector clamped on the handlebar handles the projection. A HDMI cable connects the pico projector with the RBPi. A battery pack, meant to power mobiles, powers the entire electronics via a USB cable. The speed sensor is mounted, as it should be, on the wheel.

Richardson is keen to add to the next phase of his project. He wants more animations and visualizations in his Raspberry Pi Dynamic headlight project. Such DIY inventions such as this only goes to show what all is possible with a cheap Single Board Computer, some programming and some ingenuity.

Solar Powered FTP Server with a Raspberry Pi

Why would anyone want an FTP server and that too powered by the sun? Well, with an FTP server, you can access all your digital files from anywhere with an internet connection. The sun-powered bit has two advantages, the sun charges those standby batteries and the expense does not show up in your utility bills.

For the project all the parts used are standard items. The Single Board Computer used is the Raspberry Pi (RBPi), a convenient case with all the right slots for the output ports and a small solar panel. Additionally, you will also need a solar charger and a battery box to house the four AAA sized rechargeable NiMH batteries and a micro-USB cable.

A word about the solar panel; you can buy the solar panel from Cottonpickers. The advantage is you get a solar panel with a built-in battery box and a box for the RBPi together. All you have to do is to slide in the RBPi and plug in the batteries. This model has an on/off switch, so you do not have to pull out the cord to switch off. The batteries keep charging even with the switch in the off position.

A blue LED on charger lights up when the sun is charging the batteries. There is also a USB socket, which you can use for charging other USB devices such as mobile phones. Cottonpickers also supplies a USB cable along with the solar panel, so you have almost everything you need for the project.

The solar panel supplies a little more than 300mA, which means that it is perfect for charging 3000mAH NiMH batteries, since they require a C/10 charging rate. The panel has blocking diodes to prevent the batteries from discharging through the cells.

The RBPi model B, with all its keyboard, mouse, TV and networking plugged in and running consumes about 400mA, which the solar panel can easily meet if the sun is shining in its full glory. When the sun goes down, the battery takes over seamlessly. The solar panel can fully charge four AAA cells of 750mAH capacity within three hours. This allows an operation time of more than one and a half hours on the battery.

Charging four AA cells rated at 3000mAH takes the panel about 10 hours to complete. That means if the panel is left in the sun the whole day, the battery will be fully charged for the night. The options you have are:

Powering your RBPi directly from the sun and use the four NiMH cells as a buffer when the sun hides behind clouds. Let the solar panel charge the battery of cells during the day and you can use your RBPi at night.

Next, you will need a static IP address. This is essential, as the address will let your network firewall know it has to allow incoming FTP requests from there. You will also need a vnc-server and load it up as a service every time the RBPi boots up. For the FTP, use the Very Secure FTP Daemon or VSFTPD. Setup all the software as per the instructions found on CNET and you are ready to go. Don’t forget that your RBPi needs a lot of sunshine!

HMI: How to Communicate With Machines

Accelerating quality, quantity, economic efficiencies and environmental protection are leading to an increasingly connected process flow and factory floor. In combination with decreased personnel, that has led to processing of increased amounts of information by fewer and less application-specific operators in the control center. It requires a well-designed HMI or Human Machine Interface system to decrease the gap between the production process and the operator via an intuitive visualization system, layers of detail that allow a bird’s eye view down to the minute details, and includes training material and documentation that the operator has on his fingertips.

A well-designed HMI system provides numerous benefits. Chief among them are increased safety, quantity, quality and economic efficiency. Apart from minimizing the risk of disruption in the production process, HMI systems also reduce the over downtime while allowing fewer operators to manage more information with less field-specific knowledge.

HMI provides a means of monitoring, controlling, managing and/or visualizing device processes. For example, an operator panel may allow the operator of an industrial machine to interact with the machine in a visual, graphical way. The operator can easily control the machine by using the touch screen or external buttons, as all readouts and controls readouts are graphically displayed on the screen.

HMIs can be located on the machine, in the form of simple segmented displays or LCD panels of high-resolution. They can be located in portable handheld devices that are battery operated or in centralized control rooms. Machines and process controls can use them to connect the operator with Programmable Logic Control application systems to control sensors, actuators and machines on the factory floor.

For communicating with industrial machines, the usability of the HMI system depends on the processing power of the system, its ability to render reality-like complex screens, quick responses to user inputs and the flexibility for handling several levels of operator interactions. Usually, effective communication requires the HMI to have dynamically changing graphics. This in turn, requires the system to be a high-performance type that supports various resolutions and displays of high refresh rates. For efficient communication between the operator, numerous machines and control systems, it is imperative that multiple connectivity and protocols must be supported.

Industrial automation thrives on real-time communication. Using industrial micro-controllers along with PRU-ICSS or programmable industrial communication subsystems makes it possible to support various popular, certified serial protocols, including those that are Ethernet-based. The PRU-ICSS allows HMI manufacturers easily support industrial communication protocols of multiple types on a single hardware platform. The most important advantage of this platform is that it does not require the support of external ASICs and FPGAs. This offers huge scaling in performance and the integration offers opportunities of software and design reuse.

Portable HMI solutions use several wireless connectivity solutions such as WLAN, Sub-1GHz, ZigBee and BlueTooth. This broad portfolio offers the maximum flexibility when designing for wireless. For example, the WiLink 8 solution provides high-performance BlueTooth and Wi-Fi in one module. The Sub-1GHz performance line is very popular and the most reliable in its range.