Doubts to flash NodeMCU + Garden Project

Did you flash it in the correct mode?
Is it connecting to your wi-fi and Blynk server?
What serial output are you getting?

If you’re going for different hardware (I’d stick with getting the Sonoff working if I were you) then before you rush out and buy an Arduino you should read this:

Pete.

Thks for your help I am thinking this set

The problem with sonoff is you have to trick it and maybe I did something wrong.

Did you read the link I gave you?
Do you realise that the product you’re thinking of buying has no wired or wireless internet connection capability as it stands?

Vyou do t have to “trick” the Sonoff, you have to replace the existing firmware with your own firmware, by uploading a new sketch to it. This is exactly the same as you would have to do with any other device you chose to use.

If you’re not happy to answer questions on what flash settings you used, whether the device is connecting to Blynk and what serial output you’re getting then I’ll step back and let you do your own thing.

Pete.

Hi Pete. I read your link. Interesting. The problem of sonoff is that you hace to weld some cable in the chip and I don’t know I did property. Arduino IDE confirm 100% flashing but when I connect sonoff is not doing anything.
This is the reason why I am thing to buy an Arduino board with WiFi + relays in otprder to connect my garden irrigation Solenoid and control it from my mobile.
I think I replied all your question.

You shouldn’t need to be soldering anything to the chip, just soldering-in the FTDI headers and finding the correct location to pull GPIO0 to earth while you’re powering it up.
If you hadn’t done it correctly from a hardware point of view then it wouldn’t flash to 100%.

What’s more likely is that you’ve chosen the wrong settings in the Arduino IDE.

I’ve asked twice, but I don’t see any info about the flash settings you used in the Arduino IDE, whether it’s connecting to Blynk or what output you’re getting in the Arduino IDE serial monitor, but don’t worry, I wont bother asking again.

In which case you’ll need to modify the sketch, and use SoftwareSerial to connect your Arduino and Wi-Fi modem.

Good luck.

Pete.

Hi Pete.

Finally I am not able to flash sonoff. Something happened at hardware level because now I cannot connect it again to my computer. No lights on. I think it died.

Then now I will go for Arduino which is easier to flash. I read your link about boards and due to my inexperience soldering, i am thinking to buy following board. What do you think?

Imgur

My idea is to use the sketch from this link

From Hagay or Arizona users. Hagay used sonoff then I supposed I will need to change something in the sketch.

I will read more to make less questions.

Thks a lot for your support and sorry for bordering you.

It’s overpriced, but a much better choice than the Arduino Uno.

Pete.

Thks a lot Pete. I know but it is in my house in 1 day.

Which board I should select in Arduino IDE?

Thks again.

From the Amazon.es screenshot, it looks like a NodeMCU 1.0

Pete.

1 Like

Yes it seems

Already flashed and running well. It connects to internet and I can manage. The only doubt is how to change the time to Madrid one. Also when lights are on means the relay is closed and then the spark will be irrigating?

RTC widget.

Not quite sure what “spark” means, but it depends on whether your relays are active HIGH or active LOW.

Pete.

1 Like

In the code I have LOW. Maybe the problem is that the relays need 5V and the board only gives 3.3V. Here you have instructions

  • This relay module is 5V active low. Relay output maximum contact is AC250V 10A and DC30V 10A.
  • Standard interface can be directly connected with microcontrollers.
  • Working status indicator lights are conducive to the safe use
  • 4-channel relay interface board, which can be controlled directly by a wide range of microcontrollers such as Arduino, AVR, PIC, ARM, PLC, etc. It is also able to control various appliances and other equipments with large current.
  • Widely used for all MCU control, industrial sector, PLC control, smart home control.

4-channel relay output modules, relay output contacts 250A 10A.
Input IN1, IN2, IN3, IN4, the signal line LOW effective.
VCC, GND power input, can relay a separate power supply relay power input of JD-VCC.

It is possible to give it 5.5V using below pins but I am not sure how to do it.

If someone can help me.

How are you powering the relay board?

What pins on the NodeMCU are you using to connect to pins 1,2,3 and 4 on the relay board (refer to the pins by the D letters printed on the NodeMCU).

What pins have you specified in the code, and how have you referenced them in the code (by D number or by GPIO number)?

How are you powering the NodeMCU, and what are you doing with the ground connections?

Pete.

´´´
How are you powering the relay board?
´´´
I’m using the NodeMCU board power as explained below. Then as relay needs 5V I need to use 5V power adaptor to the Relay board using above picture pins.

‘’’
What pins on the NodeMCU are you using to connect to pins 1,2,3 and 4 on the relay board (refer to the pins by the D letters printed on the NodeMCU).
What pins have you specified in the code, and how have you referenced them in the code (by D number or by GPIO number)?
‘’’
I connected adapting the GPIO pins to NodeMCU, for example if in the code was used the ping 14 and 12, then I used the NodeMCU pins D5 and D6. Each time I click buttons in the blynk app the relay is working. I also connected the GND from the relay board to the GND in the NodeMCU board close to D5 pin. also I connected the VCC from the relay board to the 3.3V close to the pin D4.

‘’’
How are you powering the NodeMCU, and what are you doing with the ground connections?
‘’’
For the NodeMCU board I was using a 5V mobile power adaptor but I will need to change to a 3.3V in order to don’t damage the board which is 3.3V

Okay, the NodeMCU has an on board voltage regulator that takes the 5v supplied via either the USB socket or the Vin (sometimes labelled 5v) pin and converts it to the 3.3v needed by the NodeMCU, so you won’t damage it by putting 5V onto either of these pins.

However, if you try to power too many other devices, especially ones that draw a reasonable amount of current, from the 3.3v pins then you can burn-out the on board regulator.

The relay board will require a fairly large amount of current to pull the contacts on the relays closed - obviously twice as much for 2 relays at the same time, four times as much fir all 4 relays at the same time. This current peaks as the relay is activated, so if you ever activate all 4 relays at the same time you’ll get the peak current draw at that point.
The relays need a beefy 5v supply to cope with this. It can be the same power supply that powers the NodeMCU, provided it can deliver sufficient peak power, but the output from the PSU should be split into two, one branch going to the relay, the other going to the Vin/5v pin on the NodeMCU, and the negative wire also needs to be split - one to the GND on the relay board and the other to one of the GND pins on the NodeMCU.

Which pins you use for driving the NodeMCU is important. With the Sonoff, these are dictated by what the manufacturer has chosen to do, ad in some cases they use pins that aren’t recommended for normal use, but they get around this by designing the Sonoff circuit to cope with this. You may have to change your choice of pins to work with the relay circuitry that you have.
You should read this thread for more info:

I’d assumed from your earlier question that the relays weren’t working, but you’ve said:

so I’m a bit confused about where you are with your project.

Pete.

1 Like

Dear Pete. Thks a lot for your info. I’m trying to make a irrigation system, means only one relay will be operative each time because I have the garden divided in 3 sectors. I assume and I will test that with the power of the NodeMCU will be enough. If not I will follow relay fabricant instructions:


As shown in the attached picture, you could take off the jumper cap, then refer to the followings to connect NodeMCU, Relay and 5V External Power:

NodeMCU 3.3V — Relay VCC
NodeMCU GND — Relay GND
External power 5V — Relay JD-VCC
External power GND — NodeMCU GND

As I have a power adaptor of 5V for supplying electricity to the electro valves I will also use it to power the relay as described.

What I don’t know is if the relay with LOW is contact close (then irrigation will run) or not. But I will test.

About pins, don’t worry they are ok, I’m following a NodeMCU sketch, then they are ok.

Many thks for your patience and for sharing your info with people like me, I learned a lot reading you and the forum. I will try to read more and to improve Arizona’s app.

You certainly shouldn’t be doing that, for the reasons I described earlier.

You’ve said that the relays are Active LOW, which means that the relay will be energised (and the contacts made, irrigation running) when a LOW signal is applied - i.e when relay pin 1 is connected to ground, relay 1 is energised. When it’s connected to 3.3v to 5v then the relay contacts are open, irrigation not running.

Pete.

1 Like

I used below pins

byte switch_pins[] = {14 , 12 , 16 , 13}; // number of gpio to be used as switch/relay control

b

1. List item

ool switch_default[] = {LOW,LOW,LOW,LOW}; // switches that use reverse polarity should be set to HIGH here

As per link they are safe to be used.

For GND and 3.3V I used following pins

I don’t understand how to supply electricity to both NodeMCU and Relay Board. I use the USB to supply to NodeMCU. I have an external 5V power source that can be used for supplying relay board and as per manufacturer it should be done as discribed above.

NodeMCU 3.3V — Relay VCC
NodeMCU GND — Relay GND
External power 5V — Relay JD-VCC
External power GND — NodeMCU GND

I am a little bit lost.

Thks in advance.
Brgds
Miguel

These relays have the ability to be used in a variety of different ways, to make them suitable for various situations. This includes the ability to (allegedly) provide full opto isolation between the supply to the relay and the pins labelled IN1 to 4.
Having studied the schematics for some of these devices in the past, I have my doubts about the isolation, but for me that’s irrelevant as I never use them in that mode. The relay board you have may be different to the ones I’ve studied before.

When I’m using similar boards I connect an external 5v supply to both the relay board and the VIN pin on the NodeMCU, so that the same supply, with shared ground, is used to power both devices without burning-out the voltage regulator on the NodeMCU.
If you want to take the same approach then do so at your own risk.

I think that maybe you’re starting to realise that the Sonoff 4Ch Pro was actually a very good solution, as all of these issues had been considered in detail when the board was designed and manufactured. Plus, the whole thing is in a nice self contained case and is certified to CE standards.
Can you see now why I was encouraging you to explain more about the issues you were having with your Sonoff so that we could help you to get that device working?

Pete.

1 Like