Monthly Archives: October 2014

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.