4n35 Optocoupler as Switch

avr_fred:
If you go with the 12 volt version of the relay, you can drive it directly from two esp8266 outputs and the power is supplied by the vehicle.

All that aside, if the device you’re powering is on when the esp8266 is on, you can create a high side switch with p channel mosfet which would eliminate the need for the rather expensive relay. That’s just a guess though as you’ve never explained what you’re doing with the 8266 and the device being controlled by the relay.

I apologize for not giving all the information or a good schematic. Was trying to keep it short and simple but missed the details and was hoping to clarify as needed.

What Im doing with the esp-12e is control a 12vdc 7W device in a car. The esp-12e and 12vdc 7W device will always be in the vehicle. The esp-12e will turn the device on and off based on a schedule.

EDIT: Thank you for mentioning high side switch. I found the below, which appears to do what i want without a relay. Being that I have a 2n3904 I would need an irf510n.

Was trying to keep it short and simple but missed the details and was hoping to clarify as needed.

NEVER try to keep it sort and simple.

NEVER clarify as needed.

ALWAYS share your information if you want someone to help you!

The IRF510 is a N channel device, it will not work as a high side switch. You need a p channel device wired something like this:

avr_fred:
The IRF510 is a N channel device, it will not work as a high side switch. You need a p channel device wired something like this:

Thank you for this. One last question why choose this over a low side switch? Switching ground on and off is another avenue I could pursue right?

Switching ground on and off is another avenue I could pursue right?

Maybe yes, maybe no.

Without knowing what you’re switching on and off, a high side switch will always work because it opens the supply, like a relay would. A low side switch, effectively disconnecting the ground, may have other current paths to ground which will result in undesired current flow when the device is disconnected from its supply ground.

It’s all a matter of what you’re trying to control which is still known only to yourself.

avr_fred:
Maybe yes, maybe no.

Without knowing what you’re switching on and off, a high side switch will always work because it opens the supply, like a relay would. A low side switch, effectively disconnecting the ground, may have other current paths to ground which will result in undesired current flow when the device is disconnected from its supply ground.

It’s all a matter of what you’re trying to control which is still known only to yourself.

its a 12vdc 7W GPS device that Im controlling power to.

Tinkering:
its a 12vdc 7W GPS device that Im controlling power to.

This should have been mentioned in post#0.

If the data pins of this device are also connected to the Arduino, then you can't just switch off power to the device.
The device could be phantom-powered through the data pins, and that could be a danger to the GPS and/or the Arduino.
Post a link to the GPS, and a full diagram showing all connections.
Leo..

I downloaded fritz and drew up a diagram. Might be missing a diode protecting power to ground on the device and resistor on trigger to gate. Below should be an imgur link. The power for the nodemcu (esp-12e) will come from a usb to the car battery. For mosfet Ill either use a TIP120 or IRLZ44N . A link to the device Im using is below and I want to leave a 100ma capacity for adding a smaller device of similar power configuration.

https://cradlepoint.com/products/cor-ibr1100-series#!specs

Imgur

Tinkering:
I downloaded fritz and drew up a diagram. Might be missing a diode protecting power to ground on the device and resistor on trigger to gate. Below should be an imgur link. The power for the nodemcu (esp-12e) will come from a usb to the car battery. For mosfet Ill either use a TIP120 or IRLZ44N . A link to the device Im using is below and I want to leave a 100ma capacity for adding a smaller device of similar power configuration.

Customer Connect

https://imgur.com/Ypryo6A

Sorry, but you will be better off drawing your circuit by hand and posting a picture of it.
Fritzy images are pretty hopeless as they don't reperesent the components properly, or labels for component leads/pins.
Please read the first post in any forum entitled how to use this forum.
http://forum.arduino.cc/index.php/topic,148850.0.html
It will show you how to post images.

Tom.. :slight_smile: