line. We’ll try to make a sine wave right from the start using
an op-amp, and use a transistor to arrest the oscillation
when we don’t want the tone.
A simple sine wave oscillator is the Wien bridge
topology. We’ll design the Wien bridge for about 400 Hz.
Frequency stability is not that important, so we can use a
simple version of this time-tested design.
Stopping the oscillator requires just forcing one of
the op-amp’s inputs to a voltage where the other could
never go. That will make sure the output cannot change
states. We’ll do this by forcing the positive input down
near the negative rail. This also makes sure the transistor
base-collector junction does not become biased towards
We’ll need another transistor to level-shift the control
signal down there. An attempt at a partially complete
circuit is shown in Figure 2. The frequency equations for
the Wien bridge oscillator are shown in Figure 3, assuming
R1 = R2 and C1 = C2.
Going the Distance with I2C
QI have four SparkFun Si7021 I2C humidity/ temperature boards. I would like to wire all of them to my Raspberry Pi DIY home monitor system. My questions are: a) How far can they
be from the CPU; b) What kind of
wire should I use; and c) Can all the
sensors connect to the same pins?
Los Angeles, CA
AI2C is a fun little bus for controlling peripherals. It’s designed to accommodate multiple
devices as both masters and slaves.
It operates in a few different speed
modes, and has the ability to go
up to 10 address bits, though
seven is typical. While it’s quite
convenient for communicating
between peripheral devices on a
board or stack of boards, there may
be some technical problems with
using it for the kind of design you are
Let’s start with your first question on about how far.
The distance the sensor (or any I2C peripheral) can be
from another is a bit unclear from the specs for the bus.
The signals are all open drain, meaning that devices may
pull the line low, but there is a resistor to pull it high. This
means that it will be slow to return to the high state if there
is significant capacitance.
A current source can be used instead of a resistor
to speed things up, but that requires a bit more work. In
any case, the wires carrying the signals cannot have a
capacitance higher than 400 pF between signals to stay
I did some looking around for capacitance estimates
for twisted pair. It looks to be about 20 pF/foot. In the best
case, that would be 20’, but I’d be surprised if it worked
over that distance with just pull-up resistors. Let’s cut it in
half just to be safe, and say about 10’ max, assuming no
other RF interference.
In the process, I think I’ve answered your second
question about the type of wire to use. I think twisted pair
will offer some shielding and work reasonably well for this
application, while keeping the capacitance low. Probably
some Cat 5 Ethernet wire will do nicely. I’d pair the + with
one data line and the - with the other. While those signals
are not truly differential, that might offer some shielding.
This brings us to your last question about connecting
multiple boards. While the I2C bus can handle multiple
peripherals — as well as multiple masters — it looks like
the device used on this board has a fixed slave address
of 0x40. Since this can’t be changed without building a
QUESTIONS and ANSWERS
Post comments on this article and find any associated files and/or downloads at
n FIGURE 2. Wien bridge oscillator controlled by PIC.
n FIGURE 3. Wien bridge frequency equation.
January 2018 13