Monday 2 May 2016

voltage - GPIO on base of transistor not scaling linearly


This is really a followup to a previous question to provide an updated schematic and photograph at the request of a commenter on that question. I'm not sure if there is a better way to provide such an update to a question but here it is anyway...


I have the following circuit:


schematic


simulate this circuit – Schematic created using CircuitLab


When I measure the voltage across R2 I don't see the 18V being supplied into the collector of transistor scaling linearly with the value of the PWM GPIO of the NodeMCU. It ranges from 9.35V with the GPIO at 0 (i.e. off) and 17.14V with the GPIO at 1023 (on "full"). With a GPIO value of 512 it reads 13.16V.



I tried my best a photograph of my set up:


enter image description here


About the only thing that is not clear in the photo I think is that the resistor "above" the transistor is between the GPIO with an orange wire and connects to the base (middle pin) of the transistor.



Answer



The correct way was to edit your previous question but we're all here now ...


enter image description here


Figure 1. 2N2222 pinout.


enter image description here


Figure 2. You have the collector resistor connected to the emitter at (1). The base looks OK at (2). You have the collector grounded at (3).


Swap the emitter and collector wiring by turning the transistor 180°.



No comments:

Post a Comment

arduino - Can I use TI's cc2541 BLE as micro controller to perform operations/ processing instead of ATmega328P AU to save cost?

I am using arduino pro mini (which contains Atmega328p AU ) along with cc2541(HM-10) to process and transfer data over BLE to smartphone. I...