~ Stuff I Learned About Tech+Hydroponics

Ladybug Shield Alpha V2 – Off to OshPark

I came to the conclusion in a previous post that the unexpected behavior I was observing while testing the EC rectifying circuit was due to a slight voltage surge that occurs when the circuit for the multiplexer was chosen.

D’OH Wrong.

The capacitor was not being discharged. There was no surge. I wasn’t using the FET correctly to discharge the capacitor prior to taking a Vin+ or ECVout measurement. This seems like such a basic concept. In fact, it alarms me that I didn’t reason this out…

Thanks To Those That Went Before

I constantly find myself mentally pounding my head on a table at how little I comprehend about electronics. These on going investigations continue to shine a light on concepts I thought I understand but in reality were not grasping. I have been blessed to get guidance and a boost of confidence from Chris Gammell – both through his Contextual Electronics courses and mentoring.

Open Source

Updated kicad files for the Ladybug Shield Alpha V2 that I sent to OshPark the other day are located at this GitHub repository.

The Circuit

the negative feedback of the 1st op amp is not tied to VGND. This is a visual representation to remind me the op amps, capacitor, and gate are relative to VGND.

And an image of the test circuit:

Tests

Analog

I am evolving my skills at testing circuits. The key – and perhaps obvious – thing I was not doing was evaluating the input and output at the same time. This is common practice with software. Is the input unexpected, why? If the input is expected and the output is unexpected, why? Can the input and output be further isolated to an interaction/result somewhere closer to the input?

I was analyzing the input and next analyzing the output using one probe. This works well when analyzing numbers, but not so well when analyzing analog circuits. Much better is to overlay the input and the output. As shown in the image above, two probes is and will be a necessity when debugging analog circuits. Oh – right – two probes are on my scope for a reason :-).

The result? Repeatable observance of a higher voltage and s l o w discharge at the node where the capacitor is located.

Digital

I wrote an Arduino sketch that calculates the digital value for Vin+ and ECVout. Recall Vin+ Vpp ~= 500mV. ECVout is the gain using a 200Ω resistor to simulate an EC probe value.

I use three i/o pins on the Arduino:

enable to multiplexer

tell the multiplexer to switch between sending in the Vin+ and ECVout waveforms

turn on the FET’s gate

The Arduino pin that I was using incorrectly was the sequence of turning on/off the FET so the capacitor is discharged. What I now do is a discharge of the capacitor before the first reading and immediately after subsequent readings. Discharging the capacitor means turning on the FET (gate = HIGH), then immediately turn off (gate=LOW).

The Arduino Sketch

The sketch I used is located at this GitHub location. Here is a sample result in a sea of runs I made:

| Count: 1000** Vin+ ** Average: 251.22| Std deviation: 2.12

| Count: 1000** ECVout ** Average: 1576.48| Std deviation: 2.04

Gain = ECVout/Vin+ = 1576.48/251.22 = 6.28 = 1 + 1K/R(EC)

Where 1K is the feedback resistor of the second op amp (R17 in the Ladybug Shield Alpha V2 schematic).

The End

Well, while I would have hoped I would have figured this out a while ago, the good news is persistence pays off. Hopefully in the future I will be able to better reason and debug analog issues. Although much continues to illude me.