Interfacing on-off sensors and dealing with bouncing and flickering can become almost a boring and routine job. But in rare occasions we need to go beyond wiring a couple of cables.
For one application we needed to use one speed control unit (see Figure 1) under some slightly different operating conditions inside a controlled environment. Firmware sources were not available, so our only entry point into the system was the sensor terminals block. The need to “fool” the control unit by tweaking its sensor signals made this application a good candidate for exercising skills and having some fun.
The sensor operates like a very low impedance contact switch. Power for the sensor is provided by means of a 560 Ω pull-up resistor in series with the internal regulator. Sensed state information comes in both, pulse width and pulse-to-pulse time interval. Our goal was to extend the pulse width, t1, without overlapping more than two consecutive pulses (see Figure 2).
There were several relatively simple solutions, but we wanted our device to act like a small, battery-less, pluggable dongle with some “intelligence” inside.
The main constraint in the design was the need to be pluggable and un-pluggable without disconnecting the sensor. The small set of requirements served the challenging and fun part of the design: battery-less operation, low power consumption, fairly precise timing (ms resolution), small size, and ability to distinguish between self-driven LOW output from sensor-driven LOW.
Ahem! Why not using a microcontroller? Why not mix some analog and digital modules? The resulting conceptual design idea is shown below in Figure 3.
The Power module “steals” a fraction from the energy provided by the control unit for the sensor. Key components are D2, Vref and the Analog Comparator , and operation is fairly simple. When the output is driven low by the logic, the positive (+) wire is driven low, too. D2 ensures a detectable (+) wire voltage below the logical “0” threshold but above 0 V . The analog comparator’s function here is to detect when the (+) wire is pulled down again by the remote sensor (see Figure 4).
There are several rail-to-rail, single-supply opamps and small pin-count CPUs that could do the job here. But real fun was looking for something really “tiny”. An ATtiny10 microcontroller from Atmel was a perfect fit for this application. It comes with an analog comparator, analog-to-digital converter, timer, watchdog, 32 bytes of RAM and 1 kbyte of Flash, all in one single 6-pin SOT23 package.
Almost all firmware tasks were done in the analog comparator output change and watchdog interrupts. The CPU stays in low power mode for most of the time. We selected one low-power silicon rectifier diode for D2 and one Schottky diode for generating the analog comparator’s reference voltage. A couple of R-C low-pass filters helped in reducing noise at the comparator inputs. I did not take pictures from real prototypes, but Figure 5 shows a partial 3D render taken from the PCB design tool. It fits inside one standard 3 mm male jack cover.
I am almost certain that most of our engineering jobs can be anything but boring. Facing new challenges and tasks is undoubtedly one of our motivation sources.
It will be interesting to hear from other colleagues about how engineers and technicians make routine tasks more fun.