i was thinking about the idea of implementing a remote control idea based on optocouplers, from one Arduino to another Arduino.
The idea is to simulate remotely the action on a Joystick, for example i move the joystick up, and then i root a signal to another Arduino to simulate i did a move. This will be done via software and isn't the principal target of the question.
My question is about the scheme below, where i thought i needed to give 5v to the optocoupler to work with a pullup resistor, but it still works with the small current transfered into the phototransistor.
Can tell me someone, if this is right to do or i need to add other components to be sure about the right working of the optocoupler.
If you go with the schematic, you will need a current limiting resistor between the Arduino 1 output and the LED of the optocoupler. You can use the internal pull-up on the Arduino 2 input pin or use an external pull-up resistor.
The project is bigger than just the optocoupler, so i want to isolate both because dont want to have a common ground. I mean i have more integrated circuits in other places, that doesnt relate to the circuit part of the optocoupler.
I know i can just use directly connection, but it isnt 100% safe to do, it need to be a completely for dummies system. Maybe someone without knowing how it works can configure a pin as output or viceversa when it should have to.
With the schematic i posted, im getting an high level on Arduino 2 Side when it is low on Side 1 and viceversa. Because, Arduino is capable of read a very low current passing transfered by the phototransistor.
With the schematic posted, you will damage Arduino 1. And I just advise to add the (internal) pull-up; if the transistor is off, the Arduino 2 input is floating.
Actually, i got a limiting current resistor on Arduino UNO, i forgot to put it in the schematic. My bad.
About Arduino 2, i will make something like the figure below with a greater pull-up resistor. Anyway i still get confused, about the 5v + pull-up resistor. Just want a good answer to put it in this case.
Read up on floating inputs. They will pick up noise from the environment and toggle between HIGH and LOW. Adding the pull-up resistor makes that the level is fixed at 5V if the transistor is not open.
You still need the current limiting resistor between Arduino 1 and pin 1 of the optocoupler.