-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Full isolation schematic #49
Comments
The green line is already at level zero at rest and gets pulled to 12 volts when active . I don't get why you think there would be short if another device drives the green line to 12 volts? If another device does drive the green line high, then the transistor just won't turn on which is fine. In a working system, no two devices drive the bus at the same time. The only time this would occur if a user set two keypads, devices to the same address by mistake and in those cases, communications with those devices would fail due to data corruption but it would not hurt anything. Of course, using optocouplers instead of voltage dividers is a better approach for all lines but my intent was to keep the circuit as simple as possible and still keep it safe on the bus. |
Yes agree that one opto isolator and circuit as is is the simplest option. I was thinking of the point of view that I don't really know how the other devices are interacting with the bus exactly. Like if the other ones used a totem pole output with a npn on high and pnp on low-side, and I did too, then if one drove at 12v and one drove at 0v, then there would be effectively be a short. But common sense would say they couldn't be using a totem pole on the other devices, or else nothing would work. I'm guessing this bus is electrically simpler, with maybe the main panel which is acting as master to poll the keypads having the only low-side driver of the receive pin or just using a passive pull-down resistor to pull things down to zero. Like in the opto isolator you have, the optoisolators transistors can pull green to 12v, but there is nothing pulling it down to 0v. And it seems like the diode in my 2nd schematic attachment probably could be considered redundant as the transistor is acting as a diode already (except it maybe isolates my pull-down resistor to not add more pull-down effect to any of the existing devices that may already have their own pulldowns). |
In the spirit of over-engineering to the extreme, I switched side of the output transisters (giving inverted output), ran them through schmidt trigger inverting buffers to cleanup incoming signal. Then on the green output side I added a inverting buffer that has an output enable input. The output enable comes 3.3v out of the esp8266 and then is run through another optoisolator to get it to be 0-12v. Clearly the firmware would have to be changed to provide this output. I haven't tested this yet, and I'm not sure it's worth the extra pain, but I will likely build this circuit, and tune the values of the resistors, etc. |
Wow, that' s quite a circuit. I don't see why the need for a greenout enable line though? As to cleaning up the signal, I also have not seen this as an issue since the bus is pretty clean when viewed on a scope. It is very low speed at 4800 baud. Of course it won't hurt. For a DIYer though i definitively see this as overkill and overwhelming for most users but if this software was to be used in a commercially available product, of course, it would need to have the type of engineering you suggest to ensure a safe and issue free product. Your first circuit showing isolation for all lines is defintively a good alternate diy'er option and I would also definively recommend a separate ground as the best option to provide complete isolation. Quite a few users are using the basic circuit and I have not heard of any real issues regarding interface so far. Doesnt mean they don't exist of course. It would definitively have been helpful to have a copy of the panel board schematic but those are not available that I can see. |
Yes, the panel already has a measured passive 1kohm resistance to ground so adding another 1kohm in parallel (as in the emitter of the optocoupler) is not necessary or recommended which is why I don't use one. Well, enjoy your experimentation. That's what it is all about. |
If you don't mind, I'd rather not add this type of change to the code at thist time as your circuit is not something that i see being used by most users. Unless I see this becoming a must have change then I will re-think this. For now, the current circuit works perfectly fine as is and I'd rather not add more complexity for no real added benefit at this point. I sample at mid pulse and a slower rise time is not an issue as far as I have seen especially at 4800 baud. |
I certainly understand, although I think in for most users, the presence of an enable pin really doesn't hurt them either as it could be safely ignored (unles someone is using the same esp8266 for more stuff, which is possible if they are using emulation). Most functionality was already in the underlying libraries (someone added at some point for some reason). Here's my patch: aselle@9d23408 Probably the sweet spot for improvement to the circuit is full opto-isolation, minus the additional logic chips. That would also not require any software change at all. |
I will definitively add a full opto-isolation example schematic as an alternative option for users as i agree that is the better approach. I will let the users choose the approach they want to use. I will keep your patch in mind. |
I'm happy to prepare an isolation schematic and submit it as PR w/o the
logic chips.. probably next weekend, once I build and test it.
-A
…On Mon, Jul 19, 2021 at 4:50 AM Alain Turbide ***@***.***> wrote:
I will definitively add a full opto-isolation example schematic as an
alternative option for users as i agree that is the better approach. I will
let the users choose the approach they want to use. I will keep your patch
in mind.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#49 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AACPTWX5QN6WJ46POFBO75LTYQGOVANCNFSM5AK4EKGA>
.
|
Thank you but there is no need as I have one I put one together that I'm testing now. |
Sure, it makes sense. I was also planning to make a PCB design which I'd be
happy to prepare as gerbers so people could order easily on oshpark or
jlcpcb. Would that be interested to include as a PR?
On Mon, Jul 19, 2021 at 11:47 AM Alain Turbide ***@***.***>
wrote:
… I'm happy to prepare an isolation schematic and submit it as PR w/o the
logic chips.. probably next weekend, once I build and test it. -A
… <#m_-2588552544395213966_>
On Mon, Jul 19, 2021 at 4:50 AM Alain Turbide *@*.***> wrote: I will
definitively add a full opto-isolation example schematic as an alternative
option for users as i agree that is the better approach. I will let the
users choose the approach they want to use. I will keep your patch in mind.
— You are receiving this because you authored the thread. Reply to this
email directly, view it on GitHub <#49 (comment)
<#49 (comment)>>,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AACPTWX5QN6WJ46POFBO75LTYQGOVANCNFSM5AK4EKGA
.
Thank you but there is no need as I have one I put one together that I'm
testing now.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#49 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AACPTWW5Y2PBTPNEYHMXMB3TYRXNBANCNFSM5AK4EKGA>
.
|
Sure, go ahead. |
I experimented with various optocouplers and found the initial recommendaton of 4n25/4n26 totally inadequate for this application. The CTR is way too low. I tried a couple others I had on hand, the TLP521 and the 4N35. The TLP521 was the best of the lot. The 4N35 is a close second. Both produce plenty of output using minimal forward current so are easily driven from the ESP. I also found using too low a resistance on the panel bus led side caused too much load on the bus and drove the signal voltage down. The minumum that can be used without affecting the bus was 4.7K. In order to have enough signal on the collector side of the optocoupler, a higher pull down value was needed to be at least 2.2k. I used 4.7K to simplify the circuit. By using a 4N35 or TLP521, a value of 220 for R1 is plenty sufficient to get full bus signal output. I used 180 in the schematic to account for varying device CTR's and temparature. |
Awesome. I saw your updated readme. The 4n25 were a bit iffy on CTR, as my last post said, but that's all I had. I noticed that sometimes on plugging my adaptor in, Some worked better than others that I had. I would get a bus fault on my remote module, so I think that was due to the voltage drop. Ijust received a digikey order w/ some 4n35's so I'll try your suggested values and verify they work for me as well. I'll give it a try and test for a few days just to verify your recommendation on another data point. |
Finally had some time last weekend to test this out. However, your commentary got me to thinking about the load on the ecp bus (which I commented above). In my old values with the 4n25 the "12v" rail was at 8.4V (I commented on it above). Without the optoisolated interface the voltages on yellow and green are in the almost 14V and with your new circuit they are about 11.4V. If we assume .7 * VCC is the logic high threshold that gives is .7 * 14 = 9.8V, so my old circuit was way too much droop. Then I looked at your non-isolated circuit and it presents at least 33k ohms` of resistance, which makes it effect ironically less than the optoisolated version. Specifically, the optoisolated one maybe presents 4.7k. So I modified the circuit to use present a 100k impedance which keeps the grmeen/yellow lines very high with almost no sag. I also added a 1M ohm resistor between the base and emitter on the optocoupler transistor as recommended by Pease's app note (got the idea from https://hackaday.com/2018/05/09/optocouplers-defending-your-microcontroller-midi-and-a-hot-tip-for-speed/). This modification makes the high-to-low transistion on the inputs to the microcontroller a little bit faster and less rounded (200k might be an even better value as it makes it almost perfectly square see below). Overall, not sure it is worth changing your recommendation, but if people have problems but still want an isolated circuit, this seems pretty good, and it was fun for me. After all, most people have random NPN transistors and resistors laying around. Edit: I verified that 200k for R8 and R9 is a pretty good value to make the waveform have faster fall time without compromising the rise time. Lower resistance decreases fall time eventually at expense of the rise time. Here 200k drops fall time an order of magnitude without much of a drop in rise time.
|
Excellent analysis . I like the idea of pre-biasing the base of the optocoupler transistor. I'll try that out. I couldnt do that with the tlp521 as it does not expose the base but for the 4nxx devices, that works. I did try using a 10k resistor for the optocoupler led side to further minimize ECP bus load but I found I was not getting optimum output and losing data so I went back to 4.7k and as you noted there that is not perfect either as it induces a voltage sag. Your design of having a transistor booster stage in front definitively is a good fix but it goes against my idea of keeping the circuit as simple and workable as possible. A dilemma. |
I received and assembled a pcb for the latest circuit and built it and made a 3d printed enclosure. Definitely overkill, but it does package it pretty nicely. It could clearly be even smaller if I used surface mount, but I went of ease of assembly. A few problems with the pcb
|
@aselle Is there somewhere to order your PCB? Nice work! |
Really clean PCB and case @aselle , would be nice to order |
Nice design @aselle ! Any chance we can get a PCB Schematic and parts list for this? |
+1, if you share the files @aselle I’d be happy to do a run of these (including cases) for anyone interested (selfishly, the transmit on my board seems to not work anymore, so I want to replace it with one of these!) |
Hi! |
Sorry I missed your requests @blacktirion, @appleguru , @lorenzodeveloper @appleguru , I have added the files and a short description on my fork master branch Thanks @Dilbert66 for including an isolated variant as well, and thanks for all your work supporting this project. |
@aselle amazing work. I’ll see if I can source parts and put this together. |
Same, will also take a look at building a batch of these! |
Thoughts on adding an isolated dc to dc converter to this circuit so that a separate power supply isn't needed? Am thinking something like the ROE-1205S: https://www.digikey.com/en/products/detail/recom-power/ROE-1205S/5684100 |
@aselle, I'll add your design and associated files to this repository if you want. It's a good design. A pcb is definitively the best option for this circuit. The CTR is not as critical due to the transistor input stage and I suspect most common optocouplers can be used with no issue. |
Awesome! Thanks. @Dilbert66 , let's update the readme file in dev branch too.
|
@lorenzodeveloper , I do prefer @aselle's isolated version as it provides very minimal loading on the bus (which is an issue with the current simpler isolated version I provide) and also provides high gain for the signal to the ESP. It basically eliminates all the issues at the added cost of slightly more components and complexity for the casual builder. Having the gerber files and availability of a board will make this a much easier and reliable process. @aselle, If you don't mind I'd like to modify your design to use on my DSC implementation as well. It will need a slight modification though as the DSC tx out is inverted and requires the green line to be brought to black (ground) (instead of green to red (12v)) so for that circuit the green line will go to pin 5 of U2 and black to pin4. Keep R11 connected between pin 4 and 6 I believe. Now, to put things in perspective though, I have run both the simple resistor version and optocoupled versions on both my test and production alarm systems (DSC and Vista) for the last few years. The simple resistor version has worked flawlessly and with minimal loading but is prone to issues in the instance of a bad ground (or missing ground). This can cause bus noise and problems on the alarm system. So the builder has to make sure the connections are secure. With the isolated version any bad connections will not affect the panel in that way. The only negative though as has been mentioned is when wanting to power the board from the panel instead of a separate power supply. |
@aselle, FYI, your gerber files are for you older prototype version so you might want to either update them or remove them. Since you provide the pcb design, it's easy enough to generate new ones. Nice work though on the design. I ldo like the breakout pins for expansion. I've modifed it to work on the DSC system as I've noted above and ordered some pcb's of for both versions to play with. FYI, the design will work perfectly well with the ESP32 version of the D1 mini as it has the same footprint available. For that one, you'll need to use IO22 for Yellow in, IO21 for Green out and IO18 for Green in. The ESP8266 uses IO5 for Yellow in (rx), IO4 for Green out(tx) and IO14 for Green in(monitor) |
@Dilbert66 feel free to include the design in the mainline and modify it as you see fit. The gerber files in the circuit/ directory were indeed old, so I removed them and pushed it to my branch. The other ones in the v1-manufacture-files should be correct. Glad the ESP32 has a d1 mini. I haven't done a ton with those as still have a sizable stash of esp8266's. Hope the prototype boards come back well. I changed my schematic resistor values to the ones that I used (as far as I could read the color codes from my photograph). But I didn't populate the 1M (you can see it empty in my photo above). Let me know how the bring up goes. |
@appleguru, I chose not to run the esp8266 off the power supply, as I think the vista boards power supply and regulators tend to already run hot. It can be even worse if you have a expander, radio device, etc. Dilbert66 may have further insight. |
First, this project is awesome! Thank you. Second, it looks like you are using the optoisolator as a level shifter, but maybe not only, given there are multiple writers to green on the bus. Shouldn't green only be driven when the microcontroller wants to write, because otherwise if another keypad tries to write to green it will cause a short? In any case, I tested your circuit as is, and it worked, but I was thinking of making a PCB along these lines:
Likely, just to be safe, I'll make it so you can select with a jumper if you want isolated grounds and populate either the resistor dividers or the optoisolators...something like this:
Thoughts?
The text was updated successfully, but these errors were encountered: