Sonoff Basic works on USB/FTDI not on mains - huh?

376 views
Skip to first unread message

Lee Hiscott

unread,
May 14, 2018, 1:53:46 PM5/14/18
to SonoffUsers
Hi Guys,

Got all my software isues solved, now have:

Openhab -> basic -> switch -> mqtt -> Sonoff-Basic (v5.13.1a)

When powered from the PC-USB-FTDI board, at 3.3V, the ON & OFF commands work AOK, from MQTT client & Openhab - great!
Power up works as expected, INFO1 through INFO3 and STATUS announcements are all AOK. More than AOK, they're GREAT!
PING is 95% reliable (it's a tiny processsor and wifi, so that's fine).

BUT------
If I power the Sonoff Basic from the mains (UK, so ostensibly 240V but mine's 248V), power up sequence is not as expected.
LED flashes 7 times,
Wifi isn't reliably connected, PING the device gives 90% lost packets, which is utterly unlike USB powered.
Sonoff/MQTT commands might get through, but could take 30sec or not at all because wifi connectivity is rubbish.

This is true of two separate Sonoff Basic units.
pcb designation th_v1.1 dated 2017-5-5
Voltage across the programming header = 3.3V   so should be OK.

Any suggestions?

I will be testing the rest of my bought units, incl 2ch and 4ch over the next few days.
;-(
Lee

Lee Hiscott

unread,
May 14, 2018, 6:56:55 PM5/14/18
to SonoffUsers
Ha! Testing the 2ch and it (sort of) works on Mains power...
Well, power1 works, but power2 throws "unknwon command" error. Still trying to nail that one down.
And despite switching off all other options, still can't get a web front end up with mqtt enabled.

any suggestions welcome,
;-)

Phil

unread,
May 15, 2018, 12:39:51 AM5/15/18
to SonoffUsers
you have flashed with the generic firmware, to set up for a sonoff dual and enable power2 control just point a browser at the sonoffs ip addy and select Configuration->Module Configuration from the main menu and select sonoff dual from the list of module types and save,  the system will restart and you should then have control over the 2nd relay  

Phil

unread,
May 15, 2018, 12:44:06 AM5/15/18
to SonoffUsers
How are you configuring the mqtt broker address if not through the web interface?


On Monday, 14 May 2018 23:56:55 UTC+1, Lee Hiscott wrote:

Phil

unread,
May 15, 2018, 1:18:34 AM5/15/18
to SonoffUsers
your inability to use mqtt and access the web interface of your devices is not normal. And suggests that perhaps some error has somehow been compiled into your binary file? rather than trace this i would suggest deleting or archiving the sources you have downloded and uncompressed, and refreshing from your download zip file, and only modify your wifi credentials in the config.h file before recompiling and flashing.

If that fails to enable normal functionality? then i would suggest trying to flash a vanilla 'sonoff-classic.bin' from https://github.com/arendst/Sonoff-Tasmota/releases And then configure your wifi credentials on the device via its AP interface by powering it up and looking for it in your computers available wifi networks and connecting to it.. The sonoff AP server address is 192.168.4.1, so pint a rowser at it to configure your wifi network credentials and you should be able to both employ mqtt and monitor and configure your device via its web interface..   


On Monday, 14 May 2018 23:56:55 UTC+1, Lee Hiscott wrote:

Lee Hiscott

unread,
May 15, 2018, 3:52:51 AM5/15/18
to SonoffUsers
Hi Guys,

Thanks for the help, much appreciated.
I haven't loaded the "stock" code, I've git cloned the release & edited the user_config.h contents according to the commented information, then compiled & loaded into the module.
The web server doesn't work for me, so I can't get to it to change the module type.

The mains power issue sems to be on two BASIC modules, (haven't tested the rest yet).
The firmware loads up, is reliable on wireless, (95% ping response) and MQTT commands & status work as expected - when powered from USB-FTDI module.
When mains powered, wifi is very lossy, MQTT is flaky (to be expected if the delivered over flaky wifi!).

It's almost like the mains to 3.3v supply is ropey. I've measured it with a voltmeter & it's 3.3V
I haven't got an oscilloscope handy or I'd look at the 3.3v supply closer.

I'd really rather not use a pre-compiled firmware file, and have to connect to one wifi, to set another one, far from ideal.
That's why I chose the git-clone & compile method, but clearly the "module selection" doesn't seem to be an option in this method - what am I missing?

Thanks in advance
Lee

Greg from Oz

unread,
May 15, 2018, 5:01:27 AM5/15/18
to SonoffUsers
You can use the precompiled binary and enter your ssid and password throught the serial console:

If ssid not set so this or some other serial program:

pio device monitor --port /dev/ttyUSB0 --baud 115200

then just type in 

ssid <space> <your ssid> <hit enter>
password <space> <your wifi password> <hit enter>
host <space> <your mqtt ip address> <hit enter>

You will NOT see what you are typing in, but it works.

Lee Hiscott

unread,
May 15, 2018, 7:44:22 AM5/15/18
to SonoffUsers
Hi Greg,

That is excellent, thanks.
I've always preferred static IP over DHCP, but as a "sanity check" it's a great option, thanks for that!
;-)

Greg from Oz

unread,
May 15, 2018, 8:00:52 AM5/15/18
to SonoffUsers
All mine are static. I just meant to use the binary so you can test to see it it works for you.

Phil

unread,
May 15, 2018, 10:43:33 AM5/15/18
to SonoffUsers
Is your DNS set correctly and is it different from your gateway addy?  is there any mac filtering enabled with your dhcp server?  without giving away details is your home network set up in any particular way that may be perhaps an enhancement of the 'out of the box ips provided system'. 

Something is hampering you from employing the simple web ui to control configure test and install your device.  If the devices are not establishing themselves within your home net correctly on start up they may be reverting to AP mode which could explain the infrequent PING failures??  If you get a ping failure can you check the list of available wifi networks to your puter (assuming your connecting with wifi) if there is an IteadXXXX Access point available, join it and attempt to open the AP config web ui @ 192.168.4.1..

Lee Hiscott

unread,
May 16, 2018, 4:47:11 AM5/16/18
to SonoffUsers
Hi Guys,

Thanks for the helpful nudges, all gratefully received. Checked DNS etc, and it's not in AP mode, I think it's just broke!
Hmm, interesting tests.
From my successful tests with 4CH and Dual_R2 modules and one other BASIC module, it begins to look like those two units are faulty!
I have bought an oscilloscope module (anly £15 eBay, not a REAL 'scope, but should be enough to watch the 3.3v rail come up...).
So for now they're in a box marked "probably broken", and I'll carry on with the rest.
Web page still doesn't work, but don't really care anymore. Once i've made some more prgress maybe i'll try a stock pre-compiled firmware, but for now this issue is closed.
Thanks for all your help & support.
;-)
Lee

Flyn...@gmail.com

unread,
May 31, 2018, 11:35:07 AM5/31/18
to SonoffUsers
Sounds to me like you are getting rfi from the mains and it is knocking six bells out of your wifi link. Have you got any other esp8266 devices you could try your compiled firmware on?.  Also, from something I remember from yonks ago....try a couple of different mains sockets in different rooms in your house, a dodgy mains earth can interfere with digital comms.

Lee Hiscott

unread,
Jun 5, 2018, 6:25:50 AM6/5/18
to SonoffUsers
Hi Flyn,
Again with the good suggestions!  I haven't analysed my home wifi, but that's worth a look.
The 4CH and a 2CH and a number of other Basics have worked OK, but that doesn't mean there aren't any other causes.
My next step will be to get a working oscilloscope & do some analogue analysis I think...
One other option - the power on might be less than clean, I've had to re-work hundreds (really hundreds) of devices whose power up circuit wasn't clean so they weren't coming out of reset reliably, so that'll be looked at, soon-ish.
I'll post an update if/when I find anything useful.
;-)

Ron L

unread,
Jun 18, 2018, 10:06:44 PM6/18/18
to SonoffUsers
Lee, I too have a Sonoff Basic that is behaving similar to yours.  That is, I can access via the web interface initially - shortly after power up; but after initial menu, I eventually get the "cannot access this address" message in my browser.  I have tried 5.14.0b and 6.0.0a version firmware, both act the same way. All my other devices work just fine except for this one device.  But, if I power it up using USB flash interface; I can access via  web interface, change configuration, etc.

Lastly, with unit plugged into mains; although web interface access is flakey, it does respond to MQTT published messages and will change state (ie. Power On and Power Off).  So the radio is not totally dead.

I never was able to get the web interface to hang in there long enough to check Status 11 and see what the Vcc value was (ie. 3.3v) .  I suspect it may be a bit shy of meeting contract.

Can't really complain though as these devices are truly amazing for no more than they cost.

Philip Knowles

unread,
Jun 19, 2018, 1:53:27 AM6/19/18
to Ron L, SonoffUsers

If it’s responding to MQTT you can request a Status 11  message from there. I use MQTT fx for troubleshooting like that

 

Sent from Mail for Windows 10

--
You received this message because you are subscribed to the Google Groups "SonoffUsers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sonoffusers...@googlegroups.com.
Visit this group at https://groups.google.com/group/sonoffusers.
To view this discussion on the web, visit https://groups.google.com/d/msgid/sonoffusers/0f68ca16-6cee-4726-a5c8-3caa7cee6dde%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

 

Colin Law

unread,
Jun 19, 2018, 3:00:03 AM6/19/18
to SonoffUsers
That sounds as if the power supply in that device is flaky.

Colin
Reply all
Reply to author
Forward
0 new messages