PDA

View Full Version : IR Question not directly related to Teensy 3



taskman
05-30-2013, 11:28 PM
I am trying to get more light from my IR LED. I am using the TSAL6100 http://www.vishay.com/ir-emitting-diodes/list/product-81009/
Currently I have it connected directly to one of the pins of the Teensy 3 and I wonder if I haven't just been lucky that it didn't burn the pin out, I do have a +-1k ohm resistor on it, but I used a 5 ohm resistor last night

So the questions
I read the Teensy 3 pins supply 3.3V so I have been supplying 3.3V to the LED. I am planning on running the Teensy 3 on a LifePo4 3.3V battery that can supply 20A+
Now looking at the datasheet of the LED it seems it can run at 3V max and draw 1.5A current if it is on for less than 100 us. Is this correct? So I can use the the 2N2222 transistor principle, same as when I need to run a motor at high current (http://forum.arduino.cc/index.php?topic=148611.msg1116551#msg1116551) to run the LED? According to this website http://led.linear1.org/1led.wiz if I enter the values 3.3, 3, 1000 it shows I can use a 1 ohm, 2W resistor. I will probably go double for safety. Will this blow the 2N2222 transistor? What kind of damage can I do?

This is my IR pulse code. The IR LED is only on for 8 us and then cools down for 8 us so it is well under the 100 us on time when using 1.5A. I have read some people don't even use a resistor when using this LED in their laser tag gear. They probably also use some kind of transistor or mosfet?


void IrCommons::pulseIr(unsigned int messagePart) {
byte firstWaitTime = 8;
byte secondWaitTime = 8;

unsigned int count = (messagePart / PULSE_TIME) + 0.5;
for(byte i = 0; i < count; i++) {
digitalWrite(IrSendPin, HIGH);
delayMicroseconds(firstWaitTime);
digitalWrite(IrSendPin, LOW);
delayMicroseconds(secondWaitTime);
}
}


Sorry probably babbled more than asking

PaulStoffregen
05-30-2013, 11:53 PM
Now looking at the datasheet of the LED it seems it can run at 3V max and draw 1.5A current if it is on for less than 100 us. Is this correct? So I can use the the 2N2222 transistor principle, same as when I need to run a motor at high current (http://forum.arduino.cc/index.php?topic=148611.msg1116551#msg1116551) to run the LED? According to this website http://led.linear1.org/1led.wiz if I enter the values 3.3, 3, 1000 it shows I can use a 1 ohm, 2W resistor. I will probably go double for safety. Will this blow the 2N2222 transistor? What kind of damage can I do?


Plenty of damage is possible with those numbers!! 1.5 amps is crazy.

The datasheet mentions a pulse current of 200 mA max. I'd recommend using that as an upper limit.

You should connect the LED+resistor between the 2N2222 collector and the positive for the battery. Do not try to power it from the +3.3V pin on Teensy3.

The LED is 1.35V, the 2N2222 is saturation voltage is probably about half a volt, and your battery is probably 3.7. That means about 1.85 volts on the resistor. For 200 mA, use 9.25 ohms (or something close, maybe round up to 10 ohms). Do NOT use a wirewound resistor. Almost all resistors over 1/2 watt are either wirewound or very expensive, so read the fine print if using a big resistor. You want a non-inductive resistor, like ordinary metal film. Power in the resistor will be 0.37 watts while on, so if you run a low duty cycle a 1/4 watt resistor should be ok.

Actually, I would start with a 22 ohm resistor for testing, then swap it to 10 or 9.25 ohms only after everything is definitely working!

The 2N2222 transistor will have a current gain of about 50, so you need at least 4 mA in the base to saturate it. With 3.3V from the pin and 0.7 on the base, you'll need 650 ohms to get enough base current (and that's based on my guesswork). I'd round it down to 560 or 470 ohms. Don't go below 260 ohms between the Teensy3 pin and the 2N2222 base.

taskman
05-31-2013, 12:02 AM
Cool thank you. Glad I didn't blow $20 last night lol

taskman
05-31-2013, 01:09 AM
Do you know of a digital variable resistor I can use for this? I can use pins 16 and 17 if it is an I2C chip. The chips I have found are all in the thousands of resistance, e.g. 5k/10k and so on

I need to be able to digitally control the range of the weapon so I need to control the intensity of the LED. I don't think I can't change my pulse code because that will change the frequency so then the hits will not land, because the message will change

Maybe another idea?

taskman
05-31-2013, 02:38 AM
Looks like this guy uses transistors to lower the distance
http://letsmakerobots.com/node/22720

Seems he has different pathways each with different resistors. The more ranges I want the more pathways and the more transistors and the more pins I will need if I went this route

So this is the plan
V+ -> resistor + LEd -> IR message Transistor (2N2222 collector) -> Ground


Lets say I do this to change the brightness
V+ -> resistor + LEd -> PWM Transisor -> IR message Transistor -> Ground

If I use PWM and a transistor to reduce the voltage, will the IR message transistor sometimes receive no power? Does the transistor block off power and let power through very very fast when using PWM? Does it have noticable drops in power at the 8 us speed that I am pulsing the IR LED?

PaulStoffregen
05-31-2013, 11:12 AM
I'm confused by your use of the term "PWM", which ordinarily means "Pulse Width Modulation". Over time, PWM emulates analog intensity because the observer (eg, a human eye) responds slowly. But in this application, we're talking about fixed width pulses required by some type of IR receiver, not a low bandwidth observer that will naturally low-pass filter rapid pulses to observe different intensity.

Normally when talking about electronic circuitry, a schematic and "reference designators" (eg, "Q1", "Q2", "Q3" for transistors) are used. Maybe if you post an image here of the schematic you have in mind, with every part labeled by a reference designator, then we can talk more clearly and meaningfully about it?

taskman
05-31-2013, 12:46 PM
Please have a look at the idea, but this is probably not going to work. As you say PWM works for the human eye, not for a circuit that pulses at 8 us

522

taskman
05-31-2013, 12:47 PM
I tried using the Teensy 3 diagram, but went over to the Teensy 2, because the Teensy 3 isn't finished yet

taskman
05-31-2013, 12:59 PM
This is the second idea, but I don't like it much because I need more and more transistors for the different distances of the weapons and it is "hard coded". It will be great for marketing if I can say 200m range down to 0m range completely configurable dynamically. All other weapons have 2 to 4 "hard coded" distance settings

523

taskman
05-31-2013, 01:01 PM
This is kind of what I think I want to do. Just don't know yet how I can use a DAC to reduce the voltage or current. I know nothing about a DAC. Thought it was just for sound

http://www.maximintegrated.com/app-notes/index.mvp/id/4025

PaulStoffregen
05-31-2013, 04:55 PM
Those circuits might work, but they don't use NPN transistors the best way.

For this project, rearrange things so the emitter of every transistor connects to ground. Always connect a resistor to the collector. If you use more than 1 transistor, connect each of those resistors to the cathode of the LED. Then connect the LED anode to the battery positive.

Always connect a resistor from the base of the transistor to the Teensy pin driving it. So for every transistor, you should have 2 resistors, one on the base and the other on the collector.

Hopefully that's clear enough so you can try a new schematic?

taskman
06-01-2013, 05:47 AM
Is this what you had in mind? The app doesn't like what I did

525

taskman
06-01-2013, 06:06 AM
I am wondering if this can't work

I tested some pots today and they are tight to turn, but they probably loosen with time as all screws seem to do
I have a mini servo here from an electronics kit. My plan is to use the servo to change the pot. I can 3D print an adapter I believe to connect the servo to the pot. So that will give me a hybrid mechanical/digital variable pot. I can then pulse the servo every minute or maybe everytime someone shoots just to make sure the pot is still in the right place. The pot will make sure the transistor gets the right amount of current and the transistor can do the job of pulsing the IR LED

526

Jp3141
06-01-2013, 06:12 AM
I don't have time to draw (or test) this, but basically you can use 1 transistor to PWM the IR LED on- and off with a 8 us cycle, and a 2nd transistor to adjust the current that will flow when the LED is on:
Do supply..LED..Q1_collector..Q1_emitter..Q2_collecto r..Q2_emitter..5_ohms..GND
Drive Q1's base via your PWM output and the previously recommended base resistor of ~ 270 ohms (actually you can go lower). Drive Q2's base from a PWM (let's call this PWM2) output of the Teensy (this creates an analog signal when averaged) through another 270 ohm and add a capacitor from the base to GND. The 270 +cap will filter the PWM2 to generate an average voltage on the base; the current that can flow in the LED is (VBASE-0.7)/5_ohm. So by adjusting the PWM2 value (from 0..255) you can adjust the current available when PWM1 pulses on.

You'll need a relatively large capacitor (try 10 uF). Basically this creates a variable supply for the LED -- just like a DAC.

There are many parts of this that might not be robust over temperature and other variations, so you'll need to be careful. One improvement could be to replace the LED..Q1_collector..Q2_emitter... above with a PMOS FET ==> V+..PMOS_source..PMOS_drain..Q2_coll etc. Drive the PMOS gate directly from the PWM1 output (the sense is inverted now -- 90 % duty cycle corresponds to 10 % on). You'll need a PMOS that operates with low VGS.

taskman
06-01-2013, 06:34 AM
Kind of like this?


528

PaulStoffregen
06-01-2013, 11:10 AM
Is this what you had in mind? The app doesn't like what I did

525

Yes, like this.

If you scale R9-R12 properly (by powers of 2), you can have 15 different current levels through the LED, depending on which transistors you turn on.

taskman
06-01-2013, 12:45 PM
Nice. I will try this setup and the setup of Jp3141. I feel proud of this tiny circuit. Thank you for the help

taskman
06-02-2013, 12:39 PM
Some feedback.

The idea of Jp3141 works, I just need to fix the capacitor and then see what happens. I am using a 100nF capacitor, because it is all I have at the moment

My IR signal starts with a header of 900

When I pulse Q2 (distance reducer) at 254 everything is perfect, ofcourse because it is the full power going through the LED
Going down to 250 I get an error message about every 5th time, the header is still 900, but there are errors, the wrong command is sent. Weapon 1 shooting weapon 2 actually change the team of weapon 2. That could be a big problem in the field :)

When I change the pulse to 244 I start getting alot of error messages, the header comes through as 200 or 600 or some other number. I tried to compensate by changing the pulse speed of Q1 down to 1 microsecond delay to 15 microsecond delay. It didn't make much difference

I hope if I fix the capacitor I will get less errors

I will let you guys know, ordering capacitors tonight

taskman
06-02-2013, 12:59 PM
Will this capacitor work at 3.3V? It says its rated voltage is 6.3V to 100V. Will it still output 3.3V if it is fed with 3.3V?
http://australia.rs-online.com/web/p/aluminium-capacitors/7110911/

The only capacitors I can find close to the 3V range are these, but they are all in the 100's of uF
http://australia.rs-online.com/web/c/passive-components/capacitors/aluminium-capacitors/?searchTerm=capacitor&sort-by=P_breakPrice1&sort-order=asc&view-type=List&applied-dimensions=4294508473,4294517959,4294826632&lastAttributeSelectedBlock=4294958851&sort-option=Price

PaulStoffregen
06-02-2013, 04:54 PM
Capacitor voltage ratings are the maximum voltage that capacitor can handle. You always want the voltage on the capacitor to be less than the maximum rated voltage it can take.

It's much like current ratings on power supplies or AC mains. If you have a AC socket capable of 15 amps (the rating of the breaker or fuse), it's ok to draw anywhere from 0 to 15 amps.

Capacitors have a lot of other complex issues to consider. No capacitor is perfect. Usually the non-ideal properties are modeled as an equivalent resistor and inductor in series with the capacitor. The type of material in the capacitor really matters. For larger values, the construction of the metal also matters. In this case, you probably want a ceramic type capacitor, because the ceramic ones work very well at higher frequencies (low ESR and ESL). Ceramics come in several quality grades denoted by 3 letter codes. NP0 and C0G are the best (those two designations mean pretty much the same thing). For this job, X7R and X5R might work fine too. You probably want to avoid the lower quality Y5V and Z5U types.

You might be able to eliminate R1 and Q1 completely from that circuit, and just connect the LED cathode to Q2's collector. The LED will turn off when the voltage at Q2's base falls below about 0.7 volts.

R2 and C1 form a low-pass filter, so you'll get an analog voltage at the base of Q2. The voltage on R3 will be approximately that base voltage minus 0.7 volts. So for PWM which makes more than 0.7 volts at Q2, current will conduct through the loop which goes through the LED.

This circuit has limited voltage range. Assuming the battery is about 3.7 volts and the LED uses about 1.4 volts, the voltage at the collector of Q2 will be about 2.3 volts. Q2 needs about 0.5 volts between collector to emitter to work, which imposes an upper limit of about 1.6 volts at the base of Q2, before raising the voltage higher doesn't result in more current through the LED.

Of course, the low-pass filter of R2 and C1 limits the speed you can change the LED current. Look at the waveforms on this PWM page (http://www.pjrc.com/teensy/td_pulse.html) to see the trade-off between filter response and the shape of the waveform.

Using Q1 might be nice, so you could leave the PWM at a desired value (and let it slowly achieve that voltage before turning Q1 on and off). But Q1 will eat up another 0.5 volts (approx), so you'll be limited to about a very small range of 0.7 to 1.1 volts on the base of Q2. Below 0.7 and Q2 turns off. Above 1.1 and the saturation voltage of the 2 transistors comes into play, preventing you from getting much more current. Also, be aware these are not perfectly hard limits... the transistor does conduct slightly with less than 0.7 volts and you do get slight increases as the transistor goes farther into saturation, but they are diminishing returns. The range that will give a nice fairly linear response in LED current to applied voltage from the PWM is the region where Q2 is between off and saturation.

Jp3141
06-02-2013, 07:58 PM
Any of those caps will work. Higher voltage rating caps are physically larger then low voltage ones, but will work fine. If you use an electrolytic cap (tantalum or aluminum), be sure to get the polarity correct (there's a + and - on them).

taskman
06-02-2013, 11:47 PM
Seems when it comes to ceramic I need multilayer. All multilayer ceramic caps that are 1uF and higher with quality of C0G or X7R are on back order at RS electronics.

taskman
06-03-2013, 10:31 AM
Are the pathways I drew right?
Are these resistors in parallel?

I had a look at resistor parallel calculations and I can't see how to setup the resistors. Lets say I use 5 ohm at R9 and 25 ohm at R10 and I switch on Q1 and Q2 then my resistance will be 4.1 ohm according to the calculators. How should I use this circuit?
If I pulse Q2 and it is in the off state then electricity will just bypass it and flow to the LED so I won't get a pulse, will I?
Should I pulse the transistors on/off that I want the path to flow through, e.g. Q1 and Q2 at the same time?

537

Jp3141
06-03-2013, 04:49 PM
Yes, this wil work. Note that Paul said to use resistors in a power-of-two ratio -- e.g. 5, 10, 20 ohms. This forms the elements of a DAC. Now if you just drive 1 transistor, you will get 100, 50, 25 mA (example). If you need finer resolution, you can drive combinations as in a binary number -- so for 125 mA, drive Q1 & Q3 (== binary 101). For 75 mA drive Q2 & Q3 (== binary 011) etc. Note this circuit doesn't have enough inherent accuracy to be worth increasing the DAC to more than the 3 bits shown.

PaulStoffregen
06-03-2013, 07:48 PM
That 4-transistor circuit looks right. Of course, actually building and testing it is the real test.

Jp3141 is correct about the resistor values. For a highly linear DAC, you'd probably need to adjust them slightly to compensate for the differing transistor saturation voltage with higher current, but if you just use approximately 10, 20, 40 and 80 ohms it should come out pretty close.

I would also agree, beyond 3 or 4 bits is probably worthless for more resolution unless you tune things very carefully. Then again, binary weighting for a linear scale may not be the best for your application. Maybe you want 4 really high currents and 3 relatively low ones?

taskman
06-04-2013, 12:43 AM
I will test the 4 transistor circuit also this week while I wait for the capacitors to arrive. Not sure if the capacitor version will work, because I couldn't get the good capacitors

I was thinking of making R9 5 ohm or what ever is needed not to blow the LED and get max range
I will make R12 XXX ohm (to be decided) to get the lowest possible range to make sure the IR signal doesn't bounce in a dark room.

This will make the product available for indoor and outdoor laser tag/skirmish. I will then look at what I want to R11 and R10.

Does that sound like a plan?

Jp3141
06-04-2013, 03:29 AM
That'll work. Note that you can still enable more than 1 channel at once to get higher current, but if the resistor ratios are 2:1 or more, it won't actually make much difference -- your range depends on the sqrt(current), so 50 % more current only gives ~22 % more range.

If you want uniform 'steps' from just enabling 1 channel at a time, the optimal ratio between R's is cube_root(R12/R9) (when you have 4 channels like you have here).

taskman
06-04-2013, 05:09 AM
I created a spreadsheet that I can use to play around with. I should have time this week to write the code and see what it does and I will have to go buy a bunch of different resistors

https://docs.google.com/spreadsheet/ccc?key=0AjYcEd1WlkqCdGYtNmhXV3ViOGswd2VGbm9KY0ktW Gc&usp=sharing

Looking at the datasheet they start at 1mA in the one graph and 1V in another so I assume that is probably the minimum the LED needs to light up. I will probably need to make sure I can produce at least that much power just before the battery doesn't have enough power for the processor anymore. The LifePo4 battery seems to be flat at 2.5V. So I am thinking I need to look at what resistor I need when the battery is at +-2.6V and I want 1V 1mA at the LED. Seems I need to have a 1800 ohm resistor. This will take alot of playing around in a dark small room, bigger dark room and out in the open. In my spreadsheet I have 15 ohm and 30 ohm and then 1800 ohm and 2700 ohm. This gives me 3 settings for outdoor and 3 settings for indoor. That is about equal to other manufacturers where they normally have 4 settings. So I will at least be better there with an extra two settings. The 2700 ohm resistor will give me the minimum power when the battery is full. Seems I will need to create a battery monitoring circuit and then as the battery drops I change the range setting automatically. I don't think anybody else in the world does that. Lots of code, great for marketing :)

taskman
06-05-2013, 01:12 PM
I built the circuit and started testing it. Currently I am using resistors I have at home, all 470 ohm. I am also using my PS 3 remote control for power. The 1.5V * 2 AA batteries don't seem to deliver much so it also keeps the circuit safe. I am still waiting for my batteries from Hobbyking. When I measure amps on the IR LED I get 60 uA max. When measuring amps on the resistors on the side of the collectors of the transistors I don't see any amps, probably not doing it right.

White/Yellow wires are negative. I ran out of black, they are in use in other circuits. Strange how they supply so few black wires for negative in these wire packs, but tons of other colours

http://www.flickr.com/photos/92380311@N04/8958044189/
http://www.flickr.com/photos/92380311@N04/8958041847/

PaulStoffregen
06-05-2013, 07:20 PM
With the 4 transistor circuit, there are 16 possible current combinations (including all off).

If you're only going for 3 short range and 3 long range settings, it should be possible with only 3 transistors and careful selection of the resistors.

taskman
06-05-2013, 11:01 PM
I see the problem I had with the circuit was the test circuit I built into it. I was shorting out, because of the red test LED's and their power supply. I removed their power and I could test the resistors. Tonight I will remove the LED's since I know the circuit is working now. I will change the code tonight so that I can pulse more than one transistor and see if the message comes out correct.

I would like as many range settings as I can get. I will know more as I do more testing and when I get my real batteries. In this setup, using 470 ohm resistors my range is really short. No bounce in a small dark room. We will see if I maybe need one of the pins used for range for something else. I have all my pins planned


Off topic for this thread, but just excited to share. Using every pin on the Teensy now. Need to remove the headers from my other Teensy's on my breadboards and turn them around so that I can get to the bottom pins. I think when I am done I need to send you a kit or two Paul, just supply your own Teensy :)

My pin use
Ground to 12
LCD 1
WEAPON CHANGE
Sound 2 (future)
IrReceivePin
Muzzle BLUE_LED
Muzzle GREEN_LED
IrSendPin
Muzzle RED_LED
MOSI (LCD 3)
Sound 1
RF TX
RF RX
LCD 7
LCD MISO (LCD 9)


Ground to 13
LCD 2
Team RED_LED
Team GREEN_LED
Motor control
DC (LCD 4)
SD CARD FAT (LCD 5)
Team BLUE_LED
RELOAD BUTTON
LCD BACKLIGHT BUTTON
TRIGGER
CS (LCD 6)
LCD 8



28 to A12
IR SEND 1
IR SEND 2
LOW POWER LED
CAPACITIVE HAND SWITCH


DISTANCE MEASURE



29 to A10
IR SEND 3
IR SEND 4
LCD 10 Backlight
SECOND RELOAD
SECOND TRIGGER

Temp sensor
Tilt sensor
Battery voltage measurement

Jp3141
06-06-2013, 03:27 AM
I ran out of black, they are in use in other circuits. Strange how they supply so few black wires for negative in these wire packs, but tons of other colours


Usually the electrons don't care which color wire they are in, but you can never be too careful !

taskman
06-06-2013, 03:36 AM
lol, nee more characters so here is another lol :)

taskman
06-11-2013, 11:55 AM
My setup so far. Sound and range on IR are working. I contacted the sound module company to find out how much the sound chips are, maybe I can build a tripple module so that I can play 3 sounds at the same time
http://www.flickr.com/photos/92380311@N04/9014521243/
http://www.flickr.com/photos/92380311@N04/9015716368/

I don't have the correct resistors yet, was focussing on getting things to work before I ordered the right resistors

I am testing with a 5 ohm resistor on R9. Wow, the light is bright when I use the video camera. When I place the multimeter over the 5 ohm resistor it measures 01.23 mA. When I place it on the LED it measures 01.85 mA. I doubt that it is 1.85 mA, but if it wasn't then the pin would have been gone by now. That is too bright for +-1 mA. Maybe it is 18.5 mA. R2 reads 1.68 mA. All resistors, except R9 are 470 ohm 5% resistors. So I might be close to burning out another pin maybe if it is really close to hitting the 20 mA range

I was reading up about transistors and they say divide the current by 10 or 20 you want from the emitter and that is the current needed on the base to fully saturate. So if I want 100 mA I need 10 mA on the base. If I want 1000 mA on the emitter I need 100 mA on the base. Ofcourse that isn't possible, I will burn out the pins. So I am going to see if I can replace my transistors with Mosfets. I have 2N7000 mosfets that I use for my motor. I think I used them on the Arduino so they activated at 5V, still need to test if they activate at 3.3V

Jp3141
06-11-2013, 07:10 PM
I was reading up about transistors and they say divide the current by 10 or 20 you want from the emitter and that is the current needed on the base to fully saturate. So if I want 100 mA I need 10 mA on the base. If I want 1000 mA on the emitter I need 100 mA on the base. Ofcourse that isn't possible, I will burn out the pins. So I am going to see if I can replace my transistors with Mosfets. I have 2N7000 mosfets that I use for my motor. I think I used them on the Arduino so they activated at 5V, still need to test if they activate at 3.3V

Beta is the parameter of a transistor that describes the ratio of collector current (similar to emitter current) to base current. A high beta device would generally work better. For home use (i.e. not high volume manufacturing), most devices you see will be better than a beta of 20.

MOSFETs will be better for this system, but you should look for 'logic level' FETs -- they have a lower threshold (turn on) voltage. Note that a FET doesn't turn on completely at the threshold votlage -- that's just the point where it begins to turn on substantially. With FETs, you won't need a R in series with the gate. A tradeoff between FETs and NPNs is that it is easier (generally) to calculate the voltages in an NPN circui, and so the currents you get will be determined mostly be the resistors you use -- with MOSFETs, the FET characteristic (and VGS) will also have a significant effect in your circuit -- you will get variations with temperature and supply voltage.

taskman
06-11-2013, 11:10 PM
how is this mosfet?
http://australia.rs-online.com/web/p/mosfet-transistors/6714736/?searchTerm=6714736&relevancy-data=636F3D3126696E3D4931384E525353746F636B4E756D6 265724D504E266C753D656E266D6D3D6D61746368616C6C267 06D3D5E5C647B367D247C5E5C647B377D247C5E5C647B31307 D2426706F3D313426736E3D592673743D52535F53544F434B5 F4E554D424552267573743D363731343733362677633D4E4F4 E4526

If I am reading it correctly on page 2, 3V will be the max needed to turn on the gate?

taskman
06-12-2013, 12:07 AM
According to MarkT here http://forum.arduino.cc/index.php?topic=125728.0 I need to look for 4.5V on the Rds line
So this one might be the right one http://australia.rs-online.com/web/p/mosfet-transistors/4866337/
The pulse is much higher than what I need (40%)
It has 4.5V in the Rds line. I just don't know how many volts I need to get it to deliver 1A. Looking at the graphs 3.3V is maybe going to give me 0.2A so I might need a logic level converter between the Teensy and the Mosfets if I am reading the graphs correctly. The input of the logic converter will then be the 2.6V that I want to run at and the output will be 5V

taskman
06-12-2013, 02:23 AM
I found this tutorial http://jeelabs.org/2011/02/07/easy-electrons-%E2%80%93-mosfets-part-2/. He uses 3.3V and the Mosfet can be powered from as low as 2.5V. If I understand the graph, powering it at 2.5V will give me 1A. I can't figure out what I need to do to get 2.6V 1A

The guy recommends this mosfet http://australia.rs-online.com/web/p/mosfet-transistors/5411247/. At least I can get it, just very expensive. Probably fine for building for now, can always try to find a cheaper alternative later

Jp3141
06-12-2013, 03:18 AM
how is this mosfet?
http://australia.rs-online.com/web/p/mosfet-transistors/6714736/?searchTerm=6714736&relevancy-data=636F3D3126696E3D4931384E525353746F636B4E756D6 265724D504E266C753D656E266D6D3D6D61746368616C6C267 06D3D5E5C647B367D247C5E5C647B377D247C5E5C647B31307 D2426706F3D313426736E3D592673743D52535F53544F434B5 F4E554D424552267573743D363731343733362677633D4E4F4 E4526

If I am reading it correctly on page 2, 3V will be the max needed to turn on the gate?

No, this won't work. The threshold V on a MOSFET is the voltage just needed to start it turning on - but it's not 'fully' on. You can see on Fig. 1 that with 3 V on the gate, it will only run about 0.1 A

Jp3141
06-12-2013, 03:24 AM
For your purposes, think of a MOSFET as a variable resistor. When the gate is less than the threshold, the resistance is infinite. As the gate goes higher than the threshold, the resistance decreases (equation is approx. R = Rmin/(VGS-VTHRESHOLD)). In addition, there is a maximum current it will conduct -- this varies significantly with gate voltage, and but for your circuit you need to ensure you have enough VGS that this is never a constraint -- therefore, you may need to buy a FET rated at (say) 30 A max, think of this really as a parameter related to the resistance, not that you should only used it in applications running that much current. The other expensive FET above may be more suitable for you -- notice that it is a 'logic level' device.

taskman
06-12-2013, 03:37 AM
Thank you. I started searching on Digikey for more logic level parts and then search for each part on RS to see if they have it. If RS has it I am keeping the details about the part and then I will go through each one to look at the stats

Does the Rds resistance mean anything to me?
What does this mean? Rds 4 ohm @ 1A, 10V or 8 ohm @ 100mA, 2.8V

taskman
06-12-2013, 04:04 AM
Am I reading this right?
Figure 1 on page 3
http://docs-asia.electrocomponents.com/webdocs/0791/0900766b807910ef.pdf

If I have an input of 1V to 10V at the Drain and I have an input of 2.7V at the gate I can get > 10A at the source? That might be a bit too much :) What will the voltage be at the source? I have a feeling the Rds has something to do with that and I am probably going to lose something somewhere

Jp3141
06-12-2013, 05:03 AM
RDS is the resistance between drain and source -- this is the resistance that changes from infinity to lower value as the gate voltage is increased. It does change slightly with drain current, but that shouldn't matter for your application -- so 4 ohm @ 1 A, 10 V means that the FET looks like a 4 ohm resistor with 10 V on the gate -- in fact it won't change more than a few % if the current is 1 A, 2 A, or 1 mA.

Jp3141
06-12-2013, 05:08 AM
Am I reading this right?
Figure 1 on page 3
http://docs-asia.electrocomponents.com/webdocs/0791/0900766b807910ef.pdf

If I have an input of 1V to 10V at the Drain and I have an input of 2.7V at the gate I can get > 10A at the source? That might be a bit too much :) What will the voltage be at the source? I have a feeling the Rds has something to do with that and I am probably going to lose something somewhere


Yes you are, but your system isn't like that ! Remember in a FET, the same current flows into the drain as flows out the source. With 2.7 V, the FET looks like at 0.03 ohm resistor. So--yes--if you have 1 V on the drain and 0 V on the S, you'd have 30 A flowing; in your system, the LED and other components would limit the current, so you wouldn't actually have 1 V between D and S -- think of a resistor divider -- one element is your LED + real resistors, the other is the RDS of the FET.

taskman
06-12-2013, 05:55 AM
I think I found my mosfet
http://docs-asia.electrocomponents.com/webdocs/0791/0900766b807913a6.pdf


It is available, always a big + :)
It is 0.68c
2.5V on gate allows 700mA
2.6V on gate allows 800mA.
2.7V on gate allows 900mA.

LED typical V = 2.6V with a max of 3V and 1A so I will be below the 3V and 1A and right on the typical V if I have a 2.6V circuit

So I am thinking get the regulator that will give me 2.6V. It might switch off at 2.7V from the batteries. That might also be the minimum discharge I want to push the batteries to**. I can run the Teensy from 2.6V and then power the gate from the Teensy with 2.6V - losses. Supply the mosfet drain with 2.6V from the regulator and get 2.6V - losses from the source into the LED.


** p.s.
Some say you can even take the batteries down to 2V. I will have to test what the charger is happy with that I have, I know I discharged before too far down and it didn't want to charge the batteries anymore. I had to charge them as lead acid and then as a different type and only after that could I charge them as LifePo4.

taskman
06-12-2013, 06:38 AM
I can use this regulator
http://docs-asia.electrocomponents.com/webdocs/0d11/0900766b80d1114d.pdf

Power my circuit at around 2.6V, I will have a look at the resistors
If it runs at 2.6V it will switch off when the battery is down to 2.8V

Maybe I should look at the fixed version of 2.5V, but I don't know if the Teensy will produce 2.5V on the pins if it gets 2.5V as input

PaulStoffregen
06-12-2013, 12:59 PM
I was reading up about transistors and they say divide the current by 10 or 20 you want from the emitter and that is the current needed on the base to fully saturate. So if I want 100 mA I need 10 mA on the base. If I want 1000 mA on the emitter I need 100 mA on the base.


First, you can buy a NPN transistor with beta higher than 10 to 20.

The other approach that works well is using 2 transistors in a darlington configuration. You can also buy darlington transistors (2 inside), but for rapid switching it's sometimes better to have 2 separate transistors so you can add a resistor to the emitter-base connection that would be inaccessible if you use a single package with both transistors inside.



Of course that isn't possible, I will burn out the pins. So I am going to see if I can replace my transistors with Mosfets. I have 2N7000 mosfets that I use for my motor. I think I used them on the Arduino so they activated at 5V, still need to test if they activate at 3.3V

You can use mosfets, but they add many other design challenges. In addition to the higher voltage required (already mentioned here), the mosfet gate is essentially a capacitor. If you need the mosfet to turn on or off rapidly, it can be challenging to charge or discharge that capacitor rapidly. Even though the mosfet needs virtually zero current to remain on, very large pulses of current can be needed to go from off to on rapidly.

From this discussion, it sounds like you're tempted to use the mosfet as a voltage controlled resistor. That is a very challenging design. The main problem is very tiny changes in voltage result in substantial changes in resistance, and the exact voltage where that change occurs varies with temperature and is different from one mosfet to another, even among two identically labeled parts from the same batch.

To make a mosfet-as-resistor application work in a practical application, you would probably need an opamp and carefully designed feedback loop that senses the current and controls the mosfet voltage. It's not impossible, but quite difficult. Aside from just the challenge of designing any opamp circuit (other than the very standard ones), a huge problem is the opamp's ability to drive the capacitive gate of the mosfet. Many opamps can't drive large capacitance at all. Even if they can, perhaps by a series resistor, placing a mosfet in the feedback loop adds significant phase shift which causes the feedback to become unstable. Usually circuits like that have very creatively designed feedback loops where the sensed current effects the opamp feedback at low frequency, but at higher frequency a second feedback path without the extra phase shift is used for stability. That can make the feedback stable, but then the whole system can have strange response to changes, so it requires very careful analog design. Definitely not a good beginner electronics project! In fact, it's so difficult that mosfets are very rarely used that way.

However, it is relatively easy to build a voltage-to-current circuit with an opamp and a NPN transistor, or even without an opamp (as previously discussed) if you're willing to accept a limited voltage range and some inaccuracy from the not-always-0.7 base-emitter voltage.

There are a lot of difficult trade-offs in an analog circuit design. I still believe the 3 or 4 transistor circuit mentioned earlier, with each transitor's emitter to ground and binary-weighted resistors between each collector and the LED is probably the simplest and easiest to accomplish your goals. The low beta value problem is fairly easy to solve, either by buying a better transistor or using 2 in darlington mode.

taskman
06-12-2013, 07:21 PM
Thank you. I will read up more about the darlington mode and low beta value. I would like to keep it as simple as possible and the current design does work. I just need more power captain :)

Jp3141
06-12-2013, 08:17 PM
You have 2 requirements which tend to conflict -- 1: you want to turn on and off quickly, and 2) you want variable currents. Ultimately these tend to require separate circuits -- one to determine the value of current and one to switch this on and off.

Given that you only have a small set of distinct current values (and little experinence in analog circuit design !), your safest approach would be to go with Paul's 1st suggestion -- for each value of current you need, use a R and a FET to GND. Drive each FET directly from a T3 I/O port. Since your currents are << 1 A, actually nearly any FET would do -- you just need its RDSON significantly less than the value of the R you are using (and at the 3.x VGS you can drive the FET to) so that variations in FET characteristics, temperature, and T3's supply V don't cause additional variations.

Now, if you find that you need currents in an integer set of ratios, you can save a few components and do a binary-weighted set of R's: So for 7,6,5,4,3,2,1,0, you would use R's in a 4:2:1 ratio, and drive the 3 ports with the binary value corresponding to the current level you want.

taskman
06-12-2013, 11:32 PM
My other conflicting requirements are to use what I call the brain (component containing the bulk of the electronics) in an indoor gun, outdoor small/medium/large gun, respawn box, domination box, night games, wireless headset and I want to be able to swap a brain from a component that is broken, e.g. respawn box is broken, replace its brain with that of a spare gun. The different tasks for the brain need different ranges, e.g. pair headset with a gun I need ultra low range so that a player doesn't pair to another gun by accident and so on

The problem is if I use low ohm resistors I will have full power on the LED and the full power brain/LED can't be used indoor or with night games, because the signal bounces too much. I don't know how to have a brain that can work for indoor and outdoor and night games and the headset, except if I build different brain components for the specific task, but then if someone buys the outdoor brain they will have problems playing night games. Operators that run games indoor normally don't run outdoor, but outdoor go everywhere. Also having different brain components made will cost more when placing orders and there is a chance of a wrong brain going into the wrong product

I received my batteries today. They have a minimum V of 2V and a maximum of 4.2V. I was thinking of the idea of two different regulators so that I could run the gun off one battery without vibration or two batteries with vibration, but then I have to give up using full capacity and add complexity. So I will just use the batteries in series and I am going to look at a regulator that I can supply with 8.4V and get 3.8V. 3.8V out means it will probably switch off when the batteries reach around 4.1V. The 3.8V will be enough for the Teensy, LED's and the eInk screen that I want to maybe rather use. I need to test and make sure the sound card can work at 3.8V. I will probably change to a 3V vibration motor. Then I can also use 3.3V mosfets or if I can find low beta value transistors maybe use them.

I think I am moving forward, everything is just so confusing, trying to cram so much info in such a short time

Have to say again, thank you very much for your help guys. Without you this would have not gone further than just code.

taskman
06-13-2013, 02:27 AM
I found a voltage regulator that will supply 3.3V 5A. It is the lowest cost one that is above 1.5A. Its dropout will be around 0.9V when everything is active so it will stop regulating when the batteries reach around 4.2V. That gives me a buffer for the batteries and keeps it simple not needing any extra resistors to configure the regulator

http://docs-asia.electrocomponents.com/webdocs/0aab/0900766b80aab29b.pdf

Been reading up on the darlington configuration and trying to find resistors with low beta values. I will try to test the darlington configuration this weekend

taskman
06-13-2013, 05:29 AM
I found a circuit simulator. Do these numbers look about right? I created a darlington configuration

570

Jp3141
06-13-2013, 01:59 PM
A Darlington has a larger drop than a single transistor -- its the sum of the VBE of the 'big' device (say 0.7) + VCE of the small one (say 0.3). Your LED could require up to 2.6 V -- so this won't work reliably from 3.3 V.

It can also be slow -- you can connect a R between B and E of the big device to speed it up -- use 100 ohm in your case (if you are trying to get peak LED currents of 1 A)

Alternatively, connect the C of the small device directly to the 3.3 V supply via a R. Calculate that R from (3.3 - 0.7) / I_LED * BETA. Say 1 A and beta = 20, so 52 ohm. Remember this will load the 3.3 V supply's regulator with 50 mA.

Now calculate your base drive R as (3.3 - 1.4) / 50 mA * BETA = 760 -- use 820 ohm.

If you are using linear regulators, then there is no energy advantage to driving the LED from their 3.3 V output as opposed to directly from the battery. However, the current would be more regulated, since it won't change with battery voltage.

Also, the R in series with the LED will dissipate about 1 W -- need a physically large one there (or use a parallel combination of four 1/4 W ones).

So, instead you could do:

directly connect small transistor (Q1)'s base to the T3 port (no R).
Q1's C --> battery
Q1's E -- > Q2 base (no R)
100 ohm from Q2 B to GND
Q2 collector directly to LED; LED to battery
R from Q2 E to GND.

R will have 3.3 - 0.7 -0.7 = 1.9 V across it; calculate the LED current from I_LED = 1.9/R_EMITTER.

Again be careful with power dissipation. With 2*4.5 V on battery = 9 V max, the current will be 1 A, and (at 100 % duty cycle) you'll dissipate a total of 9 - 2 (LED) = 7 V @ 1 A == 7 W. The R will take 2W, Q2 5W -- scale these numbers by duty cycle, and put a heatsink on Q2 !

taskman
06-13-2013, 11:21 PM
I will build the circuit this weekend and also order some components to play with. My sound card doesn't work at 3.3V so need to figure something out there

I created it in the simulator. It seems there isn't any power going through the LED in the simulator
Simulator URL http://www.falstad.com/circuit/
Simulation
$ 1 5.0E-6 0.09591894571091382 46 5.0 50
t 320 224 352 224 0 1 0.0 0.6881476784910641 10.0
t 400 240 448 240 0 1 0.6923513223019795 0.6947341404797529 10.0
w 320 224 256 224 1
g 400 368 400 384 0
162 448 160 448 224 1 2.6 1.0 0.0 0.0
R 256 224 192 224 0 0 40.0 3.3 0.0 0.0 0.5
R 352 128 352 80 0 0 40.0 3.3 0.0 0.0 0.5
r 400 240 400 320 0 100.0
g 448 368 448 384 0
r 448 256 448 320 0 30.0
w 448 320 448 368 1
w 400 320 400 368 1
w 352 128 352 208 0
w 352 240 400 240 2
x 300 198 332 204 0 24 Q1
x 62 232 160 238 0 24 Teensy 3
x 466 246 498 252 0 24 Q2
x 468 171 604 177 0 24 2.6V 1A LED
R 448 128 448 80 0 0 40.0 3.3 0.0 0.0 0.5
w 448 128 448 160 0


571

Jp3141
06-14-2013, 12:29 AM
Run the LED directly from battery instead of from the 3.3 V supply -- that will reduce that supply's load and size.

It might be possible to increase the 100 ohm to 1k; it all depends on speed you need to turn the LED off at.

taskman
06-14-2013, 12:44 AM
I fixed it, thank you. Didn't know there was a difference between a voltage source with 1 output and voltage source with 2 outputs in this app
Changing R1 in the simulator to 5 ohm and R2 to 1k shows Q2 circuit going at lightning speed.


$ 1 5.0E-6 0.09591894571091382 46 5.0 50
t 320 224 352 224 0 1 -1.7000000000000002 0.6661567681358074 10.0
t 400 240 448 240 0 1 0.14852093290504031 0.7242761217250777 10.0
w 320 224 256 224 1
g 400 368 400 384 0
162 448 160 448 224 1 2.6 1.0 0.0 0.0
R 256 224 192 224 0 0 40.0 3.3 0.0 0.0 0.5
r 400 240 400 320 0 1000.0
g 448 368 448 384 0
r 448 256 448 320 0 5.0
w 448 320 448 368 1
w 400 320 400 368 1
w 352 128 352 208 0
w 352 240 400 240 2
x 300 198 332 204 0 24 Q1
x 62 232 160 238 0 24 Teensy 3
x 466 246 498 252 0 24 Q2
x 468 171 604 177 0 24 2.6V 1A LED
w 448 128 448 160 0
v 448 80 448 128 0 0 40.0 5.0 0.0 0.0 0.5
w 448 80 624 80 0
w 624 80 624 368 0
w 624 368 448 368 0
w 448 128 352 128 0
x 469 297 499 303 0 24 R1
x 327 286 357 292 0 24 R2
x 567 392 669 398 0 24 Q2 circuit
x 267 103 369 109 0 24 Q1 circuit

572

taskman
06-14-2013, 12:53 AM
It seems when I remove the LED from the circuit the amps going into Q1 increases to almost 40 mA so that will blow up the Teensy
If I add a 170 ohm resistor between the Teensy and Q1 base and the LED blows the Teensy seem to be safe

LED alive
573


LED dead
574

taskman
06-14-2013, 01:04 AM
Can package type IPAK fit in a breadboard?

Jp3141
06-14-2013, 01:26 AM
Why would you remove the LED ?

taskman
06-14-2013, 01:33 AM
If it blows up it will be like it is not in the circuit anymore. That was my logic

AnalysIR
07-06-2013, 12:57 PM
@taskman re your code in post#1

Do you really need to turn IR on/of for 8 uSecs? If no, I recommend using PWM on the relevant pins and just enabling/disabling the PWM on those pins as needed. his means that you code wont be blocking. I am not sure if laser tag is a standard and if it specifies a 8 uSecs toggle. If not you should consider using IR modulated at between 30-60KHz, particularly if you are operating outdoors, otherwise you will get big solar interference. These modulation frequencies were originally chosen as the Sun emits at a lower level in this range. We are always looking to add new IR protocols to our project and will look into laser tags to see if there are any common standards.

If you change to using a modulation frequency, then pick one that isn't being used by common TV remote controls. Also, you are likely to experience big issues with reflection/bounce indoors. Although, I haven't seen a perfect solution for this, there are ways of mitigating this problem. Let us know the details of any issues and we may be able to help.

@pjrc - Does teensy V3 have a similar granularity of 4 uSecs as the standard Arduinos, using delay microseconds?. If not V3 may open up some new possibilities for our own IR projects. We have also been following your efforts with faster serial via USB and hope to play with your ideas when we get some time. We have a crowdfunding project and will add Teesnsy V3 as one of the new platforms for backers to vote on for inclusion.

For anyone interested in IR you can find out about our project on http://igg.me/at/AnalysIR/x/3752156

Chris

taskman
07-07-2013, 01:36 AM
Hi

Thank you for your input. I haven't had time to look at my range code or the IR code for a couple of weeks while I have been waiting for the parts for the range setting and working on my sound. I am using TSOP1156 (http://www.vishay.com/docs/82006/tsop11xx.pdf) that needs signals at 56 kHz. The 8 uSec time between pulses seem to give me the least amount of errors, but I am currently developing indoors and haven't tested it in direct sunlight yet. I am basing my protocol on the protocol of the current laser tag weapons that we own, but with a twist. They seem to require around 6 uSec between pulses to work correctly.

I actually created a new protocol, well I think I did :) Normally, what I have seen, IR protocols only use the high to transmit values with then a constant pause between pulses. I use the high and the low, but I also have a separator between the parts of my message, e.g I might send player ID of 1 and I would just pulse a 600 (600 = high in my case). Normally protocols would send a full byte so they would send 00000001. I just send 1 with a separator. The calculations that I did showed that only when you reach the 200+ players does my protocol start taking longer to transmit. I think the world record for the maximum number of players has been 400+ so you don't normally have that many players. Actually I am busy packing for a game at 14:00 for 5 players. The other thing my protocol allows is 65000 players, 65000 different teams, 65000 different damage modifiers and so on. Other companies have many many limits. If my processor gets more memory some day I can change from uint16_t to maybe something bigger and bam I can handle millions of players. Not that I need it. Maybe when I am done and I see I have memory to spare I will change to something bigger than uint16_t just so I can say I can handle a couple million players, great for marketing :)

I also switch off interrupts while I transmit so that I can make sure the message gets to the other side. We have noticed with the guns we use in our business that you shoot and the message just doesn't arrive on the other side or the wrong message arrives on the other side. We have seen that when player 1 shoots player 2, player 1 could even change player 2's team, because of an error in the message. We have seen some strange things where a player shoots another player and the message gives the other player unlimited lives. Ofcourse I still have a long way to go and alot of testing still needs to be done. Hopefully I won't have the same problems.

AnalysIR
07-07-2013, 02:44 AM
OK

First thing is the TSOP you are using is effectively EOL and you should consider something like TSOP38456, TSOP58456 or TSOP31456 instead.

Second, it seems the 8 usecs you mention is half the period of the modulation frequency, which works out at 62.5 KHz. I believe 9 uSecs is closer for 56KHz ( works out at 55.5KHz & may improve accuracy). I suggest you study up on the make-up of IR signals before sending more time on it as you will hit a lot of dead ends before you get it right (if at all). A good place to look is sb-projects (google sb-ptoject IR) - it goes thru all the basics.

When designing your protocol you need to look at and optimise for the following:
- modulation frequency
- duty cycle
- timings for headers, Marks & spaces.
- encoding for bits (pulse width or mancester encoding)

Then you need to take your conclusions and match them up with the right IR receiver ( looking at AGC, Half intensity angle). The TSAL6100 you have already is probably the best for range and narrow angle (+/- 10 Deg = 20 deg )

I suspect you will definately hit problems in sunlight without appropriate mitigation for Sun outdoors and also reflection/bounce indoors.

Another, way to increase numbers could be to use different modulation frequencies & different bit encoding schemes for different teams - would avoid friendly fire also :) during the game.

Best of luck with your efforts & let us know if you hit specific issues with IR & we will try to help out.

(I will have to read up on IR use in laser tag, as I am curious now)

Chris

--------------------------------------------------------------
For anyone interested in IR you can find out about our project on http://igg.me/at/AnalysIR/x/3752156

taskman
07-11-2013, 10:43 PM
I installed the mosfets (http://www.vishay.com/docs/91322/91322.pdf) and resistors this week and I have been trying to figure out what is wrong. It seems I am not getting full power from the LED. I compared the light with the light from our current laser tag guns. Their light makes a nice completely filled white circle. Mine makes a circle with little black spots. Think of a flash light with a low powered battery. I added extra wires between the voltage regulator breadboard positive and negative to the main breadboard positive and negative in the hopes that I don't lose power through wires as can be seen on the left side of the main breadboard http://www.flickr.com/photos/92380311@N04/9263204287/. I also added alot of extra wires between the positive and negative lines of the main breadboard


My voltage regulator supplies around 3.7V to the circuit. I measured it in 3 different places to make sure I get the correct power
Here I measure between the battery negative and the Team LED
http://www.flickr.com/photos/92380311@N04/9263204287/
http://www.flickr.com/photos/92380311@N04/9263204535/
http://www.flickr.com/photos/92380311@N04/9263204737/

Here I measure between the battery negative and the IR LED positive pin. IR LED is off at this point. When I measure across the IR LED when it is flashing I see around 300mV with my multimeter
http://www.flickr.com/photos/92380311@N04/9265980862/
http://www.flickr.com/photos/92380311@N04/9265981220/

Measure between the battery negative and a wire going into the breadboard
http://www.flickr.com/photos/92380311@N04/9265980196/
http://www.flickr.com/photos/92380311@N04/9265980746/




This is my mosfet setup. Looking at the left mosfet, the yellow wire is from the Teensy 3 going into a resistor. I tried no resistor up to 460 ohm and nothing changed. The resistor goes into the Gate of the mosfet. The white wire comes from the negative of the IR LED and goes through a resistor into the drain. I also tried no resistor here and still didn't get full power. The black wire goes from source to negative/ground of the breadboard and then to the battery
http://www.flickr.com/photos/92380311@N04/9265981092/
http://www.flickr.com/photos/92380311@N04/9265981092/

I can't measure the Amps. When I place my multimeter in the circuit the light doesn't come on and 0 amps are displayed on my multimeter. I don't know if it is because my multimeter can't handle the fast switching or if there just isn't enough Amps and the multimeter is consuming what ever is available.

When I measure the Voltage with my multimeter I see around 300mV on the meter. I tried using my oscilloscope and I also only see around the same amount of mV
http://www.flickr.com/photos/92380311@N04/9265981576/

I ordered a different mosfet (http://docs-asia.electrocomponents.com/webdocs/0791/0900766b807910ef.pdf) with a lower Rds. I read that might make a difference. If that doesn't work I will try the mosfet driver (http://docs-asia.electrocomponents.com/webdocs/0c91/0900766b80c91a9c.pdf).

AnalysIR
07-11-2013, 11:20 PM
Sorry
I cant make much sense of your setup. When debugging a circuit like this, I sometimes try to isolate the part I am testing so as to remove any unintended confusion with other parts of the circuit. Maybe just set up your LED driving circuit on its own breadboard and then test.

If you are looking to drive high current thru your IR LED, I did a bit of searching and found the guys over at Miles Tag (http://www.lasertagparts.com/mtdesign.htm) to be the experts they are driving very long range IR using current, special LEDs and most importantly good quality Optics (lenses). I suggest you read the whole site as it seems to be the source. They also publish their own IR protocol and have an Arduino section as well.


Best of luck with your project.
---------------------------------------------------------------------------------------------------
Support our project for AnalysIR - IR Decoder & Analyzer GUI(Arduino & Raspberry Pi) by visiting http://igg.me/at/AnalysIR/x/3752156

taskman
07-11-2013, 11:57 PM
Good idea. I will move just the IR to its own breadboard and see how it goes

I have actually been busy with my gun development since December 2012 I believe. I have written over 10 000 lines of code if you combine the battlebox, headset, gun and Android controller code. Miles Tag website was one of my resources I used in the beginning. I bought lenses from the same people they get their lenses from and I am using the IR LED that they recommend and sell. I also reversed engineered the IR signal of our current guns that we bought to see what they do and that is where I learnt the trick of using the High and Low to encode the commands. My messages are sent correctly. I have implemented more than 70 commands already and have some abilities built into the guns that I haven't seen anywhere else.

I believe it is now just hardware issues and that is where you guys come in because I am a junior when it comes to electronics :)

Thank you for your help

stevech
07-12-2013, 09:47 PM
56KHz... ok. most consumer IR uses 38KHz. But either is OK. - - the IR receiver as a filter tuned for one or the other. I think most 56KHz IR is in the super high end home theater gear - from the EU.
The IR receiver needs to be optically shielded from ambient light from windows and ceiling. Must have an optical filter to reduce ambient light too.
It needs Vcc that is super clean - decoupled with a low value resistor, a beefy electrolytic and a good RF bypass - to get rid of all noise on Vcc.

Consumer Ir I've worked with needs carrier on/off times (bit times) corresponding to about 1Kbps - due to the filter bandwidth width in the IR receiver. And most IR codes have a long start bit - like carrier-on for several mSec before data.

Miles (I work with that) uses much more sophisticated modulation methods and consumer IR - as the Vishay is intended for.

taskman
07-13-2013, 10:59 AM
With 6.5V I am not blowing the LED and I am getting the brightness I am after. It is probably reducing the life of the LED, but I am still only reading a couple hundred mV over the LED. This is most likely why the guns we have use 7.2V NiMh, charged to 8.5V or so. Probably also because they use old PIC micro chips that probably need 5V. They probably push the full voltage through the LED as what I am doing now. I am going to increase my voltage to 9.9V and see if it blows the LED. Charging up my whole pack before I add the extra one so can only test tomorrow night again when it is nice and dark and easy to test IR. I should get my mosfet driver in about a week and I will see how that goes. I ordered a non-inverting. Hopefully that is right. Reading on other forums it seems inverting you need to switch the PWM signal around

I am not allowed to take the batteries lower than 2V so minimum of 6V then for 3. If I setup my regulator to supply 5.7V I will probably be very close to the 6V switch off, but 5.7V is too much for the Teensy and probably the sound card. I am thinking to just add a diode to reduce it the little bit that is needed. The extra voltage might also give me full volume on the sound card, seems it doesn't like 3.7V much, can only get to 15/30 volume

taskman
07-13-2013, 02:31 PM
10V doesn't make any difference. I think the mosfet just doesn't open enough

taskman
07-24-2013, 11:15 PM
I am using this driver now http://docs-asia.electrocomponents.com/webdocs/0c91/0900766b80c91a9c.pdf and it doesn't seem to make a difference. I also moved the circuit to its own board so that there is very little that could cause a problem, still no difference. I will try some of my old basic PWM test code that I use for other things tonight to see if it isn't maybe something to do with the code

I tried increasing my delay time between pulses from 8 to 18 and no difference.

What is strange is if I use the 3.5V from the regulator and I connect that to the LED mosfet and to the driver I do get light, but if I connect 6.6V (batteries directly) to the driver and still 3.5V to the LED mosfet nothing happens. I thought maybe the gate voltage isn't allowed to be more than the drain voltage so I connected 6.6V to the driver and to the mosfet and still nothing happens. I then connect 3.5V again and I have light so the LED doesn't blow when I do this. The battery is the same one that powers the regulator so everything is grounded correctly I believe. I even moved the positive and negative of the battery to the mini circuit to make sure I don't have some grounding issue, that didn't help, still no light at 6.6V

I still can't measure the amps. When I have the ammeter between the LED and the mosfet the LED doesn't switch on and I get no reading

Maybe I should take a video of what I am doing or go see an electronics workshop or maybe go see the guys at the hacker space. I must be doing something wrong, should have blown the LED by now with all the power I am passing through it. Actually tried 3 different LED's from the pack to make sure I didn't maybe damage the LED with the power, no difference

stevech
07-25-2013, 12:41 AM
An ohm meter will tell you if the LED failed.
If you have a common low cost digital meter, it will have volts and amps. But since the LED is pulsed, and the current flow is not DC, the meter will try to average.

taskman
07-25-2013, 12:53 AM
I do have a low cost $100 meter so to really measure what is going on I need a high cost Fluke or something like that
My oscilloscope should give me an idea of the voltage at least, but not the amps?

I am starting to think to go on with the rest of the project so that I at least have something and then try and fix these kinds of problems later on.