I was not able to get Oscillation going on the Healthy EC Dev-Rev1 Shield in prior tests (link). No wonder – since the circuit is wrong…OOPS! :-) (I know it’s not funny, but for some reason I find my screw ups to be delightful. I think because the only thing they “hurt” is my ego). This is after spending several hours dedicated to understanding the electronics and circuit design of a Wien Bridge Oscillator (link).
Here’s the current design…
The goal of this post is to get the Wien Bridge Oscillator to work on the Healthy EC Dev-Rev1 or know the specifics of why it won’t work without changes to the PCB.
Thanks to Those That Went Before
Some things should be thanked for every time. This is the case with Chris Gammell. If it wasn’t for his Contextual Electronics course and guidance, I would not be passionately enjoying this incredible learning experience. I recently listened to a podcast where they noted in 1984 there was a significant drop in women who majored in computer science in the US. One woman interviewed noted she felt exceptionally strong in math and had confidence going into her freshman year at college – a hopeful computer science major. She remembers the day when she asked a question and the professor looked at her disdainfully and noted “you should already know this!” Here confidence plummeted… WOW! brings back memories…this is the EXACT experience I had with learning STEM subjects “back in the day!” Now, there are teachers/mentors/professors (these terms merge for me) like Chris who do not make assumptions about a person’s ability. Who brilliantly understand that most often not knowing/understanding can overwhelmingly be caused by a lack of context rather than an innate ability. Aha – now to me it is about the mental model…not a judgement of mental incompetence. Thanks to all those who set the passionate learner’s mental model in the direction of understanding. Thanks to Chris for the mental model I am developing about electronics.
Ryan (Sparky’s Widgets) embraces the concept of Open Source in a way that makes it possible for me to learn more about the details of pH and EC sensors. I would not be able to create these shields without Ryan’s Open Source minipH and miniEC projects. Ryan also makes these available for sale. I highly recommend buying these. At least check out his offerings.
There has been a TON of great articles available through the “Google is Our Friend” of today’s Internet. Thanks for all the information – particularly when stuff doesn’t work! My biggest challenge is using the right search term. Something I assume will always be a challenge.
101 – Characteristics of the Wien Bridge Oscillator
I understand the purpose of the Wien Bridge Oscillator – to be an AC power source for the EC probe. I don’t understand some of the characteristics of a Wien Bridge Oscillator. Reflecting on why, since I am self teaching, a challenge I run up against is understanding the theory behind a circuit. Something that is covered in beginning electronics courses. Well, this lack of knowledge of circuit theory is not the boss of me, so I’m:
- watching videos on circuit theory. After watching many on Youtube, I realized my skills in algebra – and sadly calculus also – were weak. Proving once again, I am by far not smarter than a 5th grader. OK, calculus is a stretch, after all I proudly point out our junior in high school is taking calculus – no, not 5th grade…I was hoping to find an online course on electronics theory that was as good as the iTunes course from Stanford University on iPhone programming (link). Sadly, I did not. Please let me know if you know of one! I ended up getting the engineer series of downloadable DVDs – from mathtutorDVD.com. I decided to buy and download all the DVDs in this section. For many this must seem indulgent. However, at my age time is more important than money. For me, watching the DVDs – I’m still in the process… – has been a terrific way to understand fundamental/basic circuit theory – Ohm’s law, Kirchoff’s voltage and current laws, and the Thevenin equivalent circuits (wow – the Thevenin stuff is amazingly insightful. Let’s hear it for sharp folks that figure this stuff out!).
- reading as much as I can swallow and understanding a little of what is being written in the art of electronics and Practical Electronics for Inventors.
- The frequency of oscillation is determined by a bandpass filter. The bandpass filter’s circuit goes between the non-inverting input of the op amp and the output of the op amp. THIS is where I screwed up with Healthy EC Dev-Rev1. I split the band pass filter between the inverting and non-inverting ends of the op amp. As I’ve noted before- for EC measurements, the desired frequency is 1.6KHz. The equation for determining the frequency based on the resistor/capacitor choice (see the kicad EC.sch schematic found at this GitHub location) R14 = R19 = R= 1K and C9 = C11= C=100n…. f = 1/(2∏RC) = 1/(2*3.14*1000*.0000001) ~= 1.6KHz. If the circuit was set up right, the output frequency should be very close to 1.6KHz.
- The gain loop circuit goes between the inverting input of the op amp and the output of the op amp. The “twist” in this gain loop is a way to adjust the gain once the oscillation (AC Waveform) has started in order to keep the oscillation going.
The Wien Bridge Oscillator Circuit without VGND
Here is the schematic of the Wien Bridge Oscillator without introducing VGND. This means the op amp requires a + and – voltage source. In the schematic, a +5V and -5V power source is used:
As I said earlier in this post, the frequency of the AC Waveform is 1.6KHz.
The Gain Loop
What about the Gain Loop. This is what I *think* is going on based on what I understand. Please let me know if I need to correct my understanding.
The VROOM-VROOM Stage
I like to get a picture in my mind (hopefully a cartoon that makes me smile) of what is going on. Thus, I call starting the oscillation the VROOM-VROOM stage because it reminds me of applying gas when getting a car going from steady state to moving.
VROOM – VROOM: Start Your Oscillator: Gain Slightly Greater than 3
When the current initially starts up, it can’t go through the diodes. I use SparkysWidgets 10K (R6 – above diagram) and 22K (5) design in the minieC to set the initial gain at 3.2 (Gain = 22K/10K + 1 – 3.2). 3.2 satisfies “some math” – which I take for granted is right because it will take me many (many) hours to understand – which says a gain of slightly greater than 3 is needed to get to VROOM-VROOM oscillation.
The PUTT-PUTT Stage
Once the oscillation has started, I picture it as puttering along (maintaining). I like to picture this as the PUTT-PUTT stage…like a car moving at a constant speed down the road…in fact, the car I visualize is the one from “Who Framed Roger Rabbit?”
PUTT-PUTT Keep Your Oscillator Going
I have been befuddled by my lack of knowledge in circuit theory to figure out how the Gain Loop did this. After searching through the books and googling, I’ve come to the following conclusion:
- The parallel circuit in the Gain loop includes the diodes. This circuit won’t contribute to the Gain Loop until the Vpp is around .7V (this is a silicon diode) – the forward Voltage. So until then, the Gain is 3.2.
- Once the Vpp of the AC Waveform is around .7V, the diodes + capacitor part of the circuit adds a parallel resistor to the 22K R5. OK, so what is the resistance contribution of the capacitor? Bumbling on this gem in section 3.6.5 in Practical Electronics for Inventors - the capacitive resistance = 1/2πfC = 1/(2*π*1600*.0000001) ~= 995ohms. So now the Gain Loop Circuit looks like this:
Back to the Breadboard
Perhaps the equivalent of writing “I will not split the band pass filter between the non-inverting and inverting input” 100 times on a blackboard, I set about below to create the circuit on a breadboard, similar to what I did in this post.
I’ll build up the breadboard in these steps:
- Implement VGND. I’m using a VGND in the design of the Healthy EC Shield so that only one power source (+5V) is needed. VGND is set to ~2.5V
- Implement bandpass filter so the frequency of the waveform is 1.6KHz.
- Implement feedback loop so that the AC Waveform putt-putts along.
So I’ll be using the TL072 op amps that I have favored in previous bread boards. Since I forget the TL072’s pin layout, I’ll post a picture of it here:
From the Healthy EC Dev-Rev1 schematic (kicad files available at this GitHub location):
Implement Bandpass Filter
The bandpass filter goes from the non-inverting input pin of the 2nd op amp – pin 5 – to the output pin of the 2nd op amp – pin 7. One 1K R and 100nC are n parallel, and one 1KR and 100nC are in series. The circuit is tethered to VGND. I’m finding drawing colored lines showing which components share a wire is useful when implementing on a breadboard:
Adding the bandpass filter to the breadboard:
Implement The Gain Loop
The Gain loop goes from pin 6 of the TL072 – the inverting input – to pin 7 – output of the second op amp.
Hooking up my scope, the waveform I see:
I count 550µS between positive peaks -> frequency = 1/.000550S = 1.8KHz, slightly higher than the expected 1.6KHz, but close enough given the quality of parts used in the prototype. Here is the results from running the LTSpice simulation:
in the simulation, Vmax is ~= 2.92V, vMin ~= 2.05V making the Vpp ~= .87V.
At the VROOM-VROOM stage, the simulation showed this waveform:
the Vpp on the second to last peak/valley ~ = .66V -> when the diodes start letting current through. It is at this point the waveform gets to a consistent VPP ~= .87V.
I *think* hope? I am understanding this correctly! If not, I anticipate the next rev of the Healthy EC Shield will show this.
Thanks for reading this far. Please find many things to smile about.