Wi-Fi-Connected Home Energy Monitor

The Kunzig brothers of Pennsylvania use the word “retired” loosely.

Donald and Robert are both retired—each from long careers in the telecommunications industry. And after retirement, each took on a new job (Donald developing software to track and manage clinical trials managed by BioClinica, Inc., and Robert at a large data center).

So while other semi-retirees might prefer relaxing in poolside chairs or on the couch, what do these two do? They eagerly take on some technologies they haven’t worked with before and build a Wi-Fi-connected device to monitor a home’s power usage. And after two years of trial, error, and, finally, success, they develop an e-commerce website to sell it.

“Robert’s son, Jay, a design engineer working in San Jose, CA, suggested the project,” the two brothers say in article they wrote for the May 2013 edition of Circuit Cellar. “The main purpose was to design a Wi-Fi-connected monitor that would be able to measure usage from both a utility and an alternate source of power such as solar or wind.”

Their article describes how they designed a usable device that offers programmability and function. They used a Microchip MRF24WB0MB 802.11 transceiver for Wi-Fi access and a Microchip Technology PIC24FJ256GB108 microprocessor in their design. They eventually wrote the article about the ups and downs of the process (which included five prototypes) because they felt elements of their work would help readers developing their own embedded electronics devices.

“All this effort has been rewarding, perhaps not financially (yet), but certainly intellectually,” the brothers say. “After almost two years of effort, we have produced a product with an excellent hardware design, coupled with software that is better than average. The platform can be used for just about any implementation.”

“We wanted to produce an energy monitor that was fully wireless, very accurate, extremely easy to use, and based on hardware and software that is very stable. We think we were successful on all counts.”

Check out the May issue of Circuit Cellar for their article. And for more information, visit their e-commerce website at www.wattsmyusage.com.

G-Code CNC Router Controller

Brian Millier constructed a microcontroller-based, G-code controller for a CNC router. So, we gave the retired instrumentation engineer space to publish a two-part series about his project.

In Part 1 (Millier-CC-2013-04-Issue 273), Millier explains the basics of G-code and how it is converted into three-axis motion, via the router’s three stepper motors. In Part 2, he describes his design of the router’s axis controller (powered by three small microcontrollers) and the host controller (powered by a more powerful microcontroller).

He calls the project one of the most challenging he has ever tackled.

So why bother? Especially when the combination of a PC and ArtSoft’s Mach3 software is a common and affordable approach to running a CNC router? Well, like most DIYers, Millier couldn’t resist an opportunity to learn.

“I want to be upfront and say that this is probably not the most practical project I have ever done,” Millier says in Part 1. “You can usually pick up a used PC for free, and the Mach3 software is professional-grade and handles much more complex G-code programs than my DIY controller will. However, it did provide me with a challenging programming task, and I learned a lot about designing a program with many concurrent tasks, all of which are quite time critical. Even if you are not interested in building such a controller, you may find interesting some of the techniques and tricks I used to provide the multi-axis stepper-motor motion.”

Millier’s two articles focus on the two main tasks of his project.

“The first was to understand the G-code language used to program CNC machines well enough to be able to write the firmware that would parse the G-code commands into something that a microcontroller could use to control the stepper motors used for each of the three axes,” he says. “The second task was to design the hardware/firmware that would actually control the three stepper motors, all of which had to move synchronously at accurate, ramped speeds.”

Millier wraps up his project by saying: “This was probably the most challenging project I’ve tackled, outside of work projects, in many years. In particular, the Basic program code for both of the controllers ran beyond 3,500 lines.”

You can Millier-CC-2013-04-Issue 273. The second article is available via Circuit Cellar’s webshop.

CC274: A Sensory Experience

The May issue of Circuit Cellar provides a number of articles focusing on how to utilize measurements and sensors in your designs.

Knowing how to generate a magnetic field to calibrate a sensor can help with a number of

Winding 25 turns of 26 AWG enamel wire on a toroid is normally difficult, but that slit made it very easy. You would wind much smaller wire on a toroid used as an inductor.

DIY projects. Most electronic devices use inductors or transformers that depend on magnetic fields. In the May issue, Ed Nisley describes how he used a small ferrite toroid to produce a known magnetic field, which he utilized to calibrate some cheap Hall-effect sensors he obtained on eBay (p. 52).

“While the results certainly don’t transform cheap sensors into laboratory instruments, you can use them for tech jewelry with a clear conscience,” Nisley says. “You’ll also have a better understanding of magnetic fields, which may come in handy when you’re building inductors.”

Whether you’re designing a small controller for your own use or an electronic device for mass production, it’s important to keep “testability” in mind. So, it’s a good idea to make a dedicated tester for your product part of the design process at the outset. Such a tester can ensure your device is working properly in your workshop—before it ships to a customer. On page 56, George Novacek describes how an inexpensive tester can bolster an electronic device’s reliability and increase its marketability.

Brothers Robert and Donald Kunzig, both with backgrounds in the telecommunications industry, stepped outside the technologies most familiar to them when they took on an ambitious project—to produce an accurate and easy to use wireless, energy-usage monitor. They also wanted the monitor to hold its collected data even during a power outage or a router issue. Did they succeed? Check out their article on page 18 to find out.

The DNA sequencer’s design includes a motor controller, a light sensor amplifier, and an injector driver circuit.

While DNA, the molecule that provides genetic instruction to all living organisms, is complex, building a DNA sequencer can be relatively simple. Fergus Dixon used a light sensor amplifier,  a motor controller, and an injector driver circuit to fulfill a customer’s request for a DNA sequencer with a color screen and full connectivity via Ethernet or Bluetooth (p. 26)

If you’re a DIYer who is nervous about possible levels of radiation in your home, find out how to build a hand-held radiation sensor on page 60.

Also, Jesús Calviño-Fraga describes how he built a serial port-to-SPI bridge programmer, the “S2S Dongle,” which functions without a pre-programmed microntroller (p. 34).

Finally, this issue includes articles that wrap up intriguing projects Circuit Cellar introduced in April.

Last month, Jeff Bachiochi explored the musical instrument digital interface (MIDI). In Part

An Atmel ATmega88 microcontroller is at the heart of the CNC router controller.

2, he focuses on a hardware circuit that can monitor the MIDI messages sent between his project’s MIDI devices, which include a Harmonix drum kit used with the Xbox version of the Rock Band video game (p. 68).

Brian Millier calls his construction of a microcontroller-based, G-code controller for a CNC router one of his most challenging DIY projects. The second article in his series focuses on two functional blocks: the axis controller and the host controller (p. 42.)

Electrical Engineer Crossword (Issue 273)

The answers to Circuit Cellar’s April electronics engineering crossword puzzle are now available.

Across

1.         BITDENSITY—Bits per inch of magnetic tape, for example [two words]

3.         KALMANFILTER—aka LQE [two words]

5.         EMBEDDEDSECURITY—Circuit Cellar columnist Patrick Schaumont covers this topic with articles about authentication, encryption, and electronic signatures [two words]

7.         HAMMING—Error-correcting code

8.         SPURIOUS—Unintentional

11.       LAND—Electronics and Computer Engineering professor at Cornell University and Circuit Cellar frequent contributor (many of his students contribute to Circuit Cellar as well)

13.       CLAPP—American inventor who developed an oscillator frequency standard

14.       ELECTRODE—Able to interact with nonmetallic circuit parts

16.       RINGOSCILLATOR—A feedback structure with an odd number of digital inverters [two words]

17.       PLESIOCHRONOUS—A system that’s not quite in synch

18.       OSCILLOGRAPH—Takes electric current measurements

19.       REFLECTEDBINARYCODE—Created by Bell Labs physicist and researcher Frank Gray [three words]

 

Down

2.         DEADBAND—Potentiometer’s part shortened by a tap [two words]

4.         BECHTOLSHEIM—Electronics engineer and co-founder of the company that created Java

6.         CHIPBIOMETRICS—Digital fingerprints [two words]

9.         INCANDESCENT—Illuminating

10.       ALOHANET—Computer networking system from the 1970s

12.       EEVBLOG—Where to find electronics engineer David L. Jones’s off-the-cuff online videos

15.       EULERMETHOD—Solves equations [two words]

17.       POPOV—Helped make electromagnetic radio waves more useful

Build a Simple Dedicated Tester

Whether you’re planning a small controller for your own use or an electronic device for mass production, you need to keep “testability” in mind. So, it’s a good idea to make a dedicated tester for your product part of its initial design.

Such a tester can ensure your device is functioning smoothly in your workshop—before it ships to a customer.

A dedicated tester (with the white panel) simulates inputs and loads for an embedded controller. A breakout box (with the red terminals on the panel) allows access to every interface line.

In the upcoming May issue of Circuit Cellar, columnist and engineer George Novacek discusses how to build a simple and inexpensive dedicated tester for a product.

“According to old engineering wisdom, every new project should begin with test design,” Novacek says in his column. “If you don’t follow this advice, your product may have features that are too awkward, too time-consuming, or impossible to test. You always need to keep testability in mind. Ultimately, it improves reliability, reduces manufacturing cost, minimizes field returns, speeds up production, and reduces the cost of repairs.”

Engineers certainly have access to a broad range of general testing equipment, from oscilloscopes to signal generators and analyzers.

“While these instruments are sufficient for testing, working with them solely may be slow and cumbersome,” Novacek says. “Imagine an embedded controller with a number of input and output devices, all of which need to be monitored while different signals are injected for the test. That’s where the dedicated tester comes in. Companies with deep pockets can purchase various types of automatic test equipment (ATE), but this may be too expensive for a small operation. Or, it may not be practical because of the complex setup for a low-volume production. Building a dedicated, inexpensive tester can solve the problem by ensuring an efficient and repeatable test.”

Check out the May issue of Circuit Cellar for more of Novacek’s guidance on why and how you should build a dedicated tester.

Novacek plans to continue examining product testability in upcoming issues, addressing topics that include the design of hardware and software that enables a product to be efficiently tested.

The Future of Open-Source Hardware for Medical Devices

Medical technology is changing at a rapid pace, but regulatory compliance is also becoming increasingly harder. Regulatory compliance can act as a barrier to innovation, but it is a necessary check to ensure quality medical care. For small companies, aligning innovation with regulatory compliance can only help.

Fergus Dixon

When designing any new product, the FDA-recommended process is a great reference. First, the design input requirements must be written down. After the device has been designed and prototyped, verification and validation (V&V) will ensure that the device meets the design input. The device is then documented, creating the design output or device master record (DMR). Each device made is checked against the DMR and documented in the device history record (DHR). So all the details on how to make the device are contained in the DMR, and the results and traceability are recorded in the DHR.

My company recently asked an overseas company to design and manufacture an existing product. After many e-mails, the overseas company managed to build a working unit and immediately requested an order for 1,000. Before ordering even one unit, there was the matter of V&V. So what is V&V? Verification is the act of ensuring that the circuit acts as it should, as the circuit designer intended. This involves testing to a predetermined criteria, where the pass/fail is clearly defined. Testing happens by varying the inputs and checking the outputs to test the device as close to 100% as reasonably possible. When the inputs fall outside a normal range (e.g., a 10-VDC instead of 12-VDC battery voltage), the device must still work or it must provide a message showing why the device will not work (e.g., low battery light). Validation is the act of ensuring the circuit works as the customer or patient requires. This involves field testing, feedback, and rework—lots of it.

Working for medical device companies can be very rewarding. Smaller companies tend to work at the cutting edge. Larger companies are more secure and have stable products, but they can be less agile. With one company, we had a device that used smart batteries. During testing, we discovered that the batteries would not charge below 15ºC. After many meetings and e-mails to the manufacturers, the problem went to management, who decided to change the manual to say: “Do not charge below 15ºC.” Smaller dynamic companies can attract the best scientists, which is great until a connector fails and there is a roomful of highly intelligent people with no soldering iron experience. Every technology company can benefit from having at least one experienced technician or engineer. A few hours spent playing with an Arduino is a great way to get this experience.

What about open-source hardware (OSHW) for medical devices? For home hobbyists and students, OSHW is great. There is free access to working circuits, programs, and sketches. C compilers, which once cost several thousand dollars, are mostly free. For the manufacturers, the benefits are plenty of feedback, which can be used to improve products. There is one roadblock, and that involves the loss of intellectual property (IP), which means anyone can copy the hardware. Creative Commons has addressed this with an agreement that any copies must reference the original work. Closed-source hardware can also be good and present fewer issues with losing IP. Apple is a great example. Rather than use feedback to improve products, it makes smart decisions about future products. The iOS vs. Android battle can be viewed as a closed-source vs. open-source struggle that still hasn’t produced a winner. Medical devices and OSHW will have to meet up sometime.

Fergus Dixon’s embedded DNA sequencer project (Source: F. Dixon)

What about the future of medical devices? Well, the best is yet to come with brighter organic light-emitting diode (OLED) displays, a multitude of wireless connectivity options (all using the serial interface), and 32-bit ARM cores. DNA is gradually being unlocked with even “junk DNA” becoming meaningful. The latest hot topics of 3-D printing and unmanned aerial vehicles (UAVs) have direct medical applications with 3-D printed prosthetic ears and medical nanorobotics ready to benefit from UAV technology. Using a new sensor (e.g., a gyroscope) now means visiting an online seller such as Pololu, which offers ready-built development kits at reasonable prices. A recent design was a manually assisted CPR device project, which was abandoned due to lack of funding. How great would it be to have a device that could not only improve the current 10% survival rate with CPR (5% without CPR) but also could measure a patient’s health to determine whether CPR was helping and, even more importantly, when to stop administering it? Now that would be a good OSHW project.

CC273: Necessity and Invention

Tom Cantrell wanted to stop fiddling with his sprinklers as he tried to balance conserving water in California and keeping his lawn green. So he asked himself if he could craft a weather-savvy sprinkler controller.

In the April issue of Circuit Cellar, he describes how to weatherize an embedded app. He uses a Texas Instruments MSP430 microcontroller and a WIZnet W5200 smart Ethernet chip to access National Weather Service forecasts and data (p. 36).

Engineer and entrepreneur Michael Hamilton also has found that necessity breeds invention—which in turn can start a new business. “While working for Ashland Chemical in clean room environments, I realized there was a need for an accurate humidity controller,” he says. “This led me to design my own temperature and humidity controller and form my first company, A&D Technologies.”

In our interview, he talks about what he has done since, including founding another company and becoming an award-winning designer in the RL78 Green Energy Challenge (p. 44).

A shift in the timing signal—or jitter—of a digital transmission can adversely affect your high-speed designs. It’s been an issue for at least 40 years, with the advent of the first all-digital telecommunications networks such as PDH. But you may not have dealt with it in your designs. In the April magazine, Robert Lacoste explains how to diagnose a case of the jitters (p. 54).

Jeff Bachiochi isn’t a musician. But he didn’t need to be one to work with the musical instrument digital interface (MIDI), which relays instructions on how to play a piece directly to an instrument (bypassing the musician). In the April issue, he describes the circuitry needed to connect to MIDI communication and display messages between devices (p. 60).

Atmel’s ATmega88 and ATmega1284 microcontrollers are at the heart of the CNC controller.

Also, Brian Millier describes how he built a microcontroller-based G-code controller for a CNC router. Even if you are not interested in building such a controller, you can learn from the techniques he used to provide the multi-axis stepper-motor motion (p. 30).

You also might find Scott Weber’s experience instructive. After placing microcontroller-based devices throughout his home, he found he needed a control panel to enable him to update the devices and check on their operation. He shares his panel’s basic structure and its software design. Its display shows him all the information he needs (p. 22).

While wear and tear affect the reliability of hardware, software reliability is different. Whatever causes software to fail is built-in, through errors ranging from poor coding to typos to omissions. On page 51, George Novacek shares some methods of calculating the probability of faults in your firmware.

Also in the April issue, Bob Japenga continues looking at concurrency in embedded systems. In the sixth article of his series, he discusses two Linux mechanisms for creating embedded systems—POSIX FIFOs and message queues (p. 48).

Finally, “From the Archives” features a 2003 article by Mark Balch about Verilog HDL. He discusses how to use it in your custom logic designs for digital systems (p. 68).

Open-Source Hardware for the Efficient Economy

In the open-source hardware development and distribution model, designs are created collaboratively and published openly. This enables anyone to study, modify, improve, and produce the design—for one’s own use or for sale. Open-source hardware gives users full control over the products they use while unleashing innovation—compared to the limits of proprietary research and development.

This practice is transforming passive consumers of “black box” technologies into a new breed of user-producers. For consumers, open-source hardware translates into better products at a lower cost, while providing more relevant, directly applicable solutions compared to a one-size-fits-all approach. For producers, it means lower barriers to entry and a consequent democratization of production. The bottom line is a more efficient economy—one that bypasses the artificial scarcity created by exclusive rights—and instead focuses on better and faster development of appropriate technologies.

Open-source hardware is less than a decade old. It started as an informal practice in the early 2000s with fragmented cells of developers sharing instructions for producing physical objects in the spirit of open-source software. It has now become a movement with a recognized definition, specific licenses, an annual conference, and several organizations to support open practices. The expansion of open-source hardware is also visible in a proliferation of open-source plans for making just about anything, from 3-D printers, microcontrollers, and scientific equipment, to industrial machines, cars, tractors, and solar-power generators.

As the movement takes shape, the next major milestone is the development of standards for efficient development and quality documentation. The aim here is to deliver on the potential of open-source products to meet or exceed industry standards—at a much lower cost—while scaling the impact of collaborative development practices.

The Internet brought about the information revolution, but an accompanying revolution in open-source product development has yet to happen. The major blocks are the absence of uniform standards for design, documentation, and development process; accessible collaborative design platforms (CAD); and a unifying set of interface standards for module-based design—such that electronics, mechanical devices, controllers, power units, and many other types of modules could easily interface with one another.

Can unleashed collaboration catapult open-source hardware from its current multimillion dollar scale to the next trillion dollar economy?

One of the most promising scenarios for the future of open source hardware is a global supply chain made up of thousands of interlinked organizations in which collaboration and complementarity are the norm. In this scenario, producers at all levels—from hobbyists to commercial manufacturers—have access to transparent fabrication tools, and digital plans circulate freely, enabling them to build on each other quickly and efficiently.

The true game changers are the fabrication machines that transform designs into objects. While equipment such as laser cutters, CNC machine tools, and 3-D printers has been around for decades, the breakthrough comes from the drastically reduced cost and increased access to these tools. For example, online factories enable anyone to upload a design and receive the material object in the mail a few days later. A proliferation of open-source digital fabrication tools, hackerspaces, membership-based shops, fab labs, micro factories, and other collaborative production facilities are drastically increasing access and reducing the cost of production. It has become commonplace for a novice to gain ready access to state-of-art productive power.

On the design side, it’s now possible for 70 engineers to work in parallel with a collaborative CAD package to design the airplane wing for a Boeing 767 in 1 hour. This is a real-world proof of concept of taking development to warp speed—though achieved with proprietary tools and highly paid engineers. With a widely available, open-source collaborative CAD package and digital libraries of design for customization, it would be possible for even a novice to create advanced machines—and for a large group of novices to create advanced machines at warp speed. Complex devices, such as cars, can be modeled with an inviting set of Lego-like building blocks in a module-based CAD package. Thereafter, CNC equipment can be used to produce these designs from off-the-shelf parts and locally available materials. Efficient industrial production could soon be at anyone’s fingertips.

Sharing instructions for making things is not a novel idea. However, the formal establishment of an open-source approach to the development and production of critical technologies is a disruptive force. The potential lies in the emergence of many significant and scalable enterprises built on top of this model. If such entities collaborate openly, it becomes possible to unleash the efficiency of global development based on free information flows. This implies a shift from “business as usual” to an efficient economy in which environmental and social justice are part of the equation.

 

Catarina Mota is a New York City-based Portuguese maker and open-source advocate who cofounded the openMaterials (openMaterials.org) research project, which is focused on open-source and DIY experimentation with smart materials. She is both a PhD candidate at FCSHUNL and a visiting scholar at NYU, and she has taught workshops on topics such as hi-tech materials and simple circuitry. Catarina is a fellow of the National Science and Technology Foundation of Portugal, co-chair of the Open Hardware Summit, a TEDGlobal 2012 fellow, and member of NYC Resistor.

Marcin Jakubowski graduated from Princeton and earned a PhD Fusion Physics from the University of Wisconsin. In 2003 Marcin founded the Open Source Ecology (OpenSourceEcology.org) network of engineers, farmers, and supporters. The group is working on the Global Village Construction Set (GVCS), which is an open-source, DIY toolset of 50 different industrial machines intended for the construction of a modern civilization (http://vimeo.com/16106427).

This essay appears in Circuit Cellar 271, February 2013.

Electrical Engineer Crossword (Issue 272)

The answers to Circuit Cellar’s March electronics engineering crossword puzzle are now available.

Across

1.     JACOBSLADDER—Climbing arc [two words]

5.     WOZNIAK—Apple I

8.     SPARKCOIL—Uses a low-voltage DC supply to create high-voltage pulses

10.   JITTER—Creates an imperfect timing signal

11.   ERG—Energy measurement

13.   ACOUSTICOHM—Equivalent to µbar s/cm3 [two words]

15.   BUFFER—Provides electrical isolation

16.   WIFI—Provides movement to smartphones, PCs, and tablets

17.   POSIX—An IEEE operating system compatibility standard

18.   PEAKTOPEAK—Alterations between high and low values

19.   MUTEX—Capable of ensuring atomic access to any shared resource

20.   NAKAMURA—University of California, Santa Barbara professor credited with inventing the blue LED

 

Down

2.     OSCILLATOR—American physicist George W. Pierce (1872–1956); piezoelectric

3.     EIGENTONE—A pitch capable of resonance

4.     FRETSONFIRE—Open-source gameplay for music lovers [three words]

6.     NEGATIVEFEEDBACK—Type of amplifier invented in 1927 by Harold Black [two words]

7.     BAFFLE—Sound wave obstruction

9.     MORSECODE—A pre-texting means of communication [two words]

12.   COMBFILTER—Capable of causing delay [two words]

14.   CHIPSET—Intel created the first family of these

CC272: Issue of Ingenuity

The March issue of Circuit Cellar includes articles from a number of practical problem solvers, such as a homeowner who wanted to get a better grasp of his electrical usage and a professor who built a better-than-average music box.

Dean Boman, a retired spacecraft communications systems designer, decided to add oversight of his electric usage (in real time) to his home-monitoring system. After all, his system already addressed everything from security to fire detection to irrigation control. On page 34, he describes his energy monitoring system, which provides a webpage with circuit-by-circuit energy usage. This level of detail can make you a well-informed energy consumer.

Dean Bowman’s energy-monitoring system

Bruce Land, a senior lecturer in electronics and computer science at Cornell University, thought developing a microcontroller-based music device would be a useful class lesson. But more importantly, he knew his 3-year-old granddaughter would love an interactive music box. On page 28, he shares how he built a music device with an 8-bit microcontroller that enables changing the note sequence, timbre, tempo, and beat.

Computer engineer Chris Paiano has written many application notes for the Cypress programmable-system-on-chip (PSoC) chipset. He is even working on a PSoC solution for his broken dishwasher. But that’s far from his most impressive work. Read an interview with this problem-solver on page 41.

College students built a rotational inverted pendulum (RIP) to test nonlinear control theory. But you might want to make and tune one for fun. Nelson Epp did. On page 20, he describes how he built his RIP and utilized a TV remote control to meet the challenges of balance and swing. “It is a good project because the hardware used is fairly common, the firmware techniques and math behind them are relatively easy to understand, and you get a good feeling when, for the first time, the thing actually works,” he says.

Nelson Epp’s rotational inverted pendulum (RIP)

Chip biometrics are unique digital chip features—left by the manufacturing process—that distinguish one chip from another of the same type. Finding these chip “fingerprints” is important in developing trustworthy and secure electronics. On page 45, Patrick Schaumont discusses how to extract a fingerprint from a field programmable gate array (FPGA) and authenticate a chip’s identity.

Maurizio Di Paolo Emilio, a telecommunications engineer from Italy, designs data acquisition system software for physics experiments and industrial use. In the Tech the Future essay on page 80, he discusses the many alternatives for data acquisition software and the goal of developing credit-card-sized embedded data acquisition systems, using open-source software, to manage industrial systems.

Other article highlights include George Novacek’s look at ways to reduce product failures in the field (p. 52), Ed Nisley’s take on how to get true analog voltages from the Arduino’s PWM outputs (p. 56), and Jeff Bachiochi’s guidance on using a development kit to design a tool to help transmit Morse code (p. 68).

With this issue’s emphasis on robotics, you’ll want to check out  our From the Archives article about a SOPHOCLES design for a solar-powered robot that can detect poisonous gas (p. 62).

Issue 270: EQ Answers

The answers to the Circuit Cellar 270 Engineering Quotient are now available. The problems and answers are listed below.

Problem 1: Given a microprocessor that has hardware support for just one level of priority for interrupts, is it possible to implement multiple priorities in software? If so, what are the prerequisites that are required?

Answer 1: Yes, given a few basic capabilities, it is possible to implement multiple levels of interrupt priority in software. The basic requirements are that it must be possible to reenable interrupts from within an interrupt service routine (ISR) and that the different interrupt sources can be individually masked.

Question 2: What is the basic scheme for implementing software interrupt priorities?

Answer 2: In normal operation, all the interrupt sources are enabled, along with the processor’s global-interrupt mask.

When an interrupt occurs, the global interrupt mask is disabled and the “master” ISR is entered. This code must (quickly) determine which interrupt occurred, disable that interrupt and all lower-priority interrupts at their sources, then reenable the global-interrupt mask before jumping to the ISR for that interrupt. This can often be facilitated by precomputing a table of interrupt masks for each priority level.

Question 3: What are some of the problems associated with software interrupt priorities?

Answer 3: For one thing, the start-up latency of all the ISRs is increased by the time spent in the “master” ISR. This can be a problem in time-critical systems. This scheme enables interrupts to be nested, so the stack must be large enough to handle the worst-case nesting of ISRs, on top of the worst-case nesting of non-interrupt subroutine calls.

Finally, it is very tricky to do this in anything other than Assembly language. If you want to use a high-level language, you’ll need to be intimately familiar with the language’s run-time library and how it handles interrupts and reentrancy, in general.

Answer 4: Yes, on most such processors, you can execute a subroutine call to a “return from interrupt” instruction while still in the master ISR, which will then return to the master ISR, but with interrupts enabled.

Check to see whether the “return from interrupt” affects any other processor state (e.g., popping a status word from the stack) and prepare the stack accordingly.

Also, beware that another interrupt could occur immediately thereafter, and make sure the master ISR is reentrant beyond that point.

 

Contributed by David Tweed

CC271: Got Range?

As with wireless connectivity, when it comes to your engineering skills, range matters. The more you know about a variety of applicable topics, the more you’ll profit in your professional and personal engineering-related endeavors. Thus, it makes sense to educate yourself on a continual basis on the widest range of topics you can. It can be a daunting task. But no worries. We’re here to help. In this issue, we feature articles on topics as seemingly diverse as wireless technology to embedded programming to open-source development. Let’s take a closer look.

Consider starting with Catarina Mota and Marcin Jakubowski’s Tech the Future essay, “Open-Source Hardware for the Efficient Economy” (p. 80). They are thoughtful visionaries at the forefront of a global open-source hardware project. You’ll find their work exciting and inspirational.

Stuart Ball’s Dip Meter

On page 20, Stuart Ball describes the process of designing a digital dip meter. It’s a go-to tool for checking a device’s resonant frequency, or you can use it as a signal source to tune receivers. Ball used a microcontroller to digitize the dip meter’s display.

Interested in 3-D technology? William Meyers and Guo Jie Chin’s 3-D Paint project (p. 26) is a complete hardware and software package that uses free space as a canvas and enables you to draw in 3-D by measuring ultrasonic delays. They used a PC and MATLAB to capture movements and return them in real time.

This month we’re running the third article in Richard Lord’s series, “Digital Camera Controller” (p. 32). He covers the process of building a generic front-panel controller for the Photo-Pal flash-trigger camera controller project.

Richard Lord’s front panel CPU

Turn to page 37 for the fifth article in Bob Japenga’s series on concurrency in embedded systems. He covers the portable operating system interface (POSIX), mutex, semaphores, and more.

Check out the interview on page 41 for insight into the interests and work of electrical engineer and graduate student Colin O’Flynn. He describes some of his previous work, as well as his Binary Explorer Board, which he designed in 2012.

Colin O’Flynn’s Binary Explorer Board

In Circuit Cellar 270, George Novacek tackled the topic of failure mode and criticality analysis (FMECA). This month he focuses on fault-tree analysis (p. 46).

Arduino is clearly one of the hottest design platforms around. But how can you use it in a professional-level design? Check out Ed Nisley’s “Arduino Survival Guide” (p. 49).

Standing waves are notoriously difficult to understand. Fortunately, Robert Lacoste prepared an article on the topic that covers an experimental platform and measurements (p. 54).

This month’s article from the archives relates directly to the issue’s wireless technology theme. On page 60 is Roy Franz’s 2003 article about his WiFi SniFi design, which can locate wireless networks and then display “captured” packet information.

If you like this issue’s cover, you’ll have to check out Jeff Bachiochi’s article on QR coding (p. 68). He provides an excellent analysis of the technology from a pro engineer’s point of view.

Circuit Cellar 271 is now available.

CC25 Is Now Available

Ready to take a look at the past, present, and future of embedded technology, microcomputer programming, and electrical engineering? CC25 is now available.

Check out the issue preview.

We achieved three main goals by putting together this issue. One, we properly documented the history of Circuit Cellar from its launch in 1988 as a bi-monthly magazine
about microcomputer applications to the present day. Two, we gathered immediately applicable tips and tricks from professional engineers about designing, programming, and completing electronics projects. Three, we recorded the thoughts of innovative engineers, academics, and industry leaders on the future of embedded technologies ranging from
rapid prototyping platforms to 8-bit chips to FPGAs.

The issue’s content is gathered in three main sections. Each section comprises essays, project information, and interviews. In the Past section, we feature essays on the early days of Circuit Cellar, the thoughts of long-time readers about their first MCU-based projects, and more. For instance, Circuit Cellar‘s founder Steve Ciarcia writes about his early projects and the magazine’s launch in 1988. Long-time editor/contributor Dave Tweed documents some of his favorite projects from the past 25 years.

The Present section features advice from working hardware and software engineers. Examples include a review of embedded security risks and design tips for ensuring system reliability. We also include short interviews with professionals about their preferred microcontrollers, current projects, and engineering-related interests.

The Future section features essays by innovators such as Adafruit Industries founder Limor Fried, ARM engineer Simon Ford, and University of Utah professor John Regehr on topics such as the future of DIY engineering, rapid prototyping, and small-RAM devices. The section also features two different sets of interviews. In one, corporate leaders such as Microchip Technology CEO Steve Sanghi and IAR Systems CEO Stefan Skarin speculate on the future of embedded technology. In the other, engineers such as Stephen Edwards (Columbia University) offer their thoughts about the technologies that will shape our future.

As you read the issue, ask yourself the same questions we asked our contributors: What’s your take on the history of embedded technology? What can you design and program today? What do you think about the future of embedded technology? Let us know.

Electrical Engineer Crossword (Issue 271)

The answers to Circuit Cellar’s February electronics engineering crossword puzzle are now available.

Across

3.            CONFORMALCOATING—Used on PCBs intended for extreme environments [two words]

4.            LOOP—An often repetitious code sequence

7.            VUMETER—Measures program volume [two words]

8.            GALVANOMETER—An electric current identifier

10.         FACTORIAL—“n!”

11.         DIPMETER—Evaluates radio frequency circuits [two words]

13.         REEDSOLOMON—Non-binary code [two words]

16.         SHOCKLEY—One of a group of three co-inventors who, in 1956, were awarded the Nobel Prize in Physics for creating the transistor

18.         SUBSTRATE—An insulating board’s surface

19.         TELEPHONY—Concept proposed by Belgian engineer Charles Bourseul in 1856

20.         ACTUATOR—Electric motors and loudspeakers, for example

 

Down

1.            TORODIAL—A type of inductor or transformer whose windings form a closed circular tube

2.            POTENTIOMETER—May be used to control volume on audio equipment

5.            PIEZOELECTRICITY—Often used to produce and detect high voltages, sound, and electronic frequency generation

6.            OCCAMPROCESS—An electronic circuit board manufacturing method [two words]

9.            FLYWHEEL—An energy-storing device

12.         MONOBLOCK—A single-channel power amp with high current power

14.         RELIABILITY—Quality over time

15.         MICROMETER—Used to measure small objects’ thickness

17.         EISLER—Austrian engineer (1907–992) credited with inventing the printed circuit

Open-Source Hardware for the Efficient Economy

In the open-source hardware development and distribution model, designs are created collaboratively and published openly. This enables anyone to study, modify, improve, and produce the design—for one’s own use or for sale. Open-source hardware gives users full control over the products they use while unleashing innovation—compared to the limits of proprietary research and development.

This practice is transforming passive consumers of “black box” technologies into a new breed of user-producers. For consumers, open-source hardware translates into better products at a lower cost, while providing more relevant, directly applicable solutions compared to a one-size-fits-all approach. For producers, it means lower barriers to entry and a consequent democratization of production. The bottom line is a more efficient economy—one that bypasses the artificial scarcity created by exclusive rights—and instead focuses on better and faster development of appropriate technologies.

Open-source hardware is less than a decade old. It started as an informal practice in the early 2000s with fragmented cells of developers sharing instructions for producing physical objects in the spirit of open-source software. It has now become a movement with a recognized definition, specific licenses, an annual conference, and several organizations to support open practices. The expansion of open-source hardware is also visible in a proliferation of open-source plans for making just about anything, from 3-D printers, microcontrollers, and scientific equipment, to industrial machines, cars, tractors, and solar-power generators.

As the movement takes shape, the next major milestone is the development of standards for efficient development and quality documentation. The aim here is to deliver on the potential of open-source products to meet or exceed industry standards—at a much lower cost—while scaling the impact of collaborative development practices.

The Internet brought about the information revolution, but an accompanying revolution in open-source product development has yet to happen. The major blocks are the absence of uniform standards for design, documentation, and development process; accessible collaborative design platforms (CAD); and a unifying set of interface standards for module-based design—such that electronics, mechanical devices, controllers, power units, and many other types of modules could easily interface with one another.

Can unleashed collaboration catapult open-source hardware from its current multimillion dollar scale to the next trillion dollar economy?

One of the most promising scenarios for the future of open source hardware is a glocal supply chain made up of thousands of interlinked organizations in which collaboration and complementarity are the norm. In this scenario, producers at all levels—from hobbyists to commercial manufacturers—have access to transparent fabrication tools, and digital plans circulate freely, enabling them to build on each other quickly and efficiently.

The true game changers are the fabrication machines that transform designs into objects. While equipment such as laser cutters, CNC machine tools, and 3-D printers has been around for decades, the breakthrough comes from the drastically reduced cost and increased access to these tools. For example, online factories enable anyone to upload a design and receive the material object in the mail a few days later. A proliferation of open-source digital fabrication tools, hackerspaces, membership-based shops, fab labs, micro factories, and other collaborative production facilities are drastically increasing access and reducing the cost of production. It has become commonplace for a novice to gain ready access to state-of-art productive power.

On the design side, it’s now possible for 70 engineers to work in parallel with a collaborative CAD package to design the airplane wing for a Boeing 767 in 1 hour. This is a real-world proof of concept of taking development to warp speed—though achieved with proprietary tools and highly paid engineers. With a widely available, open-source collaborative CAD package and digital libraries of design for customization, it would be possible for even a novice to create advanced machines—and for a large group of novices to create advanced machines at warp speed. Complex devices, such as cars, can be modeled with an inviting set of Lego-like building blocks in a module-based CAD package. Thereafter, CNC equipment can be used to produce these designs from off-the-shelf parts and locally available materials. Efficient industrial production could soon be at anyone’s fingertips.

Sharing instructions for making things is not a novel idea. However, the formal establishment of an open-source approach to the development and production of critical technologies is a disruptive force. The potential lies in the emergence of many significant and scalable enterprises built on top of this model. If such entities collaborate openly, it becomes possible to unleash the efficiency of global development based on free information flows. This implies a shift from “business as usual” to an efficient economy in which environmental and social justice are part of the equation.

 

Catarina Mota is a New York City-based Portuguese maker and open-source advocate who cofounded the openMaterials (openMaterials.org) research project, which is focused on open-source and DIY experimentation with smart materials. She is both a PhD candidate at FCSHUNL and a visiting scholar at NYU, and she has taught workshops on topics such as hi-tech materials and simple circuitry. Catarina is a fellow of the National Science and Technology Foundation of Portugal, co-chair of the Open Hardware Summit, a TEDGlobal 2012 fellow, and member of NYC Resistor.

Marcin Jakubowski graduated from Princeton and earned a PhD Fusion Physics from the University of Wisconsin. In 2003 Marcin founded the Open Source Ecology (OpenSourceEcology.org) network of engineers, farmers, and supporters. The group is working on the Global Village Construction Set (GVCS), which is an open-source, DIY toolset of 50 different industrial machines intended for the construction of a modern civilization (http://vimeo.com/16106427).

This essay appears in Circuit Cellar 271, February 2013.