Review of my "Optocoupler as Relay Board" circuit

Topic reopened

TOPIC MERGED.

Could you also take a few moments to Learn How To Use The Forum.

It will help you get the best out of the forum in the future.

  • Your OS and version can be valuable information, please include it along with extra security you are using.
  • Always list the version of the IDE you are using and the board version if applicable.
  • Use quote or add error messages as an attachment NOT a picture.
  • How to insert an image into your post. ( Thanks @sterretje )
  • Add your sketch where applicable but please use CODE TAGS ( </> )
  • Add a SCHEMATIC were needed even if it is hand drawn
  • Add working links to any specific hardware as needed (NOT links to similar items)
  • Remember that the people trying to help cannot see your problem so give as much information as you can

COMMON ISSUES

  • Ensure you have FULLY inserted the USB cables.
  • Check you have a COMMON GROUND where required. ( Thanks @Perry)
  • Where possible use USB 2.0 ports or a USB 2.0 POWERED HUB to rule out USB 3.0 issues.
  • Try other computers where possible.
  • Try other USB leads where possible.
  • You may not have the correct driver installed. CH340/341 or CP2102 or FT232 VCP Drivers - FTDI
  • There may be a problem with the board check or remove your wiring first.
  • Remove any items connected to pins 0 and 1.

COMPUTER RELATED

  • Close any other serial programs before opening the IDE.
  • Ensure you turn off any additional security / antivirus just to test.
  • There may be a problem with the PC try RESTARTING it.
  • You may be selecting the wrong COM port.
  • Avoid cloud/network based installations where possible OR ensure your Network/Cloud software is RUNNING.
  • Clear your browsers CACHE.
  • Close the IDE before using any other serial programs.
  • Preferably install IDE’s as ADMINISTRATOR or your OS equivalent

ARDUINO SPECIFIC BOARDS

  • CH340/341 based clones do not report useful information to the “get board info” button.
  • NANO (Old Types) some require you to use the OLD BOOTLOADER option.
  • NANO (ALL Types) See the specific sections lower in the forum.
  • NANO (NEW Types) Install your board CORE’s.
  • Unless using EXTERNAL PROGRAMMERS please leave the IDE selection at default “AVRISP mkII”.
  • Boards using a MICRO usb connector need a cable that is both DATA and CHARGE. Many are CHARGE ONLY.

CREATE editor install locations.

  • On macOs ~/Applications/ArduinoCreateAgent-1.1/ArduinoCreateAgent.app/Contents/MacOS/config.ini
  • On Linux ~/ArduinoCreateAgent-1.1/config.ini
  • On Windows C:\Users[your user]\AppData\Roaming\ArduinoCreateAgent-1.1

Performing the above actions may help resolve your problem without further help.
Language problem ?
Try a language closer to your native language:

Thanks to all those who helped and added to this list.

I am sorry if I break a forum rule. That was not my intention. The topic was closed and my questions was closely related.

if I may rephrase from my previous post? Using an optocoupler allow to separate the signal (among other I guess) just like the schematic present in post #27 above. But the ground is often electrically connected on both side of the opto. Then how does the circuit is really isolated in such case? And is it relevant to add a decoupling cap for extra isolation?

Clearly if the same ground is connect on both input and output side of the optocoupler, there is no isolation provided.

People ("newbies") misunderstand electrical circuits and tend to throw in random components imagining that because they heard that component "does" something, it will "do" something in their circuit.

That is exactly such a suggestion. :rofl:

Perhaps you should not discuss theory outside of application. This is the " XY Problem". Is there something you actually want to do? :thinking:

My objective is to understand in what situation the optocoupler is better than a mosfet switch alone. I often need mosfet switch and was thinking an opto is just a must have but now, I am not certain anymore. Let me explain, I redraw a sketch based on the optocoupler circuit describe in previous post. My sketch is a typical situation I think a lot of us come by while using arduino. It involve a main power that is downregulated to accomodate different required voltage. In this example 5 or 3.3 volts for arduino board and 12 volts for the "noisy electric coil" that we want turn on and off. In this situation with typical hobby buck converter, the ground on the 12 volt battery, converter, arduino and "noisy coil" are electrically connected. Then why using the optocoupler? We could use a mosfet relay and trigger it rigth from the arduino IO pin for the same effect and noise!
For the optocoupler to be of any use, should I have 2 batteries and physical separation of power?
Is there a isolated solution with only 1 battery? I tough it was one thing decoupling capacitor provides?

That's a silly question.
An optocoupler is designe to isolate circuit A from circuit B. If more than 2 circuits need to be isolated
then you add more optocouplers. If the arduino needs to be isolated from the inductor you can still have two batteries if you have two optocouplers
but under no circumstances can the grounds of the input and output sides be connected.
If the input and output grounds of the buck converter are isolated then the arduino is
isolated from the 12V battery. Did you measure
the resistance between them with the power off ?

I don't have a setup just yet to test this. My question is theoretical and I just want to understand and eventually have the best possible relay/trigger module for my projetcs.

Most regulator I know in the DIY community have 3 pins and ground is common. Other have 4 pins and even if there is physical separation of input ground and output ground pad, they are common. I just confirmed this with 3 differents models from my bin part. This mean that with these regulator the 12v batterie ground, arduino ground and inductor ground would be common.

Your reply also make me think that there are ground isolated regulator outhere? Can you suggest some?

Then if for any reason I can't disconnect my grounds, this mean that it is not relevant to add an optocoupler to a already working mosfet relay. Rigth?

Also, how does my initial question about decoupling cap differ from the suggestion in the second paragraph in this other related thread post reply?

thank you for your time

The question about a decoupling cap is not avalid question because it has no relevance to this discussion. A "decoupling cap" is universally understood to be a 0.1uF cap from the + power
pin of a digital IC to GND.

As far as the isolation issue is concerned , an optocoupler cannot be used to isolate a power
source. You should consider using an isolated dc to dc converter:
isolated dc to dc converter

What then IS an optocoupler used for ?
It is used to isolate signals, including a mosfet control signal.

Ok. Sorry if it sound silly again but can you expand on why? or if?, for my arduino, It would be good to isolate the IO pin from the mosfet gate?

Thank you for the link by the way.

If the mosfet is internally shorted for some reason the mosfet power voltage could
feed back to the I/O pin. This is rare I believe, but just for the record, MCU GPIOs have traditionally been opto isolated as a matter of common practice since the beginning of the
computer era. Commercial equipment almost always used isolated inputs/outputs because back then the cost of replacing the entire system was not acceptable. As technology advanced, the cost of microcontrollers dropped until eventually it was so low that even if you did blow a GPIO you could just replace the whole microcontroller at a relatively very small cost (for a company). Since the Arduino was first released, the need for opto-isolated outputs was somewhat rare because most were used for typical hobbyist applications where there was little risk of damaging an I/O pin but some applications were such that there was some risk in which case posters were advised to use opto-isolators. There are too many different applications to mention but one example is a poster wanting to monitor the AC voltage for some reason. You certainly would not want 230vac feeding back to your arduino. Another more common application is driving a noisy inductive load where you don't want the inductive load sharing the same supply as the MCU so you power it with a separate power source and use an optocoupler to turn it on and off. I could go on but you get the idea.
You should know that opto-isolators are typically rated for 5000V isolation across the photonic barrier.
See "Isolation Characteristics on page 3

5000v versus this tiny black box ! It's impressive. I guess it's still a good idea to include an opto when possible.
To rounded up on the noisy inductor and my initial sketch. If ground separation is not an option. Does star grounding may help with respect to noise reduction produced by an inductive load?
And can star grounding be apply on ground planes? Let say we chop the plane in two part and only link them at a final position close to the ground pin? Could this a be better than nothing option?

Maybe, maybe not! :worried:

"Star grounding" features in a few recent discussions here. Sadly it is sometimes, perhaps often used/ suggested as a "fix" to a problem that is poorly understood.

The more general term is to understand where the various currents in the ("ground") circuit are travelling and the consequences of those currents. You need to arrange grounding in such a way that they do not affect each other. "Star grounding"may sometimes achieve that, or just as often make it far worse.

I repeat my point - there is no general approach to how you arrange protection and reliability in a project. You must take into account a number of principles and understand the way and degree each principle affects this particular application. While you can learn a few details of one or other principle, only if you propose an actual application (with all parts fully specified), can we examine just what is involved. :thinking:

I understand. I will post a project when I have one that correspond to this problem. For now I guess my quest for an optimal relay module to inject in any of my project is just not finish! I will use the one in post 27 of this thread. It is a bit better than mine solely base on mosfet.
Isolated DC converter is also interesting. I will have to dig into this.

thank you all for your explanations and links for more reading.

What's wrong with the isolated dc to dc converter I linked In Reply #49 ?

Nothing!
When you share it, I looked at the datasheet and to make it work (at least from what I understand) it required quite a few parts and an inductor? Page 29/62 in the application note show a typical use I think. From my point of view building this is a project per se!
But it was a fast screening of the datasheet. I certainly miss some info and the document is still open on my computer for more digging.

One thing is certain, now I know that isolated supply exist! Thank to you! I just wish I can find one that is already package and available on the market.

Google is your friend.

isolated (4000v isolation)12V to 5V dc to dc converter (OUT of STOCK !)

List of isolated dc to dc converters (check for availability)