Connect Sonoff Basic Switch to the Arduino IoT Cloud

Learn how to control real-life devices via the Sonoff Basic Switch, by programming and connecting it to the Arduino IoT Cloud.

Apr 27, 2022

13202 views

7 respects

Components and supplies

4

Jumper wires (generic)

1

SparkFun FTDI Basic Breakout - 3.3V

1

Male-Header 5 Position- 1 Row- Long (0.1")

1

Sonoff Basic

Tools and machines

1

Soldering iron (generic)

Apps and platforms

1

Arduino IoT Cloud

Project description

Code

Full Code

arduino

Full Code

arduino

Downloadable files

Circuit

Circuit

Schematic

Schematic

Circuit

Circuit

Comments

Only logged in users can leave comments

tszebeni

a year ago

Better to leave official firmware on on your sonoff device and keep it managed in ewelink. Use Alexa on top of that who has skills for both sonoff and arduino cloud and a routine can be added in Alexa to ensure their connectivity. That way you don't need to flash the device, can enjoy all of its original functionality and still connected to Arduino Cloud. You can use a boolean value in arduino cloud as a switch to trigger sonoff relay just fine, with additional benefits like voice command, etc.

swetharani123

2 years ago

I am really happy to say it’s an interesting post to read . I learn new information from your article , you are doing a great job . Keep it up <a href="https://www.rstrainings.com/devops-online-training.html">Devops Training in Hyderabad</a> <a href="https://www.rstrainings.com/hadoop-online-training.html">Hadoop Training in Hyderabad</a> <a href="https://www.rstrainings.com/python-online-training.html">Python Training in Hyderabad</a> <a href="https://www.rstrainings.com/Tableau-online-training.html">Tableau Training in Hyderabad</a> <a href="https://www.rstrainings.com/Selenium-online-training.html">Selenium Training in Hyderabad</a> <a href="https://www.rstrainings.com/informatica-online-training.html">informatica Training in Hyderabad</a> <a href="https://www.rstrainings.com/datastage-online-training.html">datastage Training in Hyderabad</a>

Anonymous user

2 years ago

Wow, that is quite informative. I like this article very much. The content was good. If any of the engineering students are looking for a projects for raspberry pi projects, I found this site and they are providing the best service to the engineering students regarding the projects raspberry pi projects. https://takeoffprojects.com/raspberry-pi-projects

jarriaga

2 years ago

Hi, Thanks for your project. I didn't try it yet but I intend to do it in the near future. But I have a question for you. I already have a good knowledge of Arduino IOT as I already made a few projects so I can clearly understand your code. In your code, you can only switch on and off the relay via the Arduino IOT App. In sonoff there is also the possibility of switching the relay on and off by pressing the existing button on the device. How can you implement this in your code? And also, how can we have that feedback on the app to change the status of the switch in the dashboard?

Anonymous user

2 years ago

OK, I got the basic script to work. ;) However there was a complication with the ArduinoCreateAgent. I installed it (eventually) on my Debian Linux system, but it failed silently. It turns out that there are libraries that are not part of Debian that need to be explicitly installed. There is a bug report going back over a year (to 2021) that acknowledges this. Yet the ArduinoCreateAgent people (or the Debian people, whoever?) don't seem to care. When I installed the necessary code with the command: apt install libappindicator3-dev It downloaded over 100 dependencies. I was not the least bit happy about that! Your code works great, thank you very much. However the Arduino cloud product still has far too many rough edges. I think that without this tutorial I would have thrown in the towel. Trying to use the Arduino cloud without guidance is simply too difficult. It needs a *lot* of work to make it beginner friendly.

Anonymous user

2 years ago

Wow, that is quite informative. I like this article very much. The content was good. If any of the engineering students are looking for a projects for raspberry pi projects, I found this site and they are providing the best service to the engineering students regarding the projects raspberry pi projects. https://takeoffprojects.com/raspberry-pi-projects

swetharani123

3 years ago

I am really happy to say it’s an interesting post to read . I learn new information from your article , you are doing a great job . Keep it up <a href="https://www.rstrainings.com/devops-online-training.html">Devops Training in Hyderabad</a> <a href="https://www.rstrainings.com/hadoop-online-training.html">Hadoop Training in Hyderabad</a> <a href="https://www.rstrainings.com/python-online-training.html">Python Training in Hyderabad</a> <a href="https://www.rstrainings.com/Tableau-online-training.html">Tableau Training in Hyderabad</a> <a href="https://www.rstrainings.com/Selenium-online-training.html">Selenium Training in Hyderabad</a> <a href="https://www.rstrainings.com/informatica-online-training.html">informatica Training in Hyderabad</a> <a href="https://www.rstrainings.com/datastage-online-training.html">datastage Training in Hyderabad</a>

jocacle1

3 years ago

Did not go well. I have a Sonoff Basic R2 There are no markings on the board to match 3.3V GND RX TX (would have added a picture but not possible) Can you help?

jocacle1

2 years ago

Peter, I have another problem now... 😕😁😁 Can't work out how to connect Network (IoT) **Wi-Fi Name:UnavailablePassword:UnavailableSecret Key:**Unavailable I have got the secret key. What wi-fi name and password do I use?

jocacle1

2 years ago

Peter, Thanks for the link, a big help. Next problem 🙄. Could you or anyone else suggest an alternative (cheaper?) to the SparkFun FTDI Basic Breakout - 3.3V? Link(s) to ebay or amazon (uk), would be great. I looked, just got very confused. Probably should mention here that I'm a novice, 73yrs and limited income etc. 😕 ...but I am determined to get it working... John

jocacle1

2 years ago

Dave, I assume you mean't Basic R2 V2? I have the Basic R2 V1. Anyway, the link helped solve my problem (1st problem as it turns out). See other post

Anonymous user

2 years ago

It looks to me that Peter's device is an R2. Do a search for 'sonoff basic r2 pinout'. I found plenty of pictures. This one actually compares the original and the R2: https://i.ytimg.com/vi/7QmP9_e4IKU/maxresdefault.jpg Dave

peterwestvillage

2 years ago

Yes Dave is correct, I have the Basic R2. I think this page here might be of help if you have an older version: https://www.letscontrolit.com/wiki/index.php/Sonoff_basic, I noticed some pin labelings in there. Hope you manage to get it working!

peterwestvillage

2 years ago

No problem, happy to help. You could take a look at this: https://www.amazon.co.uk/AZDelivery-FT232RL-Adapter-Arduino-Raspberry/dp/B01N9RZK6I, it is cheaper and by the looks of it, it should work (note, it doesn't include a usb mini cable). I cannot guarantee it will work since I have not tested it, but I would consider it an option.