MOSFET as a switch

Thread Starter

M11

Joined Dec 27, 2010
18
Hi,

I am working on a project where all the sensors and the microcontroller (PIC18F4550 ) are powered from a 3.3v source.

I want to introduce a GLCD to the project. The problem is that GLCD logic high input must be at least 2V, which is just above the logic high output of the PIC, so I cannot connect the GLCD directly to the PIC.

I bought some 2N7000 n-channel MOSFET transistors to use them as switches, as shown in the image. I connected such switches to all the pins required between the PIC and the GLCD (14 pins). The value of R1 I used in all the switches is 1Ω.

I ran a sample program to test the GLCD, but it did not work and the transistors became very hot after a while. I checked for short circuit, but couldn't find any.

What do you guys think the problem is ? Is the resistor value too small? if so, what value should I use ?

Thanks a lot.
 

Attachments

Thread Starter

M11

Joined Dec 27, 2010
18
I tried the same connection using R1 = 100 ohm. In this case almost all the voltage drop across the resistor, so the input of the GLCD does not get enough voltage.

I am confused now.
- If I increase the value of R1, almost all the voltage drops across it and the GLCD input does not get enough voltage.
- If I make R1 small, the current becomes too high and the devices heat up quickly.

I got the schematic of the post above from a document from microchip website (http://www.microchip.com/stellent/groups/techpub_sg/documents/devicedoc/en026368.pdf)

I think another resistor is needed between the source and the ground (i.e 14 more resistors, for the 14 switches).

Any suggestions ?
 

gmrs

Joined Dec 30, 2011
4
It is reversing the voltage that's why you measure all of the voltage drop across the resistor. That means that if you output a HIGH (3.3V level) from the PIC pin, the output across the MOSFET's drain/source will be almost 0V. Now try to output a LOW to you PIC pin and you will have almost 5V across your MOSFET drain/source. Oh, and I wouldn't use a 1Ω resistor because if the MOSFET is sinking it won't be happy with a current out of the given tolerances (or without a heat sink) nor the 1Ω resistor will survive if it is not a high watt one. Sorry for my English and for my limited vocabulary.
 

ErnieM

Joined Apr 24, 2011
8,377
The buffer you built would be OK if you make the resistor larger, on the order of 10K to 100K. But do you even need them?

Table 38.3 of the PIC18F4550 data sheet shows the min output for an I/O pin to be Vdd-0.7 for a 3.5 mA load. For a 3.3V supply that is still 2.6V and above the 2V minimum.

With the no load a MOS input gives the outputs will be extremely close to Vdd. So no buffer is necessary.

If more then 1 or 2 lines need level translation there are dedicated IC's to do this you would be best serves to use. You can get 8 bit buffers in 1 IC, verses 16 parts to do it discretely.

(And somewhere I'm wondering if you only describe the parts running at 3.3V and didn't mention the GLCD is running at 5V.)
 

Thread Starter

M11

Joined Dec 27, 2010
18
Thanks,you are right :) there is no need for the buffer. But the GLCD displays only the beginning of the program, then nothing will be displayed.
I tried powering the PIC and GLCD both using 5v, and the program runs fine. Then I powered the PIC using 3.3v and GLCD using 5v. It seems that the program runs a little bit slower, and the GLCD will work fine for sometime then it will not display anything.

I run the PIC on 8MHz, and I verified that this is under Fmax when using 3.3v

so, what could be the problem ?

Thanks,
 

Thread Starter

M11

Joined Dec 27, 2010
18
Another thing that I have noticed when PIC is powerd by 3.3v. The displayed images are not perfect. There are some pixels turned on while they are not supposed to and vice versa.
 

ErnieM

Joined Apr 24, 2011
8,377
As long as you don't change their crystal the PIC should run at the same speed when you change the power supply voltage like that, so I don't know why it would seem to run slower.

When you get "not perfect" images it may be due to bits not getting read correctly due to a timing race where the bit doesn't quite have time to change before it gets clocked in. So see if just making the delay between data out and clock edge longer helps.

A couple of years ago I started building up a platform to connect a GLCD to a PIC32 and with the components I used there was an incompatibility in the V out high voltage levers, so I just dropped in some level translators (2 chips, 20+ pin SOIC's) and all was well.
 

CraigHB

Joined Aug 12, 2011
127
Timing issues can be tricky with LCD's. I've probably spent more time troublshooting those with various projects than anything else. I had one recently where I had an issue with bringing the SPI clock high too close to power-on for the LCD. I had to add a delay there. I've run into little oddities like that so many times.

Most LCD's have a logic threshold good for at least 2.7V. My current project runs a COG LCD with no issue using 3 Volts Vdd on the controller. I'm sure it's just a timing issue as ErnieM stated.
 
Top