Schematic sanity checking

I need a “volunteer” to sanity check my Arduino schematic for my wicking bed project. I use KiCAD to do the schematic capture and PCB layout.

I trimmed it down to just the 328P plus some support glue logic.

I don’t think I’ve missed anything but, from experience, checking one’s own work is definitely a bad idea.

:slight_smile:

3 Likes

Hey Gerard,

Whats happening on the PCB? Were most of the bits from reference circuits? I’d be happy to have a once (I’m newish to the game but having an extra pair of eyes wont hurt) over to see what you have done!

In the past I have printed off the PCB 1:1 on paper and placed the components out to make sure they all fit and check the traces vs a reference circuit

5 Likes

Hey Liam,

I broke a bit of a rule I have and did the PCB layout already. Which is a bit backward since I suspect I’ll have a couple of bugs in the schematic…but I got a bit carried away!

I always, always print off a silk screen/ solder mask and do a 1:1 component placement so we’re on the same page there. Looks like you use KiCAD too.

Let me see if I can upload the schematic.
Sheet 1

Sheet 2

Let me know if it’s readable please.

4 Likes

Assuming it’s readable, I’ll post up a bit of a ‘theory of operation’. It’s sometimes hard making sense of someone’s madness.

3 Likes

Hey Gerard,

From a quick glance nothing looks off, I pulled up another reference design for the ATMEGA328 and it seems to match!

A couple of tips for tidying everything up, you dont have to follow but I find it helps debug.
You can change the schematic page size in File > Page settings > Size.
image

And breaking the schematic up into discrete sections
(heres a smidge of one of my larger PCB’s)


Using the text function you can also add a few notes, similar to comments in code.

Simulating the circuit in a SPICE tool or Falstad(Cheers @Oliver33 for showing me this :smiley:) can also help making sure that your values are correct

3 Likes

Thanks for that. Much appreciated.

For my simulations, I use Multisim which looks pretty similar and also MATLAB which has an Arduino add-on. We used MATLAB at Uni for maths but it adapts to Arduino pretty well.

In days of yore when I did a lot of design, we had an expensive CAD package called PCAD. It was great until IBM bought it. :frowning:

3 Likes

Hi Gerard.
Just had a quick look at the 2 schematic sheets out of interest. Now I have no idea what the fundamental operation of this arrangement is but I have spotted a couple of what I believe are errors.

  1. V6A seems to be a unity gain buffer or voltage follower. If this is the case what is R16 doing As wired it is producing positive feedback which will probably produce some strange results like switch straight to positive rail and stay there. If it is a unity gain buffer or voltage follower R16 is not required.
    I would have to brush up on OP Amp behaviour but If this is supposed to be a summing amplifier as I may suspect it will have to be an inverted amp then invert again to get the volts the right way up. For this you will need a split supply (+V and -V). I think the output voltage you will get here will be the higher of the 2 sensors, not the sum of the 2 as you imply with “add_moisture_analog”.

  2. R17 and R18 (1k0) may be a bit low in value and the sensors interfere with each other. Don’t know enough about this bit but keep it in mind in case you have any funnies.

  3. Reverse voltage suppressor diode across the Water Solenoid is reversed. Cathode should go to positive supply. As it is shown now it will be a short circuit across the solenoid. It really should be a Schottky diode anyway. The 1N4004 is pretty slow and probably miss the initial spike.

Cheers Bob

5 Likes

Thanks Bob.

  1. It’s a voltage follower. I ran it up just now in Multisim. R16 has no influence one way or the other so we can pull it out. The output voltage is an average of the 2 inputs. If one is 1V, the other, say, 3V, then the output is (1+3)/2. These are those capacitive soil moisture sensors providing the analog voltage.

  2. Yeah, good point. I plucked those values out of the air.

  3. Well spotted! Thanks!

4 Likes

Also.

The Water Flow Counter is a ‘paddle wheel’ device with a Hall effect transistor. U3 and U4 are pre-loaded at the start of a cycle (based on previous historical data). Each rotation of the Hall effect device decrements the counter down to zero at which point the water is cut off.

I did some testing and 1 litre of flow is about 250 rotations > 250 pulses.

Small problem I have is some kind of machine learning algorithm. The amount of litres pumped in is a function of previous iterations of the cycle. The cycle being: Pump X litres in > now, what’s the moisture reading?

3 Likes

Hey Gerard and Bob,

Good thing Bob had a look, absolute godsend to the forum!

This I might be able to help with a bit more, what was the bit of information you were after? Are you looking at moisture as a level of how much water is inside some material or say the humidity of some enclosed environment?

2 Likes

Hi Gerard

That is what it first looked like so remove R16.

I am not too sure about that. If I get time I might simulate it or knock it up with an OP amp. I use Tina as simulator of choice. Or maybe refresh op amp behaviour.

Because of the low value source resistors (1k0) this could very well be 3V minus 1V for the same result. You would have to simulate or try with lots of values to be sure. With only 1k0 in there the source impedance of the sensor output might have too much effect. You probably have no way of finding this out so would have to measure. If you need to know and you don’t know how to measure sing out and I will tell you. It is a bit more involved than just using a multimeter.

I would multiply this by at least 10 (10kΩ). Your sensor source impedance should be very much lower than this and you should be able to ignore it.

I can understand why you are trying to average to get a more realistic result. If this little arrangement does indeed average it will be an easy way to do this and useful info to store away for future use. In practise I have never had to do this as it always been sum or difference requirements. So I will simulate and try this for my own interest when I get a chance.
Cheers Bob

3 Likes

Hey Liam,

I’ll ponder that somewhat and reply later. There’s a few inputs and I’m not an agronomist!

:slight_smile:

3 Likes

Hi Gerard

You are quite correct.
Just did an experiment using 10kΩ resistors and a dual bench supply. I did not worry about the OP Amp as being a voltage follower it will reproduce the input voltage up to the limits of the OP Amp itself.
I tried a third input and the set up nicely averaged the 3 inputs.
One thing, if you need a true “average” all inputs must be connected. That is 0V must be 0V or ground. If left floating (HI Z) that input will be ignored.

Strange, in all the years (40+) I was involved in this industry I don’t recall ever dealing with this averaging scenario. It has always been sum or difference situations like summing several audio sources into one channel etc. If any averaging system existed it must have been buried down in the depths of a project and did not concern me directly.

Some 15 years ago I did get involved in some light sensing in a big warehouse type store to control dimming of Hi Bay lighting. This was only single sensor operation but we did require linearity down to and including 0V. To do this a split supply was required as no OP Amp available at that time would get right down to 0V and the supply has to go a few volts negative to allow operation down to this level.

Cheers Bob

3 Likes

Hi Bob,

40 years? Me too. I’m back at Uni un-learning all my bad habits! You might have come across an old book titled " The Op Amp Cookbook". It was great but long out of print.

I found pretty much the same with Multisim with leaving an input O/C.

I forgot about making this thing talk to it’s peers. The project is actually a number of these things that talk back to a Master. Hopefully, the final piece in the puzzle.

Then I have to get a code-cutter as I don’t have the time! :frowning:

Gerard

3 Likes

Feb 1964. I had just turned 28. I got sick of driving buses and had done a course at ARTC…

I have. I think RTV&H serialised it at one stage and I think I cut it out and still may have it somewhere. I do still have “Understanding IC Operational Amplifiers” though.

I did not simulate it, I got 3 10kΩ resistors and 3 power sources and measured it. Confirmed what you said about averaging.

Your project looks interesting. Would be interested in seeing a block diagram of your proposed control system. I am assuming some sort of soil / water management system.
Cheers Bob

4 Likes

The kind of bus with one of those semi-automatic hydraulic transmissions?

2 Likes

No. The kind with a crash (non synchromesh) gearbox and a clutch brake. If you have never driven a vehicle with this combination you haven’t lived yet. Brilliant when you get the hang of it.
Cheers Bob

3 Likes

I think the earlier school buses I went on had that style of box if the terrible grinding noises were anything to go by!

But I digress.

I was thinking about your comment earlier about using a Schottky diode and you are indeed correct. I did an assignment in Transients simulating a collapsing field in a 10mH inductor. The results were about 1MV at 1 nanosec dropping rapidly over the time constants. Way too quick for a 1N4004.

What would you recommend for a diode then?

3 Likes

Hi Gerard
I have generally used a dual package MBR20100CT (or CL). C denotes common cathode (A is common anode), don’t know about T and L, probably packaging, tape or loose.

Connect anodes together and use in parallel which gives you 20A continuous rectified current. Don’t know about your solenoid inductance but these are usually sufficient in things like speed controllers in golf buggies etc. Comes in TO220package and available at Core (CEO7844) or Jaycar (ZR1039). They are quite common and of course places like Element 14 or RS Components also.

A 1N4004 is just a piece of wire at these frequencies. So is a resistor.
High frequencies and high (kV range) voltages present their own set of problems which I won’t go into here but coupled together they can become a nightmare.

Quick example. I once saw an engineer demonstration to a trainee using a network analyser how a 47Ω resistor was only 47Ω AT DC.
Cheers Bob

4 Likes