Circuit Analysis – Part 3: Sensors, Clocks & Switches

Before you layout a circuit, it’s generally a good idea to understand what is happening in your schematic.  And before you lay out a schematic, it’s generally a good idea to understand what is happening in your block diagram.

For more details read previous posts: Circuit Analysis – Part 1 and Circuit Analysis – Part 2.

IMU Sensor

The BNO055 inertial measurement unit by Bosch has three types of tri-axial sensors: Accelerometer, Gyroscope, and Magnetometer. To increase accuracy, a 32.768 kHz MEMS oscillator is included and must be enabled via register flags.

The datasheet notes that the sensor’s sensitive magnetometer should be mounted well away from any ferromagnetic materials. Place this device as far away from the LCD, header pins, badge clips, and batteries as possible. One other thing — the sensor package is rather inaccurate before calibration. Be sure to follow the Bosch calibration guidelines before using your device.

Environmental Sensor

Of all the integrated circuits on a board, this is perhaps the easiest one to implement. Simply place one decoupling capacitor at one pin and one decoupling capacitor at another pin. Communication is via I²C, and should be relatively easy to implement.

Real-Time Clocks

Real Time Clocks (RTC) are designed to keep track of seconds, minutes, hours, days, months, and years using an accurate clock source and a small power source. Some even include interrupts that can bring a microcontroller out of sleep at a particular time to perform a task.

The clock source is 32.768 kHz.  Why such a seemingly odd value across all devices?  It makes sense when you think about 32.768 Hz in binary.  215 is equivalent to B1000000000000000.

The RTC circuit detects the transitions of the oscillator, and a series of flip-flops on the die go to work successively dividing the signal 15 times, until the final stage of the circuit keeps track of seconds.

Binary counter from http://hyperphysics.phy-astr.gsu.edu/hbase/Electronic/bincount.html

That makes sense, but why 215 instead of 214 or 216?  That likely harkens back to the days of digital watches.  215 was good enough to keep time within a minute per month.  Each additional gate costs money to fabricate on an ASIC, so the watch/clock industry settled on “good enough.”  It’s possible to purchase crystals at 65.536 kHz (216) and 131.072 kHz (217), but you’d need additional divider stages to work properly.

On a side note -- last year I installed 131.072 kHz in a clock designed for 32.768 kHz for a marketing gag, and it did run 4x as fast. Unfortunately, it was too far back in the background of the camera shot -- which made it appear small and blurry, so nobody noticed. Life is cruel.
Mark Hughes
Royal Circuits Research Analyst

Input Switches

We often think of switches as simple devices that exist in one of two states: on or off, open or closed.  And in the steady-state, long after a transition, that is how they behave. But during the transition between states, many switches tend to misbehave as their contact points make and break contact several or even dozens of times.

This image shows mechanical bouncing. Image origin unknown.

It has to do with the way switches are designed.  Many switches are designed with springs, compliant mechanisms, or “snap-action” mechanisms that mechanically hold the switch element in place on contacts  Like a ball bouncing on the ground, the contact elements often bounce immediately after the transition. So instead of a single transition between states, there can be dozens of transitions back and forth and back again.

This rising-edge contact bounce from Maxim Integrated shows around 2-dozen logic transitions.

 

Each transition can cause electromagnetic noise and trigger the input on an integrated circuit. Imagine the switch above used in a counting application. Each switch press might be seen as 10 counts by an integrated circuit.

Switch Debouncing

We’re electrical engineers, not mechanical engineers. So we have no control over the switch design, and cannot control the bounce. We just have to deal with it. Our two options are to design an electric circuit to deal with the bounce or write software code to deal with the bounce. Datasheets sometimes recommend different debounce circuits or no debounce at all.

One of the debounce circuits from the schematic. In this circuit, a pullup resistor (R1) ties one side of the switch to the 3.3 V power rail and a low-pass filter connects the switch to the microcontroller and a 0.1 μF capacitor.

The next blog explains the calculations for the circuit.

Recent Posts

Basics of Back Drilling – Webinar

Back drilling technology reduces reflections in high speed nets. It is the preferred fabrication method in high-speed designs. In this webinar recording, learn the process of back drilling, main advantages, design parameters and more. Download the presentation slides here > Backdrilling_Presentation Slides
Read More

Build a Better Via Stack

Build a better via stack by thinking about how your board is assembled. Cap vs. Foil Construction Printed Wiring Boards are constructed in one of two ways described as “Cap” or “Foil” construction.  The construction method determines via layer options and lamination cycles. Foil Construction In foil construction, fabricators start by drilling, electroplating, and etching… View Article
Read More

Circuit Analysis – Part 4: RC-Filters, LEDs & Buzzers

Before you layout a circuit, it’s generally a good idea to understand what is happening in your schematic.  And before you lay out a schematic, it’s generally a good idea to understand what is happening in your block diagram. For additional information on circuit analysis, read the previous posts in this series: Part 1, Part 2 and Part 3. When a… View Article
Read More

Share

Share on twitter
Share on pinterest
Share on facebook
Or use this public share link