Passive Infrared Sensors

Homing in on Heat

One way to make sure that the lights get turned off when you leave a room is to use Passive Infrared (PIR) sensors. Jeff examines the science and technology behind PIR sensors. He then details how to craft effective program code and control electronics to use PIR sensors is a useful way.

By Jeff Bachiochi

“The last one to leave, please turn off the lights.” How many times did you hear this while growing up? It’s an iconic phrase sometimes used to suggest the end of life, but as I remember it, just an effort to save electricity. I would always use the logic that bulbs burn out during the initial surge current and not necessarily from remaining on, but that logic never worked on Mom. To this day I am obsessive about turning lights off (thanks Mom!). To that end I tried installing Passive Infra Red (PIR) sensors to handle this automatically. After being inundated with complaints (from my wife Beverly) about lights turning off “while I’m still in the room,” I gave up.

While PIR devices are sensitive to heat (infrared)—the human body’s radiation is strongest at a wavelength of 9.4 µm—they are based on the heat source moving past the sensor. Let’s look at a typical PIR sensor element to see how this works. The RE200B PIR sensor comes in a TO-5 package. Manufactured by Glolab, this device actually contains two sensors as seen in Figure 1.

FIGURE 1
The metal tab on the TO-5 can indicates the X-axis plane across both sensor elements. The window filter material is optimized for approximately 10 μm wavelength.

Each pyroelectric sensor is made of a crystalline material that generates a surface electric charge when exposed to heat. When the amount of radiation striking the crystal changes, so does amount of charge on the input to a sensitive FET device built into the sensor. The two elements are in series with the FET input connected to their junction. With this configuration and a wide (138-degree) field of view, whatever ambient light falls on both the sensors is canceled out. The sensor elements are sensitive to radiation over a wider range so a filter window is added to the TO-5 package to limit detectable radiation. As a standalone this device is not very useful. We need a way to interrupt the heat source from hitting both sensor elements at the same time.

Anyone familiar with opto encoders already understands how this works. Opto transmitter/receiver pairs are placed on opposite sides of a spoked wheel. Light passes between the spokes as it rotates between the pair. A second pair is placed such that when one light path is blocked by a spoke, the other light path is between spokes. As the spoked wheel rotates, the opto device’s output alternates between one coupled pair and the other. With some logic on the opto outputs, you can tell both direction and speed of the rotation. Creating the same kind of “picket fence” in front of the infrared (IR) sensor elements can cause the radiation to be alternately blocked and passed to each sensor. The trick will be to design the slat width and placement to give the desired effect.

Fresnel Lens

Figure 2
Lenses of large aperture and short
focal length are massive. The bulk
of the material can be eliminated as
long as the lens’ curve stays the same.
This can be accomplished by a series
of annular lens rings or the special grinding pattern on a single blank.

A lens could be used to artificially reduce the field of view, by collecting and focusing it into a smaller spot. Move an object in front of the lens left to right and the spot moves right to left, behind the lens. If the spot passes over the two sensor elements sequentially, voilà—each sensor will produce a push or pull at the center tapped output. And that is something we can detect. A single lens would create one sensitive area out in front of the device. This might be just what you are looking for. However, to be sensitive to a wider range we must have multiple lenses. Since glass is opaque to IR we can’t use a typical glass lens. It turns out that polyethylene type materials do pass IR light and can be formed in various Fresnel lens patterns.

The idea for the Fresnel lens goes back to the French mathematicians of the late 18th century. This was an attempt to make lenses thinner while retaining the optical quality of the original. Figure 2 shows how unnecessary thickness is removed from an original lens without changing the lens’ curvature. In the early 19th century this idea was adapted for use in lighthouses by Augustin-Jean Fresnel. The thin cross section of the Fresnel lens makes it ideal for PIR lenses. …

Read the full article in the June 335 issue of Circuit Cellar

Don’t miss out on upcoming issues of Circuit Cellar. Subscribe today!

Note: We’ve made the October 2017 issue of Circuit Cellar available as a free sample issue. In it, you’ll find a rich variety of the kinds of articles and information that exemplify a typical issue of the current magazine.

Drones Tap a Variety of Video Solutions

Eyes in the Skies

In one way or another, much of today’s commercial drone development revolves around video. Technology options range from single-chip solutions to complex networked arrays.

By Jeff Child, Editor-in-Chief

Commercial drones represent one of the most dynamic, fast-growing segments of embedded systems design today. And while all aspects of commercial drone technology are advancing, video is front and center. Because video is the main mission of the majority of commercial drones, video technology has become a center of gravity in today’s drone design decisions. But video covers a wide set of topics including single-chip video processing, 4k HD video capture, image stabilization, complex board-level video processing, drone-mounted cameras, hybrid IR/video camera and mesh-networks for integrated multiple drone camera streams.

Technology suppliers serving all of those areas are under pressure to deliver products to integrate into video processing, camera and communications electronics inside today’s commercial drones. Drone designers have to pack in an ambitious amount of functionality onto their platforms while keeping size, weight and power (SWaP) as low as possible. Feeding these needs, vendors at the chip, board and system-level continue to evolve their existing drone video technologies while also creating new innovative solutions.

Video Processing SOC

Exemplifying the cutting edge in single-chip video processing for drones, Ambarella in March introduced its CV2 camera SoC (Photo 1). It combines advanced computer vision, image processing, 4Kp60 video encoding and stereovision in a single chip. Targeting drone and related applications, the company says it delivers up to 20 times the deep neural network performance of Ambarella’s first generation CV1 chip. Fabricated in advanced 10nm process technology, CV2 offers extremely low power consumption.

Photo 1
The CV2 camera SoC combines advanced computer vision, image processing, 4Kp60 video encoding and stereovision in a single chip.

The CV2’s CVflow architecture provides computer vision processing up to 4K or 8-Megapixel resolution, to enable object recognition and perception over long distances and with high accuracy. Its stereovision processing provides the ability to detect generic objects without training. Advanced image processing with HDR (High Dynamic Range) processing delivers outstanding imaging even in low light and from high contrast scenes. Its highly efficient 4Kp60 AVC and HEVC video encoding supports the addition of video recording to drone platforms.

At the heart of the CV2 is a Quad-core 1.2 GHz ARM Cortex A53 with NEON DSP extensions and FPU. CV2 includes a full suite of advanced security features to prevent hacking, including secure boot, TrustZone and I/O virtualization. A complete set of tools is provided to help embedded systems developers easily port their own neural networks onto the CV2 SoC. This includes compiler, debugger and support for industry standard training tools including Caffe and TensorFlow, with extensive guidelines for CNN (Convolutional Neural Network) performance optimizations.

Board-Level Solutions

Moving up to the board-level, Sightline Applications specializes in onboard video processing for advanced camera systems. Its processor boards are designed to be integrated at the camera level to provide low-latency video processing on a variety of platforms including commercial drones. Sightline offers two low SWaP board products. Both products are supported by SLA’s Video Processing Software: a suite of video functions that are key in a wide variety of ISR applications. The processing software has two pricing tiers, SLE and SLA. SLE provides processing only and SLA processes the video and provides telemetry feedback. . …

Read the full article in the May 334 issue of Circuit Cellar

Don’t miss out on upcoming issues of Circuit Cellar. Subscribe today!
Note: We’ve made the October 2017 issue of Circuit Cellar available as a free sample issue. In it, you’ll find a rich variety of the kinds of articles and information that exemplify a typical issue of the current magazine.

Device Silences TV Commercials

Arduino-Controlled Solution

Ever wish you could block out those annoying TV ads? Tommy describes in detail how he built a device for easily muting the audio of commercials. His project relies on three modules: a UHF radio receiver, an IR module and an Arduino Trinket board.

By Tommy Tyler

Does your blood start to boil as soon as one of those people on TV tries to sell you precious metals, a reverse mortgage, a miraculous kitchen gadget or an incredible weight reduction plan? Do you want to climb the wall the next time someone says “But wait! Order now and get a second one free . . .“? Believe it or not, there was a time long ago when TV commercials were actually entertaining. That was before commercial breaks evolved from 30 second or one-minute interruptions into strings of a half-dozen or more advertisements linked end-to-end for three to five minutes—sometimes with the exact same commercial shown twice in the same group! What is perhaps most annoying is the relentless repetition.

Historically, all the feeble attempts at TV commercial elimination have been applied to recordings on VCRs or DVRs. Anyone who watches programming that’s best enjoyed when viewed in real-time—news, weather and sports—has probably wished at one time or another for a device that can enable them to avoid commercials. They long for a device that could be inserted between their TV and the program source—whether it be cable, satellite or an OTA antenna—to instantly recognize a commercial and blank the screen, change channels or somehow make it go away. The technology for doing that does exist, but you’ll probably never find it applied to consumer products. Since funding of the entire television broadcast industry is derived from paid advertisements, any company that interferes with that would face enormous opposition and legal problems.

After many years of searching the Internet I’ve concluded it is wishful thinking to expect anyone to market a product that automatically eliminates commercials in real-time. I decided to work instead on the next-best approach I could think of: A device that makes it quick and easy to minimize the nuisance of commercials with the least amount of manual effort possible. This article describes a “Kommercial Killer (KK)” that is controlled by a small radio transmitter you carry with you so it’s easily and instantly accessible. No scrambling to find that clumsy infrared remote control and aim it at the TV when a commercial starts. Just press the personal button that’s always with you, even while remaining warm and cozy curled up under a blanket.

Kommercial Killer

The KK operates from anywhere in the home, even from another room completely out of sight of the TV and can be triggered at the slightest sound of an advertisement, political message, solicitation or perhaps even a telephone call. It works with any brand and model TV without modifications or complicated wiring connections by using the TV’s infrared remote control system. If you get a new TV, its remote control can easily teach KK a different MUTE command. Don’t worry about leaving the room with the TV muted. KK automatically restores audio after a certain amount of time. The default time is three minutes, the length of a typical commercial break, but you can easily configure this to any amount of time you prefer. And when you want to restore audio immediately—for example if you have muted non-commercial program material by mistake or if a commercial runs shorter than expected—just press your transmitter button again.

Figure 1
Schematic of the Kommercial Killer

KK is built mainly from three commercially available modules that do all the heavy lifting (Figure 1). The first module is a miniature UHF radio receiver. The second is an infrared module that can learn and mimic the TV mute signal. The third module is an Arduino Trinket board that provides commercial break timing and overall control. This article explains how to load a small program into that module without needing any special equipment or training, and even if you have absolutely no previous experience with Arduino devices.

The three modules are small and inexpensive ($7 to $10 each) and with just eight additional components KK can be built on an open perf board, strip board or enclosed in a 6-inch3 box. It is powered from the same USB Micro cable you use to load or modify the Arduino program, or from any other available USB port or 5 V charger.

UHF Receiver Module

The best UHF radio transmitters and receivers are all manufactured in China, and there are no major distributors in the U.S. So, order this item early and be prepared to wait about 20 days for delivery. After sampling many different remote controls to evaluate performance, quality, cost and shipment, I selected a product manufactured by the Shenzhen YK Remote Control Electronics Company, whose products are sold and shipped through AliExpress. Shenzhen remote controls use two types of receivers. . …

Read the full article in the May 334 issue of Circuit Cellar

After you’ve read the full article, don’t forget to go the the Article Materials Page for useful links and information.
Don’t miss out on upcoming issues of Circuit Cellar. Subscribe today!
Note: We’ve made the October 2017 issue of Circuit Cellar available as a free sample issue. In it, you’ll find a rich variety of the kinds of articles and information that exemplify a typical issue of the current magazine.

New Sensor Technologies for Next-Gen Temperature Measurement

Melexis recently announced two new sensing technologies for next-generaration temperature measurement. The MLX90640 sensor array is an alternative to high-end thermal cameras. The MLX90342 is a quad thermocouple interface that addresses automotive sensing to 1300ºC.

The MLX90640 IR sensor arrays benefits, characteristics, and specs:

  • 32 × 24 pixels
  • –40° to 85°C operational temperature range; measures object temperatures from 240°C and 300°C
  • ±1°C target object temperature accuracy
  • Noise equivalent temperature difference (NETD) of 0.1K RMS at a 1-Hz refresh rate
  • Doesn’t require frequent recalibration
  • Field-of-view (FoV) options: 55° × 35° version and 110° × 75° wide-angle version
  • Compact, four-pin TO39 package incorporating the requisite optics
  • I2C-compatible digital interface
  • Target applications: fire prevention systems, HVAC equipment, smart buildings, and IP/surveillance systemsMLX90342 Melexis

The MLX90342 high-performance quadruple thermocouple interface benefits, characteristics, and specs:

  • Supports a –40° to 1300°C thermocouple temperature range
  • Operating temperature specification of –40° to 155°C
  • On-board cold junction compensation and linearization
  • Factory calibration; guaranteed intrinsic accuracy of ±5°C at 1100°C.
  • 26-pin 6 mm × 4 mm QFN package
  • 50-Hz Rapid refresh rate
  • Temperature data can be transmitted via a SENT Revision 3 digital interface
  • Target applications: turbo charger temperature control, exhaust gas recirculation, and diesel/gas particle filtering systems

Source: Melexis

What Is Emissivity? (EE Tip #133)

All objects radiate infrared energy. The warmer an object is, the faster the molecules in the object move about, and as a result the more infrared energy it radiates. The wavelength of this radiation lies roughly between 0.5 and 100 μm. This depends on the temperature: the higher the temperature, the shorter the wavelength of the radiated IR energy, as illustrated in Figure 1 for several different temperatures.Fig1-IR-Rad-Elektor

This means that an IR thermometer must be able to detect energy radiated in a specific spectrum in the IR band in order to be able to measure temperatures accurately over a wide temperature range. In addition, you should bear in mind that only perfect radiators (in technical terms, “black bodies”) actually radiate all of their thermal energy. With other types of objects, the amount of energy radiated also depends on factors other than the temperature of the object, such as the properties of the material and surface reflection. This is expressed by the emissivity or emission coefficient of the material, and it can strongly affect the accuracy of IR temperature measurements.

Emissivity (or the emission coefficient) is an indication of the extent to which the thermal infrared radiation emitted by an object is determined by the object’s own temperature. A value of 1 means that the infrared radiation is determined solely by the object’s own temperature. A value less than 1 indicates that the emitted radiation depends in part on factors other than the object’s own temperature, such as nearby objects or heat transmission.Table-Emissivity-Elektor

Simple IR thermometers usually have a fixed emission coefficient setting of 0.95. If the emissivity of the object to be measured differs from this, the resulting readings will be inaccurate. More expensive instruments have an adjustable emission coefficient setting.

The emissivity values of a number of materials are listed in the table. They have been compiled from lists provided by various manufacturers of IR thermometers. The emissivity of metals is strongly influenced by the processing undergone by the metal and the surface treatment.

When compiling the table, we noticed that every manufacturer states somewhat different values, which makes it rather difficult to derive the correct emissivity settings for an instrument from the table supplied with the instrument. The only sure way to determine the correct setting is to measure the temperature with a contact sensor.—By Harry Baggen (Elektor Netherlands Editorial), Elektor, April 2011

IR Remote Control Testing (EE Tip #119)

On the Internet you can find them in all shapes and sizes: circuits to test remote controls. Here I describe a simple and cheap method that is not that well-known.

This method is based on the principle that an LED does not only generate light when you apply a voltage to it, but also works in the opposite direction to generate a voltage when light falls on it. Within constraints it can therefore be used as an alternative for a proper phototransistor or photodiode. The major advantage is that you will usually have an LED around somewhere, which may not be true for a photodiode.

IR remote tester

IR remote tester

This is also true for infrared (IR) diodes and this makes them eminently suitable for testing a remote control. You only need to connect a voltmeter to the IR diode and the remote control tester is finished. Set the multimeter so it measures DC voltage and turn it on. Hold the remote control close to the IR diode and push any button. If the remote control is working then the voltage shown on the display will quickly rise. When you release the button the voltage will drop again.

However, don’t expect a very high voltage from the IR diode! The voltage generated by the diode will only be about 300 mV, but this is sufficient to show whether the remote control is working or not. There are quite a few other objects that emit IR radiation. So, first note the voltage indicated by the voltmeter before pushing any of the buttons on the remote control and use this as a reference value. Also, don’t do this test in a well lit room or a room with the sun shining in, because there is the chance that there is too much IR radiation present.

To quickly reduce the diode voltage to zero before doing the next measurement you can short-circuit the pins of the diode briefly. This will not damage the diode.—Tom van Steenkiste, Elektor, 11/2010

Want tips about testing power supplies? We’ve got you covered! EE Tip #112 will help you determine the stability of your lab or bench-top supply!

Infrared Communications for Atmel Microcontrollers

Are you planning an IR communications project? Do you need to choose a microcontroller? Check out the information Cornell University Senior Lecturer Bruce Land sent us about inexpensive IR communication with Atmel ATmega microcontrollers. It’s another example of the sort of indispensable information covered in Cornell’s excellent ECE4760 course.

Land informed us:

I designed a basic packet communication scheme using cheap remote control IR receivers and LED transmitters. The scheme supports 4800 baud transmission,
with transmitter ID and checksum. Throughput is about twenty 20-character packets/sec. The range is at least 3 meters with 99.9% packet receive and moderate (<30 mA) IR LED drive current.

On the ECE4760 project page, Land writes:

I improved Remin’s protocol by setting up the link software so that timing constraints on the IR receiver AGC were guaranteed to be met. It turns out that there are several types of IR reciever, some of which are better at short data bursts, while others are better for sustained data. I chose a Vishay TSOP34156 for its good sustained data characteristics, minimal burst timing requirements, and reasonable data rate. The system I build works solidly at 4800 baud over IR with 5 characters of overhead/packet (start token, transmitter number, 2 char checksum , end token). It works with increasing packet loss up to 9000 baud.

Here is the receiver circuit.

The receiver circuit (Source: B. Land, Cornell University ECE4760 Infrared Communications
for Atmel Mega644/1284 Microcontrollers)

Land explains:

The RC circuit acts a low-pass filter on the power to surpress spike noise and improve receiver performance. The RC circuit should be close to the receiver. The range with a 100 ohm resistor is at least 3 meters with the transmitter roughly pointing at the receiver, and a packet loss of less then 0.1 percent. To manage burst length limitations there is a short pause between characters, and only 7-bit characters are sent, with two stop bits. The 7-bit limit means that you can send all of the printing characters on the US keyboard, but no extended ASCII. All data is therefore sent as printable strings, NOT as raw hexidecimal.

Land’s writeup also includes a list of programs and packet format information.

Infrared Communications for Atmel Microcontrollers

Are you planning an IR communications project? Do you need to choose a microcontroller? Check out the information Cornell University Senior Lecturer Bruce Land sent us about inexpensive IR communication with Atmel ATmega microcontrollers. It’s another example of the sort of indispensable information covered in Cornell’s excellent ECE4760 course.

Land informed us:

I designed a basic packet communication scheme using cheap remote control IR receivers and LED transmitters. The scheme supports 4800 baud transmission,
with transmitter ID and checksum. Throughput is about twenty 20-character packets/sec. The range is at least 3 meters with 99.9% packet receive and moderate (<30 mA) IR LED drive current.

On the ECE4760 project page, Land writes:

I improved Remin’s protocol by setting up the link software so that timing constraints on the IR receiver AGC were guaranteed to be met. It turns out that there are several types of IR reciever, some of which are better at short data bursts, while others are better for sustained data. I chose a Vishay TSOP34156 for its good sustained data characteristics, minimal burst timing requirements, and reasonable data rate. The system I build works solidly at 4800 baud over IR with 5 characters of overhead/packet (start token, transmitter number, 2 char checksum , end token). It works with increasing packet loss up to 9000 baud.

Here is the receiver circuit.

The receiver circuit (Source: B. Land, Cornell University ECE4760 Infrared Communications
for Atmel Mega644/1284 Microcontrollers)

Land explains:

The RC circuit acts a low-pass filter on the power to surpress spike noise and improve receiver performance. The RC circuit should be close to the receiver. The range with a 100 ohm resistor is at least 3 meters with the transmitter roughly pointing at the receiver, and a packet loss of less then 0.1 percent. To manage burst length limitations there is a short pause between characters, and only 7-bit characters are sent, with two stop bits. The 7-bit limit means that you can send all of the printing characters on the US keyboard, but no extended ASCII. All data is therefore sent as printable strings, NOT as raw hexidecimal.

Land’s writeup also includes a list of programs and packet format information.

In Memoriam: Richard Alan Wotiz

Richard Alan Wotiz—a multitalented electronics engineer, inventor, and author—provided the international embedded design community with creative projects and useful electronics engineering lessons since the early 1980s when he graduated from Princeton University. Sadly, Richard passed away unexpectedly on May 30, 2012 while hiking with a group of friends (a group called “Take a Hike”) in Santa Cruz County, California.

Richard Alan Wotiz

Richard started writing his “Embedded Unveiled” column for Circuit Cellar magazine in 2011. You can read each of his columns by clicking the links below:

Prior to becoming a columnist, Richard placed highly in several international embedded design challenges. Amazingly, he won First Prize in both the Texas Instruments 2010 DesignStellaris Challenge and the 2010 WIZnet iMCU Challenge. That’s right—he won First Place in both of Circuit Cellar’s 2010 design challenges!

Richard published intriguing feature article about some of his prize-winning projects. Interestingly, he liked combining his passion for engineering with his love of the outdoors. When he did so, the results were memorable designs intended to be used outdoors: a backpack water level monitor, an earth field magnetometer, and an ABS brake system for a mountain bike.

Richard’s ABS system is built around a Texas Instruments EKK-LM3S9B96 evaluation board, which contains the Stellaris LM3S9B96 microcontroller and support circuitry. The mechanism mounts to the front fork in place of the reflector, and the control unit sits on a bracket that’s also attached to the handlebars. A veritable maze of wires runs to the various sensors on the brake levers and wheels.

His other projects were well-built systems—such as his single-phase, variable-speed drive for AC induction motors—intended to solve real-world problems or handy DIY designs—such as his “Net Butler” network control system—that he could use in his daily life.

Richard’s single-phase, variable-speed drive for AC induction motors is an excellent device for powerful, yet quiet, pump operation. Designed for use with a capacitor-start/capacitor-run motor, it includes active power factor correction (PFC) and inrush current limiting. This is the drive unit. A Microchip Technology dsPIC30F2020 and all of the control circuitry is at the upper right, with all of the power components below. The line filter and low-voltage supplies are in a separate box to the left. It’s designed to sit vertically with the three large filter capacitors at the bottom, so they stay as cool as possible.

Richard named his finished network control system the “Net Butler.” This innovative multifunctional design can control, monitor, and automatically maintain a home network. Built around a WIZnet iMCU7100EVB, the design has several functions, such as reporting on connected network devices and downloading Internet-based content.

I last saw Richard in March 2012 at the Design West Conference in San Jose, CA. As usual, he stopped by our booth to chat about his work and Circuit Cellar magazine in general. He had a great passion for both, and it showed whenever I spoke with him. He was a true believer of this magazine and its mission. During our chat, he asked if he could write about the seven-processor Intel Industrial Control Robotic Orchestra system on display at the conference. I agreed, of course! His enthusiasm for doing such an article was apparent. Soon thereafter he was at the Intel booth taking photos and notes for his column.

I’m happy to announce that the column—which he titled “EtherCAT Orchestra”—will appear in Circuit Cellar 264 (July 2012).

Richard’s work was a wonderful contribution to this magazine, and we’re grateful to have published his articles. We’re sure Richard’s inventive design ideas and technical insight will endure to help countless more professionals, academics, and students to excel at electronics engineering for years to come.