Monthly Archives: October 2013

How to Paint with Light and Raspberry Pi

You can paint with light if you use a camera with large exposure times, while generating moving images with a Raspberry Pi (RBPi). Light painting is not new and traditionally images were hand-painted with a penlight. With the availability of cheap micro-controllers and addressable RGB LEDs, the idea of light painting has taken on a different meaning.

Since the images are large, producing them requires huge amounts of memory, something that RBPi has ample quantities of. Adafruit has Digital Addressable RGB LED Strips and connecting them to the Raspberry Pi is quite simple except that Raspberry Pi will not be able to supply the high currents that the LED strips demand, therefore, an external power supply will be required to power the strips.

Since the project will move about a lot, strong and reliable connectors will be required to interface between the Raspberry Pi and the LED strips. Connections from the GPIO of the RBPi are best taken via a 26-pin IDC cable and header. The LED strips are connected using two JST 4-pin plug and receptacle cables. The wires of the cables are soldered together in the proper sequence.

Since the RGB LED strip requires updating at very high speeds, this is addressed with a Serial Peripheral Interface or SPI bus. However, the GPIO libraries that RBPi uses with the “Wheezy” OS distribution are not fast enough. Therefore, Raspberry Pi needs a change of OS and must use “Occidentalis”, which is the Adafruit Raspberry Pi Education Linux distro, and includes the SPI support.

Occidentalis also has sshd that makes it easier to transfer images from a PC to the Raspberry Pi. sshd is the “secure shell” daemon server. It is like a secure version of telnet, allowing a user running the ssh client program on a local computer to connect to another (remote) computer running the sshd server, and logon to the remote computer. Unlike telnet, the communications are encrypted against network sniffers.

A Python Image module is used to convert the image transferred to the Raspberry Pi to an RGB format suitable for the LED display via the SPI devices. Instead of repeatedly processing each row or column of the image on the fly, the entire image is preprocessed into the hardware specific format suitable to the LED strip and stored in the memory of the RBPi as arrays. Refreshing the display is then only a matter of reading these arrays from the memory into the SPI port. More details of the hardware and software are available here.

The motion rig consists of a large PVC pipe bent into a ring on a hula loop. The LED strip is mounted on this and retained with zip ties. The ring assembly, batteries and the electronics is attached to the rear of a bicycle, which provides the motion. The entire arrangement including the bicycle must be painted matt black to be invisible in the photos.

For the power supply, 12V batteries have to be used, and a DC-to-DC converter is required for powering the LED strip and the electronics, all of which operate at 5V. The result of all this labor is limited only by your imagination.

What is IFTTT? How can you use it?

Kevin Andersson has a lot to look forward to when he wakes up every morning. As soon as he puts his feet on the ground, all the lights in his home turn on. When he steps on to the weighing scale, the coffee maker activates itself to prepare a mug of steaming coffee.

Kevin has made all these events possible by installing a motion sensor in his bedroom and connecting it to the lighting arrangement with the help of an internet service known as IFTTT, which is the acronym for “If This, Then That”.

Since Kevin is a programmer by profession, you would naturally believe that he put his superior programming ability to use to bring about this high level of automation in his home. Strangely enough, he made all this possible without writing any kind of code. He just invested in some hardware items, linked them up and made use of the IFTTT service available on the web so that the gadgets could communicate with each other.

A Sneak Peek into Internet Services

Most of the services made possible by the IFTTT are for use on the Internet only. For instance, you can automatically save snaps you get onto in Facebook in your Dropbox folder. This is very handy indeed. IFTTT used with Gmail becomes a seriously powerful tool.

You can do other cool and trendy things like uploading only certain photos on Flickr. Although Siri works with only the default apps of Apple, you can integrate Siri with the apps you use on IFTTT.

Connecting Real World Devices

You may not find these applications available on the net amazing enough, since you may take the Internet for granted as most people do. However, the fact that IFTTT services can hook up your everyday home devices and make them perform remarkable tasks like preparing your coffee without your needing to step into the kitchen is amazing indeed!

The services can link many of your home gadgets like Belkin WeMo devices used for sensing motion, home lighting system made available by Phillips and a variety of equipment to suit your specific needs.

What exactly is IFTTT?

If This, Then That implies a cause and effect relationship. If a situation triggers an event, a certain result occurs. Say for example, if the stock price of a certain product rises above a specific mark, the stock market will send you a Google alert. Here the rising of the stock above a particular value is the trigger or the cause and the alert sent to you by the market is the effect or the result.

Linden Tibbets and his brother Alexander, the brains behind IFTTT conceived of the project in terms of how people react to ordinary objects in the home and the office like doorknobs and cell phones. Often, people use these objects in ways the designer did not intend. For instance, you may use your phone as a paperweight because you can judge from its looks that it is heavier than a sheet of paper. Tibbets and his brother have extended this idea into the digital world so that IFTTT allows individuals to use Internet applications in modes the developers of the packages did not expect.

Monitor your health with Raspberry Pi & an E-health sensor

You can monitor various health parameters with your Raspberry Pi or RBPi. All you need to do is to use the e-Health Sensor Platform by plugging it atop your RBPi. This arrangement is especially helpful in performing biometric and medical applications where nine different body parameters are to be sensed: oxygen in blood or SPO2, pulse, body temperature, airflow or breathing, electrocardiogram or ECG, galvanic skin response or GSR or Sweating, blood pressure or sphygmomanometer and patient position or accelerometer.

All this information is available in real time, and can be used to monitor the state of health of a patient. The sensitive data can be stored for subsequent analysis for medical diagnosis. Depending on the application, the biometric data gathered can be sent wirelessly over any of the six different connectivity options available: ZigBee, 802.15.4, Bluetooth, GPRS, 3G or Wi-Fi.

For real time image diagnosis, you can attach a camera and send photos and videos of the patient to the medical diagnosis center. For permanent storage, the data can be sent to the Cloud. Visualization in real time is possible by transmitting the data over to a Smartphone or a laptop directly. There are plenty of applications for the iPhone and Android Smartphones that will allow the patient’s information to be seen.

This opens up a new era of open source medical products. The RBPi provides the new e-Health applications and products a quick proof of concept with the necessary tools. However, one of the key points in such applications is privacy and several security levels are provided with the platform.
The communication link layers use WPA2 for Wi-Fi and AES 128 for ZigBee and 802.14.5. The application layer uses a secure protocol (HTTPS) to ensure a point-to-point secure tunnel between the web server and each sensor node. Banks use this type of communication security protocols for their transactions.

The e-Health Sensor Platform is available from Cooking Hacks. Cooking Hacks, the open hardware division of Libelium, have designed it. The platform helps artists, developers and researchers to measure different biometric sensor data for their experimentation, tests or fun purposes. Compared with the expensive and proprietary medical market solutions, Cooking Hacks provides a comparatively cheap and open alternative.

Cooking Hacks also provides an RBPi to Arduino shields connection bridge, which includes the possibility of connecting the analog and digital sensors to both the boards. This allows harnessing the power and capabilities of the RBPi with the pinot of the Arduino. Further, they also have the arduPi library that allows the use of RBPi with the same code that is used for the Arduino. The arduPi library allows wireless modules, sensors, shields and electronic module or actuator to be interchangeably used for both RBPi and the Arduino.

Note: The e-Health Sensor Platform does not yet have a medical certification. Therefore, it must not be used to monitor patients who are critical and who need to be monitored by medical methods that are more accurate or those whose conditions need monitoring for ulterior professional diagnosis.

Cool Technology: a spelling pen!

You might have wished for something to warn you if you misspelled a word while writing a letter or doing a school assignment. Well, help with this is on the way!

A couple of German inventors, Daniel Kaesmacher and Falk Wolsky have developed a prototype of a pen that can warn you when you make a spelling mistake or when you do not write a letter correctly. Going by the name Lernstift, the pen starts to vibrate when the writer makes a mistake while writing out a word or letter. Lernstift is German for the term ‘learning pen’. The spelling pen will certainly not autocorrect your spelling like automated software tools for checking grammar and spelling do on your PC, but it will tip you off when you make a slip-up.

How does it Work

The prototype of the pen makes use of a software program that recognizes movements related to the forms or shapes of each letter. You can use the pen in two modes. In the calligraphy mode, the pen warns you by buzzing when you do not form a letter properly. This is particularly useful for people with messy handwriting. If you use the pen in the orthography mode, it will buzz if you make a spelling error. A non-optical sensor perceives the mistakes.

The Linux minicomputer installed in the spelling pen gets its power from a battery with a Wi-Fi chip. A crucial feature of this writing tool is that the sensor can detect any writing motion. This eliminates the need for a special kind of writing paper. Unlike other similar smart writing tools, which are slowly coming into the market, Lernstift can work on any kind of paper.

The inventors propose to incorporate exchangeable tips or refills. You can choose to write with fountain pen or ball pen refills.

Modifications to Prototype

You would not really expect the developers of this immensely innovative tool to be complacent about their invention. The creators are already looking for ways to check grammar. Wolsky and Kaesmacher expect the pen to go a long way in assisting children to build up their writing skills. The hands-on approach will certainly serve a better purpose than memorizing rules of grammar. Future models may include pencil leads, as well.

Other enhancements proposed by the inventors include pressure sensors and connection to personal computers. You may then connect the pen to your smart phone or PC to upload text files and share them online. The developers also hope to design apps to widen the possibilities of the pen so that it becomes a multi-functional device.

Idea behind the Inspiration

Falk Wolsky got the concept for the pen when he saw his son struggling with spelling issues in his homework. He conceived of the idea that a vibrating pen could warn a writer about a mistake made in written work.

Since writing is an important procedure for learning, Wolsky feels that the pen could be a useful means for young learners to develop language and spelling skills.

This is something we could all use!

A Cross-Compiler for Your Raspberry Pi

Your pet dog knows it has to “Fetch” the Frisbee you throw out and to “Sit” when you command it to do so. The dog knows this since it has been trained to learn some commands. As its association with you grows, so does its vocabulary. As the dog is an intelligent creature, it sometimes chooses to ignore your commands, depending on its mood.

Fortunately, the Raspberry Pi or RBPi does not have moods to ignore your commands. Not possessing any intelligence of its own, it faithfully obeys (or tries to) what you throw at it. As a processor, your RBPi can understand only machine level language or MLL made up of two logic states ‘0’ and ‘1’, whereas you usually send it commands in C, BASIC, Python or similar high level languages or HLL.

Linux, the Operating System used in your RBPi has a compiler that translates your HLL codes into the MLL understood by the processor. As not all processors are the same, you must inform the compiler as to what processor it should translate the code for. Therefore, when you write code for your RBPi, the compiler creates a binary file, which consists of the machine code suitable for the processor in your RBPi board.

When you write your program code in HLL, there may be unknown errors called bugs that prevent the program from running smoothly on your RBPi. You have to spend time in debugging your program until the desired result is obtained. Most of the time, the bugs are not obvious and you are not sure why the program crashed or did not operate.

The amount of memory available in the Raspberry Pi and its CPU capabilities are limited. Therefore, when you have to debug and compile a long program, these limitations become a bottleneck. Debugging and compiling a lengthy program on a desktop or a laptop PC running Linux, is far faster than trying to compile it on an RBPi. The only problem is it will not be compiled for the RBPi processor, but rather for the processor within the PC.

The way out is to use a cross-compiler. This will run on the PC platform, but will generate the code necessary for the processor used in the Raspberry Pi. Using crosstool-ng is the simplest way to build a cross-compiler. A set of scripts is used to bring up a menuconfig type of interface allowing you to select your compiler settings. With the necessary inputs, the crosstool-ng downloads what else it needs, patches itself, configures itself, builds the cross-compiler and installs it for you. How to create the cross-compiler is detailed here.

Crosstools are notorious for the large amount of space they take up on the hard disk. This is due to the many files downloaded and intermediary build results necessary to be created when building up the crosstool. Be prepared with a 4-5GB amount of empty space on your HDD, as creating the crosstool-ng cross-compiler will take up at least 3.5GB. The Linaro C-compiler works well for the Raspberry Pi, although this is an experimental version.

How does a Fan Regulator Work?

A fan regulator is a crucial component that serves to increase or decrease the speed of your fan according to your needs. You have a choice between conventional and electronic regulators. The technology along with the circuitry that controls the fan speed is quite complex.

Conventional Regulators

Older versions of conventional regulators were quite bulky to look at. A square box jutting out of a board with a circular knob or toggle switch did not make for very sleek appearance. The box contained the circuit elements of the regulator system. You had to adjust the knob to set the fan at the desired speed. Modern day conventional regulators present just a toggle on a board that incorporates the switches for the other electrical devices for the room. You do not get to see the regulating unit concealed in the wall behind the board.

To understand how a regulator works, you must know something about resistances. Any electrical conductor allows current to pass through it. The conductor however, offers a certain amount of resistance to the passage of current. The resistance depends upon the material of the conductor.

The regulator has spools of wire with different amounts of resistances. When you set the knob at a particular position, you include a certain resistance in series with the fan. A series connection implies the resistance is in line with the fan. This reduces the voltage drop across the fan and its speed to your desired level. The greater the resistance, higher is the voltage drop across it and that lowers the speed of the fan.

Considerations

These regulators are available at a reasonable cost. The difficulty in using them is that the heat generated in the resistance causes wastage of power. Hence, you reduce the speed of the fan at a considerable cost. In fact, you incur a significant loss in power, when you set the regulator for a very low fan speed.

Capacitor Regulators

You can overcome this problem by using capacitor regulators. This type of regulator helps you to save power at all speeds of the fan. The regulating unit is visible as a much smaller knob, compared to those of conventional resistors. You can change the resistance by rotating the knob.

The idea behind a capacitor regulator remains the same, which is to adjust the voltage across the motor of the fan. Now, when you increase the capacitance, the voltage across the capacitor decreases but that across the fan motor increases. Accordingly, the speed of the fan increases. In other words, you need to increase the capacitor value to increase the fan speed. However, since there is no power loss in the capacitors, there is no heat generated, and consequently, no extra expense.

Benefits of Capacitor Resistors

Capacitor resistors present many obvious benefits. They are smaller, lighter and less clumsy to look at than their conventional counterparts are. In addition, these units provide linear control of speed. Since they are energy efficient, they help you to save on your power consumption. Compared to electronic speed controllers, there is no distracting humming sound when the fan is on. Additionally, you can expect to get a reliable performance especially as compared to the electronic regulators.

Why Are Industrial Sensors Going Wireless?

Industries are increasingly opting for low-power wireless photoelectric sensors with extended range of signals that carry for miles. Such improvements have been made possible with the proliferation of low-power micro-controllers that have boosted the range of the sensors and enhanced their battery life.

In general, wireless sensors conserve and extend battery life by switching themselves off when they are not taking measurements. This allows the sensor to spend most of its time not consuming any power. With this simple technique itself, the battery life of the sensor is boosted by a factor of 100 or more in comparison to that of a continuously powered sensor. However, as the sensor does not sense when it is off, the response time suffers.

To understand how much the battery life can be extended, consider a dry contact wireless sensor that typically dissipates about 100 to 200 µW of power. Such a sensor operates on two AA batteries, which last for five years with the dry contact wireless sensor sampling at 10 times or more every second. In comparison, a powered sensor system can remain on continuously and can respond more quickly. It is also possible to run them at higher power levels to produce a longer wireless range.

To provide reliable and interference-free communication, FHSS or Frequency-Hopping Spread Spectrum techniques are used in industrial wireless sensors. Basically, FHSS switches a carrier rapidly among several possible frequencies, using a pseudorandom sequence. When bound or paired devices communicate with each other, data and control packets are interchanged using these frequency channels randomly, but in a pattern known only to the communicating pair.

Typically, the bandwidth necessary for frequency hopping is much larger than that required for transmitting the same information on just one carrier frequency. However, the transmission takes place only on a small portion of the bandwidth at any given time. Since the effective bandwidth of any interfering signal is the same as that for a narrow carrier, frequency hopping greatly diminishes interference from narrowband sources. Usually, a site survey is conducted before installation of wireless sensors to determine if there is RF interference and whether this is strong enough to be a problem.

Modern wireless sensor systems have a radio master device or gateway that polls all its sensor nodes at specific intervals to ascertain radio communications are still operating. If there is no response from one of the sensors, the system reacts deterministically; the system enters a state to maintain control in a fail-safe way.

The radio master connects to multiple sensors allowing many dozens of wireless sensor nodes to work within a single radio network. Using a TDMA or Time-Division Multiple-Access technique, ensures that all the sensors in the network have adequate time to transmit their data and receive their individual instructions. This effectively eliminates the possibility of multiple sensors trying to communicate simultaneously.

One of the major advantages of using wireless sensors and indicator lights is the elimination of complex cable installation. Rearrangement can easily be done if the plant layout changes. The modern wireless sensor with its own battery, radio and sensor in a single housing, allows higher productivity with real-life status of the production line.

Where Do You Use a Touchless Rotary Sensor?

Most touchless rotary sensors use a magnetic position marker for sensing position. The position marker is attached to the rotating part of the application. It also uses a sensor to measure the angle of the marker. The touch-less rotary sensor uses a magnetism-based technique and does not require physical contact between the marker and sensor. Although other noncontact magnetism-based sensors overcome the limitations of potentiometric sensors that use resistance-based track-and-wiper techniques, they still need a shaft to be attached to the housing of the sensor.

Touchless rotary sensors are the most suitable technology when you have:
• An application that requires measurements through a nonmagnetic plate or wall;
• An application working in extreme environments that necessitate the sensor shaft to be sealed;
• An application where the drive shaft vibrates or has a lot of play;
• An application that necessitates very low friction-torque requirements;
• An application where misalignment can be problematic.

Touchless sensors offer many advantages over conventional sensors. They have lower operating costs, are rugged, reliable, programmable and simple. Although the initial cost does seem higher than the alternatives, it is not always so. The alternatives often require expensive subcomponents such as ball bearings and or expensive precision shaft couplings.

Since the working core of a touch-less rotary sensor is always sealed from the environment, the sensor parts experience no mechanical wear. Although the magnet is exposed, it can be potted with ingress resistant compounds, especially when it is exposed to fluids. The sensor life is usually measured in MTTF or Mean Time To Failure.

There are two types of touch-less rotary sensors, customer programmable and preprogrammed, making it simple for the user. Where safety and is paramount, preprogrammed and pre-calibrated sensors can be used and their functionality cannot be altered. These are also less expensive as the sensors do not require any look-up table for calibration with microprocessors. Where precision and expanded functions are required for quick calibration of star and end angles, customer programmable touch-less sensors may be used.

To operate properly, both the sensor and the position marker attached to the rotating component of the machine must be appropriately sized and positioned. The magnet position markers come in several body styles. You can either screw them into the rotating component or clamp them onto the rotating shaft. The working distance between the sensor and the magnet is important and dictates the best magnet size. For example, if have a shaft with an axial offset in the X-Y direction, you will need a bigger magnet to compensate for the non-linearity and the drop in the axial tolerance band.

You can mount the sensor unit of the touchless rotary sensor system in the traditional servo-type mounts or in the two to four screw mount. The body of the sensor usually has mounting holes and slots and comes with screws for the mounting. This allows the sensor to be rotated and placed in an optimal mounting position before being secured.

Touch-less sensors typically measure rotary movements from 0-360 degrees with repeatability from 0.1-0.12 degrees. The resolution is typically from 10-14 bits. Most of the sensor units are rated to IP69.