Writing here as we're a little bit stumped on what I thought was a simple design, but turns out to be much more complicated.
We want to have an arduino based system controlling either a high current load (such as high power LEDs), or a digital device (such as WS2812 ledstrip).This would be SW controlled of course.
Our original plan was to use an NPN transistor, with a design similar to this one:
Don't pay attention to the resistor values, they are just here as a reference
Design is quite simple really, 3.3V on the output of the Arduino (it's actually an ESP12, but from the principle it does not really matter as far as I understand), and 5V on the output.
Output GPIO of the ESP12 has an internal pull-up to 3.3V, so we don't need to add it on the gate (well... in theory)
To provide even more flexibility, we would like to be able to switch between 5V and 3V and 12V on the output reference voltage (using DIP switches)
- We can indeed drive loads with this setup, works fine
- However digital logic does not work in most cases. We can make it work for one reference voltage (ie 3.3V output), using appropriate tuned resistor values (and of course we need to pay attention to the signaling, since it's inverted, but that works), but we can't make it work with a 5V output with the same value.
What we don't get is why:
- Why would resistor values have such an impact
- Why would reference voltage have such an impact
- Why would the resistor values depending on the reference voltage ?
It's been many years since I looked into NPN transistor design (plus I was abysmal anyway at analog circuitry design - as proven here), but I would have assumed I could resolve this. No luck.
Again, we can drive a load so we know the transistor does activate when input pin is driven high (so output pin is driven low - we drive the load by the ground)
It's digital logic (frequency is at 800khz) which eludes us. WS2812 input is high impedance, so we tried to add a serie resistor on the output of the transistor to attenuate signal integrity issues, but that did not resolve the issue
Next step would be to add a scope and see what's wrong, but as a starting point : any guidance you could give ?