I have an application that needs to sink up to 12mA for a GPIO pin. It looks like the R4 can only sink 8mA max. What are some good ways to protect it? I'm using the GPIO to generate a 60Hz square wave to drive some cameras.
Put a buffer after your 60 Hz signal.
Any part you can recommend?
You can use just about any NPN transistor, with a 1K-10K base resistor as an inverting buffer. 2N2222, 2N3094, etc.
HIGH on the Arduino output pin produces LOW at the collector.
I'm pretty new to all this, so this may be a obvious question.
- Any reason I shouldn't put the load on the emitter side?
- If I put the load on the collector side, should I instead use a pull up resistor and tie the load to the shared ground?
If it makes any difference, I have 6 device in parallel, and the max current draw for each is 400uA when high, 2mA sink when low.
It makes a big difference because I don't think either circuit shown so far would work for you.
If you tell us what these "devices" are maybe someone can suggest the proper circuit.
This circuit would work without any problems. But without knowing what you are switching this answer is currently the best answer I can give to resolve your question. Posting links to technical informationm will help a lot.
Link: Using MOSFETS with TTL levels (5 Volt and 3.3 Volt) – Arduino, ESP8266, ESP32 & Raspberry Pi stuff
What I'm trying to do is to drive 6 Basler cameras to synchronize image capture, each over a 10m GPIO cable. It's just a 60Hz TTL signal for synchronization, so the load will be tiny. My main concern is the 2mA sink for 6 camera, and any potential long cable issue that I'm not aware of.
The camera spec says:
- Current draw (high-level): <100 μA
- Sink current: Your application must be able to accept 2 mA sink current from the GPIO input line without exceeding 0.8 VDC.
logic 0 is 0-0.8VDC, 1 is >2VDC, safe range is 0-5VDC.
The cable spec is ≤142 Ω/km
So my math is that driving all 6 in parallel means the max draw is 6x100uA, max sink is 6x2mA.
Just for my own education, what is the problem with the above simple transistor buffer?
Thanks!
what is the problem with the above simple transistor buffer?
For a logic 1 it doesn't supply >2V
For logic 0 it will depend on the MOSFET
You need one of these
If I use one of these buffers, do you recommend I drive each camera off one output, or just connect all the GPIO wires to a single pin? Do you have any pointers to circuit diagram that I can use as a reference?
Do whatever results in the most convenient wiring. All to one or 2 on 1, 1 on 1.
The device can easily source and sink 24mA on each output
You can connect all 8 inputs together and drive them with 1 GPIO
So use one R4 output to drive 3 shutters, and another R4 output to drive the other 3 shutters. That way you stay within the limits of the R4 pins. Any delay between the first output and the second will be negligible and way too small to see, as firing shutters is many orders of magnitude smaller than the shutter's firing time.
Nothing, but you proposed putting them in the emitter, and that is what Jim was responding to. This configuration is known as an emitter follower, where the voltage on the emitter follows the voltage. BUT with a voltage shift of Vbe (voltage between base and emitter) which is a minimum of 0.7V.
Without knowing what you are aware of it is impossible to answer what you are not aware of. See my problem.
Long wires will pick up interference, the capacitance will slow down the signal and eventually swallow it and the resistance of the cable will slightly reduce the voltage that arrives at the other end. Or in the case of pulling down might not pull down far enough to be lower than 0.8V.
Interesting. I'm planning to use the PWM output to drive the camera. Do you think it's possible to drive both of the them off the same timer?
Why on earth are you going to do that?
It makes no sense to me.
I was going to set it to 60hz and 50% duty cycle. That should just be a normal square wave, no?
Each of the GPT timers on the R4 drives two pins. If you choose the two pins carefully so that they're on the same timer then it should be simple to keep them in sync.
The tone() function can be use for that.
tone()
Do you actually know how to configure a timer on the RA4M1 processor?