I am pretty new with electronics, and I am working on an arduino project that involves a led that must turn on and off very quickly. I want to integrate a push-pull system that drains any left over current faster. I know I need one pnp, one npn transistor, and some resistors, but I have no idea if I will need anything else or how to set one of these up with the hardware. I fully understand the software behind it though.
You might want to look at this How to get the best out of this forum before you proceed any further.
We only know what you tell us, and without knowing what you have, we don't stand a chance.
So as per the link above what is your schematic and code?
You do not even need that. In fact I am not sure why you think you do?
Why do you think you need something like that to simply turn an LED on and off rapidly?
Just look at the blink example in the IDE and change the delays in it to make it blink at what ever speed you want it to.
If you can't find it then here it is
/*
Blink
Turns an LED on for one second, then off for one second, repeatedly.
Most Arduinos have an on-board LED you can control. On the UNO, MEGA and ZERO
it is attached to digital pin 13, on MKR1000 on pin 6. LED_BUILTIN is set to
the correct LED pin independent of which board is used.
If you want to know what pin the on-board LED is connected to on your Arduino
model, check the Technical Specs of your board at:
https://www.arduino.cc/en/Main/Products
modified 8 May 2014
by Scott Fitzgerald
modified 2 Sep 2016
by Arturo Guadalupi
modified 8 Sep 2016
by Colby Newman
This example code is in the public domain.
https://www.arduino.cc/en/Tutorial/BuiltInExamples/Blink
*/
// the setup function runs once when you press reset or power the board
void setup() {
// initialize digital pin LED_BUILTIN as an output.
pinMode(LED_BUILTIN, OUTPUT);
}
// the loop function runs over and over again forever
void loop() {
digitalWrite(LED_BUILTIN, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(LED_BUILTIN, LOW); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second
}
Just copy and paste that into your Arduino.
What sort of Arduino do you have anyway?
My goal for this project is the beginning of an optical communication development project. I want to use Manchester style transmission, and apparently that requires extremely fast flashes, and just as a precaution, I don't want there to be any delay.
Then do not put any delay in.
Using digital write takes about 4uS. if you want any faster then use direct port addressing, where it will take 2 machine cycles. Depending on the sort of Arduino you have but still have not told us about.
It would have been good to know this extra information at the start. We don't like drip drip of information here, it wastes a lot of time by dismissing answers for reasons you have not disclosed previously.
No, Manchester encoding does not require rapid flashing. Optical communications can be done rapidly, but it doesn't have to be.
Thank you so much for the advice! At what general speed of flashing do you think a push pull thing would have to be used. By the way, I am really sorry about my ignorance towards the project. I am VERY new to all of this.
At no speed would a push pull system be necessary.
Where is this current left over from? That sentence makes no sense at all. There is no left over current. I am not sure where you got this idea from but where ever it was it is either wrong or you misunderstood what you were reading.
Is this a "school" project where certain prerequisites, such as driving the led with a discreet push pull circuit or using Manchester code, have been specified as part of the exercise?
What data transmission speed do you want (baud) ?
This isnt for school; im just playing around with some arquino stuff, and I need to provide a proof of concept similar to this to use high powered lasers.
"School project" in this context also includes any project with an "academic" or "research" type character where certain constraints must be observed. Experience of this forum shows that if constraints appear in a project which are not well grounded, then a disproportionate amount of the thread discussion if focused on alternative solutions, other than those mandated in the exercise, which the OP has to fight off.
Is the power supply for the led at higher voltage than the voltage output by the Arduino pin that will be controlling the switching circuit you are to develop?
You didn't answer the question about the transmission speed.
The arduino outputs are in fact push/pull by default.
Not that that is likely to mean anything when driving an LED.
For higher currents you could use an half h-bridge, as common for motor drivers. But that’s likely to slow down optical pulses more than a simple power/disconnected transistor switch.
Current is moving charges. The wire has charge that can be moved but when the force (EMF) that moves the charge is turned OFF, the circuit current in this case stops.
It is not like current in a circuit has inertia.
Suggest that you search and read up on Laser Modem.
Think of GND as being 100% pull for + charge, 5V and GND are already push and pull.
Hey, you can charge a wire that goes nowhere .. to a pin moded as INPUT that is not being read. When you read the AVR pin, the pin 'eats' about 1 microAmp of charge. Until then the charge is static/unmoving and it you drain the charge (make the pin OUTPUT LOW) then you get a brief current but only when the wire is grounded and for 5V in a jumper, brief is less than a microsecond.
The notion of left over current is confusing at best.
There is no such thing as a dumb question, except the one you forget to ask.
Perhaps she had in mind that a simple one-transistor level translator will work only up to certain speeds, e.g., something I did not know or managed to forget. Theory meets practice. Or transistors for dummies meets reality. Whatever.
And thought the same concern might obtain in the case of driving one LED with an AVR output pin.
As long a the current is neither to high or two low, it will switch the LED on and off with rise times near the pin's ability at frequencies attainable through code, no matter how.
I wonder if you have the testing equipment to measure the timing of the LED light you are attempting to use. How will you determine the different on/off times you are creating?
And completely wrong in concept. What is really there is the electrical charge in the capacitor formed by the wiring. That is why RS-232 was developed to allow data speeds greater than 120bps. That is why teletype used the polar relays to speed data between cities and that idea came from the use of polar relays for sending Morse code between cities.
IF the OP wants to take care of residual charges, they must force that to happen, not just open the circuit and hope.
Thank you for your advice. How would I force this to happen? Can you please give me some resources to look into about this? I really want to prevent any lag and reduce the time it takes for the current to enter and leave the light producing dioide
I think the first step is to eliminate the resistor commonly used to limit current and replace that with electronically limited current. The second might be to select LEDs with a very narrow spectrum of light, so only a single crystal is involved with the light generation. Third is to also select a LED with epoxy covering that does not distort or spread the emitted light.
And 4th might be to create circuit boards for your SMD LED with all associated circuitry on that board and minimal distance between the LED and the other circuitry.
Only when you reach the limits of your project, think of driving the LED with an IC that can reverse polarity, whatever that device might be.