NerdKits - electronics education for a digital generation

You are not logged in. [log in]

NEW: Learning electronics? Ask your questions on the new Electronics Questions & Answers site hosted by CircuitLab.

Basic Electronics » When powering an inverter, my LCD becomes blank

February 12, 2010
by Frozenlock
Frozenlock's Avatar

My problem of the day:

My LCD becomes blank when I turn on my inverter.

The GND pin of the inverter is connected to a transistor controlled by my MCU, effectively giving me the ability to start or stop my oscillator. When I turn it on, my LCD goes blank and stay that way. A reset doesn't help. I literally need to remove the +5V wire and put it back for my LCD to live again.

I tried to add a big capacitor between the GND and the +5V, in case one of them was disturbed by the oscillation, but no visible results.

Any thoughts on what might cause this?

Thanks in advance!

Frozenlock

February 13, 2010
by BobaMosfet
BobaMosfet's Avatar

You're going to have to give a bit more description. My questions:

  1. Which oscillator are you referring to? The one providing timing to the MCU?
  2. How much current does your inverter draw?

If you are stopping your crystal oscillator, that stops everything. Including the display.

If your inverter is drawing too much current, the entire circuit will collapse.

It is important to really understand voltage and current before one build electronics. If understanding is poor, the expectation (outcome results) are usually different than reality-- which only confuses one even further.

BM

February 14, 2010
by Frozenlock
Frozenlock's Avatar

No, it's not the crystal to the MCU.

I do remember that this chip had a tendency to become warmer than the orders. It might, as you suggest, be drawing too much current. I will try to add a resistance to limit the consumption. Thanks!

February 14, 2010
by BobaMosfet
BobaMosfet's Avatar

Frozenlock-

You need to get the spec sheet for your inverter and see how much current it needs. Adding a resistor isn't the answer. Your circuit might not be able to provide enough current at all to power the inverter (for example, what if your inverter requires 2amps?). In which case, as soon as you try to control the inverter, your circuit collapses under the demand. c

Please advise on what you find.

BM

February 15, 2010
by Frozenlock
Frozenlock's Avatar

Some news:

My IC wasn't heating up, I confused it with another inverter I used prior to this one.

After some tinkering in the C code, I realized that the LCD was in fact able to stay open. It seems I just can't send new info when my inverter is running. I think my MCU simply stop working, as one of the next command after turning on the inverter is to turn it off.

The inverter's datasheet says it tolerates a maximum of 50mA.

When I checked with my multimeter, something weird happened. Usually it goes as usual, with my MCU jamming and the board using about 200mA. But once in a while, my multimeter read a consumption of 160mA, and the program kept running! (I have some cues showing on the LCD, to know what is the last sent command.) It might be nothing, but I wanted to give every info I have.

February 15, 2010
by BobaMosfet
BobaMosfet's Avatar

Frozenlock--

Thank you that helped. Please explain to me (or provide a schematic) of how you have the inverter connected. I believe I can help you fix this fairly quickly. :P

BM

February 15, 2010
by Frozenlock
Frozenlock's Avatar

Here is the schematic.

Inverter Rather complicated, I know ;-)

What I wanted to do: I need to COUNT the number of oscillations before an exterior event occur. I can't use the MCU, because the oscillator is going way too fast.

I use an external counter IC (not in the schematic). With it, my MCU can take all the time it needs to retrieve the data.

How it works:

I can control when the oscillator start with the MCU. When the MCU's output is set to +5V, a small current activate the transistor and power up the first inverter. The trigger signal is set at GND.

This signal is inverted to +5V, then again to GND. This allow the second inverter to power up, and it starts to oscillate with the crystal.

When my trigger signal is HIGH, the GND of the second inverter is set to +5V, disabling the second inverter. Now, even if the trigger signal return to low, the first inverter is stuck in a loop, which gives enough time to my MCU to retrieve the data. Then, it can reset the first inverter if other oscillations are needed, or simply power it off.

When the trigger signal is sent just a slight moment after the oscillator started (and I mean a reallllllly short time), the program runs smoothly.

Frozenlock

February 15, 2010
by Frozenlock
Frozenlock's Avatar

Ok, no, it doesn't run smoothly at all...

February 15, 2010
by Frozenlock
Frozenlock's Avatar

I think I've found something interesting... I forgot to put a diode between the trigger signal and the inverter.

trigger

Could this be problematic?

February 20, 2010
by BobaMosfet
BobaMosfet's Avatar

Thanks, I'm looking at what you've posted now-- sorry for the delay.

BM

February 20, 2010
by BobaMosfet
BobaMosfet's Avatar

Can you post your part Numbers (what is your transistor, op-amp, and crystal?). I just want to be sure I get the proper datasheets.

BM

February 21, 2010
by Frozenlock
Frozenlock's Avatar

The transistor (2n7002E), the resonator (CSTCE8M00G55-R0) and the op-amp (lmh6702).

Sorry for MY delay, I've been really busy!

February 22, 2010
by BobaMosfet
BobaMosfet's Avatar

Frozenlock--

I've got more questions than answers. Your 'schematic' is incredibly confusing. It can't even be wired as your schematic suggests and work. Not only does your schematic not reference all the pins, but the way you have them connected is confusing.

Your FET is a voltage switching transistor, not current. Why you have a 220K Ohm resistor for R4 is a mystery. Why you have both sides of your FET tied to Ground is confusing. You tie one of the outputs of an inverter (4Y to GND) and well, honestly, your circuit doesn't make any sense.

I feel like the schematic does not match what you've created. Can you take a picture of what you've created and post that so we can see the actual connections and ask questions?

BM

February 22, 2010
by mongo
mongo's Avatar

Here is a simpler way to do the same thing from what I can decipher...

Instead of an inverter to be the oscillator, try using NAND gates or NOR gates.

A crystal across a gate, (either one) with both inputs together is essentially an inverter oscillator.

One gate for an oscillator, One gate for the oscillator output buffer, which prevents loading the oscillator and affecting the stability of the crystal.

The next gate, feed one input with the ocsillator buffer and the other input with your trigger and the final output is a switched signal at the oscillator frequency.

The difference between the NAND gates and the NOR gates is the phase shift in the output wave form and the polarity.

Typically, these are CMOS chips, as they have high input impedance and work well with crystals. The 74HC series also works well and at higher frequencies.

If you wish, I'll upload a quick sketch.

February 22, 2010
by Frozenlock
Frozenlock's Avatar

Thank you, clearly I've became too ambitious and should go step by step. I prefer to realize it now rather than some $$$ later, by building on mistakes.

First the oscillator. If I understand, the schematic below would provide me with the ability to start and stop the oscillation simply by the input's state. That would prove to be more reliable than trying to mess with the inverter's GND pin. alt image text

Second the trigger. Surely there is a more elegant way to obtain what I seek. Once a trigger signal is sent (which mean my op-amp gives around 4V), I need my oscillation to stop. I can't use the MCU for this task, the delay would be too long.

I appreciate your patience while I learn new things ;-)

February 23, 2010
by mongo
mongo's Avatar

Yep, that looks like it'll work just fine. The simpler the circuit, the better. elegance through simplicity.

Keep in mind though, most 4000 series CMOS chips are usually only good up to 5MHz.

February 23, 2010
by BobaMosfet
BobaMosfet's Avatar

Frozenlock-

You realize that you don't need to start & stop your oscillator at all, right? I mean, if you do, there is a penalty in terms of the time it takes the oscillator to stabilize after it receives power.

Instead, just let the oscillator run all the time, and use a transistor as a switch to pass (via source & drain) it's output waveform elsewhere. This only requires 5 components:

1 crystal oscillator
2 tuning capacitors
1 transistor
1 resistor to protect the transistor gate

Just another way to slice the pie.

BM

February 23, 2010
by Frozenlock
Frozenlock's Avatar

Ok, so here are the parts I plan on buying: NAND gate I've selected this one to be able to obtain high frequencies (around 10Mhz). Please tell me if my reasoning is erroneous: With a propagation delay of 2.5ns, it would mean a delay of 5ns per cycle. At 10MHz, a cycle is 100ns. My cycle is then 20 times longer than the delay. I expect this to be enough, but is it?

I would like to use the Murata resonator I already have. It's 3 legged, and have internal capacitors. So, no need for the 2 tuning capacitors?

Also, the way I understand how the transistor and the resistor would be positioned is shown below:

Oscillator----Resistor----FET----Counter
                     _____| |
                     |      |
                  Control  GND

What would be the higher limit for the resistor? (To limit current consumption) The oscillator's circuit usually uses a 1Mohm resistor, so the signal must be able to go through that quite easily.

February 23, 2010
by Frozenlock
Frozenlock's Avatar

I think I may have a solution for my loop. It will require an entire NAND IC, but I believe the result will be much more reliable.

maintain

This should "lock" the signal at +5V with a simple trigger. Then, to reset the circuit, I set a pin to +5V on the MCU.

What do you think? Should it work?

February 23, 2010
by Frozenlock
Frozenlock's Avatar

Oops, the NAND gate with the feedback and the MCU would not work... a +5V would be sent if both input are low.

I'll be back.

February 23, 2010
by Frozenlock
Frozenlock's Avatar

Ok, this time it should work. The MCU pin is always at +5V except for the reset.

alt image text

February 23, 2010
by BobaMosfet
BobaMosfet's Avatar

Frozenlock-

The oscillator you've chosen (CSTCE8M00G55-R0) is an 8MHz oscillator, according to the datasheet. The third pad on its case is a GND. You can usually operate it without that being connected unless you're really sensitive to noise. It's slower than the MCU, so the MCU would have no problems controlling output from it.

At 8.00Mhz, it is completing 1 cycle every 0.000000125 seconds.

BM

February 23, 2010
by Frozenlock
Frozenlock's Avatar

Yes, but I might need to use higher speed, so I planned ahead with a 10MHz for my parts selection.

Am I in a safe zone with my cycle/delay ratio of 20?

February 26, 2010
by BobaMosfet
BobaMosfet's Avatar

Frozenlock-

You stated: "What I wanted to do: I need to COUNT the number of oscillations before an exterior event occur. I can't use the MCU, because the oscillator is going way too fast."

Your MCU is almost twice as fast as your oscillator. Of course it can count the oscillations (eg 'cycles') from your oscillator.

BM

February 26, 2010
by Frozenlock
Frozenlock's Avatar

Is that so? I was afraid the MCU would not be able to follow, as the clock speed determines the number of operation per second... and I wasn't sure how many operations such a task really is. For example:

 If input A=1
 then i=i+1

Is this 2 operations? I suppose I should not refresh the LCD while counting...

February 27, 2010
by BobaMosfet
BobaMosfet's Avatar

Frozenlock,

You would have to write it in assembler, inline, with no stack overhead. You can just barely do it with the 8MHz secondary oscillator. If you push to 10MHz for the secondary oscillator, you might have problems unless you apply careful strategy. Look to page 347 in your ATMEGA168 Datasheet for instruction/cycle timing.

In either event, you might consider running your ATEMGA168 at 20Mhz.... I believe it can actually be run at that clockspeed, which would help you all the way around.

Some of how you engineer your circuit depends on what value you are counting up to. For example, in some cases, you could engineer it such that each cycle of the secondary oscillator simply causes a bit-field to increment. One that will automatically roll back to zero, at the desired interval. And then all you need the MCU to do is watch for a zero-value into the ADC (or specific pin going to ground), and when it does, it fires off an action.

I hope this is helpful

Bm

February 27, 2010
by mrobbins
(NerdKits Staff)

mrobbins's Avatar

Hi all,

Great stuff going on here and I don't want to interrupt, but perhaps I should point you to page 111 of the ATmega168 datasheet:

"The Input Capture Register can capture the Timer/Counter value at a given external (edge triggered) event on either the Input Capture pin (ICP1) or on the Analog Comparator pins (See “Analog Comparator” on page 242.)"

This may let you run the Timer/Counter as fast as you want (as fast as CLK) and have the hardware freeze the counter value when a certain digital level changes (or even an analog one, using the analog comparator). Look at page 117 too.

Also, I quickly browsed through these posts, and couldn't find some simple datapoints: what is the length of time you're trying to measure? What resolution are you trying to measure it with?

Mike

March 01, 2010
by Frozenlock
Frozenlock's Avatar

These are all great news! It sure is making all this easier!

The event I want to capture should take approximately 1.65*10^-6 s, or 1.65 Us.

Concerning the resolution, I would like to be able to discriminate in the tenth of the total time as a minimum, so around 165 ns. Any superior resolution will be taken gladly of course.

March 01, 2010
by BobaMosfet
BobaMosfet's Avatar

I guess a question I have is this: Does this event happen zillions of times in fractions of a second, or just once in awhile (but it's done and gone in 1.65us)?

BM

March 01, 2010
by Frozenlock
Frozenlock's Avatar

It happens only once in awhile, when I send a command for it.

March 17, 2010
by Frozenlock
Frozenlock's Avatar

I'm back, with an all new circuit! Well not exactly new, it's the one described previously with the NAND gates. No more problems with my LCD screen, thanks guys!

My next problem is now with the counter. For all I know, the oscillation is working. My multimeter is reading 2.2v at the NAND's ouput, which would be half of the 4.5V on VCC. The FET is also working very well to silence the signal when a voltage is applied.

For a mysterious reason, my counter refuses to increment. It always stays at zero.
I think it's the signal's low voltage, as the datasheet specifies a minimum 3.15V for the HIGH input. Still, I would appreciate a second opinion before trying anything.

Look what happens after the 1 MOhm resistor. The voltage drops to 1.3V (so perhaps 2.6V at the oscillation's peak). Would this mean that the counter's input impedance is also in the MOhm range? A possible solution would then be to reduce the resistance, 100k perhaps?

alt image text

March 17, 2010
by mongo
mongo's Avatar

A suggestion...

Lose the 1M and 2.2K resistors. Both will cause unnecessary loading on the crystal.

Looks like you have the FET in the circuit to load down the final output. It would be just as effective to control one of the inputs to that gate.

M

Post a Reply

Please log in to post a reply.

Did you know that NerdKits believes in the importance of a mixture of meaningful topics, clear instruction, and engaging projects? Learn more...