Sonoff 4CH with ESPEasy

Moderators: grovkillen, Stuntteam, TD-er

Message
Author
User avatar
toffel969
Normal user
Posts: 469
Joined: 03 Jan 2017, 10:58
Location: Germany

Re: Sonoff 4CH with ESPEasy

#11 Post by toffel969 » 14 Feb 2017, 14:01

panameranet wrote:Hello, I also flashed the Sonoff 4CH with ESPEasy R147 RC8. I used Arduino 1.8.1 with the chip 8285. Below you can see my properties in the screenshot.
After flashing I can connect to ESP_0 and select my SSID. After that, I want to connect to ESP on Sonoff, but this went wrong. My browser wants to relink to 192.168.4.1, although my Sonoff has the new IP-adress 192.168.178.76.
Does anybody know this problem? Is something wrong with the firmware?
Thank you.
Try to keep the serial cable connected and see what is going on. I had to restart my router in the past to get over this
Domoticz on Raspi 2 -- 14 ESP units (hacked Sonoff,NodeMCUs, Wemos, self-built units) running with RC140- Mega 2.0.0 dev8

Shardan
Normal user
Posts: 1156
Joined: 03 Sep 2016, 23:27
Location: Bielefeld / Germany

Re: Sonoff 4CH with ESPEasy

#12 Post by Shardan » 14 Feb 2017, 14:03

Memory /SPIFF sizes, anyone?
Regards
Shardan

User avatar
toffel969
Normal user
Posts: 469
Joined: 03 Jan 2017, 10:58
Location: Germany

Re: Sonoff 4CH with ESPEasy

#13 Post by toffel969 » 14 Feb 2017, 15:22

Shardan wrote:Memory /SPIFF sizes, anyone?
1Mbyte
Domoticz on Raspi 2 -- 14 ESP units (hacked Sonoff,NodeMCUs, Wemos, self-built units) running with RC140- Mega 2.0.0 dev8

Shardan
Normal user
Posts: 1156
Joined: 03 Sep 2016, 23:27
Location: Bielefeld / Germany

Re: Sonoff 4CH with ESPEasy

#14 Post by Shardan » 14 Feb 2017, 17:07

Thanks a lot.
Then i compiled correctly..
Regards
Shardan

Elmacaroni
New user
Posts: 4
Joined: 13 Feb 2017, 19:43

Re: Sonoff 4CH with ESPEasy

#15 Post by Elmacaroni » 14 Feb 2017, 20:44

Seems to got it compiling now with Aduino IDE 1.8.1.
Changed the board to 8285
It generates a file: ESPEasy.ino.generic.bin, right?
Changed nothing on the source, flashed the bin with esptool.py (running Ubuntu) as I did several times for the SonOff 8266.
But nada/nothing to see. No ESP_0 here...

Confused...

User avatar
toffel969
Normal user
Posts: 469
Joined: 03 Jan 2017, 10:58
Location: Germany

Re: Sonoff 4CH with ESPEasy

#16 Post by toffel969 » 14 Feb 2017, 21:36

Elmacaroni wrote:Seems to got it compiling now with Aduino IDE 1.8.1.
Changed the board to 8285
It generates a file: ESPEasy.ino.generic.bin, right?
Changed nothing on the source, flashed the bin with esptool.py (running Ubuntu) as I did several times for the SonOff 8266.
But nada/nothing to see. No ESP_0 here...

Confused...
The bin file should be correct, but i would only use that for ota. I had to Flash some sonoff multiple times until they worked.
Can you Post serial Output? After flashing open arduino serial Monitor and contact @115200 bps. You can also Flash straight from arduino ide by using compile and Upload. Esp need to be in flashing mode

Also, How did you Power the Board? Maybe your ttl Adapter gives enough juice to Flash sonoff, but not for the 4ch
Domoticz on Raspi 2 -- 14 ESP units (hacked Sonoff,NodeMCUs, Wemos, self-built units) running with RC140- Mega 2.0.0 dev8

Elmacaroni
New user
Posts: 4
Joined: 13 Feb 2017, 19:43

Re: Sonoff 4CH with ESPEasy

#17 Post by Elmacaroni » 14 Feb 2017, 22:07

toffel969 wrote: The bin file should be correct, but i would only use that for ota. I had to Flash some sonoff multiple times until they worked.
Can you Post serial Output? After flashing open arduino serial Monitor and contact @115200 bps.
You can also Flash straight from arduino ide by using compile and Upload. Esp need to be in flashing mode

Also, How did you Power the Board? Maybe your ttl Adapter gives enough juice to Flash sonoff, but not for the 4ch
Arduino: 1.8.1 (Linux), Board:"Generic ESP8285 Module, 80 MHz, 115200, 1M (512K SPIFFS)"

De schets gebruikt 424417 bytes (84%) programma-opslagruimte. Maximum is 499696 bytes.
Globale variabelen gebruiken 49168 bytes (60%) van het dynamisch geheugen. Resteren 32752 bytes voor lokale variabelen. Maximum is 81920 bytes.
warning: espcomm_sync failed
error: espcomm_open failed
error: espcomm_upload_mem failed
error: espcomm_upload_mem failed

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
Options enabled:
esptool v0.4.9 - (c) 2014 Ch. Klippel <ck@atelier-klippel.de>
setting board to ck
setting baudrate from 115200 to 115200
setting port from /dev/ttyUSB0 to /dev/ttyUSB0
setting address from 0x00000000 to 0x00000000
espcomm_upload_file
espcomm_upload_mem
opening port /dev/ttyUSB0 at 115200
tcgetattr
tcsetattr
serial open
opening bootloader
resetting board
trying to connect
espcomm_send_command: sending command header
espcomm_send_command: sending command payload
trying to connect
espcomm_send_command: sending command header
espcomm_send_command: sending command payload
espcomm_send_command: receiving 2 bytes of data
espcomm_send_command: receiving 2 bytes of data
espcomm_send_command: receiving 2 bytes of data
espcomm_send_command: receiving 2 bytes of data
espcomm_send_command: receiving 2 bytes of data
espcomm_send_command: receiving 2 bytes of data
espcomm_send_command: receiving 2 bytes of data
espcomm_send_command: receiving 2 bytes of data
Uploading 428560 bytes from /tmp/arduino_build_93838/ESPEasy.ino.bin to flash at 0x00000000
erasing flash
size: 068a10 address: 000000
first_sector_index: 0
total_sector_count: 105
head_sector_count: 16
adjusted_sector_count: 89
erase_size: 059000
espcomm_send_command: sending command header
espcomm_send_command: sending command payload
setting timeout 15000
setting timeout 100
espcomm_send_command: receiving 2 bytes of data
writing flash
................................................................................ [ 19% ]
................................................................................ [ 38% ]
................................................................................ [ 57% ]
................................................................................ [ 76% ]
................................................................................ [ 95% ]
................... [ 100% ]
starting app without reboot
espcomm_send_command: sending command header
espcomm_send_command: sending command payload
espcomm_send_command: receiving 2 bytes of data
closing bootloader
Arduino serial Monitor:
FLASH: Zero Fill Sector: 232
FLASH: Zero Fill Sector: 233
FLASH: Zero Fill Sector: 234
FLASH: Settings saved
FLASH: Settings saved

ets Jan 8 2013,rst cause:1, boot mode:(1,7)


ets Jan 8 2013,rst cause:4, boot mode:(1,7)

wdt reset
Then nothing. Powered up the 4Ch, and voila! ESP_0 in the air!

Image


One happy El is one step further.
You wrote: I had to Flash some sonoff multiple times until they worked.

Me too ;-)

jbaumann
Normal user
Posts: 16
Joined: 21 Mar 2016, 23:15

Re: Sonoff 4CH with ESPEasy

#18 Post by jbaumann » 18 Feb 2017, 13:23

Sorry, I didn't have the time for the forum in the last days. Happy that everything worked :-)

Cheers, Joachim

DavidVT
Normal user
Posts: 18
Joined: 26 Nov 2016, 04:27

Re: Sonoff 4CH with ESPEasy

#19 Post by DavidVT » 20 Feb 2017, 20:19

I have my Sonoff 4Ch working well with 9 one-wire sensors.
I have flashed back and forth between ESPEasy and Tasmota so may have self inflicted some problems...

One issue I am struggling with:
The 'rule' I copied out of the old Sonoff wifi was a way to toggle the power relay with pressing the single Sonoff button.
When I try that now on the Sonoff 4ch, I get strange results. Channel one almost works as expected. Channels 2,3,4 simply will not turn on at all.
When I watch the buttons on MQTT, I see them latch on or off.

I am curious if the rules could be impacted by my swapping between the firmware? It did mess up the devices which I had to redo.

Thoughts anyone?

paxi
Normal user
Posts: 121
Joined: 02 Feb 2017, 00:48
Location: Germany

Re: Sonoff 4CH with ESPEasy

#20 Post by paxi » 20 Feb 2017, 21:57

Post your rules. ;)
If in doubt if back and forth flashing messed up then erase flash (see here) and start from scratch. Since settings are stored outside the actual firmware it is possible that some residual data is confusing espeasy.

DavidVT
Normal user
Posts: 18
Joined: 26 Nov 2016, 04:27

Re: Sonoff 4CH with ESPEasy

#21 Post by DavidVT » 21 Feb 2017, 00:39

Rules built from other examples and changed for the first two switches of four on the 4 channel Sonoff.
The first button and relay works some times but the second set does not.
For both I can see the status change in MQTT, the web console and the device page (with refresh). But again, no second relay operation.
I have done all four but only show two here.
Any one see the simple mistake that must be there??

I swear this worked the first time I programmed it. But all those flash swaps perhaps I borked the hardware if that is possible? I will now try to operate those relays via node-red to make sure they are ok.

Thx
====
On PowerSwitch#Switch1 do
If [PowerState#Relay1]=0
gpio,12,1
else
gpio,12,0
endif
endon

On PowerSwitch#Switch2 do
If [PowerState#Relay2]=0
gpio,5,1
else
gpio,5,0
endif
endon
================

DavidVT
Normal user
Posts: 18
Joined: 26 Nov 2016, 04:27

Re: Sonoff 4CH with ESPEasy

#22 Post by DavidVT » 21 Feb 2017, 01:02

And yes, all hardware works and responds via Node-red and MQTT. However much slower than via the local rules....

User avatar
toffel969
Normal user
Posts: 469
Joined: 03 Jan 2017, 10:58
Location: Germany

Re: Sonoff 4CH with ESPEasy

#23 Post by toffel969 » 21 Feb 2017, 07:11

DavidVT wrote:Rules built from other examples and changed for the first two switches of four on the 4 channel Sonoff.
The first button and relay works some times but the second set does not.
For both I can see the status change in MQTT, the web console and the device page (with refresh). But again, no second relay operation.
I have done all four but only show two here.
Any one see the simple mistake that must be there??

I swear this worked the first time I programmed it. But all those flash swaps perhaps I borked the hardware if that is possible? I will now try to operate those relays via node-red to make sure they are ok.

Thx
====
On PowerSwitch#Switch1 do
If [PowerState#Relay1]=0
gpio,12,1
else
gpio,12,0
endif
endon

On PowerSwitch#Switch2 do
If [PowerState#Relay2]=0
gpio,5,1
else
gpio,5,0
endif
endon
================
set web log to level 4 under advanced. then try to actuate relay via switch. post the log.
Domoticz on Raspi 2 -- 14 ESP units (hacked Sonoff,NodeMCUs, Wemos, self-built units) running with RC140- Mega 2.0.0 dev8

paxi
Normal user
Posts: 121
Joined: 02 Feb 2017, 00:48
Location: Germany

Re: Sonoff 4CH with ESPEasy

#24 Post by paxi » 21 Feb 2017, 09:22

Make sure the last linr in rules ends with CR/LF is another idea.

Or simply erase the flash - if it worked before there's something messed up. ;)
The sympthoms clearly indicate this.

jbaumann
Normal user
Posts: 16
Joined: 21 Mar 2016, 23:15

Re: Sonoff 4CH with ESPEasy

#25 Post by jbaumann » 21 Feb 2017, 17:10

I used the following rules to enable all buttons (with R148). I defined the buttons as Channel1 - Channel4:

Code: Select all

On Channel1#Switch do
    if [Channel1#Switch]=1
        event,Channel1_On
    else
        event,Channel1_Off
    endif
endon
On Channel2#Switch do
    if [Channel2#Switch]=1
        event,Channel2_On
    else
        event,Channel2_Off
    endif
endon
On Channel3#Switch do
    if [Channel3#Switch]=1
        event,Channel3_On
    else
        event,Channel3_Off
    endif
endon
On Channel4#Switch do
    if [Channel4#Switch]=1
        event,Channel4_On
    else
        event,Channel4_Off
    endif
endon


on Channel1_On do
    gpio,12,1
    inputswitchstate 0,1
endon
on Channel1_Off do
    gpio,12,0
    inputswitchstate 0,0
endon

on Channel2_On do
    gpio,5,1
    inputswitchstate 9,1
endon
on Channel2_Off do
    gpio,5,0
    inputswitchstate 9,0
endon

on Channel3_On do
    gpio,4,1
    inputswitchstate 10,1
endon
on Channel3_Off do
    gpio,4,0
    inputswitchstate 10,0
endon

on Channel4_On do
    gpio,15,1
    inputswitchstate 14,1
endon
on Channel4_Off do
    gpio,15,0
    inputswitchstate 14,0
endon
I didn't find a more elegant definition, and didn't invest any more time for a better solution...

Cheers, Joachim

DavidVT
Normal user
Posts: 18
Joined: 26 Nov 2016, 04:27

Re: Sonoff 4CH with ESPEasy

#26 Post by DavidVT » 22 Feb 2017, 04:02

Joachim,
I wiped the Sonoff 4ch unit and tried your code. It worked, much to my delight (with MQTT disabled so to not conflict).

Next I rebuilt my 1-wire sensor devices, (still leaving MQTT disabled).
Now only the Channel 1 button will work. The rule code is unchanged and the log file shows the test for [channelX#Switch]=1 fails for all but channel1, pushing the events to off rather than on....

If I change the following, I can properly operate the Channel 4 relay properly with the first button (or any of the 4):
==========
On Channel1#Switch do
if [Channel1#Switch]=1
event,Channel1_On
else
event,Channel1_Off
endif
endon
=========
to:
=========
On Channel1#Switch do
if [Channel1#Switch]=1
event,Channel4_On
else
event,Channel4_Off
endif
endon
=========
But trying the Channel2,3,4 buttons fail.
Perplexed...
I have tried my switches normal, active low, with and without delays, etc.
Any thoughts?
Thank you

paxi
Normal user
Posts: 121
Joined: 02 Feb 2017, 00:48
Location: Germany

Re: Sonoff 4CH with ESPEasy

#27 Post by paxi » 22 Feb 2017, 08:42

Leaving IDX=0 is a common trap - are they all different and ≠0?
Save your settings and attach them here or make screenshots of all devices. We need every detail. ;)

Can you make the buttons work again by removing the sensors?

DavidVT
Normal user
Posts: 18
Joined: 26 Nov 2016, 04:27

Re: Sonoff 4CH with ESPEasy

#28 Post by DavidVT » 22 Feb 2017, 19:54

Thank you,
I just put ESPEasy on the other Sonoff 4ch to get a fresh start and the most recent rules work fine with the buttons.
No MQTT, no 1-wire, no relays defined yet.

I use IDX of four digits. example 9201,9202, etc. following last two IP+two digit Task that seems to work ok.

BUT I think I see the problem...

As I change the Device 'Name' and 'Value' text to my format, the problem came back.
This makes sense as to why it once worked on the other unit. I changed the names at one point to improve MQTT issues... hmmmm
In my case I like to use the same Names across functions so they group in MQTT.

BEFORE:
On Channel1#Switch do
if [Channel1#Switch]=1

MY Format: 'Name' not unique, 'Value' text is unique. I thought the combination was evaluated not just 'Name'.
On PowerSwitch#Switch1 do
if [PowerSwitch#Switch1]=1
OR:
On PowerSwitch#Switch3 do
if [PowerSwitch#Switch3]=1

Watching the log file, the 'ON' selection combination works correct with my syntax but the 'IF' choice is failing. I would see the EVENT fire properly but the IF test would fail.

This is working for now with unique names but I really want the number out of Name if possible. Or another way to group them in MQTT..?
I went back to the other Sonoff4ch and made the same changes (with the MQTT turned off). The buttons all work now despite being very slow.
--- following working on both units, but really would prefer to make 'PowerSwitch' the same for all 4 buttons and the unique part be the 'Value' text ---
On PowerSwitch#Switch1 do
if [PowerSwitch#Switch1]=1
event,Channel1_On
else
event,Channel1_Off
endif
endon
On PowerSwitch2#Switch2 do
if [PowerSwitch2#Switch2]=1
event,Channel2_On
else
event,Channel2_Off
endif
endon
On PowerSwitch3#Switch3 do
if [PowerSwitch3#Switch3]=1
event,Channel3_On
else
event,Channel3_Off
endif
endon
On PowerSwitch4#Switch4 do
if [PowerSwitch4#Switch4]=1
event,Channel4_On
else
event,Channel4_Off
endif
endon


on Channel1_On do
gpio,12,1
inputswitchstate 0,1
endon
on Channel1_Off do
gpio,12,0
inputswitchstate 0,0
endon

on Channel2_On do
gpio,5,1
inputswitchstate 9,1
endon
on Channel2_Off do
gpio,5,0
inputswitchstate 9,0
endon

on Channel3_On do
gpio,4,1
inputswitchstate 10,1
endon
on Channel3_Off do
gpio,4,0
inputswitchstate 10,0
endon

on Channel4_On do
gpio,15,1
inputswitchstate 14,1
endon
on Channel4_Off do
gpio,15,0
inputswitchstate 14,0
endon
---
FYI:
Unit with 1-wire is running at 34% with MQTT off
Unit with no 1-wire and MQTT off is running at 6%


Thank you

David
paxi wrote:Leaving IDX=0 is a common trap - are they all different and ≠0?
Save your settings and attach them here or make screenshots of all devices. We need every detail. ;)

Can you make the buttons work again by removing the sensors?

paxi
Normal user
Posts: 121
Joined: 02 Feb 2017, 00:48
Location: Germany

Re: Sonoff 4CH with ESPEasy

#29 Post by paxi » 22 Feb 2017, 21:49

Its really really difficult to follow without seeing the working/failing setups.:roll: Give us the complete picture. ;)
I'm going to guess:

1) You created 4 switch devices with the same name?
Or
2) PowerSwitch is a dummy device with the values switch1-4?

In case 1) it must fail because the firmare skimms through the list of devices and adresses the first one it finds for that name. Use unique names.

For 2) it should be possible to create rules and mttq topics around it.

I refuse to answer further questions without screenshots, logs and complete rules (preferably nicely wrapped in 'code' tags). :lol:

paxi
Normal user
Posts: 121
Joined: 02 Feb 2017, 00:48
Location: Germany

Re: Sonoff 4CH with ESPEasy

#30 Post by paxi » 22 Feb 2017, 22:01

Ok, your edit made it clear. :D

The solution is to keep the "unique name stuff" aka the physical devices and their representation in software completely inside espeasy (send data disabled) and work with a dummy to send data to and recieve commands from your controller.

DavidVT
Normal user
Posts: 18
Joined: 26 Nov 2016, 04:27

Re: Sonoff 4CH with ESPEasy

#31 Post by DavidVT » 23 Feb 2017, 20:57

Thank you for all the help!

I learned and used the dummy device for the switches on both units.
I used the dummy device x2 for the eight 1wire sensors on that unit.
I turned off send data for all the 'real' devices. That 'seems' to have lowered the load on the 1wire Sonoff.
Sonoff 4 channel with no Temp Sensors: 21%
Sonoff 4 channel with 8 one wire sensors: 34%

FYI: The portion of the rules for feeding the 3 dummy devices on the 1wire Sonoff looks like this:
--
On Clock#Time do // this event comes in every minute
TaskValueSet 20,1,[PowerSwitch1#Switch]
TaskValueSet 20,2,[PowerSwitch2#Switch]
TaskValueSet 20,3,[PowerSwitch3#Switch]
TaskValueSet 20,4,[PowerSwitch4#Switch]
TaskValueSet 4,1,[OneWire9211#Temp]
TaskValueSet 4,2,[OneWire9212#Temp]
TaskValueSet 4,3,[OneWire9213#Temp]
TaskValueSet 4,4,[OneWire9214#Temp]
TaskValueSet 6,1,[OneWire9215#Temp]
TaskValueSet 6,2,[OneWire9216#Temp]
TaskValueSet 6,3,[OneWire9217#Temp]
TaskValueSet 6,4,[OneWire9218#Temp]
endon
--

I did learn that I can place a slash in the Task name which really helped with the MQTT subscriptions.
On the one wire unit, I have two dummy devices for the OneWire sensors but want to subscribe only once.
So, the device names are "OneWire/A" and "OneWire/B".
The MQTT subscription is "/+/OneWire/#"
That gives me all 8 sensors readings from the Sonoff4ch and 1 sensor from a wifi Sonoff that has a device name "OneWire".
--
S4onoff2DevicePage1.PNG
S4onoff2DevicePage1.PNG (33.4 KiB) Viewed 45618 times
MQTTinspector.jpg
MQTTinspector.jpg (172.6 KiB) Viewed 45618 times
This should be my last post on this as it did run off the hardware topic quite a bit..
Thx again

paxi
Normal user
Posts: 121
Joined: 02 Feb 2017, 00:48
Location: Germany

Re: Sonoff 4CH with ESPEasy

#32 Post by paxi » 23 Feb 2017, 23:38

Great!

Depending on how often the pushbuttons are used I'd prefer to update the switch states immediately instead of once per minute:

Code: Select all

on PowerSwitch1#Switch do TaskValueSet 20,1,[PowerSwitch1#Switch]
;)

wrbrower
New user
Posts: 6
Joined: 16 Oct 2016, 17:18

Re: Sonoff 4CH with ESPEasy

#33 Post by wrbrower » 26 Feb 2017, 16:33

Remember when flashing ESP8285 devices (Like the SONOFF TOUCH - I have not tried flashing my SONOFF 4CH yet) use SPI Mode DOUT.
Attachments
Capture.PNG
Capture.PNG (20.09 KiB) Viewed 45585 times

manjh
Normal user
Posts: 516
Joined: 08 Feb 2016, 11:22

Re: Sonoff 4CH with ESPEasy

#34 Post by manjh » 25 May 2017, 15:07

I need a little push in the right direction.
This morning I flashed brandnew Sonoff 4CH with an ESP Easy bin that I found (I currently don't have the compile environment setup, so prefer a pre-compiled set).
Attached an FTDI device (no TX/RX crossing, as advised), and attached to a USB port.
Flashing went OK, I saw the MAC address showing up in the panel so communication was OK.
It took a minute or two to download the firmware into the device, and the log showed that everything was OK.

So I detached the whole thing and connected the mains. I expected ESP_0 to show up on Wifi, but that did not happen. Nothing.
Then detached the mains, repeated the whole procedure just to make sure. Same result.
I then kept serial (TX/RX) connected, detached ground and vcc, started the Arduino IDE as port monitor and plugged in the mains.
On 57600 baud, I could see the usual startup information coming up, but after that a lot of rubbush.
Unplug the mains and replug: same result. Tried other speeds but then no readable text is coming up.

Any hints, or advise?

Shardan
Normal user
Posts: 1156
Joined: 03 Sep 2016, 23:27
Location: Bielefeld / Germany

Re: Sonoff 4CH with ESPEasy

#35 Post by Shardan » 25 May 2017, 18:26

Hello,

two things about this.
ESPEasy on the serial answers on 115200 Bd on the serial.

Second: The sonoff 4ch uses a little different chip. It is not the ESP8266, it's the ESP8285.
This chip has it's own flash built in and uses it a little different from the usual ESP8266 with external flash.

So you definitely need to compile your own ESP-firmware. The ready made .bin-files are for ESP8266.

You may use this version i've compiled for my own 4ch's.
ESPEasy_R148a_1024.zip
(281.09 KiB) Downloaded 1016 times
Please anyone, be aware: This is not an official release, don't expect support for it.

Regards
Shardan
Regards
Shardan

manjh
Normal user
Posts: 516
Joined: 08 Feb 2016, 11:22

Re: Sonoff 4CH with ESPEasy

#36 Post by manjh » 26 May 2017, 18:07

I used a pre-compiled bin file, especially for the Sonoff 4CH.

But just to make sure, I installed the Arduino environment, downloaded the latest 2.0+ source, installed the libs in the right place, and downloaded the ESP board info set.
Then selected the right com port and board (ESP8285), and then recompiled and downloaded into the board without problems.

After that checked the serial monitor: nothing.

Next step was to disconnect vcc from my ftdi device, and plug in the mains.
I then saw something coming up on the serial monitor, readable at 74880 baud:

Code: Select all

 ets Jan  8 2013,rst cause:1, boot mode:(3,6)

load 0x4010f000, len 1384, room 16 
tail 8
chksum 0x2d
csum 0x2d
v4022eaa8
~ld
ƒÿÿ“ÿû»
Does this make sense to anyone? Since the Arduino compiler will download the firmware without complaints, I am guessing the hardware is OK.
But what is wrong then?

Shardan
Normal user
Posts: 1156
Joined: 03 Sep 2016, 23:27
Location: Bielefeld / Germany

Re: Sonoff 4CH with ESPEasy

#37 Post by Shardan » 26 May 2017, 18:50

manjh wrote: 26 May 2017, 18:07
Next step was to disconnect vcc from my ftdi device, and plug in the mains.
I suggest to try another USB-TTL board with CH340G, PL2202 or similiar.
The FT232 on the cheap modules is a fake chip in most cases.
A genuine FT232 chip alone costs around 5€/piece in lots of 1000.
Compare the price you paid to that.....


Anyways, FTDI has taken measurements against those fakes:
The data you send to the ESP will be corrupted by the windows driver
if the driver detects a fake chip. As the flash programs can't do a
"read back and compare" it looks like flashing worked fine.
But some of the code has ben replaced by "FAKE CHIP DETECTED"
or something similiar this ruining the code.

(Note to myself: Make a prepared text for this... ;) )

Regards
Shardan
Regards
Shardan

manjh
Normal user
Posts: 516
Joined: 08 Feb 2016, 11:22

Re: Sonoff 4CH with ESPEasy

#38 Post by manjh » 26 May 2017, 20:37

I've used these ftdi units for several other flashes, without any problem. Most recently I flashed 4 Sonoff single channel units, and they work just fine. So I am guessing I must have the "real" chips... :D
FYI: I have two different FTDI converters, tried both.

Shardan
Normal user
Posts: 1156
Joined: 03 Sep 2016, 23:27
Location: Bielefeld / Germany

Re: Sonoff 4CH with ESPEasy

#39 Post by Shardan » 27 May 2017, 00:17

Did you set DIO mode for flashing?

Otherwise your 4ch might be faulty.
Regards
Shardan

manjh
Normal user
Posts: 516
Joined: 08 Feb 2016, 11:22

Re: Sonoff 4CH with ESPEasy

#40 Post by manjh » 27 May 2017, 08:52

Shardan wrote: 27 May 2017, 00:17 Did you set DIO mode for flashing?

Otherwise your 4ch might be faulty.
Where in the Arduino IDE can I set DIO mode?

Shardan
Normal user
Posts: 1156
Joined: 03 Sep 2016, 23:27
Location: Bielefeld / Germany

Re: Sonoff 4CH with ESPEasy

#41 Post by Shardan » 27 May 2017, 11:04

Sorry, i have to pass on that, i don't use the arduino ide for flashing.

I've compiled with the "Export Binary File" option and used the .bin file with the ESPtool delivered with the R14x versions.
Regards
Shardan

Bas Spiek
New user
Posts: 2
Joined: 11 Jun 2017, 18:12
Location: Heteren

Re: Sonoff 4CH with ESPEasy

#42 Post by Bas Spiek » 11 Jun 2017, 18:48

Have somebody solved this problem already? i also have a sonoff 4ch. flash looks ok no errors. but no esp01 on wifi.

Hope somebody kan help me, drives me crazy :shock:

manjh
Normal user
Posts: 516
Joined: 08 Feb 2016, 11:22

Re: Sonoff 4CH with ESPEasy

#43 Post by manjh » 11 Jun 2017, 19:21

Did you check what the unit gives back over serial? Set at 115K and see what comes out...

Shardan
Normal user
Posts: 1156
Joined: 03 Sep 2016, 23:27
Location: Bielefeld / Germany

Re: Sonoff 4CH with ESPEasy

#44 Post by Shardan » 11 Jun 2017, 19:58

Which programmer did you use?
Regards
Shardan

Bas Spiek
New user
Posts: 2
Joined: 11 Jun 2017, 18:12
Location: Heteren

Re: Sonoff 4CH with ESPEasy

#45 Post by Bas Spiek » 13 Jun 2017, 21:53

Solved,

The programmer that came with the bin file (FlashESP8266.exe) did not work. Now i used the Nodemcu programmer and that worked well!!
Now i have ESPEasy_v2.0.0-dev10_normal_1024.bin flashed on my Sonoff 4 channel.


THX :D

ewaldharmsen
Normal user
Posts: 66
Joined: 16 Feb 2017, 09:23

Re: Sonoff 4CH with ESPEasy

#46 Post by ewaldharmsen » 21 Jun 2017, 08:01

thanks for this post!

I succesfully flashed my 4CH.

However I would like a few more GPIO pins.
I planned to solder pins for GPIO7 and 8, but they are not available in the ESP Easy GUI.

How can I add them?

Shardan
Normal user
Posts: 1156
Joined: 03 Sep 2016, 23:27
Location: Bielefeld / Germany

Re: Sonoff 4CH with ESPEasy

#47 Post by Shardan » 21 Jun 2017, 15:16

Use of GPIO 7 / 8 is not recommendet as they are used for other purposes (SDIO/SPI).
That's why they are simply not built into the firmware.

Anyways yo may alter the firmware to your needs and compile it yourself.

Regards
Shardan
Regards
Shardan

manjh
Normal user
Posts: 516
Joined: 08 Feb 2016, 11:22

Re: Sonoff 4CH with ESPEasy

#48 Post by manjh » 11 Jul 2017, 13:09

I just received a fresh Sonoff 4CH this week, and tried to flash it. Before doing that I checked with the Sonoff app and found the unit in good working condition.
Then I tried to flash it with the "Captain-Slow" R148 bin file with the NodeMCU programmer. It appeared to load OK, but after that I tried to restart the Sonoff and looked for the Wifi access point, nothing there. Also tried to connect to serial and see what comes out. Nothing.

After that I tried the Arduino compiler, set it to the right device and size (1M), and compiled/loaded.
No complaints from the compiler, and the load went 100% OK.
Restarted the Sonoff, still no sign of it on Wifi or serial.

Any hints?


Edit: I found out that the combination of the right bin file with the proper loader is important.
I found a bin file named "ESPEasy_R148a_1024" (source unknown...) and combined it with the usual Esptool.exe and flash.cmd files. Then uploaded into my new 4CH and: success!
This solution was actually recommended a few postst above by Shardan, on 27 May 2017, 11:04. So I could have known.... :mrgreen:

Shardan
Normal user
Posts: 1156
Joined: 03 Sep 2016, 23:27
Location: Bielefeld / Germany

Re: Sonoff 4CH with ESPEasy

#49 Post by Shardan » 11 Jul 2017, 15:16

Hello,

the R148a-file was published by me.
The main difference is that the sonoff 4ch uses a ESP8285, not an ESP8266 so it has to be compiled for this CPU.
They differ in the way memory is connected so the compiler has to take care for that.

Regards
Shardan
Regards
Shardan

cy80rg
New user
Posts: 8
Joined: 23 Aug 2017, 22:08

Noob question?

#50 Post by cy80rg » 23 Aug 2017, 22:22

Evening all,

Work in IT and pretty au fait with Raspberry Pi stuff (so vaguely intelligent, I like to think! ;) )

My new Sonoff 4 channel switch is my first project trying to flash EasyESP.

I've flashed stuff before, but I cant work out how to give the Sonoff enough power to boot?

I saw one video where the guy's Sonoff (pro) has a DC-in, but my non-pro doesnt have that.

I've been trying to work off this...
https://captain-slow.dk/2017/04/01/flas ... onoff-4ch/

By putting the voltage reg inline on my breadboard - but the Sonoff didnt power on at all, perhaps unsurprisingly.

Looking at that tut linked above, he's got seperate pins for 5v, VCC and 3.3v.
With the jumper between vcc & 3.3v, I beleive that just sets the "value" / output of VCC to 3.3v?
On my programmer, my 5v / 3.3v jumper is on a seperate jumper pins on the board.

Just running the Sonoff off the 3.3v on the programmer, the Sonoff booted, but then constantly rebooted due to the lack of ampage (as expected).

My programmers one of these...
Image

Any help on this please?

Thanks :)

cy80rg
New user
Posts: 8
Joined: 23 Aug 2017, 22:08

Noob - powering Sonoff for flash?

#51 Post by cy80rg » 23 Aug 2017, 22:37

More specifically, my issue is:

On his modd'ed programmer in that tutorial, he's got 3 pins - 1 VCC, 1 3.3v, 1 ground.

On my programmer, I have two pins - Vcc and ground.

Looking at his programmer / voltage reg, he's got the first two legs of the voltage reg going to VCC and 3.3, but then using a jumper to short them together / set 3/3v.
The 3rd leg of the reg is ground, which is easy enough.

On my programmer, I only have the one Vcc + voltage select on jumpers above the out put pins, so - in desperation - I figured that joining both Vin and OUT on the reg to the VCC on the programmer would be an equivalent... obviously not.

From the inline voltage reg (on my breadboard) I had Vin and OUt going to VCC on the programmer, with Ground going to Ground on the Sonoff.

Clearly I was incorrect - what should i have done?

sjp770
New user
Posts: 3
Joined: 24 Aug 2017, 03:49

Re: Sonoff 4CH with ESPEasy

#52 Post by sjp770 » 24 Aug 2017, 03:56

Any ideas if the Sonoff 4CH Pro is supported? Would love to have the RF support as well.

manjh
Normal user
Posts: 516
Joined: 08 Feb 2016, 11:22

Re: Sonoff 4CH with ESPEasy

#53 Post by manjh » 24 Aug 2017, 08:17

What you could do is connect tx/rx and ground, keeping the vcc pin open, and then connect the Sonoff to mains. Careful! :geek: :ugeek: :geek:

cy80rg
New user
Posts: 8
Joined: 23 Aug 2017, 22:08

Re: Sonoff 4CH with ESPEasy

#54 Post by cy80rg » 24 Aug 2017, 09:20

Thanks Manjh ,
I know it's easy to "ignore the dumb noob" when you guys are all at such a higher level :)

Much appreciate your help, I'll give that a try tonight.

Apart from "generally not poking things with a screw driver" when connected to the mains, and specific non no's?

From your advice, I plan to run a direct mains supply into the "wire clamp input" (no barrel input on this model)...

Is that correct?

manjh
Normal user
Posts: 516
Joined: 08 Feb 2016, 11:22

Re: Sonoff 4CH with ESPEasy

#55 Post by manjh » 24 Aug 2017, 14:06

cy80rg wrote: 24 Aug 2017, 09:20 Thanks Manjh ,
I know it's easy to "ignore the dumb noob" when you guys are all at such a higher level :)

Much appreciate your help, I'll give that a try tonight.

Apart from "generally not poking things with a screw driver" when connected to the mains, and specific non no's?

From your advice, I plan to run a direct mains supply into the "wire clamp input" (no barrel input on this model)...

Is that correct?
Don't worry if you're a noob or not (I doubt it), even Einstein started out as an absolute noob :)

The only thing you need to remember when you're working on the Sonoff 4CH when it is attached to mains: there will be leads on the bottom that are "live". So make sure you place the print in the bottom part of the housing, and place it on a very stable flat surface. Make sure the leads are out of the way so you can't accidentally pull the print from the table. Imagine what would happen if in a reflex you try to catch it...
All jokes aside, 230V is no joke to play around with.

So connect a wire with a plug to the "mains in", connect tx/rx (remember: no crossing for this device!), and connect ground (probably not really needed, but I would connect it anyway).
Once you are satisfied that everything is connected: connect the plug to a mains outlet.

cy80rg
New user
Posts: 8
Joined: 23 Aug 2017, 22:08

Re: Sonoff 4CH with ESPEasy

#56 Post by cy80rg » 24 Aug 2017, 14:50

Thanks Manjh :)

One last...

When you say "no crossing on this device", does that mean

A) the device doesnt cross tx to Rx, so I'll need to
Or
B) the device does cross, so I don't need to?

So Rx to Rx, tx to tx?

manjh
Normal user
Posts: 516
Joined: 08 Feb 2016, 11:22

Re: Sonoff 4CH with ESPEasy

#57 Post by manjh » 24 Aug 2017, 16:28

cy80rg wrote: 24 Aug 2017, 14:50 Thanks Manjh :)

One last...

When you say "no crossing on this device", does that mean

A) the device doesnt cross tx to Rx, so I'll need to
Or
B) the device does cross, so I don't need to?

So Rx to Rx, tx to tx?
Normally you would cross: so connect tx to rx and vv.
With the Sonoff the labels tell you where to connect. So connect tx to tx, rx to rx.

cy80rg
New user
Posts: 8
Joined: 23 Aug 2017, 22:08

Re: Sonoff 4CH with ESPEasy

#58 Post by cy80rg » 24 Aug 2017, 19:24

thanks manjh

home now, got the sonoff and the programmer connected as you suugest - runnng off the mains.

power to the sonoff is stable.

I was hoping it would just be a case of "holding down the first button", then appying power to the sonoff to get in to boot flash mode...

Howver, if i do that - the sonoff doesnt seem to turn on at all (no lights).

However, if i push the first button (fw/100 - I like the fact it's labelled "fw"!) , after the sonoff is powered, the L4 led lights (IO4) - in what may be green or red (im color blind).

Trying to upload a bin to the sonoff via Nodemcu... I get

Arbitrarily set to COm5, as thats what Nodemcu started up with.

AP MAC - Waiting MAC
STA MAC - waiting mac

Blue spinning icon bottom let corner (which i assume means it thinks its doing something), and reuire ("gpio") and require("wifi") fade in and out under the com area of the UI.

I would imagine those are the current commands being sent to - received from the sonoff - but they just repeat...

Silly question - this sonoff is straight out of the box - I've never had it associated on my wifi etc - do i need to do the basic set up, as per the OEM fw, first?

For fear the FW is actually being written - I'll leave it all plugged in and "doing it's thang" for a while....

manjh
Normal user
Posts: 516
Joined: 08 Feb 2016, 11:22

Re: Sonoff 4CH with ESPEasy

#59 Post by manjh » 24 Aug 2017, 20:12

You will need to get the Sonoff in flash mode before applying power. If it reacts to that first button like you describe, it means that the firmware is still the original Sonoff.
If you want to test, you could download their app and see if you can pair it.

So: press and hold the button and only then plug in the mains. That should do it (I flashed two of them this way)

cy80rg
New user
Posts: 8
Joined: 23 Aug 2017, 22:08

Re: Sonoff 4CH with ESPEasy

#60 Post by cy80rg » 24 Aug 2017, 22:48

Thanks Manjh,

So, hold down the first button (marked fw/io01) then power the sonoff, then release the button...?

How does the Sonoff show its in flash mode, lit LEDs etc?

When I did that with mine, it didn't show any LEDs or sign of life period.

I have since paired and tested with the OEM app, so at least I've not killed it....

Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 56 guests