# Low Power, Long Bus Sensor Array

#### lance2010

Joined Sep 28, 2007
2
The project I need help on is a low power, battery operated system that incorporates a sensor array taking periodic measurements. The premise is quite simple, but I'm lacking the practical experience to complete the design. I have specific questions, but overall feedback is welcome as well.

Requirements
• Detect an initiating event using a normally closed circuit
• Count discrete events from an array of open collector sensors and periodically report this information back to an MCU (8051 derivative). The reported count must be consistent i.e. sampled at the same point in time across all sensors.
• Consume the lowest possible power for extended battery operation (2-3 AAs)
• Sensor bus length of up to 3 meters with sensors stationed along the length of the bus with up to 1 meter distance between sensors and/or MCU
• Accommodate between 4 and 16 sensors on the bus
• Operate in an office/industrial environment (semi-noisy)
• Minimal sensor array thickness. Clearances are tight.

Design
The attached schematic is the interface circuit for each sensor in the array. Note that this circuit is designed to daisy chain the sensors with each connecting to the next.

The sensor array is normally powered off to conserve power and armed via a (closed) reed switch found on the schematic. Opening the reed switch causes the following:
1. Interrupt on the MCU
2. Power up the sensor array to start counting events
The sensor array is powered down at some point the and the sequence rearmed to repeat.

The sensors are interfaced to the MCU via a UART operating in SPI mode with the MOSI pin connected to LOAD and MISO connected to DOUT of the first sensor. Transmitting a special pulse byte loads a consistent count into the shift register after which the counts can be shifted out down the line.

Oh, I'm only using the low 6 bits of the count and hijacking the high order bits for a little self diagnostic capability.

Questions/Concerns
1. Noise and overall reliability of the circuit. I mentioned the operating environment, but the circuit must also withstand plugging/unplugging the array without damage. Of course, I'm not comfortable directly connecting to the MCU I/O pins, but I don't know specifically how to address.
2. Providing power to the array. Each sensor in the array will consume up to 1 mA, which isn't a lot, but once again, I'm not comfortable with a direct connection to the MCU. I was thinking of using a standard bipolar transistor to switch and have read about JFETs and MOSFETs. This should be a simple, standard problem - any suggestions?
3. Clock distribution. Should I be using a buffer or something on this? Also, I'm assuming I'll have to fine tune the RC values (R4) based on the actual cable used, but is there a better approach? I'd like to run the bus at 100kHz max.
4. Normally closed interrupt (INT). The idea here is to consume very little current when not operational. The current design (not shown) connects the interrupt line to the MCU and uses a 250k pullup. I'm concerned about a direct ground loop connection to the MCU as well as parasitic losses through the pullup (perhaps an unwarranted concern).
5. Cabling. I'll likely need two types. Clearances seem to require flat cable between sensors while routing to the MCU requires flexibility. Any suggestions/experience with cabling and connectors?
6. Surface mount prototyping. I'm currently using a breadboard to prototype, but is there a good SMT prototyping system. I've seen a couple, but none seem all that great.
7. Schematics. What's a good free/low-cost schematic package for simple stuff like this? I'm currently using ExpressSCH since I'll probably be using them to do prototype boards at some point.

#### Attachments

• 103.6 KB Views: 51

#### nomurphy

Joined Aug 8, 2005
567
How much are you willing to pay for this design project -- \$100/hr?

#### SgtWookie

Joined Jul 17, 2007
22,221
I'm wondering what you're doing with that schematic - the 74598 is an 8-bit latching shift register, not a counter - and you have it connected to yet another universal shift register. Are you a shifty kinda guy?

The reed switch - have you considered using Hall-effect switches instead? Reed switches are much slower to respond than Hall-effect switches and would have a much shorter life span. Hall-effect devices come in a variety of packages; many are very compact. I picked up a number of Philmore type UGN3130's, Philmore part# 86-1030 a few years ago. Package is similar to TO-92 (3-lead plastic), runs on 4.5 to 16vdc, drives TTL or CMOS logic, connects to power, ground, and has on/off signal out. Back it up with a magnet, and it'll sense when ferros metals are nearby. It's in the middle of this catalog:
http://www.calcentron.com/PDF_Documents/philmore_pdf/philmore_d-i-y_component_parts.pdf
http://www.calcentron.com/Pages/philmore/philmore_home.htm

As far as all of your shift registers - why not consider just using a D-type flip-flop (such as 1/2 of a 4013) for each sensor latch?
Rich (BB code):
4013
Dual D flip-flop with set and reset.
+---+--+---+           +---+---+---+---*---+---+
1Q |1  +--+ 14| VCC       | D |CLK|SET|RST| Q |/Q |
/1Q |2       13| 2Q        +===+===+===+===*===+===+
1CLK |3       12| /2Q       | X | X | 0 | 1 | 0 | 1 |
1RST |4  4013 11| 2CLK      | X | X | 1 | 0 | 1 | 0 |
1D |5       10| 2RST      | X | X | 1 | 1 | 1 | 1 |
1SET |6        9| 2D        | 0 | / | 0 | 0 | 0 | 1 |
GND |7        8| 2SET      | 1 | / | 0 | 0 | 1 | 0 | *
+----------+           | X | \ | 0 | 0 | Q |/Q | *
+---+---+---+---*---+---+
Truth table key:
1 = high logic level
0 = low logic level
X = Don't care
/ = rising edge of clock
\ = falling edge of clock
* - these two entries updated noon EST, 30 Sept for correction and clarity
Just connect your sensor so that the set and reset inputs are driven by it; in other words, the non-inverted output of your sensor goes to the set input, and the inverted output goes to the reset input. You might use a 4502 IC for that:
Rich (BB code):
4502
6-bit 3-state inverting buffer/line driver with NOR inputs.
+---+  +---+             +---+---+---+---+
A0 |1  +--+ 16| VCC         |/OE| A | B I/Y |
/Y0 |2       15| A5          +===+===+===+===+
A1 |3       14| /Y5         | 1 | X | X I Z |
/OE |4       13| A4          | 0 | 0 | 0 I 1 |
/Y1 |5  4502 12| B           | 0 | 1 | 0 I 0 |
A2 |6       11| /Y4         | 0 | X | 1 I 0 |
/Y2 |7       10| A3          +---+---+---+---+
GND |8        9| /Y3
+----------+
Run the output of your sensor to one of the buffer inputs; that output goes to the RESET input of the D-type FF, and also to the input of another of the buffer inputs. The output of the 2nd buffer goes to the D-type FF SET input. Pull /OE low when you want to store the state of the sensor. Use pull-down resistors on the SET and RESET inputs to ensure they don't float high on you when the output isn't enabled. Having the signal go through two inverters is going to add propagation delay times for you to keep in mind. Remember, these are CMOS devices - and ALL inputs must be pulled to Vcc or ground - otherwise, the signal levels will float and you will wind up with lots of added noise and current consumption.

Dual-D flip-flops generally have a Q and /Q (Q BAR, or inverted) outputs. If the distance between your sensors is going to be significant, consider using line driver/line receiver pairs of IC's, and twisted pair conductors between. This will give very substantial noise immunity. Otherwise, you could connect the Q output of one flip-flop to the Data input of the next flip-flop. Each time you clock the string of flip-flops, it'll crank the bits downstream. You could connect an arbitrary number of sensors in this manner; of course you'd have to tell your microcontroller what the bits mean. Consider using Cat-5 type twisted pair cables; make your signals complimentary pairs. For maximum noise immunity, use shielded cabling; but twisted pair may just do the trick for you. Since your sensors are going to be spread out a bit, don't forget you'll have extra propagation delays to plan for. As far as the twisted pair cable goes; you can also get twisted pairs in flat ribbon cable. Here's a page with a bunch of different types:
http://www.spectra-strip.com/ecappsearch2.cfm?app=Internal+Zip/Twisted+Pair&Nav=InternalZip

Don't forget you'll need to power up your sensors, wait long enough for them to stabilize and provide an output, then /OE the buffer long enough to get a sample, then disable the buffer out, and then power the sensors down. If you started clocking the flip-flops too early, you'll have sensors still setting or re-setting all the bits as they get cranked through.

Consider using optoisolators for your interface to the MCU.

#### SgtWookie

Joined Jul 17, 2007
22,221

#### SgtWookie

Joined Jul 17, 2007
22,221

For even lower power consumption, look at LTC491's, by Linear Technology.

http://www.alldatasheet.com
for no cost.

#### SgtWookie

Joined Jul 17, 2007
22,221
Lance, did some more fiddling with this - and the more fiddling I did, the more it looks like the way to go would be to use inexpensive individual microcontrollers like a PICAXE at each sensor station.

They have built-in communication facilities, data I/O - basically, all the functionality you need in a single IC. To do this using discrete IC's would make the project more expensive and time consuming, not to mention that the increased parts count would increase the footprint of the sensor board, along with increasing the troubleshooting time and decreasing the reliability.

Just ad a resonator and a few caps to your PICAXE, your sensor, and write the program. You could do the data exchange directly with some careful planning.

#### lance2010

Joined Sep 28, 2007
2
Thanks - yeah, I don't know why, but I was resisting the urge to go that route, perhaps due to (unfounded) concerns over power consumption. Those little PICs sure seem versatile.

My design's changed slightly anyway after sitting down to refine the actual sensor data processing algorithm. Bottom line, I'm gonna give it a little more thought and go back to the drawing board on this one with your comments in mind.

By the way, you mentioned opto isolation and/or differential bus. I was hoping to do without either for simplification if I could get away with it. When I first sat down to design this, I was looking at using I2C which seems to get the required speed/distance without going differential. I figured I could do SPI, which seems very similar, without introducing additional complexity/parts. What's the guidline/wisdom on this (when to use opto/diff, etc.)?

#### nanovate

Joined May 7, 2007
666
For SPI you need to use the Chip Select (Slave Select) for each device on the bus.

#### SgtWookie

Joined Jul 17, 2007
22,221
Differential transmission lines provide for very reliable communication in noisy environments. Sems to me you mentioned somewhere that the environment will be noisy - I assumed you meant electrical noise.

Optoisolators provide a very great deal of isolation. Take a 4N25A for example - isloation for up to 2500 V peak. It's a great way to isolate from potentially noisy sources, while still providing reliable communication.

I2C or SPI would work fine - if the noise level will be low. However, if you're in an environment where you might have large noise sources (like large electrical motors starting up, etc) then expect to have communication interrupted. In that case, you're going to need to use differential lines; perhaps even shielded.

Haven't mentioned safety before - but if any of this project could endanger human safety if failures occur, you should get an engineer to do it, as fail-safes need to be designed in.

Audio noise - if your environment will be accoustically noisy, that can present problems as well. Small, well-supported PCB's should be OK though. Early Radio Shack TRS-80 computers had problems with "microphony" in the disk drive expansion interface; simply tapping on the board would cause the system to crash. Similarly, a few years ago a Harley-Davidson dealer was using an IBM PC clone to take data from their dynamometer. The noise from some of those Harleys running wide-open throttle was tremendous, and frequently caused the computer to crash, just from all of the vibrations. Ensuring that your boards are well-supported will reduce this possibility.

#### nanovate

Joined May 7, 2007
666
250k for pull-ups is a bit large-- will reduce your noise margin not to mention that the leakage currents wil drop some voltage across it.

Using optoisolators provides good galvanic isolation but at the expense of power dissipation. The LED "burns" up loads of current.

You never mentioned how quickly the events happen and how long is the window in which they happen. This will factor into the design topology. Maybe a large microcontroller with multiple IOs connected to S&H circuitry could be used.

As far as supplying power to the array there are a number of options. Many voltage regulators have an "enable" pin that you can be used to control the output ON/OFF. When not "enabled" the regulator will be in a low power state -- can be < 2uA in some devices.