DMX circuit on my Teensy 4.1

SteveSFX

Well-known member
Hello

Lack of intelligence alert...

I am using the attached circuit off my Teensy 4.1. There seems to be several variations of this circuit floating around.

My question...
Obviosuly the Teensy is 3.3v. This circuit actually does seem to work with DMX lights, even though it falls below the 3.5v minimum for the DC/DC isolator.
But, in the long term, that should not really remain.

If I run this circuit on the recommended 5v, my concern is the RX/TX connections.
I don't really want to have to make a new board (I have made this pcb already for another 5v project).

I am sending a serial low signal I assume to the TX of the transmit isolator, and a simple low for the direction isolator, so I think they are OK.
But the returning signal from the receive isolator is potentially 5v?

Also, are R4 and R6 correct at 100R? Seems low to me.
 

Attachments

  • DMX.png
    DMX.png
    30.5 KB · Views: 24
I am ashamed to say...... I asked ChatGPT...

In this circuit, the resistor R7R7R7 is in series with the input LED of the optocoupler 6N137. To determine the voltage drop across R7R7R7, we need to consider the following:
  1. Forward Voltage of the LED in 6N137: The input side of the 6N137 contains an LED. This LED typically has a forward voltage drop (VLEDV_{LED}VLED) of around 1.2V to 1.4V, though it can vary slightly depending on the specific part.
  2. Supply Voltage: According to the circuit, the supply voltage is +5V+5V+5V.
  3. Current Through R7 and LED: The current through R7R7R7 and the LED determines the voltage drop across R7R7R7. This current is governed by the equation:
    I=Vsupply−VLEDR7I = \frac{V_{supply} - V_{LED}}{R7}I=R7Vsupply−VLED
Given the typical values:

  • Vsupply=5VV_{supply} = 5VVsupply=5V
  • VLED≈1.3VV_{LED} \approx 1.3VVLED≈1.3V
  • R7=4.7kΩR7 = 4.7k\OmegaR7=4.7kΩ
Let's calculate the approximate current (III) and then find the voltage drop across R7R7R7:

I=5V−1.3V4.7kΩ≈0.787 mAI = \frac{5V - 1.3V}{4.7k\Omega} \approx 0.787 \text{ mA}I=4.7kΩ5V−1.3V≈0.787 mA
Then, the voltage drop across R7R7R7 is:

VR7=I×R7≈0.787 mA×4700 Ω≈3.7VV_{R7} = I \times R7 \approx 0.787 \, \text{mA} \times 4700 \, \Omega \approx 3.7VVR7=I×R7≈0.787mA×4700Ω≈3.7V

The voltage drop across R7R7R7 is approximately 3.7V. This leaves around 1.3V across the LED in the 6N137, matching the typical forward voltage drop of the LED.

Pin 6 of the 6N137 optocoupler is connected to the input side of the internal LED after the resistor R7R7R7. Since we previously calculated the voltage drop across R7R7R7 to be approximately 3.7V, the remaining voltage on pin 6 would be the LED's forward voltage.

Given a 5V supply, we calculated:

  • Voltage drop across R7R7R7: ~3.7V
  • Supply voltage: 5V
So the voltage on pin 6 (after the drop across R7R7R7) would be:

Vpin 6=5V−3.7V≈1.3VV_{\text{pin 6}} = 5V - 3.7V \approx 1.3VVpin 6=5V−3.7V≈1.3V

Conclusion

The voltage on pin 6 is approximately 1.3V, which matches the typical forward voltage drop of the LED inside the 6N137.

Question is.... is that correct!
 
The voltage across the LED is 1.3V or so, yes. The point is the current through it.

Those 100R resistors on the opto couplers for TX and D2 will try to pull lots of current from the T4 pin, far more than they are designed for. This circuit seems to be for an Arduino AVR which can push out 25mA per pin(*). I think for the T4 you should bolster the outputs with a transistor or FET so they can drive the opto couplers at 25mA.

(*) AVR output pins have about 40 ohms of internal resistance, so total resistance = 100R + 47R = 147R. 3.7V/147R = 25mA

However note the 6N137 only needs 5 to 15mA of drive anyway so those 100R resistors really could be 390R or so, which would be much friendlier to a T4 drawing about 5mA which might just work without extra hardware.
 
Yea. I am having a lot of problems with this whole setup that I normally don't get.
My Teensy 4.1 for starters is messing around when I plug in the USB telling me unrecognised device and all kinds of issues (and it's not the lead)
 
So.. a 390R resistor on the input to the 6n137 seems to work. Turned out I had a dud opto-isolator (maybe I fried it).

I looked at the data sheet for the 6n137 and just don't see the forward voltage for the internal Led. This 390r probably pulls a tad over 5mA from the Teensy 4.1 pin? Is that gonna be OK long term. Really wish Teensy pins had a little more than 4mA a pin.

Bizarrely, I connected the same PCB to an ESP32 devkit IC and it doesn't work. I suspect the resistor is now too high, as I am sure this PCB worked with 100r resistors in it on the ESP32 last time.
I don't see why the output level of the ESP32 is different to the Teensy 4.1.

Had another project go sideways yesterday and just could not get the IDE to connect to a different 4.1. No idea what is going on with these 4.1's lately (It must be me). They were my default IC but being really problematic lately.

I connect to them and they are just not recognised. The port stays greyed out, they refuse to upload. The Teensy loader throws errors.... all on projects that used to load fine. Something wrong with the Teensy loader?
 
I connect to them and they are just not recognised. The port stays greyed out, they refuse to upload. The Teensy loader throws errors.... all on projects that used to load fine. Something wrong with the Teensy loader?

Remember we can't see your screen. Figuring out the root cause of technical problems can be challenging even with complete info, but in this case we can't even see the errors you're saying you saw. I can't even tell if you're using MacOS, Windows or Linux, which matters for troubleshooting errors where your PC can't communicate with Teensy.
 
I just don't know what is going on.....

These are proper Teensy 4.1's (Pi Hut). Running on Windows.
Plug them in and they get picked up. Select the port.... and then they fail to upload. Then an error pops up saying an unrecognised device has been plugged in.
Never had this before, but it's driving me insane. No idea what is causing it.

It just did it again
 
As a first step, can you at least collect a screenshot of the Ports menu before you try to upload, and a screenshot of the error which appears? I want to help, but we're flying completely blind without the ability to see the errors you're seeing.

As a second step, if those messages don't give enough info, there are special ways to run Arduino IDE or Teensy's command line discovery tool which can show a lot more info. Please mentally prepare yourself for needing to run those, and show us their messages.

But the first simpler step is to just capture screenshots running the softward the normal way you already know. I don't use Windows much so please understand this may not be perfect description, but I believe you can capture a screenshot to clipboard with the PrtSc button, maybe while holding shift or control key. If you don't want to show us your entire screen, open a graphics program. Even MS Paint will do. Create a new image and Ctrl-V to paste from clipboard. Then use the arrow tool to select just the part you want to show, and press Ctrl-C to copy to clipboard. Then here on the forum, just use Ctrl-V to paste the image right into your message.

We can help much more when we're able to actually see...
 
Last edited:
The IDE version.... I have two. 1.8.9 and 2.3.2. My go-to is 1.8.9 because I just find it plays much friendlier with everything.
I only have 2.3.2 because some stuff requires it.

But.... version 1.8.9 had been pretty bulletproof over the years.

Next time it throws a hissy, I will grab some screenshots.

When it does finally find it in the IDE, it often calls the Teensy 4.1 some weird HID35447*^%584 name for some reason (that isn't accurate).... but it does usually upload.
 
Back
Top