Go Down

Topic: I/O between arduinos with opto coupling. Sample schematic  (Read 5223 times) previous topic - next topic

jeffez


jeffez

I can't read a schematic the size of a postage stamp. I don't know what you did but that file is resized into oblivion . Start over and don't resize it unless you have to and then only 20% at a time .
Not sure what happened there. I didnt resize it. It was supposed to be a link with a small thumbnail image. I've put up a direct link which should show its full size.

raschemmel

That schematic looks ok. I would avoid thumbnails .  They are never used on the forum. If you are posting a link then use the LINKS toolbutton to enter a link label, Otherwise just post the schematic like you did. That circuit should work. Have figured out how you are going to manage the communication so both sides don't try to send at the same time ?
The simplest and oldest method is that the first side to send sends an ACK at the end  of the message. The receiving unit sends an ACK (Acknowledge) when it receives one , telling the sender it is ready to receive more. If the message it just received was a command then it sends an ACK before executing the command.  The command could be "SND TEMP DATA".
It would send "ACK TMP", read the temp, and then send it. The other unit would respond wjth "ACK TMP", and then might might follow with "SND MTR SPD". The receiving unit would respond with "ACK MTR SPD" , read the speed , send it and wait. The receiving unit would receive the speed and respond with "ACK MTR SPD". This continues with one always requesting info and the other supplying it until the requestor sends ACK ACK ACK to indicate it is the others turn to request.  The other unit would receive the ACK ACK ACK  and respond with a request like "SND BAT VLTG" . This method can be modified such that either side can send critcal data whdn necessary , like "LOW BAT !" to which the other would respond with "ACK LOW BAT".


 (that's Full Duplex mode by the way) Your schematic prevents full duplex because you tied RE-NOT to DE. According to the truth tables on the LT1481 datasheet, RE-NOT cannot be LOW if DE is HIGH and vice versa, preventing full duplex. Here is a full duplex chip.
Arduino UNOs, Pro-Minis, ATMega328, ATtiny85, LCDs, MCP4162, keypads,<br />DS18B20s,74c922,nRF24L01, RS232, SD card, RC fixed wing, quadcopter

jeffez

That schematic looks ok. I would avoid thumbnails .  They are never used on the forum. If you are posting a link then use the LINKS toolbutton to enter a link label, Otherwise just post the schematic like you did. That circuit should work. Have figured out how you are going to manage the communication so both sides don't try to send at the same time ?
The simplest and oldest method is that the first side to send sends an ACK at the end  of the message. The receiving unit sends an ACK (Acknowledge) when it receives one , telling the sender it is ready to receive more. If the message it just received was a command then it sends an ACK before executing the command.  The command could be "SND TEMP DATA".
It would send "ACK TMP", read the temp, and then send it. The other unit would respond wjth "ACK TMP", and then might might follow with "SND MTR SPD". The receiving unit would respond with "ACK MTR SPD" , read the speed , send it and wait. The receiving unit would receive the speed and respond with "ACK MTR SPD". This continues with one always requesting info and the other supplying it until the requestor sends ACK ACK ACK to indicate it is the others turn to request.  The other unit would receive the ACK ACK ACK  and respond with a request like "SND BAT VLTG" . This method can be modified such that either side can send critcal data whdn necessary , like "LOW BAT !" to which the other would respond with "ACK LOW BAT".


 (that's Full Duplex mode by the way) Your schematic prevents full duplex because you tied RE-NOT to DE. According to the truth tables on the LT1481 datasheet, RE-NOT cannot be LOW if DE is HIGH and vice versa, preventing full duplex. Here is a full duplex chip.
Glad to hear i'm on the right track. I thought my last schematic was missing something though because this schematic below which is used on the blue rs485 pcb i showed has more added to it than just the max chip and the termination resistor.


As for preventing both sides communicating at the same time i wasn't fully decided on that but i was thinking of using canbus and within that using some kind of three way handshake before sending data, which i think is similar to as you described.

I was planning to use half duplex given the system would only send the occasional message back and forth. How ever perhaps full duplex would allow for the rare case where both ends want to message at the same time. Perhaps i should do it that way? Does using a software serial undo the benefits of full duplex given that software serial can't transmit and receive at the same time?

raschemmel

Quote
Does using a software serial undo the benefits of full duplex given that software serial can't transmit and receive at the same time?
I'll have to think about that but I think you already answered it .
Arduino UNOs, Pro-Minis, ATMega328, ATtiny85, LCDs, MCP4162, keypads,<br />DS18B20s,74c922,nRF24L01, RS232, SD card, RC fixed wing, quadcopter

Go Up