#93 Remote Motion Detector Using a Hacked SONOFF Switch for Home Automation Projects

แชร์
ฝัง
  • เผยแพร่เมื่อ 2 ต.ค. 2024

ความคิดเห็น • 175

  • @SuperHouseTV
    @SuperHouseTV 7 ปีที่แล้ว +2

    That's a great combination of the D1 Mini and a Sonoff. Nice project, and very helpful video.

    • @AndreasSpiess
      @AndreasSpiess  7 ปีที่แล้ว

      Thanks. I also look your videos with great interest. Good stuff!

  • @HariWiguna
    @HariWiguna 8 ปีที่แล้ว

    Grüzi Andreas,
    I will build one for my workbench. Thank you for the detailed guide!
    This video was useful and interesting to me! Bye... ;-)

    • @AndreasSpiess
      @AndreasSpiess  8 ปีที่แล้ว

      You're welcome. And good luck!

  • @NickBartzeliotis
    @NickBartzeliotis 7 ปีที่แล้ว

    Hello Andreas, great video! I suggest you to search about "blynk", it's a service(and app) that lets you play with IoT with no programming at all! And it also resolves all issues for controlling GPIO Pins outside from the local network. I'm sure you will love it! :)

    • @AndreasSpiess
      @AndreasSpiess  7 ปีที่แล้ว +2

      It is since a long time on my list, but so far, I newer used it. Maybe because I like to program...

  • @underwoodblog
    @underwoodblog 8 ปีที่แล้ว

    Great video again! I was waiting for this. Do you plan to test the Sonoffs with build in 433Mhz receiver to?
    A good alternative to PIR are "microwave motion sensor". I have nearly replaced all PIRs with them. There are ready ones, modules for DIY and eaven LED bulbs with build in microwave motion sensor. They have better range, can be build in a lamp or non conductive housing without drilling holes and eaven work when you wear warm clothes in the winter. Nearly same price range as the PIR modules.

    • @AndreasSpiess
      @AndreasSpiess  8 ปีที่แล้ว

      I have one laying around. But it needs quite some additional circuitry. Which ones do you recommend? I would be glad to test one.
      Concerning the 433: It is not on my priority list. So, it will take a while.

    • @underwoodblog
      @underwoodblog 8 ปีที่แล้ว

      Haven't received a sonnoff with 433mhz receiver yet, so I can't recommend one. When I remember right you already buyed some 433mhz sender and receiver modules. This learning remote goo.gl/QCzRNr can be helpfull for first tests with 433Mhz.
      Remoteswitch library from bitbucket.org/fuzzillogic/433mhzforarduino works very good on a Digispark/ATTINY85.
      433mhz remotes aren't the best solution but they are small an cheap. I don't want to get my smartphone out of the pocket, connect to my wlan, open a browser or app to only switch on a light. It eaven can work as a backup if wifi fails.

    • @AndreasSpiess
      @AndreasSpiess  8 ปีที่แล้ว

      I was not clear. I was asking you about the radar sensors!
      I hope, I will be able to deal with the 433 MHz...

    • @underwoodblog
      @underwoodblog 8 ปีที่แล้ว

      I have lots of these for stand alone use with some lights:
      goo.gl/lgXQYt
      You can get similar at reichelt electronic to, that work well to.
      and I use these to:
      goo.gl/gw31OQ
      be aware that the 9W and 7W ones are very huge and don't fit in every lamp but they are easy to open, have sensor, power-supply and leds on seperate pcbs and there is some space left that may fit a small esp.
      I only testet this diy module goo.gl/U452vy on my bench and it worked. Not testet it in an application yet.

    • @AndreasSpiess
      @AndreasSpiess  8 ปีที่แล้ว

      Thanks. I will have a look at these...

  • @itsadamoc
    @itsadamoc 8 ปีที่แล้ว +2

    Just use /on and /off. Your uri isn't valid without a question mark. I ditched running a web server on all my sonoffs, they're not really capable of handling a lot of traffic. They lock up. MQTT is perfect for sonoffs. Keep the sonoff dumb and put the intensive stuff on a server.

    • @AndreasSpiess
      @AndreasSpiess  8 ปีที่แล้ว +1

      1. I used one of the examples as a basis for my sketch. And these URLs had no question marks. At the Sonoff, I anyway get the whole string and can parse it with or without question mark.
      2. Do you use QOS=1 in your MQTT scenarios?

    • @microbitbanger
      @microbitbanger 8 ปีที่แล้ว

      @itsadomoc, Andreas isn't using server argument parsing, (i.e. server.arg("SWITCH") since the requirements are so simple. Andreas is just string matching the whole URL for the commands. Though, I prefer using server args as you don't have worry about case sensitivity. MQTT would require either Internet access to a server or a local MQTT server added to the mix.(Yes, I know it's an easy RPi solution ) ..It appears that Andreas went with the simplest plan.

    • @itsadamoc
      @itsadamoc 8 ปีที่แล้ว

      You don't need to explain it to me mate ;) I'm a developer. I'm just simply saying there's no need for the equals sign in that string. It's pointless. MQTT is not a difficult thing to add to your home automation ecosystem. It even comes bundled with home assistant. It's really not an issue to add MQTT to the mix.
      Andreas. I use QoS 0. My sonoffs toggle their state, so that seems to work best for me.

  • @garrypkeogh
    @garrypkeogh 8 ปีที่แล้ว +2

    Well done Andreas. In my experience using MQTT behind the firewall is a great way to operate many integrated ESP8266's. Message payloads can be a single bit. I have many deployed in my home on NodeMCU boards, Wemos D1 Minis and some Sonoff also.
    I use several for an integrated security/access control where they are deployed on a gate lock release accessing my garden and a WiFi extended zone connecting my sheds to my home alarm system. The sheds are solar/battery powered with efficient 3.3v buck dc-dc power supplies, Wemos boards, reed door switches and PIR sensors. These can operate for many days without sunlight.
    I have found it easier to keep the workload and complex logic of the ESP modules to a minimum and use a Raspberry Pi from the first ever production run embedded in my home security panel to monitor my house alarm and integrate the sheds as a zone. The Raspberry Pi runs the MQTT (Mosquitto) broker and an instance of Node-RED. With Node-RED I can easily process the MQTT traffic and create or edit the functionality of all my ESP/Sonoff devices on simple graphical flows. Node-RED even allows secure push messaging of alarm activations to our mobile devices using the Pushbullet API and I have used several UI nodes in my flows which are ported through my firewall allowing me full control of the systems in the outside world via DDNS.
    The system is so easy to use that I added several automated Halloween props including sound via system commands to play MP3's on a Raspberry Pi called via MQTT in sequence with lightning, zombies in a coffin and more.
    I recommend this architecture for easy centralised control.
    Please keep the videos coming, they are an inspiration!
    Garry

    • @AndreasSpiess
      @AndreasSpiess  8 ปีที่แล้ว

      Sounds like a big installation! Thanks for your info. After all the comments about MQTT and node Red I think, I will do a video about using this technology. But maybe next year... Next, I want ot hack the other Sonoffs including the POW.

    • @garrypkeogh
      @garrypkeogh 8 ปีที่แล้ว

      MQTT + Node-RED is an easy option especially for novice programmers like me but I do enjoy trying and learning from your examples.
      Great videos, thanks Andreas. Garry

    • @AndreasSpiess
      @AndreasSpiess  8 ปีที่แล้ว

      :-)

  • @stu110
    @stu110 8 ปีที่แล้ว +4

    great video again andreas, keep them coming!

  • @gabezack3
    @gabezack3 6 ปีที่แล้ว

    Dear Sir, I'd like to build a power control system to avoid blackout in my apartment due to overload. It should be based on "sonoff pow" module. When the total apartment's power consumption goes above a predetermined threshold the system should start switching off in a sequential prioritised manned different appliances using sonoff switches. Can You help me?

  • @tjunkieu2b
    @tjunkieu2b 4 ปีที่แล้ว

    Is it possible to use esp8266 already present in Sonoff and add the PID in the same box or near it ? I mean modify the basic Sonoff. Thank you

    • @AndreasSpiess
      @AndreasSpiess  4 ปีที่แล้ว

      I do not like to modify 240 volt devices. It is too dangerous for me.

  • @nickdeacon295
    @nickdeacon295 4 ปีที่แล้ว

    Thanks for the video. I have developed a PIR activated lighting system using the Sonoff CH4 and Sonoff 433MHz PIR sensors - similar in function to yours. github.com/nickdeacon/PIR-Lighting-controller.

    • @AndreasSpiess
      @AndreasSpiess  4 ปีที่แล้ว

      Nice project. Did you have a look at Tasmota? I think they also have some software for this hardware.

  • @Peter_S_
    @Peter_S_ 8 ปีที่แล้ว +1

    Excellent video. :-)
    I use a PIR sensor similarly to turn off my soldering iron if I have not been near it in the previous 5 minutes. An ESP8266 version of this would allow for verification the iron is off from 100km away.

    • @AndreasSpiess
      @AndreasSpiess  8 ปีที่แล้ว +1

      True. BTW: I currently test a soldering iron with an accelerator builtin. Also a neat idea...

    • @underwoodblog
      @underwoodblog 8 ปีที่แล้ว

      I have a DS90T from banggood that has timer and accelerator builtin. I love this feature and I put my old ersa in retirement, that only has two different tips to choose from. The new one is compatible with hakko tips.

    • @AndreasSpiess
      @AndreasSpiess  8 ปีที่แล้ว +1

      Seems also to be a nice iron...

  • @h4z4rd42
    @h4z4rd42 7 ปีที่แล้ว +1

    Nice detailed vid.
    Obviously subscribed for more. Thank you.

  • @chuxxsss
    @chuxxsss 8 ปีที่แล้ว +2

    Thanks Andreas, Are you going to reprogram Sonoff touch boxes? Just got one here looks like a nice piece of kit.

    • @AndreasSpiess
      @AndreasSpiess  8 ปีที่แล้ว +1

      It was not on stock when I ordered. For the moment, I have enough others to test and to play with. But its on my list.

  • @Fragtion
    @Fragtion 7 ปีที่แล้ว

    Hi Andreas, do you know anything about the CE Conformity from the Sonoff`s? Or for the Swiss i think it has to be conform with some IEC norms. I Like the Devices very much but i am afraid to use it with main leads. When it starts burning no insurance will pay anything.

    • @AndreasSpiess
      @AndreasSpiess  7 ปีที่แล้ว

      The engineer told me, that the devices with the sign printed on the box really comply . You decide.
      I mound these thins in places where they cannot destroy a lot. Generally, I fear more that they destroy my computers and lab equipment if they expose 220v on 5 volt leads...

  • @giuseppefrancescodeluca
    @giuseppefrancescodeluca 6 ปีที่แล้ว

    Dear Sir, I'd like to build a power control system to avoid blackout in my apartment due to overload. It should be based on "sonoff pow" module. When the total apartment's power consumption goes above a predetermined threshold the system should start switching off in a sequential prioritised manned different appliances using sonoff switches. Can You help me?

    • @AndreasSpiess
      @AndreasSpiess  6 ปีที่แล้ว

      Sonoff POW can measure power and have a relay. so this is easily done. Place a POW for each large load and add up the power in a Raspberry. Switch off if needed. Look for Espurna or Tasmota if you search a firmware for the Sonoff and Use MQTT as a protocol.

  • @motormusic1
    @motormusic1 6 ปีที่แล้ว

    Thats really good, thank you. is there a way of extending the range of the IR sensor? Also, could you do a tutorial of how to integrate with online services - i'd like to switch led lights on the stairs when someone approaches, but turn them off when they get to the top? Can you also post links to the IR sensor that you used as well please? Thank you

    • @AndreasSpiess
      @AndreasSpiess  6 ปีที่แล้ว

      I have videos about calling services, about building your own service using MQTT and Node red on a Raspberry Pi, and also on IR communication. Maybe you browse once through the (long list). Maybe you find what you need.

  • @jangAckman
    @jangAckman 7 ปีที่แล้ว

    Hi Andreas, I'm not sure if you had problems with the system if you being stationary or just some small motions, say fine soldering, reading, etc., and the controller switch off the lights? If so, how would you propose to solve this? Thank you, as always, for sharing these great ideas and videos.

    • @AndreasSpiess
      @AndreasSpiess  7 ปีที่แล้ว

      I solve this problem with a long delay till the lamp goes off. And if I really stay too long without a movement and the light gets off, I have to move a little ;-)

  • @donovanlewis1868
    @donovanlewis1868 7 ปีที่แล้ว

    Great Video, I have a question, I've been trying to get the ARILUX® AL-LC02 Super Mini LED WIFI controller to broadcast after flashing with a mod firmware. It seems the firmware is not allowing the controller to broadcast wifi after the flash. . just wondering if you had any knowledge with this controller?

    • @AndreasSpiess
      @AndreasSpiess  7 ปีที่แล้ว

      No, I do not own one of these.

  • @gurgelplus
    @gurgelplus 7 ปีที่แล้ว

    What are the tools with the green/yellow handle we can see at the start of the video?

    • @AndreasSpiess
      @AndreasSpiess  7 ปีที่แล้ว

      Prying tools. I think, I showed them in one of my mailbags

  • @norm1124
    @norm1124 8 ปีที่แล้ว

    Hallo Andi, ein Link zu den IoT- AppStore Folgen im Kommentar wäre vielleicht eine Idee ;-) - Ein Arbeitskollege ist FHEM Fan für die Home-Automation, scheinbar gibt es dort auch schon einen SONOFF support.

    • @AndreasSpiess
      @AndreasSpiess  8 ปีที่แล้ว

      Den Link mache ich. Betreffend Sonoff und Home Automation: Da muss ich mich mal schlau machen. Bis jetzt habe ich mich mehr auf die Devices selbst konzentriert. Im Moment bin ich an einem TV Simulator (mit Neopixels und LEDs als Lampenersatz), der eine "Anwesenheit" simulieren soll und vom Sonnenuntergang gesteuert wird.

  • @xfabiosoft
    @xfabiosoft 7 ปีที่แล้ว

    On the terminal where there is the relay does it put 220v or just closes the contact? I'm thinking to use it with a "logic" input on the other side and i just need to close the contact... no big AC current allowed.

    • @AndreasSpiess
      @AndreasSpiess  6 ปีที่แล้ว

      I do not understand your question.

    • @xfabiosoft
      @xfabiosoft 6 ปีที่แล้ว

      Andreas Spiess when the contact on the sonoff is closed. There is high voltage or just a closed relay?

    • @AndreasSpiess
      @AndreasSpiess  6 ปีที่แล้ว

      The 220 volt is switched by a relay. You can use this relay for other purposes if you do not want to connect it to 220 volts. However, then, you have to power the ESP8266 (it is powered by the 220 volts).

  • @JHarkness80
    @JHarkness80 7 ปีที่แล้ว +1

    Great Video! I look forward to exploring the rest of your channel's videos!

  • @rahulkp1929
    @rahulkp1929 7 ปีที่แล้ว

    what happens if i connect GPIO 14 TO GND on a non modified (stock firmware) sonoff? will it go to default state?
    I need my sonoff device to switch off all appliance if i connect GPIO 14 TO GND .. is it possible ?

    • @AndreasSpiess
      @AndreasSpiess  7 ปีที่แล้ว +1

      I never uses stock firmware, so I do not know

    • @rahulkp1929
      @rahulkp1929 7 ปีที่แล้ว

      Andreas Spiess any way to get my above configuration

  • @khidmahsamad3746
    @khidmahsamad3746 6 ปีที่แล้ว

    Dear Sir, your videos are very informative, many thanks for videos, I need help if you can, would you make a video on how to make a same device as similer as sonoff 4 channel pro but by using Wemos D1 mini. Most important thing is it should be connected to wifi by using eWelink app in mobile and by pressing a button in a circuit made of Wemos D1 mini . Many Thanks a.Samad

    • @AndreasSpiess
      @AndreasSpiess  6 ปีที่แล้ว

      EWelink is a proprietary system.

    • @khidmahsamad3746
      @khidmahsamad3746 6 ปีที่แล้ว

      Thanks again Andreas for your prompt reply

  • @colfaxschuyler3675
    @colfaxschuyler3675 7 ปีที่แล้ว

    Oh, this is so cool it hurts.
    This is very similar to what I want to play with for our back yard - basically a mesh network of PIR and LED lights. I think I was thinking about it from too complicated an approach.
    Oh man, now I have to get MORE stuff... at least I can say it's for Christmas.

    • @AndreasSpiess
      @AndreasSpiess  7 ปีที่แล้ว +1

      If you look at the newest files on Github and also the video at Christmas, you might get even more exited. Then, you get the whole thing much more stable, with proper DNS names, setup with your smartphone, and the best: You can download it directly and install and update it on your devices over the air... Without compiling the code...

    • @colfaxschuyler3675
      @colfaxschuyler3675 7 ปีที่แล้ว

      I'll look, but I don't know how much more excitement I can take... my head will explode!

  • @ataasgari
    @ataasgari 8 ปีที่แล้ว

    Is it possible to flash esp8266 based AC relay module with sonoff firmware?

    • @AndreasSpiess
      @AndreasSpiess  8 ปีที่แล้ว

      I do not have the Sonoff firmware and I think, it is not open source.

  • @antoinevivares2680
    @antoinevivares2680 5 ปีที่แล้ว

    Great video thanks a lot !
    How do you power the sensor ? I thought it should be feasible to use the sonoff to power it. This would be great if some motion detection.sensors.could also be used as sensors for a diy security system via a hacked sonoff reporting the state.

    • @AndreasSpiess
      @AndreasSpiess  5 ปีที่แล้ว

      Sonoffs have internally 3.3 volts. However keep in mind: They are connected to 120/240 volts. This can be dangerous.

    • @antoinevivares2680
      @antoinevivares2680 5 ปีที่แล้ว

      @@AndreasSpiess thanks for your reply. I came to the conclusion that too much hacking of the sonoff was indeed not a great idea, ill stick to changing its firmware.

  • @peopledrivemecrazy
    @peopledrivemecrazy 8 ปีที่แล้ว

    nice I see why you use http... for a while now I have stopped using http and only doing with mqtt. you can use hivemq broker or paho JavaScript client.

    • @AndreasSpiess
      @AndreasSpiess  8 ปีที่แล้ว +1

      After these many comments about MQTT I have to look inside it again. But maybe for a little more complex scenario...

    • @peopledrivemecrazy
      @peopledrivemecrazy 8 ปีที่แล้ว

      WhenI find the time, I can upload the project files, I will be sure to post the links in your channel. It may help you.

    • @AndreasSpiess
      @AndreasSpiess  8 ปีที่แล้ว

      Thanks!

  • @ljl451
    @ljl451 7 ปีที่แล้ว

    Hi,
    regarding the pir sensor HC-SR501, could you please recommend a good way to calibrate it?
    I tried three of them.
    The first one worked fine with the first example that I found on the internet, but I was unable to use the other two.
    Thanks

    • @AndreasSpiess
      @AndreasSpiess  7 ปีที่แล้ว +1

      Next week, you will find a new video concerning the HC-SR501 and SR505 PIR sensors.

    • @ljl451
      @ljl451 7 ปีที่แล้ว

      This is great news, thanks!

  • @pleggli
    @pleggli 8 ปีที่แล้ว +1

    I use a slightly modified version (i just removed some features like OTA to make it harder to hack) of this mqtt-firmware for for my sonoffs github.com/arendst/Sonoff-MQTT-OTA .. Having a message queue instead of direct connections is much more flexible and easier to manage/monitor as the number of devices in the network grows. I would probably suggest moving to a queue/bus solution somewhere after 5 to 10 devices.
    There are many UI solutions for phones, computers etc.. home-assistant.io/ is one example which is quite easy for setting monitor and control of mqtt connected devices.

    • @AndreasSpiess
      @AndreasSpiess  8 ปีที่แล้ว

      Thanks for your tips! I will have a look at them. So far, I feared MQTT for simple scenarios because it needs a broker. And I did not want to go to the internet with these "live" applications unless I understand the security aspects a little better.
      But your argument about the number of devices is absolutely valid.

    • @pleggli
      @pleggli 8 ปีที่แล้ว +1

      I use a local network mqtt server because esp8266 can't do TLS and I don't want to rely on the internet for my home automation stuff.. IIRC ,home assistant can act as a simple mqtt-server by itself, I run a mosquitto server for MQTT.

    • @underwoodblog
      @underwoodblog 8 ปีที่แล้ว

      Haven't testet MQTT yet but as pleggli mentioned, it isn't very difficult to set up an own MQTT broker with mosquitto on a raspberry pi. If you install node-red to, you have a powerfull and simple to use combination.
      I've started my fist tests with UDP. If you wan't to react on different places from one sensor, it gets complicated very fast and you have to change lot's of (ESP)-devices if you only want to add one device or feature. With MQTT you only have to publish your sensor data to the broker and lots of other devices can easy react on this data or combination of data from different sensors and switches.
      For excample: You want your PIR sensor tp switch on heating to, if the room temperature is under a certain level. When you make this without MQTT you have to send and request lots of messages arround when using http or udp.
      If you use a raspberry pi 3 you can run you esp app store on it to and you have not to rely on your internet connection or have think of security problems because everything is in your intranet behind the router.
      All "outside" stuff can be handled over a vpn connection to your pi.

    • @AndreasSpiess
      @AndreasSpiess  8 ปีที่แล้ว +1

      You convinced me: The next one will be with MQTT :-)

    • @pleggli
      @pleggli 8 ปีที่แล้ว

      yeah, there are soo many things which gets easier with mqtt.. one this is that you can use a command line mqtt client to monitor everything that's happening on a mqtt-server by subscribing to all topics using a wildcard, super handy for debugging and developing :
      mosquitto_sub -d -h 192.168.0.xx -t \#
      It's also handy to do the opposite while testing integrations.. one example is this command which triggers all my sonoff-mqtt devices to report their current state to mqtt..
      mosquitto_pub -d -h 192.168.0.xx -t cmnd/power/power -m ""
      After I send that command I see a bunch of these in subscriber above:
      Client mosqsub/17897-transwhal received PUBLISH (d0, q0, r0, m0, 'stat/tf-light-ceil/POWER', ... (2 bytes))
      On

  • @winchesterlyon
    @winchesterlyon 6 ปีที่แล้ว

    Hi. Thank you for your video. I am planning a project using your solution in this video. I'm going to be using:
    - WeMos D1 Mini v2.3.0 modules
    - HC-SR501 PIR sensor modules
    - Sonoff Basics
    I would like to power my modules by batteries. I don't want to use rechargeable batteries. My only concern is that the batteries can last up to a year.
    I would like to know:
    - What type of batteries would you recommend for this?
    - How should I do the wiring for the WeMos + PIR module + batteries?
    - Would your Sonoff Sender sketch work for with this?
    - How would you reduce the issue of false start on the PIR sensor. I read on a forum that this can be fixed by soldering a 220nF ceramic capacitor across pin12 & pin13 of the PIR sensor's chip (BISS0001), but he offered no other info as to the voltage of the capacitor or anything.
    - I would also like to add both the receiver and the sender to Hassio. Is this possible with your sketch?
    I'm a noob when it comes to electronics, so any help will be greatly appreciated.

    • @AndreasSpiess
      @AndreasSpiess  6 ปีที่แล้ว +1

      Maybe you watch my videos about ESP8266 deep sleep and the videos about batteries.

    • @winchesterlyon
      @winchesterlyon 6 ปีที่แล้ว

      Thank you for replying. I will take a look at those videos. Thanks.

    • @winchesterlyon
      @winchesterlyon 6 ปีที่แล้ว

      One more question. Would this work with MQTT and Hassio? If not, what would I need to do to get it to work? Also, would the ESP-01s work instead of the WeMos?.

  • @raguaviva
    @raguaviva 8 ปีที่แล้ว

    Isn't the ESP drawing too much current as to have it on all day long?

    • @AndreasSpiess
      @AndreasSpiess  8 ปีที่แล้ว +2

      +aguaviva Good point. I have to check it. The ESP itelf uses 0.08 A x 3.3V = 0.26 W which is not a lot, compared with the 300 Watts of the LEDs. But the power supply might use more.

  • @DiyintheGhetto
    @DiyintheGhetto 8 ปีที่แล้ว

    Hello Andreas i use that web config all the time. And when it switches from AP to station mode there is a administrator mode that disabled about a few minutes. You can go in there is raise that amount of minutes from i believe it's 3 or 5 minutes raise it as high as you like . I think it's in milliseconds.

    • @AndreasSpiess
      @AndreasSpiess  8 ปีที่แล้ว

      Yes, you are right. and probably, I will introduce once a button to switch manually back to operation to save the time of waiting

    • @DiyintheGhetto
      @DiyintheGhetto 8 ปีที่แล้ว

      That would be awesome. That is why you are the pro man :)

    • @AndreasSpiess
      @AndreasSpiess  8 ปีที่แล้ว

      :-)

    • @DiyintheGhetto
      @DiyintheGhetto 7 ปีที่แล้ว

      Hello Andreas I finally got my Sonoff switch and i figure out most of the GPIO pins being used. But i noticed something. The Led is using GPIO 13. But the Led is Bicolor No one has mention what the Other Led is connected to?

  • @kimlindblom6964
    @kimlindblom6964 7 ปีที่แล้ว

    Is it possible to connect the PIR sensor directly to the sonoff GPIO 14? Running the PIR on the Sonoff 3.3v?

    • @AndreasSpiess
      @AndreasSpiess  7 ปีที่แล้ว

      +Kim Lindblom you have to check whether your PIR sensor runs of 3.3 volt. If not, you have to connect it to 5 volt.
      The ESP pins should be 5v resistant.

    • @kimlindblom6964
      @kimlindblom6964 7 ปีที่แล้ว

      Seems like the board voltage regulator can be bypassed so it should work then? =):
      randomnerdtutorials.com/modifying-cheap-pir-motion-sensor-to-work-at-3-3v/

    • @AndreasSpiess
      @AndreasSpiess  7 ปีที่แล้ว

      As I wrote, it depends on your PIR sensor. It seems that this one will work.

  • @PhG1961
    @PhG1961 8 ปีที่แล้ว

    Omg, what a nice workshop ! Beautifull equipment, I'm impressed.

  • @PedroLarroy
    @PedroLarroy 8 ปีที่แล้ว

    Hi Andreas. I just discovered your channel. Why do you use gloves? It's it because of the chemicals in the components?

    • @AndreasSpiess
      @AndreasSpiess  8 ปีที่แล้ว

      No. It has private reasons.

    • @PedroLarroy
      @PedroLarroy 7 ปีที่แล้ว

      Ok, thanks, great videos! I love them. Could you do one of At tinys?

    • @AndreasSpiess
      @AndreasSpiess  7 ปีที่แล้ว

      What do you have in mind? There are a few of my early videos I did with ATtinys (e.g. battery tester, printer switch, ultrasonic sensor with I2C)

  • @n1kkri
    @n1kkri 7 ปีที่แล้ว

    Will you be doing a Sonoff Dual? I want to use the 2 on board relays not to supply A/C but just to act as a simple switch to close a contact.

    • @AndreasSpiess
      @AndreasSpiess  7 ปีที่แล้ว

      Maybe. But not soon. I think, it is very similar to the normal Sonoff

    • @n1kkri
      @n1kkri 7 ปีที่แล้ว

      If you should see it somewhere please post the link. I have a garage door operner project I am thinking of and I have 2 door openers. Thanks,

  • @gmag11
    @gmag11 8 ปีที่แล้ว

    As usual, a very good example of using ESP8266 IOT device in a real world case. It is a good scenario to use MQTT and Node Red to have flexible and powerful logic. It may be run on same machine as IOT App Store. Thanx for sharing.

    • @AndreasSpiess
      @AndreasSpiess  8 ปีที่แล้ว

      I get many comments concerning using MQTT. I think, this is a very good protocol. But running a Raspbery just to transfer a command once in a while is an overkill for me. I experimented with MQTT, but at tis time, it did not support QOS=2. What is the current status of the clients and brokers?

    • @gmag11
      @gmag11 8 ปีที่แล้ว +1

      For things like MQTT, Node Red and Esp8266, Peter Scargill​ is who has researched and published most. You may follow his posts and ask him if you want to know current development status. Check tech.scargill.net

    • @AndreasSpiess
      @AndreasSpiess  8 ปีที่แล้ว

      I will do that.

    • @underwoodblog
      @underwoodblog 8 ปีที่แล้ว

      If you have a pi running, you find other task for it very fast. I replace my pi 1 with a pi 3 in the next days, because it can't handle all the stuff that is running on it.
      For example, I run mumble on it to phone with my friends. It checks every device in my lan if it's up and running and handles some of my UDP messages that I'm sending arround for controlling my ESPs at the moment. Sends me notifications via mail, push or twitter messages. Notifys my ESPs if I got new mail. Updates my external IP to www.nsupdate.info and lots of other small tasks.

  • @christianhofmeister8652
    @christianhofmeister8652 7 ปีที่แล้ว

    Thank you Andreas! Your videos are always very exciting for me and full of really good ideas!
    I tried to programm my Sonoff Switch with the code (Sonoff_ReceiverV3) you linked in the comment. Unfotunately I get the following error when trying to compile the Sonoff_ReciverV3.ino:
    C:\Users\\Documents\Arduino\Sonoff_ReceiverV3\Sonoff_ReceiverV3.ino:34:25: fatal error: credentials.h: No such file or directory
    Could you please help me to solve this error?
    Lovely greetings from Bern
    Christian

    • @AndreasSpiess
      @AndreasSpiess  7 ปีที่แล้ว +1

      This is a small thing. Just delete this line. Then, you have to fill in the credentials (mySSID, myPASSWORD)

    • @christianhofmeister8652
      @christianhofmeister8652 7 ปีที่แล้ว

      After changing the three "Debug.ative(Debug.DEBUG))" to "Debug.isActive(Debug.DEBUG))" parts in the loop(), I could upload the code to the Sonoff.
      But now I get this output on the serial monitor:
      Start SonoffReceiver V3.4
      BootTimes 1
      Reading Config
      Configuration found
      ...................................................
      ets Jan 8 2013,rst cause:1, boot mode:(3,6)
      load 0x4010f000, len 1384, room 16
      tail 8
      chksum 0x2d
      csum 0x2d
      v09f0c112
      ~ld

      It repeats this continously, while increasing the BootTimes number.
      Do you have any idea what went wrong?

    • @AndreasSpiess
      @AndreasSpiess  7 ปีที่แล้ว

      It somehow has false credentials and does not connect. So, you have to force it into Config mode
      Change line 155 to if (retries >= MAXRETRIES) espRestart('S');
      Now, it should reset and will stop with "wdt reset". Then, you have to manually reset the board the first time (bug in ESP8266). Then, you should find a new Wi-Fi network in your mobile phone. Connect to it and enter 192.168.4.1 and enter the configuration.
      Hope, it helps. Otherwise just come back.

    • @christianhofmeister8652
      @christianhofmeister8652 7 ปีที่แล้ว

      Hi Andreas
      Unfortunately it doesn't work. After I uploaded the edited code (line 155), I get this output on the serial port:
      Start SonoffReceiver V3.4
      BootTimes 1
      Reading Config
      Configuration found
      MAC: xx:xx:xx:xx:xx:xx //changed by me
      ........
      connected
      IP = 192.168.1.129
      Update_server 192.168.1.200
      UPDATE_URL /iotappstore/iotappstorev20.php
      FIRMWARE_VERSION SonoffReceiver V3.4
      Updating...
      HTTP_UPDATE_FAILD Error (-1): HTTP error: connection refused
      IP = 192.168.1.129
      Update_server iotappstore.org
      UPDATE_URL /iotappstore/iotappstorev20.php
      FIRMWARE_VERSION SonoffReceiver V3.4
      Updating...
      HTTP_UPDATE_FAILD Error (-106): Verify bin header failed
      * MDNS responder started. constant3.local
      Server started
      Use this URL to connect: 192.168.1.129/
      Connecting to data.sparkfun.com
      After resetting the device there is no new WiFi visible. But the Server on the Sonoff works and I can send on/off commands to the IP 192.168.1.129.
      What can I do else?

    • @AndreasSpiess
      @AndreasSpiess  7 ปีที่แล้ว

      It seems to work now as designed and you can switch the Sonoff remotely. Since this video was made, we improved the infrastructure around iotappstore.org completely and you have to use the address
      iotappstory.com
      /ota/esp8266-v1.php
      But you have to adjust a few other things, too. If you want to use the remote update, I recommend to watch my videos concerning iotappstory.com.
      I will make a note in the description of this video.

  • @ufohunter3688
    @ufohunter3688 8 ปีที่แล้ว

    I know that 8266 can also serve as an AP. Is there a way to run an MQTT server on one of the many in a dedicated local network?
    I was thinking I can use the 2.4 GHZ band for a network that runs 4x8266's, and use the 5.8 GHZ for my PC. That way, the MQTT server can be running on one of the *266's and not rely on the outside world (Adafruit, etc..), and not interfere with my PC and secure from hacking.
    Is there code that would run on 8266 and provide MQTT broker services?
    Another excellent video from the 8266 master :)

    • @AndreasSpiess
      @AndreasSpiess  8 ปีที่แล้ว +1

      I do not know about the MQTT broker, but I assume, they are based on UNIX. Most people use Raspis. Maybe with a Zero, the effort is also small to have such a broker.

    • @ufohunter3688
      @ufohunter3688 8 ปีที่แล้ว

      I think I'll buy another PI3 cuz Pi zero with the wifi and the rest, comes to more $ here in Canada. a Pi0 is about $30 not $5
      Thanks for the reply

    • @ufohunter3688
      @ufohunter3688 8 ปีที่แล้ว

      I have a Pi3 running a pi camera 24/7. Maybe I can add a Mosquito process to run concurrently. I have to look into it. It makes no sense to put up another one, if I can do the job with one Pi3.
      Let me know if you think it's possible.

    • @AndreasSpiess
      @AndreasSpiess  8 ปีที่แล้ว

      I do not know Unix or Raspbery (yet). So, I cannot tell.

    • @ufohunter3688
      @ufohunter3688 7 ปีที่แล้ว

      It works like a charm. Installed Mosquitto and all is running fine. So no more external MQTT broker for me.
      Was concerned with security and I don't really have any use to control stuff from the outside.

  • @cornjulio4033
    @cornjulio4033 4 ปีที่แล้ว

    Hallo Herr Spiess. (Vorsicht bischen griffiger Ton:)
    Ich verstehe nicht, wieso niemand damit Fehl-Alarm-Probleme hat. Ich habe das Naheliegende gemacht, und den "Out" Pin des PIR an einen Pin von einem ESP8266 angeschlossen, und der Triggert wie besessen. OHNE Bewegung (anderes Zimmer). Scheinbar macht niemand Langzeit-Tests, sondern nur schöne Videos. Habe mehrfach gelesen, dass die BISS ICs ultra empfindlich auf Störungen sind. Es gibt sogar Alternativen von Panasonic, die sogar mit der Stör-Unempfindlichkeit groß Werben. Wieso redet niemand über diese "real world" probleme, die dann auftreten, wenn man es wirklich baut, statt nur youtube schaut? Ich habe Tage gegoogelt, und es gibt ca. vier Wege, dem entgegen zu kommen. Ich versuche es mit einem Ferrit-Kern, den ich per Post erwarte.
    Grüße !

    • @AndreasSpiess
      @AndreasSpiess  4 ปีที่แล้ว

      Wenn du meine Videos regelmässig siehst weiist du, dass ich den Panasonic gezeigt, auf die Problematik der Fehlalarme hingewiesen, und sogar eine Quelle mit Abhilfe verlinkt habe ;-)

    • @cornjulio4033
      @cornjulio4033 4 ปีที่แล้ว

      Ich kucke gerne und regelmäßig alles von Ihnen ! Das Video hatte ich noch nicht. Passt perfekt, danke sehr.

  • @capelliverdi
    @capelliverdi 7 ปีที่แล้ว

    you can open the electric lock with NFC?

    • @AndreasSpiess
      @AndreasSpiess  7 ปีที่แล้ว +1

      No, I cant. Maybe somebody else ?

  • @mnelson10000
    @mnelson10000 8 ปีที่แล้ว

    This is cool, but I don't know if wifi is ideal for a house full of sensors... if you have 50 IOT devices in your house and need to change your wifi password, then you have to change the password in all 50 devices!! What a pain. Are you familiar with the MySensors project? The idea is that the IOT devices are RF and they communicate with a gateway to gain access to the controller and the internet.

    • @AndreasSpiess
      @AndreasSpiess  8 ปีที่แล้ว

      As everything in live, it has advantages and disadvantages. I have plenty of sub GHz modules laying around to test other concepts. But for the moment, the Sonoffs are ok for me. It will still take a moment till I have my 50 sensors ;-)
      Especially interests me the reach of these sub GHz modules in my home. For the WiFi I have now an infrastructure enabled and I wonder, if I would need another one for sub GHz.

    • @mnelson10000
      @mnelson10000 8 ปีที่แล้ว

      The NRF24L01 modules with built in amplifiers have a very impressive range and can be arranged in a mesh network to relay data (which is another thing that MySensors does). The wifi modules and the RF modules can work together by bringing them together with a common controller like OpenHAB or HomeAssistant.

  • @HboskO1982
    @HboskO1982 7 ปีที่แล้ว

    how much GPIO has sonoff? Thanks

  • @norberthartmann5075
    @norberthartmann5075 8 ปีที่แล้ว

    very very good!!

  • @Bestoniclab
    @Bestoniclab 8 ปีที่แล้ว

    Hacked!

  • @LearningToFly77
    @LearningToFly77 8 ปีที่แล้ว

    Wieso sagst du nicht mehr "again" ? ;-D

  • @squalazzo
    @squalazzo 8 ปีที่แล้ว +1

    Andreas, take a look at the small OrangePI Zero board we're talking about here: tech.scargill.net/fauxmo-alexa-delights/
    you can make an affordable local mosquitto broker, or even with node-red, for about 10$, so no need of internet connection to benefit of the mqtt stuff :)
    and take a look at this excellent lib for managing wifi setup on esp8266 :) github.com/tzapu/WiFiManager

    • @PeterScargill
      @PeterScargill 8 ปีที่แล้ว +1

      Another little winner - though slightly more expensive is the little NanoPi Neo Air - it REALLY is small. WIFI+Bluetooth. Mentioned in same blog.

    • @AndreasSpiess
      @AndreasSpiess  8 ปีที่แล้ว +1

      I had a look at the WiFi Manager, but I need many more fields, not only credentials. I want a complete separation between data and code. And this is not easy to be reached. Maybe, I will use the WiFiManager source code and extend it to my needs.
      I have a Pi Zero lying around, so, it is not about cost for the moment. It is about priorities. But I understand, that many of my viewers are interested in this topic. So, maybe, I will invest the needed time...

    • @squalazzo
      @squalazzo 8 ปีที่แล้ว

      oh, yes, you already know Peter Scargill's blog... it's always plain of precious info on IOT :)
      extending and resharing code on github and bitbucket is always good :)

    • @underwoodblog
      @underwoodblog 8 ปีที่แล้ว

      @squalazzo has node-red a build in mqqt broker or is a extra node required for this? Does node-red run together with mosquitto? I'm not clear about this.
      What linux os/version do you recoment for the orange pi. My Orange Pi Plus 2E just arrived today. I use debian jessie light on my pi's

    • @squalazzo
      @squalazzo 8 ปีที่แล้ว

      all you need is in the first script here: bitbucket.org/snippets/scargill/

  • @marcelocerri3779
    @marcelocerri3779 8 ปีที่แล้ว +1

    You can use mDNS to make each device announce itself in the .local domain.
    github.com/esp8266/Arduino/tree/master/libraries/ESP8266mDNS

    • @AndreasSpiess
      @AndreasSpiess  8 ปีที่แล้ว

      +Marcelo Cerri This is, what I did on the Sonoff. If I called it from the browser, it worked. But from the sensor ESP, it did not work.

    • @888cromartie
      @888cromartie 8 ปีที่แล้ว

      I don't know the details, but some OSes don't support mDNS natively (like Windows), so I gather the ESP can broadcast their own mDNS, but cannot find other mDNS devices with the ESP8266mDNS library. Could be wrong though...

    • @AndreasSpiess
      @AndreasSpiess  8 ปีที่แล้ว

      That's how it looks like in the moment.

    • @underwoodblog
      @underwoodblog 8 ปีที่แล้ว

      Thanks for the tip Marcello Cerri, will thest it on my ESPs soon.
      @888cromartie I have bonjour on every windows os and avahi on every linux os, that makes live easyer :)

    • @marcelocerri3779
      @marcelocerri3779 8 ปีที่แล้ว

      Andreas Spiess , take a look at this example: github.com/esp8266/Arduino/blob/master/libraries/ESP8266mDNS/examples/mDNS-SD_Extended/mDNS-SD_Extended.ino

  • @danbemowski3014
    @danbemowski3014 7 ปีที่แล้ว

    Looking to use a Sonoff with a Vera home controller? Check out my tutorial on my blog page. dan.bemowski.info/2017/07/04/using-a-sonoff-with-espeasy-and-vera/