12V DC relay switch

I am trying to figure out a way to control DC powered lights in my RV. All I want is to have some sort of hardware relay that will allow me to set bindings to turn them on and off. That’s really it. I’ll get more complicated later, but I’m just starting out with this, so if I can get some lights to work, I know I’ll have the first step built.

Does anyone know of a relay I can buy or build that would receive a signal from a raspberry pi running openHABian? I looked at Z-Wave and the Fibaro RGBW controller, but that has color control and dimming and costs nearly $70. I want to start with something more simple and less expensive. Is there something out there that would work in this situation? If its wifi, that’s great. If I have to buy a Pi Zero and make it somehow connect, I can do that. I’m just not sure how to do it right now and looking for ideas and insight.

I’m using a mosfet switch to control 2 12v fans from a raspberry pi. It has a 12v input and output, and then take a 5v feed from the raspberry pi for control. Controlled via gpio ports.

Yes, that is what I was looking for. Would it be possible to have more than one switch connected to a single Pi and then have openHAB on the central Pi control everything? I’m not sure how that would work, but then I could just get a Pi Zero W, control as many lights as I can within a zone, and have it all accessible from the device I’m using to control it.

Sorry if this sounds wrong, I’m just starting out and trying to figure out what the hell I’m doing.

yes, you can control all the individual GPIO pins from openhab. Add a a cheap relay board and you are set

I would not use a relay in a RV setup, because this draws additional current when on and you need to save your battery.
Better use a MOSFET switch, something like this for example:

GPIO would work just fine, as described. Another approach is to use the MySensors framework, there exist a Binding (in the marketplace so integrating into openHAB might be easier. Though it adds some complexity in the other end (you have to build your sensor/actuator, compile a sketch for your arduino (or whatever you choose)).
I have two MySensor sensors, once running it has brought me some flexibility.

But as I said, GPIO approach would also work great.

As in your other thread (Smart Home on the road) mentioned, have a look at ESP8266 and ESPEasy. Have a look at the homepage of ESP-Easy to get a clue what is possible with this Little Piece of Hardware.

For switching applications, the mosfets are a good choice. And you can even use them as driver for RGBW-LED-Stripes which can also be controlled via ESP-Easy and MQTT from openHAB.
And as mentioned in the other thread: just connect one or two DS18B20 1-wire temperature sensor to the ESP8266 and you can also measure the temperature (or connect DHT22 to measure temperature and humidity)…

I think using MQTT will be a good choice, because you can have a lot of sensors and actors connected to with one single Interface to openHAB. And it doesn’t matter if you go with ESP8266 (WiFi) or Raspi Zero W (also WiFi) or any other Raspi 1/2/3 B (wired Ethernet).

Andreas

This is a lot to figure out, but I’ve got time, just not lots of money.

Since I want to start small and cheap, I could get the ESP8266 and install ESPEasy on it and it once set up, I could control it from openHAB on the central Pi3, right? The switch would do the actual work of opening and closing the circuit, the ESP8266 would do the work of connecting the switch to the network, and that would be it? Trying to figure this out all ahead of time so I can tinker with it later when I have the parts. I haven’t soldered anything in a long time either, so I’ll hope I still remember how and can put it all together.

With the tiny size of the switch and ESP8266, I could install one per light up in the mounting, and then I should be able to figure out how to power it with the power coming in for the light. Its 12V, but I’m not sure the Amps on the lights. But if I can assemble something that I can just splice in between the power for the light and it works, that would be awesome. I can figure out how to make zones and bindings and all that later. Baby steps here.

Hi,
try Tasmota for your Esp8266 things :slight_smile:
https://github.com/arendst/Sonoff-Tasmota
works perfect with Openhab with MQTT installed on your PI3. You can control a lot with that setup.
Works out of the box with that cheap 12V Esp8266 relay:
https://www.aliexpress.com/item/ESP8266-WIFI-relay-network-relays/32741837053.html?spm=a2g0s.9042311.0.0.rNSiMM

Okay, now with that 12V relay, it has wifi and the switch together, so I would use MQTT to connect them to the network, then openHAB would be able to see them and I could bind them from there? So all I’d need is the wifi relay and the pi set up, and that’s it?

Yes thats it :sunglasses:

Here is an instructable I published a little while back it gives you a full work up of design and code for making your own devices and programming the openhab environment … Note I am using the cheap particle as a control medium …https://www.instructables.com/preview/E8MMIRVJ9OWBVP1/

I also purchased the relay from sparkfun

I went to read the instructions, and well, crap, that’s above my skill level. I haven’t soldered anything since high school and that was twenty years ago. I probably could do it if I had to, but I’m going to try and find an easier route. leaning towards the ESP8266. I can get a few of them to try out and see if it works without investing a ton of time or money into it.

For something else, I downloading the openHAB Android app. Tried connecting it to my openhabian Pi, and can’t figure out how to connect to it. It wants a protocol://IP:Port. Of those three things, I know the IP, got it set up as static on the network. Anyone know the protocol or port I have to enter to access it from a tablet? Or is there someway I can turn on autodiscovery? Not sure if that’s setup on the Pi or the tablet.

Hey ok … that’s the easy part …You can use the IP address internally in your house on the Raspberry Pi …example 192.168.1.101:8080 you need the 8080 cause that’s the port that OpenHab uses you can also put your outside ip in address but you have to port forward your router to the ipaddress of the Pi …port 8080 but you won’t be able to see the external o e cause your inside but when your out in the world on a different Pi address you’ll see your house …Instead of Using isp866 you should try the Particle …It’s awesome cause you can program it from anywhere on any computer … and it uses the same Arduino c code with small differences …Lots of help there as well