Dave answers a viewer technical question about why his circuit is acting up, and goes through a design review outlining the possible problems.
Level translation, clocking, schmitt triggers, line driving, loading, buffering, bypassing, and other aspects are discussed.
If you want to see more design reviews like this please drop a like and comment.
Schitt Trigger Tutorial: https://www.youtube.com/watch?v=Ht48vv0rQYk
Forum: https://www.eevblog.com/forum/blog/eevblog-1365-viewer-pcb-circuit-design-review/
Subscribe on Library: htts://lbry.tv/ @eevblog:7
EEVblog Web Site: http://www.eevblog.com
The 2nd EEVblog Channel: http://www.youtube.com/EEVblog2
EEVdiscover: https://www.youtube.com/eevdiscover
Support the EEVblog through Patreon! http://www.patreon.com/eevblog
AliExpress Affiliate: http://s.click.aliexpress.com/e/c2LRpe8g
Buy anything through that link and Dave gets a commission at no cost to you.
Donate With Bitcoin & Other Crypto Currencies!
https://www.eevblog.com/crypto-currency/
T-Shirts: http://teespring.com/stores/eevblog

Hi. I had a viewer email me about a circuit that they were having issues with and they wondered if I could, uh, help out. You know, analyze the design and Pcb and uh, tell them you know if they're doing something wrong, what's happening, explain why they're getting uh, issues and I get emails a ton of emails like this all the time and unfortunately, I don't have the time to uh, respond to most of them. so I usually say look, it's better off if you put it on the Ev blog forum and then either myself because I'm a forum known on the top poster over there, or you know, thousands of others, tens of thousands of other Uh engineers on the Ev blog forum can, uh, help you out And then it's You get much more input from everyone and everyone discusses it and everyone learns everything and then it's searchable from the public and it's all fantastic.

So yeah, rather than just give a personal reply, I thought I'd do a design review video. and if you like this type of video, give it a big thumbs up. Please leave it in the comments down below and I might might make this possibly a series. although I don't want to get inundated with a design review request.

Anyway, I thought this one, there might be some interesting things to talk about in this one. so thank you very much M. Lyman 89 for uh, providing the easy Eda files that I or anyone else can I go in and have a play around with. Um, so let's check out his uh email, shall we and see what's what? Hello Dave, I'm a big fan of your youtube channel.

I recently watched a video explaining Pcb design of a photo sensor because I can't seem to figure out how to design a Pcb properly and was looking for video explanations to help me. I'm having some Pcb travels of my own and thought maybe you'd be able to help me figure things out. Well, I can give it a go. I'm a total novice and do not know what I am doing, but I'm trying awesome Anyways, I'm trying to create a Pcb with two uh, 74hc595s you know I'm a 595 fanboy and two Ulns2803s.

I'm also a 2803 fanboy as well to control a sane Smart 16 channel relay module with my Raspberry Pi. I'd like to be able to daisy chain multiple of these Pcbs to control multiple relay modules. I've prototyped the design and it works well on a breadboard, but when I had the Pcb built by Jlc Pcb, I'm getting very unexpected results and can't seem to figure out why or how to solve it. If I use just one Pcb, it works no problem.

But if I daisy chain more Pcbs to use more relay modules, it doesn't work. Uh well. it still works just with unexpected results. Ah-ha A lot of experienced engineers might already, you know, might already twig to what's going on here.

But anyway, let's get into it like two relays will be triggered when only one was supposed to be triggered or the wrong relay will be triggered. My goal is to create a firework firing controller. I know. Super original.

Uh, no, it's good. Do it. The 74hc595 datasheet says to use a 10 nano farad cap on each chip and the Uln 2803 doesn't specify needed ending capacitors. The piece would be all connected directly to the relay module with a 2 by 10 female header block using the 5 volt ground supplied by the relay module to power the Pcb.
I was hoping you might be able to take a look at schematic and Pcb where my mistakes are. I think we might be able to help out here. Okay, first of all, let's have a look at what's uh happening here. He's trying to connect this board to one of these uh sign smart 12 volt relay module.

So a whole bunch of 12 volt relays and what looks like Opto couplers, opto coupler inputs. and here's the header connector that he's designing the Pcb. Where is it? Where I had the Pcb up and this is what the Pcb is going to plug into. So there's his Pcb with these two chips and his input and output header connectors, where he's going to potentially daisy chain them together for multiple relay boards.

And yeah, so that plugs directly into there. so no real signal integrity issues or anything else really to do with interconnecting that board to this module. Just plugs on that header, gets power from here. Has a local regulator on here like this.

but the interesting thing here is is that this has been driven by Opto couplers. They're classic optocouplers there, and even down here it tells you. Ah, where does it tell you? It tells you something. More info: 12 volt, 16 channel relay interface board and each one needs 15 to 20 milliamps driver current.

So you need significant driver current to actually, uh, drive the Opto couplers on this board. You know you've got to drive like that. 15 20 milliamps through the lead in the opto coupler. Led.

A lot of people complain about lead. Now it's lead. damn it, not Led Lead. Um, so you've got to drive the lead with, you know, a reasonable amount of current again, then saturate the photo transistor on the other side, which then, um, switches on.

It looks like it. Oh no, it looks like it has receivers. Anyway, I wasn't. The manual doesn't download on here.

I don't know why, but I found an equivalent one. I don't know who's ripping off who, but it looks slightly different. The regulator looks different and stuff like that. But anyway, so they've just got uh, looks like just some Opto couplers driving.

Once again, some Ula 2803's If you don't know what they are, they are. Well, I'll show you. it's a Darlington transistor array. so it's basically just a logic input like this.

so that would be coming from the output of the update couple of the photo transistor and then they've just got big green, beefy, um, open collector uh transistor in there which can drive realize and you know, hundreds of milliamps? Okay, 500 milliamps? There you go. You can get different, uh, variants of it. You know, 50 volt output voltage. Grunty, right? Great little things.
And they've got a reverse protection diet in there. Great for protecting you from back emf from relays for example, so you don't need the external catch diode for the relay. Great. Anyway, once again, this says it needs 15 to 20 milliamp driver current.

So unfortunately we don't have a schematic or anything uh for this. so I can't tell you what the opto couplers are, whether or not they need less current or something like that. but that seems to be the specification so these are not designed to be driven by a digital interface. It would have been better to pick a board that actually had a digital interface and then you could go directly from.

If we go over to the schematic here, you could do away with the Ula 2803s here. You wouldn't need them at all. You could just take the outputs of the 595s directly into the relays. So okay, so all we've got is a board here with a header which is powered from that same Smart Relay driver board.

We've got some five Nine Fives, which if you don't know, is a serial input shift register. One of my favorite Uh chippies. So basically what it's got is a serial data input that goes into the input data of the first flip flop here. and that's just got cascaded flip flops like this.

So and they're all then clocked from a serial clock like this. So you can feed in data and a clock and you can feed. You know if you feed a one in here, then the one will go from here and then the next clock cycle the one will transfer to here, then the one will transfer to here and it shifts along so you can shift data in and these. That's why the 74595 is just the jelly bean part for doing I O expanders.

If you've seen my oscilloscope, tear downs, and stuff like that, you'll see one of these inside the uh front end. for example. In, you know, lots of rigorous scopes. All the cigarette scopes haven't very common because you only want to have a couple of you don't want to have.

If you've got like 10 Control 8 control lines that you need for controlling various uh things in a front end or any other part of your circuitry, then you need eight lines coming from your micro controller and that's kind of annoying. You're going to run them right across the board and you may be out of pins on your micro or whatever. So this is like a serial expander so to speak. So you can only only need two lines like this and you can cascade as many chips in series as you want because it has a not Qh output here and then that can then cascade to the data of the next one and you can.

Two lines can have as many outputs as you want. So you just shift in the data and once you've shifted in the data here, then you do the r clock which is the register clock and then you've got another bunch of flip flops here which then transfer all the data out so all the data can actually shift out all at once. So it's all synchronous because if you're trying to clock things and do other stuff in your circuitry, it takes time for the because your clock rate is A you know it's a certain clock rate and it takes time that's a terrible looking waveform in it. It takes time for the data to shift through all of these registers and if you don't have, you can get our versions of these uh, chips without these registers if you want.
But then the problem is is that, um, these outputs here are just constantly changing all the time as the data shifts through and you don't really want that, you want to make sure the data is in the right position first. So if you want one here and a zero here, and a one here and a zero here, you shift all that data in first. and then you put a pulse on the clock line like that and it'll shift it all through and all the outputs change at once. Brilliant.

Geez, I'm waffle it on Dave and get to the problems. Okay, first of all, nothing inherently wrong here. Okay, so yeah, you've got some uh decoupling here, right? 100 n mentioned 10 in before doesn't really matter. You could put one big one mic on there, a one big ten mic or whatever something like that, which we might get we might get into because it might be part of the uh issue here.

But anyway. um, yeah. Basically okay. if you've got a nice clean digital signal uh, coming in and you've got a couple of decoupling caps on your chip as is basic.

uh, you know, standard practice then it should. Just if all your edges are nice and fast, because don't use very slow edges like this. You don't want to use slow edges with your five Nine Five because you're five Nine five because your serial clock here and your register clock as well. They don't have what's called Schmidt trigger inputs, so Schmidt they don't have the symbol.

If they did, they would have the little well, I'll draw it out here. but they will have the Schmidt Sing Schmidt trigger signal and I've done a whole video on Uh Schmidt triggers and how they're better for if you've got dirty clocks coming in, if you've got dirty filthy clocks, because if you've got a clock that's coming in like this and you know it's got some filthy bugger business going on here, right? and it dips down like that, then you can get multiple clocks anyway. If your logic thresholds are like this, this is the worst diagram I've ever drawn in my life. Um, anyway, they aren't really set thresholds.

so or if your data transitions really slowly as I said through here, you can get noise on your signal, noise like this and noise can. Got a dirty filthy noisy signal like that that can actually cause depending on the threshold levels and everything else or the fact that it's in no man's land in here that can cause multiple triggers or multiple clocks on for on your input here. So you may have one you may have intended to put one clock into here, but you end up getting a edge like that, but you get another little sneaky bugger edge in there like that and then like that. and then you end up with actually two clock pulses and your data doesn't shift uh, into one position like this.
It actually shifts twice through to here even though you didn't intend to. And that's why we saw we read here that, um, like two relays being triggered when one, uh, only one was supposed to, be triggered or the wrong real relay being triggered. So right off the bat, I guarantee know for a fact that there's something wrong with the clock inputs here that's causing multiple clock pulses. And that's why you're not getting clean shifting of your data through the 595 and that's where you're seeing oddball stuff.

You could actually add a Schmitt trigger buffer in here like this and you know? Well, there we go. Ah, that's pretty crap isn't it? You can add a Schmitt trigger buffer on all of your clock and uh, data inputs here so that, um, it can try and clean them up and stuff like that. It's one method to do, and if you know your input if well, if you aren't certain what the signal integrity of your input clock is going to be, then at a minimum like if they're coming from externally or something like that, you should be using at least Schmitt triggers inputs just to if you've got noisy signals like this that can cause a problem. So right off the bat it could be, uh, noise because this board, obviously I don't know how you how you're connecting it, uh to your what is it raspberry Pi.

So you've got the raspberry Pi coming in. Your header cable might be, I don't know. 30 centimeters long could be half a meter long. We we just don't know what that is so we don't know the signal integrity of the clock coming into your 595 And I'm sure I've done videos on this.

Uh, if you're going to scope this on your probe and see, oh, am I getting multiple clocks, then you've got to probe it. Connect correctly. That means not using this antenna. Earth lead this huge inductor hanging off.

Do Not Use this. This is not a proper uh, like high frequency probing technique you really need. If you're serious about signal integrity, then this just contributes to a big overshoot and undershoot on your signals because it's got a lot of inductance in this wire so you don't want to do that. You want to use the little ground probe on there and actually probe it properly.

and you have to do some setup and stuff like that. I'm sure I've done that in many videos. Anyway, I won't explain how to do high frequency probing, but yeah, probing is important. If you want to actually see the signal, you can't just hook up a scope probe loosey-goosey and expect to see it.

So right off the bat, um, solving issues of like long transmission lines. Essentially, they are right. Long transmission lines going Uh, from your driver board over to your receiver board like this. there's many ways to look at this.
Um, in fact, if you're going to be driving long things you might be going for. You might not go for a single ended solution like 5 volt Ttl. So you might go for like a differential solution like Rs-485 for example. For driving stuff over long twisted uh pair lines, you might have something like this linear technology Lt C486 or something which has you know is a quad differential driver.

so you have you know, digital in here and then it drives a differential. Nice differential twisted pair terminated with 120 ohms on each end and then it comes out here. and that's a really robust way to send digital data over very long lines. But in a situation like this, you may need something like that.

but I won't go into the pros and cons of which solution to choose. And then there's other things about you know, terminating. You know you can terminate digital lines and stuff like this. I won't go into the whole signal integrity aspect of it because that's a whole deep dive rabbit hole.

I might have even covered that in other videos or something like that. So uh yeah, let's but there's something else um in this that makes me think, uh, it may not be noise or something and we have to go back here and talk about the thing we hinted at before. each one needs 15 to 20 milliamps driver current. So if you need to drive like you know, 10 15 milliamps per input that you're trying to drive, what do we go? What is it? 12 inputs or something? Um, if you're driving all that, let's say we've got Uh, 10 at 10 milliamps each? Bingo.

There's 100 milliamps or even 15 milliamps each. That's 150 milliamps right there. That has to be provided by the power supply and the power supply. In this case, are these two little piddly, uh, 100 n caps up here.

Otherwise, it's got to get it from the relay module over here. Okay, and it's got a run all the way from. I can't point at it. damn it.

But it's going to run all the way from the regulator. Uh, there. it's got to run all the way over to the board over here. It's got to run through the header connector onto your board.

but that's not a huge deal. Uh, because this board. There's no cable between this board and the board. so the the run is, it's relatively short.

So anyway, let's have a look at the Uh. Pcb here and see what's what. please, uh, forgive me. Uh, I don't use easy Eda.

So yeah, I'm not going to be able to do anything serious here now. He is using a four layer board here. so we've got Vcc. We've got ground.

of course you wouldn't Didn't need to use a full layer board like this, although it's probably gonna help as we're gonna, uh, talk about in a second. And there's our bottom layer. Um, yeah. like like why have a bottom layer at all? But then again, you wouldn't use like a three layer board for example, you only get them in like even multiples.
Um so Anyway, yeah, that's a bit of a shame there. that. Uh, anyway. top layer here.

And like, just before we get into this, this has nothing to do with the issue to hand, just a few routine things. And I've done this in many videos, but I'm triggered. Um, these traces coming out of here. No no, no, no, no, no old school guys are going to be going etch and trap, etch.

and trap. Um, it's yeah. Not really an issue these days. It's just an aesthetics.

uh thing. it's a professional layout thing. There's the tray should come out here like this. from the center and then 45 degrees and then up and then 45 degrees and then across.

Yeah, never bring them out from just inside like that. That's just a no no. And and once again, you've got to let this like go in an angle like that. That should have gone straight out to there like that.

Um, yeah, you've done it here again and over here. Uh, for example, like I won't go into like our clearance rules and things like that, but this shouldn't be this close to this pad. It should come through the center and then 45 degrees and then go through the center of here and then come through here and then down there and then down in there like that. But anyway, I'm just a few little layout things there.

But oh, and you've also done the ground here. Like, like coming in the site. Oh god, that's annoying, isn't it? Sorry, I'm not on the ground later. Um, yeah, it's like oh yeah, it's It's highlighting the net.

Okay, it's auto highlighting the ground net. Is it? Yeah, I think it is. The tray should have just come out here and then drop. Nuvia.

Should have been here and dropped straight down. Anyway, minor things. So let's get back into the actual issue to hand Here We talked about: you could be drawing if you switch all these outputs on at once, you could be gulping hundreds of milliamps of current just to drive these output transistors here. So these are our shift register and our output transistors.

So what we've got is essentially, um, this is, you know, kind of a neat example where while we don't have analog here, you know I've done videos talking about our separate analog and digital grounds and power supplies and things like that. This kind of shares a similar sort of thing. You've got a high power section even though it's all digital. Essentially right.

You've got a high power sensor section here, right with these two chips. and you've got a low power digital section over here. So if you're switching a couple hundred milliamps, if all that current is flowing across your board, through a trace or a plane or whatever that's shared by these little sensitive digital chips. over here, you can get ground bounce okay, and power bounce right.

You can get, um, you know, voltage drops in these lines. It's not so much of a problem when you've got a, you know, a big ass ground plane in there. So I'm not necessarily saying it's an issue here. I'm just like this could be one, or potentially part of it.
Could be exacerbating the issue right. You could be right on the margin with some other issue and then this. you know, not laying out your ground and power properly. Can you know tip it over the edge and cause a threshold problem that we're talking about.

and the multiple clock pulses. So uh, yeah. so I don't think that's really an issue on this board. But the fact is right, you've got your bypass cap here.

Okay, it's via going down the ground and power plane that's okay. Like you know, if you're doing this on a two-layer board, of course you wouldn't uh, do that. You would route the Vcc track over to here as a priority. uh, to your bypass cap.

You've only got two little piddly 100 end caps which are fine for this. this digital side here, right? or this load called the low power side. But the high power side is taking these huge gulps of current. Where's that current coming from? It's got to come.

You've got no local bypassing on this board. It's not going to come. from these bypass caps over here. They're on the wrong side.

So really, the only place that's going to come is. where's the Vcc pin. It's going to come from the Vcc pin right through your Vcc plane, of course, right, which is being shared by once again, the ground and power. Even though it's a big, thick, low impedance, ground and power plane, it is technically shared by the uh, Digital low power digital chips over on this side.

and their ground has to flow. and power has to flow basically under through all of this high power stuff here. So um, yeah, when you're talking about hundred, couple hundred milliamp gulps, potentially that's the worst case you've got to always design For worst case, if they all switch it once, for example, it's not just 15 milliamps of one switching, you've got to assume that they're all going to switch of course. So that has to come from that regulator we saw over on the same Smart Relay board.

And how much bypassing do they have? Will it upset something on that board? For example? I don't think that's the case here. I think it's yeah, it's your issues localized. I guarantee it's You know it's localized on the board here with the 595. you're getting multiple clockings in your 595s, guaranteed.

But anyway, So yeah, What I would have done on a board like this is put local bulk decoupling. I'm talking. You know, a couple of hundred microfarads where you know a significant current here that has to be gulped and you don't want it to come. It's pretty rude quite frankly to force it to come from your other board and this would be especially a problem if this was a long line.

If you had like, if your board was here, you had a long cable like a ribbon cable connecting over to the board. Over here, those big gulps of current would have to come through the really thin cable over here which is once again being shared by these digital by these low power ones over here. and then your ground and power is just bouncing all over the place because it's drawing a couple hundred milliamps and you know you might only be talking. You know, tens of millivolts? Um, you know, bouncy drop or whatever.
but you know you can really come a gutsy from that. So anyway, um, yeah, and then it rings and does it like it'll resonate and you get big ringing and all sorts of right issues. But the good news is that no, you're plugging directly into the board. so I you know and I don't think it's a huge easy, but this board should have a couple hundred microfarads.

I'd probably have one for each chip for example, or even one bulk. And then you actually run separate traces. So can we actually place a track w to place a track? So let's let's place it. Let's assume it's a big thick trace.

Okay, I won't bother, uh, changing it. But yeah, then I would have a cap in here, right? A big couple of hundred mic cap. Okay, and then I would power the Vcc here like this. and I do like.

you know you've got to get routing room to do this, but then I would do it, even share it like you could go w Is it? Yeah, you can share, I don't. I can't go across a trace, but then you can run it all the way down there. You can run on a different bottom layer or whatever right? and then pop it up and power this chip right. and then you want your power over here.

You want to separate these so you want to. Actually, you could actually split your power plane. So the Vcc could actually be split. Yeah, I don't know how to split a power plane on here, but yeah, you could actually split the power plane and then have the power for just these.

the low power stuff coming around here and going back to the pin. So you're effectively star powering. It's called a star because the traces go off in. you know, it's one central point and then you've got digital stuff.

You might have analog stuff and you might have high power stuff going off and it's all from one central location. and then you'd have a big bulk decoupling cap just for that as well. So I would. potentially because we're talking a couple hundred milliamps As good design practice you'd put.

like, you know, you might have a hundred mic decoupling for these, You might have a bulk hundred mic for the board or something like that, and then, um, yeah, and then separately run these analog ones back. But because their ground and power planes are pretty low impedance, maybe it's probably not an issue on this board. It's just something to think about or it could be combined with other issues. After having said all that, I just realized that, um, yeah, these are actually open collector outputs.

So all the currents Actually, it's not being supplied by Vcc here. It's actually been supplied through ground. Where's the ground up there? Yeah, it's actually been supplied through the ground. It's been supplied on the power on the opto coupler side over on the board over there.
But still, the current has got to flow through the ground. You know, back to the other board. So it's a similar sort of thing. but it's not as bad as a full loop coming through the Vcc here.

But anyway. Okay, so let's say we have our board over here. Okay, and this has our driver on it. That's our five volt digital driver.

And then we've got our ground as well. Okay, because your ground is going over, so your ground's going all the way. Did it over to here and you've got ground on your receiver board here. So this is the big cable that you've got, uh, connecting this thing.

We have no details on that. Okay, so this has to come over and this has to drive your serial clock line all the way over here like this. Now you could actually probe this with your scope and find that you know at the output. Here you have a beautiful, you know, nice square wave something like this.

Okay, well by the time it gets over this, uh, dodgy transmission line, which, um, luckily you're not taking that 150, you know that 100 milliamps, 10 to 100 milliamps, uh gulps of current from this board over here if you were and it was going over all these lines and you get massive bounce in your ground like this? And yeah, that would really ruin your day. but luckily you've got it coming from more locally from that relay driver board anyway. But by the time the signal gets over to here, it's not going to look nice and square. I'm going to expand it here, so let me expand it.

This is the clock line. It's going to look something like my horrible drawing here. It's going to have lots of ringing on it. Okay, and then when it goes down here, you're going to get undershoot and it's going to look something like that.

Okay, it may be as bad as this. it may not. Actually, I guarantee that the clock going into here if you're able to measure it, uh, properly, is actually doing something horrible like this. and you're getting multiple triggers.

So if you're just, you know, crudely, if your logic threshold is like this, then you're going to actually get a signal that looks out of, um, you know, basically out of here out of this uh buffer here because this is an input buffer. Okay, it's not schmidt triggered, so you might get a signal that now looks. I'm going to try and time correlate this. Boom.

It might have a short little pulse in there, could have a little runty, whatever. But yeah, it's going to look like that. and you're getting this extra pulse. and you're getting one pulse here that's being clocked in because there's a positive edge.

Yes, So if you get it. yeah, positive input, positive edge here. Get the data gets clocked through on the positive edge. So a data gets clocked here.
but then it also gets clocked here. And unfortunately, you can't actually probe inside the chip. If you probe inside the chip and probe the output of this buffer here, you would actually see multiple Uh pulses there. You'd actually see these pulses.

You wouldn't have to worry about signal integrity because it's already buffered by this chip here. so you might be able to actually see that if you actually insert an external buffer in there like that Um, you. You know you get your dirty signal. You know if you can't measure your signal integrity properly, you could have.

If you had a buffer in there, then you could actually probe your output here and you'll be able to see if you're getting multiple pulses anyway. I guarantee that is where you'll get in. That's your problem. You'll get in multiple clock pulses inside here, and it's shifting your data through more times than you expect.

It could be a software timing issue, because, right, this is positive edge triggered. Okay, so this clock here on the positive edge. here. It clocks in your data.

Okay, then you've got negative edge and you've got the positive edge again. and it'll clock in your second data. Let's say that you wanted to clock a one into this, right? So you've got a zero. Your data should change Like in this part of you know it should change in the middle here somewhere.

So then it's one. when this goes high. When you want to be, you want it to be clocked in like this. this is called set up and hold time And you can find this in the data sheet and you'll find that there are set up and hold times for this.

So this is this gets into timing analysis and stuff like that. We're not talking about signal integrity anymore. It could be any one of these things. Oh, by the way, here's here's these uh, rise and fall times I was telling you about before.

Um, do not exceed. like at four and a half. I don't know whether. thank you.

Five and a half. Five volts, right? Four and a half volts do not exceed 500 nanoseconds Because if you do, you can get multiple if your input clock is too slow like if, uh, your? This is, uh, common on I Squared C buses. Uh, for example, because they're an open collector output. so they need a pull-up resistor.

and if your pull-up resistor is too high the capacitance on the line. it can cause slow charging up like that. And if your time from here to here is greater than your 500 nanoseconds, uh, ryzen. 4 time you can come Agatza and you can get it.

You can enter Meta stability. You can get multiple clock pulses. Basically, nothing's guaranteed anymore, especially driving flip-floppies and things like that. You get better stability.

I've probably done a video on that and you can get multiple clockwise, ruin your day. Multiple clock pulses? Okay, and here's the input. uh, logic thresholds. Once again, I've done videos on this.
so you've actually got this region between 1.5 volts and 3.15 where it's an indeterminate region. So if you've got overshoot or undershoot that's causing ringing and it goes in this region. especially if it takes some time for example, then yeah, you can get that can cause you multiple Uh clock pulses. But here is our setup time.

Okay, so uh, what we need is, um, serious sir. Which is I. I believe that's the serial data, Is it? Yeah, Serial data in. So the data in Before the serial clock.

it's got an up arrow that means the serial clock going high because it's an active, um, high, uh transition that it latches the data on. The setup time is typically because this is a oh no, 74 Hc. This is the uh, military version. The 54r series at ambient temperature does vary over temperature.

so if you're right on the edge, might work in your lab here. Get it outside in 40 degree heat or zero degrees and you come with guts. gutter. It doesn't work anymore because you're right on the margins of your uh timing.

So anyway, at five volts, you need 25 nanoseconds setup time. So which isn't much. Of course, that means that your data over here can you know go high, right? Just 20 at least 25 nanoseconds before that positive edge comes along. Well, my head's in the way before that positive edge comes along there.

So yeah, that's um, but you know it's These are all things that you need consider for. Even like a basic design like this, there's you can really go down the rabbit hole. trust me, I can spend. I can do a whole series on just implementing something like this.

It's just there's so much to it. But yeah. set up an Old Times But so there could be a software problem. You may be, uh, setting up your data.

It could be as simple as that. Um, look, you're outputting your data at the same time as you're clocking it on the edge here. And if you do that, might work, sometimes might not work at all. It's you know, it's just yeah.

not good. Um, so yeah. You want to set it up on the negative going transition of your clock pulse and then of course we have to think about that. You're potentially daisy chaining these together.

and you said that are the issues start showing up when you daisy chain many of them together like this. Now, you could actually have a driving problem due to the capacitance of the line. Because if this is your Raspberry Pi board over here, you know if you're driving one Modular can be okay. Your signal integrity is okay, and it's working fine, but you might still.

You know you might get the occasional thing, but then you need more lines coming down here like this, which goes off to, you know, another board here, right? So this is the identical board, but stuck in here. So you've got your 595s and everything in here and then you know you've got the output of this one. Plus, right? So you got the output of this. So this combines back in here like this and like that and then this goes off to your next board.
like this. daisy chain like this and your daisy chain. These balls. you've got the one driver over here.

The one driver may not be enough on your raspberry Pi to actually drive all of the capacitance of all of these lines. So once again, that could like slow the lines down, slow rate can drop the voltage level that drops your voltage margin, your voltage level margins on your chip, and bingo you start getting maybe progressively. as you get along the chain like this, you might find all that the ones near the end of your chain don't have the margin required. Uh, for you know, clocking in everything successfully.

So what I would do there is, uh, the have another like a buffer chip on this uh board that then drives the output of the board. So where's the So yeah, this is your input over here. Yes, I believe it is right. So this output here.

I would actually have another set of buffers right? Just uh, buffers. Or you know, two inverters in series. Whatever. Um, to drive that line because otherwise you've got this one clock line here.

It's poor little oh, you've got the uh, clear as well, have you? Okay, so you've got the register clock, the shift clock, and the clear. You don't necessarily need the clear line because uh, unless you want to like clear things really quickly, you can always just shift zeros into it so you know I've I've saved. I'm using 595's I've saved an extra line by you know, which can which can make or break. You are saved an extra line by not requiring a serial clear because you just shift all zeroes in first and that that clears everything.

Um, anyway, so you've got yeah, this one line going over here and you're not buffering. you're not having this. So I would definitely have another buffer chip on here. It could be as simple as that.

I mean that could solve all your issues. Uh, right there. So yeah, definitely add a buffer chip. So as I said, it could be like a combination of factors.

but you know the main things I would do on this board is I would actually add an input buffer. I'd add a Schmidt trigger input buffer chip. You can either do like two inverters in series or just do a buffer whatever you want to do and then I would have drivers on here. You could use the same chip because you've got what three lines there you go.

Um, you've got a six uh package. You can use the one chip uh three can be input buffer. Three can be your output uh, driver. So then you've got.

so you're re-buffering the signal to drive it out powerfully to the next line. So you only have to drive that one segment. you don't have the one on your raspberry Pi trying to drive this segment. This segment.
This segment, you've got all the capacitive and you've got the capacitance of the line which gets more as you uh, go along and also the capacitance inputs of the and the loading of the Uh chips. These aren't Ttl chips, they're like Cmos chips and you know, so that could solve your entire uh problem. As I said, I'd add more uh bulk decoupling on here for your uh, power devices. I'd probably you know you could like split your ground plane or whatever.

uh for just keep those uh separate for your lower stuff, but that's not really neither here nor there. I don't expect that to be an issue, but I definitely put some extra. you know, a couple hundred mic bulk decoupling on there for those large current uh transitions and then you've got uh, things like um, as I said, like why like this is designed, these are optocoupler inverters. You're already sharing the ground between this system and with the raspberry Pi as well.

So the whole, So you're using a common ground. but then you're You know you're doubling up on these optocouplers and these uh, transistor arrays. Here, you're actually, you know, doubling up on these boards as well. and on your uh schematic.

and on here, you've got to have the extra chips to drive it and it's driving all this current for no isolation reason if you needed isolation in the system. Sure, you know that's what these things are for, but you're actually sharing the common ground between all of your boards, your raspberry pi going over here, and then I won't get into like common mode noise in the whole system and stuff like that. There's a whole nother thing which is another reason, uh, to use Schmidt trigger inputs um here as well. So yeah, I would.

Yeah, that you could find just those buffers, solves everything and all your problems just magically go away. Yeah, and the other things I talked about like differential pair driving and stuff like that I wouldn't like do that for this, uh, design. I think this is probably good, but like fireworks, I don't know how far apart do these driver modules? If you're talking about like, you know, tens of meters, hundreds of meters for example, then you're not going to be able to do this properly with a five volt single ended five volt uh, Ttl type stuff you're gonna have to go for, you know, long differential pairs. or you know, these days are these new kitties.

They'd be using Ethernets and uh, yeah. And then they're Str micros. And and another problem, which almost certainly has, uh, something to do with it is a voltage level. uh translation.

You said you're driving this with a raspberry pi. There actually are 3.3 volt signal level outputs and uh, this is being powered. It says uh, well, Vcc but it's a 5 volt output apparently. So yeah, we have to go over to the data sheet over here and uh, let's have a look at the signal levels.
high input voltage level. There it is. At four and a half volts, it's once again, it doesn't give a figure for five volts, but you're right on the margin there. So yeah, you likely.

So if you're trying to drive a 5 volt Cmos device like this with a 3.3 volt drive, you're right on the margin of where it's going to do it. So you're right in the gray area there. Once again, you might find as you have already found, it does. It did actually work with one board, but then when you add an extra load on with the extra board and boom you're you're right out the window in terms of your voltage margin there.

So you need a logic level, uh, translator. So you could, uh, because the 595s of course can be powered down to two volts. You could actually have a 3.3 volt regulator on this board and actually power the 595s from uh, 3.3 volts. And then the receiver level would be, uh, fine, of course.

But then, uh, would the five point. Would the 3.3 volt output of the 595 be enough to drive the Uln 2803s? Well, we have to go over to the Uln 2803 data sheet over here like different. It's not really threshold logic threshold levels like it is with that regular Cmos they call it V E V I which is V In On which is the on state which is the output transistor saturated so on state. Input voltage with Uh Vce or V collector emitter saturation voltage of uh, two volts.

So it this varies so the input voltage varies with how much output drive current you've got. So, but it's up in the order of you know, a couple hundred milliamps. you're only driving like you know, 10 milliamps with each one or something like that, right? So it's now four. So it's got and actually a maximum value of Uh 2.4 volts.

But even at 300 milliamps, it's three volts there. So you could actually drive this with probably have it looks like you can actually do it even though it specifically says up here operation directly with Uh Ttl or five volt Cmos devices. Um, so well Ttl is lower than that. The levels are quite low, so yeah, it looks like um, yes, you could actually just drive these.

You could actually have a voltage regulator on your board and receive everything at 3.3 volts so you wouldn't need any logic translator. otherwise you could have you still wanted to power it at uh 5 volts for whatever reason, Then you could use a logic level translator 3.3 volts to 5 volts. Uh, you can even get those as chips or you can. You can even do discrete transistor solutions and other uh stuff, but you just use an off-the-shelf chip.

So yeah, it looks like, uh, that's possible. So that's certainly uh, one of the issues here. And of course, that doesn't negate all of the other stuff that I've talked about. This is all part of the design review.

uh, process you might find. Oh yeah, you simply, uh, you know, change. At a 3.3 volt regulator, all your problems are fixed. But that doesn't mean that all the other stuff we've talked about is not potentially an issue.
And then of course, you've got your more professional things if you want to like. If you're really serious about this, you want to sell it. Perhaps you want to make hundreds of these things. and actually, you know, take it more seriously.

you're talking about, uh, esd because you've got long lines on the input. um, input, surge protection and stuff like that. You know, power, surge protection, all sorts of uh, things. And then you've got a Rfi, for example, We talked about noise on the signals using the Schmitt trigger.

One of the issues can be you've got big antenna leads on the thing, right? so it can be picking up all sorts of uh, crap. So you might want Rf beads on the input and you know things like that. So there's a whole swag of stuff we could go into. I if I sat down and actually made a list, it'd be quite substantial.

So anyway, I hope that gives you, uh, food for thought here. about, um, some stuff to add to this uh, design And I'm sure like there's like stuff I probably didn't cover here and I'm sure everyone will fill the comments down below with. you know, oh, it's definitely. This is definitely this.

Add this, Do this, Do this, and which is great. That's the whole idea of this. Um, because like I didn't prepare notes or anything for this. I just turned on the camera and press record and started waffling.

So you know I might have, uh, you know, my stuff that just didn't pop out of my mind or whatever. Um, but hopefully that's given you some a reasonable direction. Uh, to go in. But and you know, As as I said, I could do a whole series of videos on all of the different issues in setting up this.

This is why this is like you might think this thing is just so easy to do right. You've got a raspberry pi, You're just, you know, driving like a very simple 595. you know, a serial latch. It doesn't get much simpler than that and you've got it.

Doesn't matter that you're using output transistor drivers here, but it's a simple application, but it brings in so much. When you start talking about long lengths of transmission lines potentially like common ground things and buffering of long lines and and synchronization, it could. As I said, it could. just be a software thing that you're not latching the uh, you're not setting up your data before you actually like latch it.

If you're setting up your data and your thing at the same time, it might work sometimes, and then you know if you fart halfway across the room doesn't work anymore. So anyway, that's why I thought this is a pretty neat example of how system complexity can like, really get out of control. and we can. really.

If you do want me to do a specific video on a specific aspect of something I've mentioned here or something I've missed, please leave it in the comments down below. So if you liked that video and found it useful, please give it a big a thumbs up. And as always, discuss down below or on the comments or over on the Euv blog forum where there's just thousands of some of the world's best engineers over there. they'll just happily they'll just love this stuff.
They eat this sort of stuff up, uh, for breakfast and they'll help you out with your uh design. so it's I think it's pretty much the best place on the interwebs. um, if you need help for stuff like this. So anyway, yeah, that was fun.

Catch you next time you.

Avatar photo

By YTB

28 thoughts on “Eevblog #1365 – viewer pcb circuit design review”
  1. Avataaar/Circle Created with python_avatars Ty says:

    .
    Big up to you Dave, love your content and makes me aspire to study harder and aspire to greater heights in the beautiful field of electronics. Ty from South Africa

  2. Avataaar/Circle Created with python_avatars Mitchell Smith says:

    Near the beginning of the video, you briefly mention some trace routing issues that you noticed. You called it etiquette. Could you do a video on trace routing do's and dont's ? I'm pretty new at making boards and I have a lot to learn. I found some information on trace routing but it would be great if you did a video. Thanks!!!

  3. Avataaar/Circle Created with python_avatars Jonathan says:

    A series like this would be great not just for young players but areas you don't usually work with. Microwave/RF engineers working on striplines may not appreciate the design challenges of nanoAmp measurement guarding and vice versa. IGBTs and DIN rails may be unfamiliar to designers working with twisted pair and coax Comms. Etc.

  4. Avataaar/Circle Created with python_avatars Circuitsoft says:

    Maybe recommend a TPIC6B595? Super handy, and might make for a significantly simpler board layout. Also, does the relay module have resistors on it? Should this board have resistors on it to current-limit the optocouplers?

  5. Avataaar/Circle Created with python_avatars Leo Gray says:

    Love this video. Thank for taking the time to share the knowledge. Such traps for yong players are quite hard to find ourself, great for videos like this to point them out.

  6. Avataaar/Circle Created with python_avatars CircularTonic says:

    Neat idea using real world examples of circuits with problems and giving your opinions on it. I have read quite about Schmitt triggers and their uses. Just never played too much with them for this case use.
    I would love to see more circuits that are having problem and can be solved by you giving your knowledge on the subject.
    Great learning experience.

  7. Avataaar/Circle Created with python_avatars Thorsummoner0 says:

    it would be kinda neat to see a similar cirtuit/application, and to take that design and redesign it for various common power levels, and show how increasing the operational power level changes a design

  8. Avataaar/Circle Created with python_avatars Arek R. says:

    If you post a question on forums these days you will get scolded by the old dogs, they will tell you to read this and this book and won't provide quick fix/solution.
    Even worse someone searches for same issue finds this post and essentially gets same treatment when reading it.
    Or they tell you oh that issue was explained here and here and give your URLs.
    Many times searched for some arduino issues, 1st google result leads to a thread where they give dude a URL which leads you to another post where they finally give you URL to the actual solution.

  9. Avataaar/Circle Created with python_avatars fullmoon6661 says:

    Hi Dave,
    Speaking about the topic you've missed or topic suggestion; I noticed that I couldn't find in your videos talking about strategies of driving a motor. Maybe as simple DC motor, like what PWM frequency to use (got a personal experience where I needed to drive beyond a frequency or the motor will be a ringing noise, I didn't know about this at all and no one writes about it or maybe I was just dumb). And maybe also the relation between torque and the current draw.
    Anyway, good series 😀

  10. Avataaar/Circle Created with python_avatars Jernej Jakob says:

    That relay board is a very bad design. It has both 2803s and optocoupler inputs, but the optocouplers aren't isolated from the relay 12V supply at all, they use the onboard 5V regulator to power them. Why use them at all if the isolation is defeated anyway? Just give direct connections to the 2803 inputs, problem solved, lower input current needed, can be driven directly from TTL logic. Or even better, get rid of the onboard 5V regulator, give direct access to the optocoupler pins completely isolated from the relay supply, then you can drive the optocouplers with your own supply, 3.3V if you want to. And there's no reason to use that high a driver current, the 2803 only needs a milliamp, even accounting for a CTR <100%.

  11. Avataaar/Circle Created with python_avatars Jernej Jakob says:

    A comment about the supply bypassing. The 2803s don't gulp those 100mA from vcc, they're open collector drivers. Local bypassing won't help, the loop is through the supply for the optocouplers on the relay board, through the 2803, through the gnd pins back to the relay board. You can get gnd bounce so a low impedance gnd is the only thing you need.
    You actually noticed that in the video later

  12. Avataaar/Circle Created with python_avatars isettech says:

    I use Eagle CAD when reverse engineering boards we do not have schematics for, and need to repair regularly. Some of the boards I work on have a 10 to 30 ohm resistor in the VCC line to each of the logic chips followed by the 10nF capacitor at each logic chip, just to decouple the sensitive chips from dirty power on the board. Don't forget the noise on the ground circuit if the relay boards each are powered from the same supply. High currents to multiple relay boards and multiple logic boards will cause local variations in the potential on each board's ground. This change in the ground potential, will cause problems with the logic levels clocking the boards.

  13. Avataaar/Circle Created with python_avatars eebaker69 says:

    As a newbie electronic hobbyist. I found this a great discussion. Can you make more like this please?
    I can't believe you made this video unscripted. I found it packed with useful information and ideas. Thank you for sharing your thoughts.😁

  14. Avataaar/Circle Created with python_avatars Tom George says:

    Hi Dave, a great idea for basic PCB projects like this, not complicated and using basic PCB design principles and datasheet research.👍👍👍👍👍

  15. Avataaar/Circle Created with python_avatars Simon A says:

    I've heard a lot about order of ground connections like star ground. What about order of VCC connection? Is it equally important? Why no star VCC??

  16. Avataaar/Circle Created with python_avatars Stephan Weinberger says:

    In model railroading there is the S88-Bus, which is essentially the same thing as this circuit here (a distributed shift register) and suffered from the very same problems with signal integrity. Even professionally designed components from big brands like Märklin had exactly the same issues in the early days.

    But I guess that's a mistake that everyone makes at least once in their life as an electronics engineer 🙂
    It happened to me even while using a RS485 bus: I just wanted to check for bus activity (i.e. is there a transmitter sending data onto the bus), so I thought I'd simply plug in my circuit behind the differential receiver, that should surely solve all problems with signal integrity – oh how wrong I was… Turns out in the wrong environment (the finished product should be used in a town that happened to have some heavy industry, steelworks etc.) even differential transmission is no guarantee for a clean signal.

  17. Avataaar/Circle Created with python_avatars LittleLad says:

    For those that matter, these are the videos we want to watch!
    This type of video might not get the most views, but it's immensely valuable and interesting for those of us working on similar problems.

  18. Avataaar/Circle Created with python_avatars Zoltán Kozma says:

    LED finally someone!!! Yes it is LED. Simple. Why do people make their lives harder spelling it out? Thanks Dave. You are the man.

  19. Avataaar/Circle Created with python_avatars imark7777777 says:

    I'm only three minutes in but I feel like I should be saying "fail safe" not "fail deadly", this is a fireworks controller after all the circuit should be able to fail in a safe manner and not light all of the fireworks at once etc……..

  20. Avataaar/Circle Created with python_avatars Ted McFadden says:

    Add me to the cacophony (I hope?) of voices asking for more of this. Identifying pitfalls makes it possible for us ignoramuses to start asking the right questions, if nothing else, and you brought up quite a few here on a relatively simple circuit.

  21. Avataaar/Circle Created with python_avatars Don Reid says:

    The signals do not have to go thru the 2803s in any particular order! If you re-order them you can get rid of much of the messy criss-crossing of the lines on the schematics and the PCB.

  22. Avataaar/Circle Created with python_avatars Wesley Mays says:

    About that board design, would you consider that "local" or "global" decoupling? It's really close to the 595 chips, but it's also not directly connected to any of the chips pads.

    Also, I'm guessing that "etchant trap" thing is to just avoid acute angles AT ALL COSTS ?

  23. Avataaar/Circle Created with python_avatars Roman Dvoryadkin says:

    I'm used relay board like this, but with RS485 interface and 12V power, controlled by raspberry pi 3 and RS485 shield. For large scale installation more suitable.

  24. Avataaar/Circle Created with python_avatars zapro_dk says:

    Something doesn't add up. All the relay boards i have had in hand has 2k2 resistors for the optos. It's 3.3/5V signal integrity issue. Not current.

  25. Avataaar/Circle Created with python_avatars Kevin Cozens says:

    I hope we hear back from the user to find out what progress they made in getting the circuit to work reliably. Kudos to the person drawing the schematic with all the wires shown. Makes it possible to follow the lines from one end to the other and easily see where they go. However, take away some of those kudos for the way it is drawn. Don't interleave one group of wires with another group of wires. Don't be afraid to rotate the part symbols or to flip them horizontally or vertically to minimize wire crossings. Also, try and avoid running wires through part symbols or through other text in the schematic. J10 and J11 should be rotated 180 degrees so the ground connections are at the bottom rather than the top.

  26. Avataaar/Circle Created with python_avatars Slordmo says:

    Yes, correct PS bypassing on each IC is a must, even with a power/gnd plane … and don't forget 'buffering' for long lines…. just hooking a bunch of chips together doesn't mean it's is good design practice…. it's the little items that turn into 'gotchas' …..

  27. Avataaar/Circle Created with python_avatars CaptainDangeax says:

    Kicad + freerouter is a powerfull set of tools for beginner in electronic and PCB design. The learning curve is steep but the results are great and well supported by online PCB makers. One can also design his own components and footprints easily by just reproducing the datasheet

  28. Avataaar/Circle Created with python_avatars Alex Novickis says:

    Oh how many times I have seen this problem, In fact I just finished simulating a clock layout a week ago before it went out. Yes please you should have an endless stream of reviews and we will all learn

Leave a Reply

Your email address will not be published. Required fields are marked *