A Simple Circuit concept to study biasing transistors

MrAl

Joined Jun 17, 2014
11,389
1. sensor on time. that sounds like a good idea. but the sensor needs time to stabilize once it goes on. also, during the stabilization period it squeaks out random out put signals.

2. currently it runs on 5v reg voltage. however it can run on 3.3 to 3.7. I use 3.7v lith batteries and it steps the out put to 5v. I use one of those portable back up phone charges only there are 3 and sometimes 4 batteries in parallel.

that's about to change and I will just power with the 3.7v parallel battery packs and figure out an undercharge circuit protection/ charging system later.

today I was met with a challenge. the 12v digital timer circuit with the mechanical relay "appears" (can't find a schematic) to always have 12v power going to it. and it seems that it uses the ground (and a transistor) to switch the electromagnet on/complete the circuit. I based that on the diode that protects from the collapse of the magnetic field.

it has 17 different ON/OFF capabilities and lets you choose what ever day or days you want it to operate, darn!

I am progressing nicely on my transistor studies so it hasn't been a wash out of a day.

I have learned something.

Hi,

Well if something takes too much time to boot up, then it may not make a good candidate for duty cycling. It depends on the required duty cycle too though. If it boots in 1 second and you only need to check the scene every 10 seconds, then you can power down for 8 or 9 seconds and power up for 1 second or so, and that may do it. If you need to see the scene every 2 seconds you cant save as much obviously. It is one of those things, may work for some sensors not for others. In some cases all you can do is increase battery capacity so you get longer run time.
 

Thread Starter

fredric58

Joined Nov 28, 2014
252
HI, I think I ran across one of your threads on the arduino forum about saving power. I continued on some other sites and see that one of the users removed the power on LED and the 5V reg.(this was the UNO, not the NANO and in sleep mode (which there are several options of) he brought down power consumption while asleep to .74mA. THAT'S A PRETTY DARN BIG DIFFERENCE!!! I believe he said normal operating consumption is around 40mA. Are you still investigating this and have you made any progress?
 

MrAl

Joined Jun 17, 2014
11,389
HI, I think I ran across one of your threads on the arduino forum about saving power. I continued on some other sites and see that one of the users removed the power on LED and the 5V reg.(this was the UNO, not the NANO and in sleep mode (which there are several options of) he brought down power consumption while asleep to .74mA. THAT'S A PRETTY DARN BIG DIFFERENCE!!! I believe he said normal operating consumption is around 40mA. Are you still investigating this and have you made any progress?
Hi,

I have not removed any regulator chips on any Arduino yet, but i have done a similar thing with my own circuit that used a 78L05 regulator, and even that was too much current for my application so i simply went to another type of regulator which had much less quiescent current.

I have not actually put the Arduino to sleep, i had done that on circuits that used the PIC chips. There is a way to do it with the Arduino circuits too but you'd have to look on the Arduino site to find that information.

I consider 740ua still too high for my applications though. I shoot for maybe around 200ua average. On an automobile application i may go a little higher though because they have bigger batteries and take a long time to run down. 740ua would be ok for a car circuit i think. I would probably be willing to go up to 1ma for that kind of app.
 

Thread Starter

fredric58

Joined Nov 28, 2014
252
ok, let me ask this. currently I use a LDR and a LM339 with hysteresis so I have a solid switching ON and OFF. it works very well. I originally designed it for an analog circuit. not knowing any better I use it in my nano project

it turns on at night, turns off in the morning. it isn't precise. it just has to be dark or light. what I mean by that is. in the back ground the nano checks the LDR circuitry every half hour, if the nano checks at 7:00 and hysteresis doesn't register dark till 7:01 it has to wait till 7:30 to turn ON. which is as precise as I need. same thing in the morning. it will be on or off within a half hour of dark or light,

I am trying to streamline and cut any thing redundant out of the project. this seems redundant. but I didn't think about it till just now. it's based on resistance and it is a fixed amount. if it is between X--+--X>-----------------<Y---+---Y. it goes on or off.
can a microprocessor be coded to simply READ the value/resistance of a stand alone LDR with a little (+) or (-) (for hysteresis) and do the same thing?
 

MrAl

Joined Jun 17, 2014
11,389
ok, let me ask this. currently I use a LDR and a LM339 with hysteresis so I have a solid switching ON and OFF. it works very well. I originally designed it for an analog circuit. not knowing any better I use it in my nano project

it turns on at night, turns off in the morning. it isn't precise. it just has to be dark or light. what I mean by that is. in the back ground the nano checks the LDR circuitry every half hour, if the nano checks at 7:00 and hysteresis doesn't register dark till 7:01 it has to wait till 7:30 to turn ON. which is as precise as I need. same thing in the morning. it will be on or off within a half hour of dark or light,

I am trying to streamline and cut any thing redundant out of the project. this seems redundant. but I didn't think about it till just now. it's based on resistance and it is a fixed amount. if it is between X--+--X>-----------------<Y---+---Y. it goes on or off.
can a microprocessor be coded to simply READ the value/resistance of a stand alone LDR with a little (+) or (-) (for hysteresis) and do the same thing?
Hi,

If i understand you right then yes, but of course the LDR has to be powered with current or voltage so the ADC can read that and calculate the resistance if that is what you need.

The code would go something like this...

Startup:
initialize
Loop:
turn on LDR
measure voltage
calculate resistance
determine on or off state of night light, turn on or off
turn off LDR
sleep(10 seconds or longer even)
goto Loop

Something like that would do it. The LDR may not have to be turned off if it does not draw much current.
 

Thread Starter

fredric58

Joined Nov 28, 2014
252
it does work, that's actually what I did when I did the nano project. it's set up as a voltage divider. nano would power it for a few mills, check it, then do what it was told. I forgot. I have made many many versions of this project. though each with a slight improvement over the last.
 

Thread Starter

fredric58

Joined Nov 28, 2014
252
this get funner every day. last night I learned how to put the arduino into a deep deep sleep. from it's operational 22ish mA current to when in sleep with .006mA with the watchdog timer running and it could be lower with a lower power supply. 3.7v instead of the 5v currently used. but this is a good start. so my LDR idea will work fine with a minimal amount of power used.

previously when it got dark my circuitry just turned the arduino on and it ran for 8 to 10 hrs (280mA)..........cause the PIR was powered through the arduino all night. I haven't had a chance to study this yet but still would like to raise the question. in stand by mode, the PIR if I recall runs on 1 micro amp. hmmmmmm

I've read a "little" about latch circuits. is this something that could be used so all the arduino would have to do when it registers dark is simply turn the PIR on through a latch circuit then go back to sleep (the PIR will be tied to the battery) and could it do the same thing in reverse "unlatch" when it registers light????? I'd be saving a boat load of milla amps

is latching worth studying or could there possibly be a more efficient way? that is the question for the day.

thanx
 

MrAl

Joined Jun 17, 2014
11,389
Hi,

Oh yes if the sensor only uses minimal power when operating then it does not have to be turned off at all. Did you say 1ua? That sounds very low, but if that is true then you dont even have to turn it off. As a guide i usually base my run time on AA alkaline cells not paralleled. With 1ua current a typical AA cell will run for about 228 years. Since that is longer than the shelf life of the cell, i would definitely say that 1ua is not a lot of current and is well within the reasonable constant current draw requirement for a battery operated device.
100ua will get you around 2 years run time so that's probably a good limit.
These are all based on running 24 hours a day seven days a week.
If you go to AAA cells then divide the run times by 2.
Button cells will reduce the run time by around 10 times, depending on the size. A 200mAhr button cell will reduce the run time by 10 times from the above calculated with the AA cells.
Since 9v alkalines are about 500mAhr, they will have a run time about 4 times less (about 25 percent run time) than above with AA cells. So if AA cells keep it running for 2 years a 9v battery will keep it running for about 6 months.
 

Thread Starter

fredric58

Joined Nov 28, 2014
252
so back to my question. I see all kinds of examples of latching switches but they all use push buttons. is it even possible to use an arduino
 

MrAl

Joined Jun 17, 2014
11,389
so back to my question. I see all kinds of examples of latching switches but they all use push buttons. is it even possible to use an arduino
Hi,

With an Arduino you can easily make a latched output pin. It has to be powered up though. You can still use it to change the state of a discrete latch however and that will hold the state you want to store even with the Ard power turned off.. For example if you built a two transistor latch (very easy) you can change the state with an Arduino output pin, then turn the Arduino power off. The two transistor latch is made from two transistor NPN inverters with the inputs and outputs cross coupled with additional resistors perhaps. The resistors should be high enough in value to limit current draw from the battery to a very low level. Two 100k collector resistors would limit the current draw to less than 50ua in a 5v system using two small transistors. Probably a couple diodes to connect to two Arduino output pins and that should just about do it (dont want to power the Arduino through one of it's i/o pins when its power is turned off).
 

Thread Starter

fredric58

Joined Nov 28, 2014
252
Mr Hobbyist, hello. I understand how to use a transistor as a switch now. but now I am faced with a challenge that I "think" could be solved with a logic gate. but I am still not sure. a transistor turns on when the right amount of current is applied to the base. that allows current to flow from the collector to the emitter. in it's simplest form. everything has a balance. that's understood.

in gate examples on the web most every one uses (2) push buttons, the momentary kind and usually switch from one LED to another (latching circuits). I'm sure this can be done just need to be pointed in the right direction. a signal, can it be used in place of a momentary push button switch to switch on a circuit? and when the signal is emitted again, switch said circuit off. specifically a signal from a micro processor. I could have (2) different in put pins if I need another one.

I see in logic gates that sometimes when they have multiples, the output from another gate is fed back through the second input of the first gate, the first signal would be from the processor so the output would be true, the second gate goes to the other input of the first gate, so it's still true, (it's "and or") but the processor shuts off, and it is still true. that "could be a switch" and go to the base of a transistor. that's with a question mark.

it isn't really worded correctly but I think you get the idea?

thank you.

.
 

Thread Starter

fredric58

Joined Nov 28, 2014
252
mrAI, that came in while I was writing. so it is possible????? the arduino can power up for a moment switch the switch and go back to sleep.

now how do you get out of it? or turn it off? that's where I get stuck.
 

hobbyist

Joined Aug 10, 2008
892
in gate examples on the web most every one uses (2) push buttons, the momentary kind and usually switch from one LED to another (latching circuits). I'm sure this can be done just need to be pointed in the right direction. a signal can, it be used in place of a momentary push button switch to switch on a circuit? and when the signal is emitted again, switch said circuit off. specifically a signal from a micro processor. I could have (2) different in put pins if I need another one.
Sure can, the latches are designed to take electronic switch control. No need for manual switching.

If you have 2 separate outputs from the driving source, you can have one output connected to one side of the latch and the other output to the other side of the latch.
That's bilateral switching. If done discreetly it only takes 2 transistors and 4 resistors.

If you have only one output signal, then you would need to implement a logic circuit, called a Toggle flip flop, people on the board could direct you to what IC's would work for that, as I'm only a discreet component hobbyist.

A toggle flip flop would change states every time it recieves a input signal, usually these flip flops are edge triggered, mostly on the rising edge.

Hope this helps.
 

MrAl

Joined Jun 17, 2014
11,389
Hi again,

Simplest example i can think of is the two transistor latch. The output of one drives the others input.
To switch stages, pull the high collector down to near zero volts with an Arduino pin. The other collector will go high. Once you go back to high impedance state for both Arduino pins, the latch holds the last state you put it in. You may get away with just two NPN transistors and two collector resistors although we could try this in a simulation. I mention this because you can use high values resistors and draw little current, but i suppose a CMOS flip flop or cross coupled inverters would do the same thing.
I'll draw a circuit a little later today if you want to try it in simulation or real life circuit.
 

Thread Starter

fredric58

Joined Nov 28, 2014
252
yes I have seen the flip flop. I will study how it performs. usually they are simply switching LED's on and off but I kinda get the idea that there is a signal switch and looks to be a rather simple application. direction is always appreciated.
 

Thread Starter

fredric58

Joined Nov 28, 2014
252
Hi. this is/was/might be something new...... a simple on off switch. with a LED. (in the dotted line) forget about resistor and cap values right now.

ok, this is a stand alone circuit. I want to break into it and switch on a load. that would be my PIR. using a transistor for a switch. (in the circle)
because I don't want to power it with the aurduino it appears it will have to run all the time. which I don't like. because it will run 24/7, consume power, when the PIR is off and when the PIR is on. so I guess this is where you check to see which would be better. run with the on off switch which shuts down the PIR for say 10 hours. or just run the PIR 24/7? that's for another day.

my question is since it's using the same power source to register the over or under value of the stabilized voltage divider. how do I hack into it to use a signal from the arduino to flip flop on and off?
 

Thread Starter

fredric58

Joined Nov 28, 2014
252
yeah! mr hobbyist and AI, thank you both, especially mr hobbyist for the fantastic tutorial on transistor switches. it was right in front of me. the push button on the above 555 flip flop circuit is replaced with...... wah-lah "a transistor". a momentary signal from the arduino will go through a resistor to the base opening the circuit. depending on which state the 555 is in it will flip and lock on till it is flopped. I know I took the long way to get there but I learned about other things as well along the way. which gave me more ideas as well as questions. this is great fun. I sincerely appreciate the time you devoted and your instructions. I learned exactly how to accomplish the task. there may be a more efficient to do it which I will find out as I learn more. I haven't built it yet but I'm pretty sure it will work based on what I have learned so far. many thanks again. I will post my findings.

ps, I have a lot more questions : )
 

MrAl

Joined Jun 17, 2014
11,389
Hello again,

Looks a little complicated. Look for a CMOS flip flop with set/reset inputs.

In the attachment you will find a circuit that acts like a set/reset (SR) latch.
The voltage source V2 and diode act like an Arduino output pin (i/o pin set as output).
When the V2 'pin' goes low, it changes the state of the latch and it stays that way.
The way to get it back to the original state is to use another Arduino pin to pull down the other collector.
BTW the cap is there just to force the circuit to start in a known state with the Q2 collector is high, as shown by the waveform for that output.


With a CMOS SR latch you would just use the S and R inputs.
A toggle flip flop is harder to use because you dont know what state it will start up in.

To use the Arduino pin set the output to low state to switch FF states, then set it to high impedance, or use a diode as shown. The diode here is 1N4148. The diode would be needed if the Arduino power was removed but not needed if it is not removed.

So you need two small transistors and four resistors, or a CMOS SR latch.
 

Attachments

Top