Author Archives: Andi

Is banana pi tastier than raspberry pi?

It is surprising that for so long, no one had come up with a variant or clone of the ever-popular credit card sized single board computer, the Raspberry Pi or the RBPi. Ultimately, there is a Banana Pi from Lemaker, a China-based company. Banana Pi, although an RBPi-alike, is not a direct clone, but rather an evolution. Lemaker has used a more modern dual-core processor – the 1GHz ARMv7 AllWinner A20 – in place of the single-core ARMv6 700MHz Broadcom BCM2835. Lemaker has doubled the RAM to 1GB and Banana Pi has additional connectivity such as a USB OTG port and a SATA 2.0 port with built-in 5V power supply for 2.5-inch storage devices up to 2TB.

Performance comparisons between the two are stunning. During testing, the 95th percentile SysBench time for the Banana Pi was 29.72ms, outshining the RBPi’s 51.45ms. Banana Pi took only 2.39s to compress and 0.21s to decompress a 10MB gzip test file. RBPi was much slower on the same test and clocked 8.64s and 3.08s respectively. This proves that the dual-core processor is better at multithreaded applications as compared to the single-core processor on the RBPi.

Banana Pi has a somewhat larger footprint than the RBPi, which makes it incompatible to the several RBPi cases and mounts available in the market. Although the 26-pin GPIO header is claimed to be pin-for-pin compatible electrically, its position is shifted from the RBPi’s layout to make room for a mounting hole. Therefore, larger piggyback boards foul with the composite video output on the Banana Pi.

The A20 chip on the Banana Pi lacks the CSI or Camera Serial Interface and uses a parallel camera interface instead. Therefore, none of the off-the-shelf camera modules meant for the RBPi will connect to the Banana Pi. Lemaker has promised a camera module of its own in the near future.

Rather than produce a distribution just for their board, Lemaker has taken the route to porting existing Linux distributions to the Banana Pi. Therefore, users are treated to flavors of Linaro, Arch, openSUSE, Raspbian and Google’s Android as SD Card images. These distributions had trouble addressing the GPIO ports at the time of launch. However, Lemaker has worked hard and removed these bottlenecks. Now, most projects based on Wiring Pi, Raspbian or RPi.GPIO libraries have no trouble at all working on Banana Pi.

The Banana Pi, along with its faster processor, also boasts of faster and more reliable USB ports. However, the most interesting addition is its SATA connectivity. This is not offered even in the newest RBPi Model B+. You can connect a mass storage device to the Banana Pi via the angled SATA port on the top side of the board, without tying up one of the USB ports. However, Banana Pi has only a 233Mb/s network throughput.

Overall, although Lemaker may have blatantly attempted to copy the RBPi, it has demonstrated possibilities of a few impressive improvements. On the positive side are the more powerful processor and the useful SATA port. On the negative side, there is the larger footprint, lack of CSI and altered layout along with a bottlenecked network and software bugs.

How do you measure cable length?

Where miles of cable are involved, how do people determine where the fault lies and decide where to dig for initiating repairs? The method involves something very similar to how people determine the depth of a well, the distance of a cliff or the location of a thundercloud – by echolocation. If you know the speed of sound in air, you can find the distance of the sound source from the product of the amount of time sound is taking to travel the distance to its speed in air. For example, light travels much faster than sound; therefore, light from a thunderclap precedes its sound. By timing the gap between seeing the flash of light and hearing the thunder, it is easy to tell how far away the thunderclap occurred.

When an electrical pulse is directed into one end of the cable, it travels down the length until it meets a change in the cable’s impedance. This may be a fault in the cable or it may simply be its other open end. Whatever the situation, the change in impedance causes the pulse to turn back to its point of origin. The time gap between the original pulse and its return represents the length it has traveled. Therefore, if it has returned in, say 30ns, instead of the 100ns expected, the fault is at about 1/3rd the cable’s length from the end where the pulse was injected.

Engineers usually rig up an oscilloscope and a pulse generator for the purpose. Knowing the cable’s characteristics is necessary to set the pulse generator’s output impedance. The pulse generator needs to output a narrow pulse of about one to 100ns, with as small a duty cycle as possible – the two parameters depending on the length of the cable under test. The pulse voltage is not critical – 1V peak is enough.

The oscilloscope’s trigger level should be just under the peak voltage of the 1V pulse. The time base should be set just long enough to display one pair of the 1V pulses generated. That completes the setup.

As you launch the pulse into the cable, it triggers the oscilloscope sweep. The pulse now continues to the other end of the cable, until it encounters an open end. Since energy cannot be destroyed, the pulse is reflected back to the generator. When it passes the oscilloscope, it is displayed again. You can differentiate the reflected pulse from the original by the reduction of its amplitude and a difference in the rise/fall slopes. This happens because of attenuation when traveling within the cable and a loss of high-frequency harmonics. Although there may also be additional reflections caused by input capacitance of the oscilloscope, the echo of interest is only the first one after the original pulse was launched.

The round trip time is dependent on the cable length, which is usually known. For most cables, the pulse will travel at about 66% of the speed of light in vacuum (300m/µs). That makes its speed within the cable about 200m/µs. You may have to play with the time base and the pulse period until you can see both the launched and the reflected pulse.

Will UEFI replace BIOS?

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 Future Of The Internet?

Brazil and NET1 organized a major conference called NETmundial on April 23-24, 2014. Representatives of the tech community, civil society and governments convened to discuss the future of the Internet. Their focus was on how the Internet should be governed.

The necessity for the event was multiple revelations, such as from Edward Snowden, about mass surveillance of digital communications by state agencies. As the President of Brazil stated at the 68th UN General Assembly, the absence of right to privacy takes away the true freedom of expression and opinion, destroying effective democracy.

That set the ball rolling for the Internet governance institutions, which include ICANN or the Internet Corporation for Assigned Names and Numbers, IRTF or the Internet Engineering Task Force and the W3C or the World Wide Web Consortium. Together, they released a joint statement renouncing activities of mass surveillance. They referred to the recent revelations of pervasive surveillance and monitoring, expressing strong concerns over the undermining of the confidence and trust of Internet users globally. They identified the need to keep up the efforts for addressing Internet Governance challenges, while agreeing to support community-wide efforts actively towards the development of a global multi-stakeholder Internet cooperation.

In reality, the Internet runs as an MSM or a multi-stakeholder model. Here, the tech community, civil society groups, governments and the private sector all have their say. However, it is old news that different parties want to have a greater power over the Internet. In this respect, the US, which has a historically grown role of dominance in Internet governance, is envied not only by other nations, but also by the Internet libertarians.

Every few years or so, the battle over Internet governance raises its head. The last time this happened was in the 2012 conference of the UN International Telecommunication Union. Although many non-western nations attempted to delegate more influence to governments, the US and its European allies successfully warded off the demands for Internet governance changes.

However, this time, because of the NSA scandal, the US has lost much of its legitimacy of dominance over Internet governance. Moreover, most of those who allied with the US in 2012 now have their own reasons in demanding globalization of Internet governance.

The Global Multi-stakeholder Conference or NETmundial has two goals to achieve. The first is to produce universal principals that will govern the Internet. The second is to generate a roadmap that will lead to the globalization of Internet governance institutions such as ICANN.

The conference will generate an outcome document to bring forth the conclusions and decision made on the summit. The draft outcome document disseminated prior to the start of the summit, allowed those gathered at the summit to propose changes to the document, aiming to create the final version that all have agreed on.

However, the first day of the summit saw civil society organizations issue a press release expressing their concern over the weaknesses in the draft document. Organizations such as the Free Press, World Wide Web Foundation and Article 19 are proposing a number of amendments, which include:

• Interception and surveillance must be done in accordance with international human rights law
• The right to privacy must be reinforced by stronger actions
• The globalization of ICANN should follow a clear roadmap and be completed by September 2015.

The latest in wireless charging technology

Although battery technology has improved many times over, mobile devices remain always hungry for power, thanks to the demands from always-on wireless, GPS, hi-performance audio and video along with the ever-increasing applications and nearly constant use of the mobile devices. People are looking for more convenient and accessible ways of charging their mobile gadgets. That has led to the availability of wireless charging systems, where one needs only to place the mobile device on the charging pad for an effective charging. The demand can be estimated from the fact that more than five million wireless charging devices were shipped in 2012, with a forecast of more than 100 million more to ship by 2015. Apart from smartphones, these numbers include MP3 players, digital cameras and other mobile devices.

Foremost among wireless charging technologies is the technique offered by Qi (pronounced as “Chee”). Using a wireless charging pad and a properly equipped mobile device, the intention is to create an international standard for interoperability. A conglomerate of nearly 200 organizations including phone manufacturers, semiconductor suppliers and wireless service providers came together to form the Wireless Power Consortium. They released the Qi open standard in 2009. Since then the market has over 350 types of Qi-compliant devices. Among them are the Samsung Galaxy S3 and S4, which can be equipped with after-market receiver sleeves suitable for Qi wireless charging. The Qi wireless charging pads are available off the shelf at eBay and Amazon. Other manufacturers who are directly integrating Qi into their devices include Google Nexus 4, Nokia Lumia 920, LG Optimus LTE2 and phones from Panasonic Eluga.

A Qi wireless charging system is available as a single-position, guided placement or a single-position, free placement. For those who want to charge more than one device at a time, there is the Qi three-position charging pad. The single-position guided placement is the cheapest type where the user can charge only a single mobile that he has to set in a specific position. The single-position, free placement is a little more expensive, as the user does not have to lock the mobile to the charger in any particular position. The Qi charging sleeve is very inexpensive and can be fitted to several models of mobiles.

The wireless charging standard makes it simpler for the consumer because of the ease of interoperability. Only a single wireless charger is enough for all devices in the household. Imagine that you are visiting the local coffee shop that has a Qi wireless charger. While enjoying your coffee, not only can you sample their free Wi-Fi, but make use of their wireless charging, without any concern about the compatibility of your device.

Qi works on the principles of magnetic induction between two coils. The charging pad holds one of the coils, which acts as the transmitter. The other coil is positioned inside the mobile device, usually just under the battery cover. Maximum power transfer requires one transmitter for each receiver, less than 4 cms of separation between the coils and a specific positioning of the mobile in relation to the transmitter. Qi chargers overcome the last limitation by providing more number of transmitter coils.

Use Raspberry Pi to Control Your Garden Sprinklers

People who have a lawn in their backyard know how important it is to water it carefully to keep it looking green and lush. The timing has to be right to prevent the grass in the lawn from drying off and allow just enough water so that the lawn is not flooded. Most people use sprinklers to wet the lawn evenly. However, timers sold in the retail stores for controlling the sprinklers have only limited functionality that leaves users unsatisfied.

Most people are busy and on the move, which does not allow them much time to monitor the working of the sprinklers. With the timers purchased off the shelf, it is not possible to have flexible watering schedules and remote control is not a feature.

This unsatisfactory scenario of the uncontrollable lawn sprinklers led Ray Wang to set about designing his own sprinkler controller. He built his first functioning prototype “The Mint-tin Water Valve Controller.” It used an Arduino Pro Mini and a homemade PCB with a wireless transceiver. Along with Chris Anderson, the editor-in-chief of Wired magazine and the CEO of 3DRobotics, he turned this project into a potential business opportunity. It grew into an open-source, web-based smart sprinkler controller project – the OpenSprinkler.

For Ray, keeping OpenSprinkler as an open-source project is important, as he is an educator who always wants people to not only use a product, but also to have the opportunity to learn how the product works internally. The project has a strong educational purpose, as anyone can design a new sprinkler based on this project and not have to reinvent the wheel, a great way of promoting technological innovations.

Starting with OpenSprinkler v1.0, Ray improved it to v2.1 before moving over to the affordable, tiny credit card sized single board computer, the Raspberry Pi (RBPi). The advantage is that the RBPi’s GPIO pins can directly control the sprinkler valves. Thus, on Feb18, 2013, was born the OSPi or OpenSprinkler Pi v1.0.

A number of enthusiastic users helped in porting the Arduino code to Python for use with the OSPi. In the process, they introduced new features such as advanced logging and a built-in mobile frontend. Others revamped the code and provided a more modern, streamlined user interface. Ray has made a pre-configured SD card image where the OpenSprinkler software is pre-installed. If you need to control your lawn sprinklers, all you need to do is download this image, burn it into an SD card and pop it into your RBPi. Of course, you will need the sprinkler extension board, which houses all the hardware necessary for making the project compatible with the standard 24VAC sprinkler valves used for watering and irrigation systems.

OSPi makes the entire project much more convenient and intuitive compared to traditional sprinkler controllers that have buttons to set everything and a tiny LCD, which hardly helps. OSPi is a web-based controller that allows remote access. The user can additionally pull in weather data online for helping to adjust watering schedules when necessary.

Raspberry Pi Detects Trains in Stockholm Subway

Imagine waiting for a train in a subway. As the train arrives, a nearby poster of a woman has hair blowing all over her face, as if in response to the wind from the incoming train. As the train stops, the woman in the poster clears her hair from her face and resumes her smile, until the next train arrives. The Stopp Family, a Stockholm production company and Akestam Holst, an ad agency, have joined forces for modifying one of the play screens of Clear Channel in the Stockholm subway. The idea was to simulate the effect of turbulence from the train catching the model’s hair as it arrives at the platform.

This required a device that could sense the arrival of the train without reacting to the passing passengers. After studying several possible solutions such as wind sensors and sound detection the team came to settle on an ultrasonic sensor for measuring the distance.

The team connected the ultrasonic sensor to the popular single board computer, the Raspberry Pi or RBPi, which was running a Python socketserver. The RBPi sent the measured distance to a connected client at predefined intervals. The client, a flash application, received the measured distance and when this reached a predefined value, triggered a video of the model’s hair blowing in the wind.

The most critical factor was in deciding when to trigger the video. The distance measured by the sensor was about 4 meters when the train was on the platform, which increased to 7 meters when there was no train. To prevent false triggering, the team had to set up some rules for the video to trigger to play. They found that best results were obtained when the video was triggered with distance readings between 3.9 and 4.1 meters. Moreover, once the video had played, it could be triggered again only after the client received three readings with distances greater than 6.9 meters. With these two rules, they were able to prevent the same train triggering the video more than once, while also preventing the video from being triggered by nearby people.

With this simple but stunning project, the team is able to extend the existing and create new technical solutions further. They can now define new interactive platforms. Rather than simply changing advertisements to fit the technology, they are now in a position to adapt technology to fit ideas that are more creative for advertising.

Ultrasonic sensors work by sending out bursts of ultrasound – sound that is beyond the range of human hearing – at about 40 KHz. The RBPi generates the timing for the bursts and waits for an echo. The sound travels until it meets an obstacle that can reflect it back to the transmitter, in the form of an echo. A receiving sensor, placed close to the transmitter, senses the echo and informs the RBPi. By multiplying the speed of sound with the measured time elapsed between the original burst and its returning echo, the RBPi calculates the distance travelled by the burst and hence, the distance of the obstacle from the unit.