Ford Transit USA Forum banner
1 - 17 of 69 Posts

· Registered
Joined
·
766 Posts
Discussion Starter · #1 ·
I'd use a ESP32 and a 8 channel relay board (or maybe a 16) and wire everything off that. I'd mount that beside the new house fusebox. I'd use momentary "normally open" switches to trigger the ESP based upon a "change of state" of the switch. I'd write the code so the ESP32 Inputs triggered by a ground signal. That way every switch would only need one very small wire to it from the ESP because I'd ground each one to the body locally to supply the ground. I could have used as many switches as I wanted to for every single device. If I would have done that, I could have controlled everything from my phone over a WiFi access point on the ESP and even used timers in the code if I chose to. Temperature sensors and photocells could have been implemented as well. Manual switches could have been grouped together and wired using just one cat 5 wire allowing 8 switches to be wired with just one small cat 5 wire. The sky would have been the limit and the costs would have been far less. There would have been no need for 3 way or 4 way switches and all that 14 gauge wire. Better control, centrally located components, less wiring, less voltage drop and less chance for a malfunction! The boards are only a few bucks and the 32's are inexpensive. Hindsight is 20/20 I guess!

 

· Registered
Joined
·
766 Posts
Discussion Starter · #5 ·
I am confused. How would I use a ESP32 and a relay board? What would I control?
I'd control all the lights with the ESP. That way I could put "control panels" in different places that would allow control of any light from any location. I'd probably use regular blank household wall palates and drill holes in it for the switches. Then just run a cat 5 wire to each panel. Buttons could be programed to allow dimming and/or count down to off. It could even be programed that when the TV is turned on, the lights dim. A "one button" "all off" or "all on" would be easy too. If you always had a hot spot, it could even be Alexa controlled.

The way I did my NON-ESP wiring added a lot of complicated wiring and larger switches. I have one LED strip set that can be turned on or off from 4 locations (drivers seat, countertop area, sliding door and above the bed), that required two 3 way switches and two 4 way switches with wiring between all the switches. I bet there's 40 feet of wire just for that. With a ESP, I could have ran one wire from the relay to the LED's and used cat 5 to all the panels. That one cat 5 ran back to the ESP would control 8 devices. Then anytime I wanted to I could add, change or remove a switches function in each panel. There would never be a need to rewire anything if I wanted to change or add something. Just reprogram the ESP. I could do that "over the air" while the van is in the driveway.

I'd also like to be able to turn the Van PC on from in the house. Sometimes I download videos to the hard drive and have to go out and turn the inverter on. The PC fires up anytime it has power so a ESP on the WiFi and a relay would allow me to turn it on remotely.

The only drawback would be there would be a very very very small power draw from the ESP. It would takes months and months to wear down a battery.
 

· Registered
Joined
·
766 Posts
Discussion Starter · #8 ·
Yep.
In addition, you can use things like this:
to avoid having to run control wires to the loads (DC or AC) at all.

I am planning on writing a central controller using microPython on an ESP32, probably with a touch screen.
I have not used those. I've been using Sonoff's for stuff around the house. I install them in fans, stereo receivers, etc. Would you flash them and use a broker in the van?
 

· Registered
Joined
·
766 Posts
Discussion Starter · #11 ·
I'm totally new to this, only googled it after reading your first post... but looks interesting. How would the control panels look exactly? Based on your description of running cat5 to each panel, I'm guessing you'd be using a PoE ESP32 board like this one and then somehow wire your momentary switches to that PoE board? (I haven't gotten far enough to figure out how to wire the switches).
And then the cat5 cables would be routed to a networking switch with another ESP32 board connected to a relay board like this one?

Sorry - total noob here. But you've piqued my interest!
No PoE needed.
No network needed.

NOTE: Be careful, some relay boards require a 5 volt signal. ESP's do 3.3 volts so they will not trigger a board the needs a 5 volt signal. There's ways around that but just get the right board to start with or use a Arduino. They do 5 volts. Personally I like ESP's

I'd keet it simple. All I would be doing is triggering the ESP inputs by sending a ground signal by pressing the switch. Each "new" ground signal would trigger a change of state of the relay.

I'd just use cat 5 as regular wire. I have a 1000 foot roll here. Cat "anything" would work as long as the wires are color coded. The real advantage is that you get 8 wires in one run and since the volts / amps are so small, the small gauge cat wire would be perfect. I'd just strip and solder to the switches. There's 8 wires in a cat 5 so each switch would get one wire and they'd all be connected together to one ground (to the body). A blank cover plate or some thin wood with holes drilled would work for a mounting plate.

I'd use simple normally open switches like these:

Color coding like that might be nice to keep from having to label the panels. You'd quickly learn what each color did. I don't see ever needing more than 8 switches but who knows.

Personally, I'd limit it to just my 12 volt stuff since I only have to control the inverter on or off. That would keep the A/C current away from any 12 volt stuff. I would just switch the 12 volts to the inverter with the ESP and one of the relays.

One switch could turn on or off multiple relays. You'd just write it into the code.

For instance:

Blue switch controls "front lights'
Green switch controls "rear lights"
Black switch controls "both front and rear together".
Red switch turns all the lights off and turns on the TV.
Yellow turns the outside lights off after 5 minutes

Whatever you wanted it to do. If you haven't played with Arduino and micro controllers, there would be a learning curve :).

You have to start small with blink. I remember when my first LED blinked. WOW I was excited LOL!

Download Arduino and get a ESP8266 to play with. YouTube is your friend.
 

· Registered
Joined
·
766 Posts
Discussion Starter · #12 ·
.........I hate TV............We all have different requirements.....
No TV?? What do you do to get pissed off?

The only two things I wired so that I can control them from more than one location is the LED strip lights and the MaxAir fan. Like I said the LED's can be controlled from 4 locations. That took some wire! Old school works too.
 

· Registered
Joined
·
766 Posts
Discussion Starter · #13 ·
I am planning on writing a central controller using microPython on an ESP32, probably with a touch screen.
The ESP32 has touch inputs too. I'm thinking 8????? I wonder how touch on the ESP would work in a van? Maybe the fact it was going down the road might make weird things happen. Maybe a light show???
 

· Registered
Joined
·
766 Posts
Discussion Starter · #16 · (Edited)

· Registered
Joined
·
766 Posts
Discussion Starter · #21 · (Edited)
Not sure how this will post but here we go:
FEEL FREE TO USE AND/OR MODIFY AS YOU DESIRE
Copy and past text below into Arduino
//*

// Designed for ESP32 other boards may not operate
// Use momentary normally open switches / Light duty switches are all that is needed.
// Each press of a button changes the relays state to "off" or "on"
// Changing GPIO pin numbers is not recommended
// Do not use a solid state relay board to switch DC
// Connect as many button panels as you wish to every GPIO pin can be connected to more than once
//Ground each switch back to the ESP. I'd do it through the van body.
// One ground is all that's required for all the switches in each panel location.
//The ESP must be grounded to the van body

// Buttons should be connected to GPIO pins listed below
const int ButtonOne = 27; //wire color: Orange
const int ButtonTwo = 1; //Wire Color: Orange White
const int ButtonThree = 3; //Wire Color: Blue
const int ButtonFour = 5; //Wire Color: Blue / White
const int ButtonFive = 13; //Wire Color: Green
const int ButtonSix = 14; //Wire Color: Green / White
const int ButtonSeven = 23; //Wire Color: Brown
const int ButtonEight = 26; //Wire Color: Brown / White

// Relays should be connected to GPIO pin listed below
const int RelayOne = 2;
const int RelayTwo = 4;
const int RelayThree = 12;
const int RelayFour = 16;
const int RelayFive = 17;
const int RelaySix = 18;
const int RelaySeven = 19;
const int RelayEight = 25;

int ButtonOneState = 0;
int ButtonTwoState = 0;
int ButtonThreeState = 0;
int ButtonFourState = 0;
int ButtonFiveState = 0;
int ButtonSixState = 0;
int ButtonSevenState = 0;
int ButtonEightState = 0;

int LastButtonOneState = 0;
int LastButtonTwoState = 0;
int LastButtonThreeState = 0;
int LastButtonFourState = 0;
int LastButtonFiveState = 0;
int LastButtonSixState = 0;
int LastButtonSevenState = 0;
int LastButtonEightState = 0;

int ButtonOnePushCounter = 0;
int ButtonTwoPushCounter = 0;
int ButtonThreePushCounter = 0;
int ButtonFourPushCounter = 0;
int ButtonFivePushCounter = 0;
int ButtonSixPushCounter = 0;
int ButtonSevenPushCounter = 0;
int ButtonEightPushCounter = 0;

int DeBounceTime = 20; // used to de-bounce the pushbuttons

void setup() {
pinMode(ButtonOne, INPUT_PULLUP); // sets pins as input pullups
pinMode(ButtonTwo, INPUT_PULLUP);
pinMode(ButtonThree, INPUT_PULLUP);
pinMode(ButtonFour, INPUT_PULLUP);
pinMode(ButtonFive, INPUT_PULLUP);
pinMode(ButtonSix, INPUT_PULLUP);
pinMode(ButtonSeven, INPUT_PULLUP);
pinMode(ButtonEight, INPUT_PULLUP);

pinMode(RelayOne, OUTPUT); // sets relay pins as outputs
pinMode(RelayTwo, OUTPUT);
pinMode(RelayThree, OUTPUT);
pinMode(RelayFour, OUTPUT);
pinMode(RelayFive, OUTPUT);
pinMode(RelaySix, OUTPUT);
pinMode(RelaySeven, OUTPUT);
pinMode(RelayEight, OUTPUT);

digitalWrite (RelayOne, LOW); // sets each relay to off when ESP boots
digitalWrite (RelayTwo, LOW);
digitalWrite (RelayThree, LOW);
digitalWrite (RelayFour, LOW);
digitalWrite (RelayFive, LOW);
digitalWrite (RelaySix, LOW);
digitalWrite (RelaySeven, LOW);
digitalWrite (RelayEight, LOW);

delay(1000); //A little time for thinking
}
void loop() {
ButtonOneState = digitalRead(ButtonOne); // reads state of button
if (ButtonOneState != LastButtonOneState) {
if (ButtonOneState == HIGH) {
ButtonOnePushCounter++;
}
else {}
}
delay (DeBounceTime);
LastButtonOneState = ButtonOneState;
if (ButtonOnePushCounter % 2 == 0) {
digitalWrite(RelayOne, HIGH);
} else {
digitalWrite(RelayOne, LOW);
}

ButtonTwoState = digitalRead(ButtonTwo);
if (ButtonTwoState != LastButtonTwoState) {
if (ButtonTwoState == HIGH) {
ButtonTwoPushCounter++;
}
else {}
}
delay (DeBounceTime);
LastButtonTwoState = ButtonTwoState;
if (ButtonTwoPushCounter % 2 == 0) {
digitalWrite(RelayTwo, HIGH);
} else {
digitalWrite(RelayTwo, LOW);
}

ButtonThreeState = digitalRead(ButtonThree);
if (ButtonThreeState != LastButtonThreeState) {
if (ButtonThreeState == HIGH) {
ButtonThreePushCounter++;
}
else {}
}
delay (DeBounceTime);
LastButtonThreeState = ButtonThreeState;
if (ButtonThreePushCounter % 2 == 0) {
digitalWrite(RelayThree, HIGH);
} else {
digitalWrite(RelayThree, LOW);
}

ButtonFourState = digitalRead(ButtonFour);
if (ButtonFourState != LastButtonFourState) {
if (ButtonFourState == HIGH) {
ButtonFourPushCounter++;
}
else {}
}
delay (DeBounceTime);
LastButtonFourState = ButtonFourState;
if (ButtonFourPushCounter % 2 == 0) {
digitalWrite(RelayFour, HIGH);
} else {
digitalWrite(RelayFour, LOW);
}
ButtonFiveState = digitalRead(ButtonFive);
if (ButtonFiveState != LastButtonFiveState) {
if (ButtonFiveState == HIGH) {
ButtonFivePushCounter++;
}
else {}
}
delay (DeBounceTime);
LastButtonFiveState = ButtonFiveState;
if (ButtonFivePushCounter % 2 == 0) {
digitalWrite(RelayFive, HIGH);
} else {
digitalWrite(RelayFive, LOW);
}
ButtonSixState = digitalRead(ButtonSix);
if (ButtonSixState != LastButtonSixState) {
if (ButtonSixState == HIGH) {
ButtonSixPushCounter++;
}
else {}
}
delay (DeBounceTime);
LastButtonSixState = ButtonSixState;
if (ButtonSixPushCounter % 2 == 0) {
digitalWrite(RelaySix, HIGH);
} else {
digitalWrite(RelaySix, LOW);
}
ButtonSevenState = digitalRead(ButtonSeven);
if (ButtonSevenState != LastButtonSevenState) {
if (ButtonSevenState == HIGH) {
ButtonSevenPushCounter++;
}
else {}
}
delay (DeBounceTime);
LastButtonSevenState = ButtonSevenState;
if (ButtonSevenPushCounter % 2 == 0) {
digitalWrite(RelaySeven, HIGH);
} else {
digitalWrite(RelaySeven, LOW);
}

ButtonEightState = digitalRead(ButtonEight);
if (ButtonEightState != LastButtonEightState) {
if (ButtonEightState == HIGH) {
ButtonEightPushCounter++;
}
else {}
}
delay (DeBounceTime);
LastButtonEightState = ButtonEightState;
if (ButtonEightPushCounter % 2 == 0) {
digitalWrite(RelayEight, HIGH);
} else {
digitalWrite(RelayEight, LOW);
}
}
 

· Registered
Joined
·
766 Posts
Discussion Starter · #25 ·
Given my (lack of ) skills, I suspect that I may take the advice of LostInWoods and just use a 3.3 or 5V relay to then trigger the higher amp 12V relay:
That's a good idea. You could use Mosfets if you wanted to but the relay boards will handle the higher current, keep it somewhat simple and not have to worry about heating up mosfets. The draw back is not being able to dim the lights using a PWM signal which could be done with mosfets using (millis) as the timer. If you tried it with relays, they'd buzz and not last very long. The (delay) function sucks for most advanced coding. Millis is better.

You could also delete anything in the code that mentioned "eight" and use one of the cat wires as a ground return to the ESP. That would limit you to 7 switches with each cat wire but eliminate the need to use the body as a return ground and depend of Ford!

Also if you wanted indicator lights above each switch, you could run another cat to the switch panel from the outputs on the ESP. If the corresponding output was HIGH the LED would be lit.

I'd would have put three panels in my van. One near the bed. One near the kitchen and one up in the cab.

One switch could also be used to ground the RST (reset) pin on the ESP32. The way I wrote the code, if the ESP resets, everything goes LOW so it could be used as a "Master all off". Sometimes a microprocessor gets a little "sideways" and needs a reset or a smack in the forehead! That "Master Reset button would reset any malfunction that ever occurred. If you have something you want to be on when a reset occurs, just change the line to HIGH in "void setup".

Have fun!
 

· Registered
Joined
·
766 Posts
Discussion Starter · #26 ·
......since they're going to be bright, be able to PWM dim them from at least a couple places.
Not going to happen with relays. You'd need mosfets.

And maybe get them to strobe if someone comes knocking on the door in the middle of the night......
Relays would do that for a limited duration. They're mechanical so they'll give up the ghost sooner or later if operated that way. If somebody knocks at 3AM, just turn on the lights and stick the 9 out the door.
 

· Registered
Joined
·
766 Posts
Discussion Starter · #35 · (Edited)
@tngw1500se
I am not sure if I should thank your or curse you on this one,
LOL! If you don't blow up a few boards you're not learning anything.

Just use a relay board that has opto-couplers. Most relay boards have them built in.

Expensive example: LINK Better price can be found.

It isolates your 3.3 or 5 volt electronics from the 12 volt stuff. No need for resistors. DON'T USE A STANDARD AUTOMOTIVE RELAY. Just make sure the board you pick is triggered by the voltage you're using. ESP's output 3.3 volts and other micro-controlers output 5 volts. NOTE : The board may require 5 volts to operate but wants to see 3.3 as a trigger(s). If you try to trigger a relay board that wants to see a 5 volt trigger signal with 3.3 volts you'll be disappointed in the result. I'm guessing you're using resistors because you're testing with LED's. The relay board doesn't need those resistors on the triggers.

NOTE: Solid state relays might sound good but they don't like to switch DC voltage. They switch on (or off) when the AC wave form is at the zero cross over point. (See below) DC current has no cross over point. If you're switching AC they're a good choice.




NOTE: If you want more inputs or outputs than your controller has pins for, use a "shift register" or two, or three or four!!!
Now you'll really curse me ;)
 

· Registered
Joined
·
766 Posts
Discussion Starter · #39 ·
🤣

Same here. I kinda took the ball and ran with it on this one. In addition to controlling lighting I've so far added 5 ds18b20 temp sensors that'll control various tank,pipe and battery warming pads and I'm now researching adding an IR blaster to try to control my Maxxair 7500 fan. I'm also dabbling with getting an MQ-7 CO sensor that will trigger the maxxair fan and also shut down my auxiliary gasoline heater if it detects CO in the van. Not sure if I'll pull off the MQ-7 and IR stuff but it's fun toying with it!
Sounds ambitious what are you using for a controller?

Why no cameras, GPS and servos to control the steering and brakes? Limited on GPIO's?

Some advice:

#1: Cut your hair really short so it's hard to get a good hold on it. Ripping out roots causes real damage.

#2: When editing a "working" code, the first thing I do is type a line that says:
"//Started editing a working code HERE on 11/11/2021 10:14AM"
That way if things go south, you can click "undo" and you'll know when to stop "undoing" when you get back to that line. If you're happy with the changes, you can delete the line or just leave it since it's a "//" line.

#3: Store your code on a USB flash drive or a cloud based storage. Don't depend on Bill Gates and one hard-drive to keep it for you.

#4: Program more than one micro-controller so you have a second working device. When you accidentally touch a connection with a hot or ground and the smoke comes out you'll have a spare.

KEEP US INFORMED ON PROGRESS!

Currently I'm busy with painting since my wife found the nails!!! She can't decide where she wants the pictures so she moves them a lot. (##@%**&^%$#) I thinking a 5 gallon bucket of drywall mud would be a perfect wedding present for most couples or just buy houses with metal walls and magnets on the pictures!!!
 

· Registered
Joined
·
766 Posts
Discussion Starter · #55 ·
I dont know, Boat stuff? Lot of people buy these Blues Sea switch panels.

I found that LED controller interesting. The only problem I have with stuff like that is when it breaks, can I get a replacement or has it been discontinued.

Also, I think I'd play with changing colors for a while but since I live in a state where weed is illegal, I think I'd soon lose interest and just leave them on warm white.
 

· Registered
Joined
·
766 Posts
Discussion Starter · #67 ·
Thanks for the info as it had me rethinking the RedArc Redvision system again but it’s too limited. Now I’m looking at something like the RCR Force-12

Wow that's a handful of cash! Also, what happens a year from now when some part of it fails and the company is history? You can build your own system for less than 100 bucks, get what you want and have a drawer full of spare parts.
 
1 - 17 of 69 Posts
This is an older thread, you may not receive a response, and could be reviving an old thread. Please consider creating a new thread.
Top