I am designing a circuit so that I can mute/unmute a microphone using an Arduino/Raspberry Pi.
I am using a CD4051 which is designed for controlling audio applications. The schematic is based off of this blog.
I am using a dual rail power supply with +9 and -9 V on the CD4051.
CD4051
pin 16 = +9 V
pin 7 = -9 V
pin 11 = audio select (low 0 V = active, high 9 V = inactive)
Because the Raspberry Pi GPIO pins use 3.3 V, but the CD4051 uses 9 V, I am attempting to use a IRLZ34N N-channel MOSFET as a logic-level converter.
Problem
This logic level circuit should allow a 3.3 V microcontroller to toggle a 9/0 V on the CD4051 (pin 11).
Yet when I prototype this circuit, I measure 3.3 V at pin mic_A
(and pin 2 of the MOSFET). I've double checked my circuit, and even compared to this blog article.
This is how the circuit performs in the simulator
(I am using 5 kΩ resistors instead of 10 kΩ, and using an IRLZ34N instead of a BS170)
What is wrong with this logic-level converter? Why am I not getting 9 V at pin mic_A
?
- https://thetuberoaster.wordpress.com/2020/09/25/cd4052-audio-signal-switch/
- https://circuitdigest.com/tutorial/bi-directional-logic-level-controller-using-mosfet
Update
Why use an IRLZ34N?
Because thats the only TTL N-channel MOSFET I currently have.
Here is a photo of the prototype:
Update 2
After further experimentation, I was able to get this working and have the IRLZ34N to be switched with 3.3v logic.
However based on the comments, I have also learned
- BS170 is a better suited mosfet for this application since the IRLZ34N is intend for high current
- +9V/-9V is not required for the CD4051
- Logic Level Conversion is not necessary since the CD4051 logic can be controlled with 3.3v
- I should add bypass capacitors to the power rails of the CD4051
Video of working circuit: https://www.youtube.com/watch?v=3zxkHmgybTc