I am a complete beginner and my electrical knowledge back from school is basically non-existent anymore.
I have discovered the ESPHome project and am amazed by its simplicity, so I wanted to turn a dumb IKEA USB powered lamp (cheap + USB powered should be a good start) into an IoT lamp, after I had quick success with different sensors.
Fast forward, while everything is working out nicely when powered by 3.3 V via my serial adapter, the lamp is rather dim in comparison to the unmodified circuit and I would assume that this is because of two things:
- The GPIO I am using is intended for logic, not load
- The lamp expects 5 V from the USB, while my ESP is running off of 3.3 V
So as the next step is to hook everything up to USB, this is creating issues for me now. I am planning to use these "AMS1117"-based step down converters to regulate the power down from the USB to avoid frying the chip (I hope the choice was OK; Again, I am basically doing this without any knowledge here), but how am I going to control the 5 V lamp now? I have one of the chip's GPIO's set up to control the lamp, either as active high or low, depending on my choice.
My "circuit" looks like this (aka: the bare minimum to power it), the "open" wire is my GPIO for the lamp:
I wanted to:
- Connect the step down converters' - and + to the pins on the ESP/resistors
- Connect the lamp's + or - (depending on whether I'll go with a active high or low GPIO setup, if I understood that right) to the USB plug's pin
- Connect the other pin to the GPIO (or relay/etc.) <-- This is where I have to do something.
Is this a job for a relay, another step-up/down converter, something as simple as diodes or resistors or what? I understand where the issue comes from, but my knowledge is too limited to know the appropriate answer to it.
All feedback is highly appreciated, I have tons of things to learn.
PS: And yes, I went with the bare ESP8266 after playing around with a Wemos D1 mini, as I am a purist and eager to learn the basics (and I like the smaller form factor).
PPS: I couldn't find questions that looked as basic as this one or they were about the other way around or only about logic signals.
EDIT: OK, so the part i am looking for seems to be a MOSFET. I have found e.g. this one; It supports voltages for drain+source of up to 60v (that would be used for my lamp's 5v line I assume) and up to 20v for the gate (for my GPIO's 3.3v I guess) with a continuous output current of up to ~22A (I assume the maximum the lamp can draw; It came with a 1A power supply), which should be far below my circuit's limits. The Gate Threshold Voltage/VGS(th) is 1-2.5V (as pointed out by vir); That means that as long as I'm above those values, it will recognize the input as logical "on"? And how much current does the gate pin survive? Is it the "Avalance current" value?
If i understood it right, I would:
- Define the lamp's GPIO as active low
Connect the lamp's GND to the ESP's GNDshouldn't be necessary, i can just leave that wire as is (but would it be OK if they shared a common GND even though they're operating at different voltages?)- Connect the GPIO to the MOSFET's gate
- Connect the USB plug's + to the MOSFET's source
- Connect the lamp's + to the MOSFET's drain