Timeline for H11L1 opto isolator does not pass signal to Arduino (correctly)
Current License: CC BY-SA 3.0
23 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Nov 16, 2020 at 11:16 | comment | added | Michel Keijzers | @ForTheOneWhoDownvotedHundredOfMyQuestions: please mention why you downvoted, so I can improve it if needed. | |
Jun 26, 2017 at 20:24 | vote | accept | Michel Keijzers | ||
Jun 26, 2017 at 8:07 | comment | added | Michel Keijzers | I already made a successful optocoupler test with Serial (using 2 Arduino Uno's, one for sending, one for receiving). But I still didn't get good MIDI information ... I think it has to do with the edge speed ... I can buy a better oscilloscope, but even that wouldn't 'fix' the problem. | |
Jun 26, 2017 at 8:00 | comment | added | CL. | Isn't the problem that you need a second serial for debugging output? If might be a better idea to make that the software serial. | |
Jun 25, 2017 at 21:22 | comment | added | Michel Keijzers | @CL: Problem is solved ... see my answer (I had two use two H11L1's because of the inversion... you told me about it, but didn't think it was needed in this case, but it seems it is. | |
Jun 25, 2017 at 20:23 | answer | added | Michel Keijzers | timeline score: 0 | |
Jun 25, 2017 at 20:18 | history | edited | Michel Keijzers | CC BY-SA 3.0 |
added 75 characters in body
|
Jun 25, 2017 at 14:45 | comment | added | Michel Keijzers | @CL: That will probably work ... since I tested with putting the Anode to +5 or GND directly to see the LED and that is either on or off, but the problem is with 'faster' (Serial/MIDI) circuits. | |
Jun 25, 2017 at 14:17 | comment | added | CL. |
Try without SoftwareSerial : write 0/1 manually to pin 11, then wait a little, read the input from pin 9, and output that value to a LED connected to another pin. Use a delay of one second or so to be able to observe it. If this works, then the problem is not with the hardware.
|
|
Jun 25, 2017 at 14:14 | comment | added | CL. | R2 and R3 form a voltage divider that prevents a proper high voltage; you have to connect the LED to 5V as shown in Transistor's answer. And the real MIDI circuit has more than one 220 Ω resistor; you can increase R1 to 1 kΩ. Anyway, for loopback testing, a direct connection 11 → 9 is OK. | |
Jun 25, 2017 at 14:09 | comment | added | Michel Keijzers | @st2000 I tried also to print a newline after the A, but it also does not make a change. Using an interrupt routine for a test seems a bit overkill (in that case I rather wait for the Mega ... or use my old optocouplers which already work, but the H11L1 are a bit smaller. | |
Jun 25, 2017 at 13:55 | answer | added | Transistor | timeline score: 3 | |
Jun 25, 2017 at 13:40 | comment | added | st2000 | Perhaps I should add. In the real world, I would write an interrupt routine to handle the received data. All it would do is maintain a buffer of received data that is long enough to contain any expected messages until I could get around to reading it. So when I'm off sending data I will not miss any data being sent to me. I am not sure how the Arduino serial libraries are written. But they need to be simple so as to be small and compatible with as many other Arduino libraries as possible. | |
Jun 25, 2017 at 13:37 | history | edited | Michel Keijzers | CC BY-SA 3.0 |
added 3 characters in body
|
Jun 25, 2017 at 13:35 | comment | added | st2000 | I am fairly sure the UART connected pins are similar or the same as GPIO. Interestingly, I can't find an exact match to this problem (if in fact it is a problem). Most use the UART to send messages followed by and EOL like an '\n". So they write sketches which expect to talk in turn. You, on the other hand, probably need to write a sketch which will work byte by byte. This assumes the Atmel processor you are using can only buffer 1 UART byte. Take a look at "Serial.readBytes()" to get some ideas. This is a long way to go just to test the optical coupler. | |
Jun 25, 2017 at 13:34 | history | edited | Michel Keijzers | CC BY-SA 3.0 |
added 597 characters in body
|
Jun 25, 2017 at 13:29 | answer | added | Jot | timeline score: 1 | |
Jun 25, 2017 at 13:26 | comment | added | Michel Keijzers | (ok in that case I need to change my sketch a bit) ... btw, for this test I put a wire directly between pin 9 and 11 (without any resistor) ... hope that is the correct way? | |
Jun 25, 2017 at 13:24 | comment | added | st2000 | I'm still looking around. When looping back, you are depending on the Atmel processor hardware to buffer up received data while your software is busy transmitting it. Then you are depending on the Arduino serial libraries to get that buffered data (if there is any) after the it was already received. It is like talking and listening at the same time. Instead of the usual taking then listening in turn. | |
Jun 25, 2017 at 13:18 | comment | added | Michel Keijzers | @st2000 I don't receive anything (guess I have that problem) ... what can I do about that (?), never heard of it (in Arduino context at least) | |
Jun 25, 2017 at 13:16 | comment | added | st2000 | First, try looping back the Arduino's RX/TX lines to verify you do not have a full verses half duplex problem. | |
Jun 25, 2017 at 13:09 | history | edited | Michel Keijzers | CC BY-SA 3.0 |
added 77 characters in body
|
Jun 25, 2017 at 12:55 | history | asked | Michel Keijzers | CC BY-SA 3.0 |