Questions with regards to ESP8266 Basic and hardware interfacing and control via Basic commands

Moderator: Mmiscool

User avatar
By forlotto
#50894 CURRENTLY RUNNING ESPBASIC v3 alpha 12 on the SONOFF works perfect

HOW TO SONOFF ESPBASIC

Do not hookup to mains to program!

USE THE FOLLOWING IMAGE AS A REFERENCE!
sonoff5 Programming Pinout.jpg

solder pin header on the 4 pins in the picture above.
if you have a 5th pin it is a new version the 5th pin is GPIO14 good for DHT sensor no worries ignore this!

Once you have header soldered hook to usb to serial as follows
GND to GND
TX to RX
RX to TX
VCC to VCC

before you plug in
OPEN basic flasher
select com port
select 1MB flash
hold the button down to enter programming mode.
Plug in but keep holding button down then push firmware flash in espbasic you should see com lights blink on your usb to serial fairly rapidly wait you can let go of button and let it do its thing until you get a msg ..................................................... with a bunch of dots.

Now reset and connect.

According to what I can find here is the wiring diagram for SONOFF
SONOFF wiring diagram.jpg


Type A plugs are generally polarised and can only be inserted one way because the two blades do not have the same width. The blade connected to neutral is 7.9 mm wide and the hot blade is 6.3 mm wide.

Usually if both wires are the same color one of them has writing on it to help you distinguish the difference.

Now we want to switch our hot so it would be nice to know if that wiring diagram is 100% correct for safety purposes. It is supposed to handle 10A that is 1200 watts of power but for safety I would not trust this much power I'd suggest using a power switch tail II for larger appliances.

Anyhow I hope this guide has helped don't forget I accept dogecoin for the cause 24/7 just donate using the address below! Any little bit will help me test out more hardware and share more findings.

relay uses pin 12 so make your code to fit this accordingly!

Have fun SONOFFing

- forlotto
You do not have the required permissions to view the files attached to this post.
User avatar
By forlotto
#51557 I have really only used them for a light switch currently. Nothing too fancy a simple on button and off button practical device with a practical use.

Code: Select allwprint "LIGHT ON"
button "ON", [TurnOn]
wprint "LIGHT OFF"
button "OFF", [TurnOff]
wait

[TurnOn]
io(po,12,1)
wait

[TurnOff]
io(po,12,0)
wait


Fairly simply it is a relay board which is its main function you could add a temp sensor or even possibly add dimmer control to this as well with my dimmer board example. Control pretty much anything smaller that is about 8AMPS of power fairly safely I would imagine. A lamp would be nice for instance you could pull up the IP of your sonoff and have at it save a shortcut on your phone etc... This way you could turn the lamp on in the middle of the night and save yourself from stubbing your toe on that project you didn't quite get around to finishing last night in the wee hours :P
User avatar
By eNORm
#58566 Have a done permanent damage by using a 5V TTL cable trying to flash? I was able to flash Micropython on it, but after some flashing and reflashing, the device seams broken.