Hi, has anyone successfully interface an optoisolator and and 20ma current loop to the arduino digital output and digital input pins?
I have a Vibration sensor located about 100 feet from where the arduino will be.
The sensor has its own power supply (9v battery). I want to keep the sensors power and ground isolated from the arduino power and ground (9v wall wart). Given the distance I think I want to use a 20ma current loop over a shielded twisted pair to read a signal from the sensor and to send a Reset signal to the sensor. I want to read the sensor say every second and Reset it whenever appropriate. Reset would drive digital output pin High for x milliseconds then drive it low and keep it low until next reset time. A High on the digital input pin would indicate a certain level of vibration (think very loud knock) was picked up. The Arduino would poll the input pin and when it sees a High on it, it would send a Reset signal to the sensor and then run code to process that a knock has been heard. When done processing the knock it would start listening for future knocks.
I found a chip set called HCPL4100 and HC4200 that looks like it will do the job.
Not sure if I need a resistor from the arduinos digital output and digital input pins to the TTL out and TTL in pins on the respective chips.
This is my first arduino project and I do not want to burn up the arduino if I connect it wrong.
Anybody have any suggestions?
There's also RS422 and RS485 to consider - plenty of driver and transceiver chips for 5V operation and less current drain.
Can I read a single bit into a digital input pin if I supply a clock pulse from a digital output pin?
The Tx and Rx lines on my arduino uno are already in use driving a 16x2 serial lcd.
Would I need a current limiting resistor from the digital output pins and or digital input pins to drive the rs485 input and clock pins?
Look into the language reference for SoftwareSerial which provides a software-based serial interface on any digital pins.
Specific to your serial LCD, I would move it off of those hardware serial ports and use SoftwareSerial. The signals that are echoed to that port when you're uploading sketches has a tendency to really hose up those devices.
A current limiting resistor would typically not be required with an RS485 chip.
Thanks Chagrin, I will look into using SoftwareSerial. My Sensor interface to the Arduino is only 2 bits so I have attempted to design a 2 bit digital interface with RS485 chips. The sensor output is a latched logic high or low from a 555 timer. The sensor has a reset circuit that when it receives a low pulse it will resets the 555 output to a low. I took a shot at designing a rs485 interface using 3 digital output pins and 1 digital input pin. The arduino will set one 485 chip into transmit mode and send either a low or a high pulse to a remote 485 receiver. The receiver will send its RO output to the /RE and DE lines of another 485 chip. This will either enable its DI input or its RO output. The DI input will send the logic state of the latched 555 timer back to another 485 chip near the arduino so the arduino can test if the latch is set or clear and then do something like write a message to the serial lcd display. The RO output will drive a mosfet in effect simulating a switch being closed to ground to be used to reset the latched 555 timer back to a logic low state.
I am attaching a schematic that I think may work. I would greatly appreciate all comments on whether or not my schemtaic will accomplish my goal which is: Remotely read the state of a switch( the latched 555 output) and then remotely reset the switch back to a known logic state.
arduino_rs485_isolated_serial_io.pdf (85.2 KB)