16 Relay esp32 coding (help!)




Can anyone provide help on recreating this project from a previous thread?

Not sure how to place the code in the notepad++ without knowing how to space the code out. I have all the items needed but not sure how to go about with the code for starters. It may be the entire code or just a piece. Wanted to create a board to integrate into smart home automation.

Code needs to be in code tags.
All code, not snippets.
You need to provide a circuit diagram including markings of all terminals and include power supplies.( not fritzing)

Above all, read introductory posts at beginning of the forum.

1 Like

Sorry if this went against current rules. The previous forum post left this subject matter and nothing else. So just trying to learn how to repost something that has been closed.
Link to previous forum post

Also look at the library examples.

Will be starting from the ground up on this one. Working also on making diagram right now.

Considering the "previous thread" successfully made it work... I would say, "Follow the previous thread."

I would do the setup() like:

for(int i = 0; i < numRelays; i++)
{
   digitalWrite(relayPins[i], HIGH); // set pin HIGH, relay OFF
   pinMode(relayPins, OUTPUT);   // set pin to OUTPUT, relay OFF until 
                                 // commanded ON
   client.publish(topics[i], "OFF");
}
2 Likes

Have the freenove expressif esp32-wroom x2
Esp32 wroom32u devkit c
And a few breakouts including the freenove version.

Loading visuino to see if i can get the hang of placing this coding corrrectly as well to get close to the version in the post.

Not sure yet which version to integrate as the heart of the relay system just yet but its time to get the ball rolling.

This is day 1 of coding for me. I learn fast!

Well, I know zilch about the ESP boards but good luck & have fun. :grin:

1 Like

Stay tuned. Have more boards to try out. Been so busy with wiring and mounting that getting used staying on the computer aches at first. The nano IOT is around but havent pulled out the box of parts yet.

Which boards are you accustomed to?

When I "discovered" Arduino around 2012 the main boards were the Atmel "AVR" boards, UNO, Nano, pro Mini, Leonardo, pro Micro, Mega2560 and the "Teensies" from PJRC. Then came the ESP and ARM boards, but by that time my neuropathy (hand tremors) affliction had progressed to the point that I could no longer solder or work with the progressively tinier components. So I still piddle with AVR boards on breadboards and try to stay abreast of the changing MCU scene but my inability to build things really throws a clinker in the works.
BTW: I'm 77 YO.

1 Like

This new visuino stuff and breakout board with no need to solder are the new keepsakes.

think you need to start by drawing up a requirements-specification
once you have that you determine what hardware/software you will need to meet the specification?
can you give a link to your relay board?

2 Likes

Go into that old topic, click "flag post" icon, select "it's something else" and add a note asking the moderators to re-open the topic. Also ask them to merge this topic into the old one (give a link to this topic).

1 Like

[Relay board link ](ALAMSCN 16 Channel DC 5V Relay... ALAMSCN 16 Channel DC 5V Relay Module with Optocoupler Low Level Trigger Expansion Board for Smart Control Switch: Amazon.com: Industrial & Scientific)

And on my seperate build
[8 channel dpdt relay for seperate build](ALAMSCN 16 Channel DC 5V Relay... ALAMSCN 16 Channel DC 5V Relay Module with Optocoupler Low Level Trigger Expansion Board for Smart Control Switch: Amazon.com: Industrial & Scientific)

The 8 channel DPDT relay has an extra left over. It was used to make a hardwired control system that would turn a fridge off and in turn apply circulation fans and a dehumidifier in the lower fridge and the freezer would have a circulation fan as well that in hopes can be regulated to consume a certain power limit of solar power system depending on the amount of power generated. Its going to be a large system of 4 inverters and a natural gas generator. Long build.... most already installed.



Figured out what happened. The breakout board was not powered. Most likely when connected to the relay board which was already powered by 12 volts, the ground loop in the system which is solar powered and has a negative ground caused a short somewhere innthe esp32. Most likely it was gpio16/relay 10 which is intended perhaps for firmware updating etc. Ill have yo upload the schematic along with the power diagram etc tomorrow. Having to focus on ordering a plc board at the moment. Most likely an out of market version than handles ac voltage primaily.