Announcement

Collapse
No announcement yet.

ESP8266 - Proof of Concept

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • ESP8266 - Proof of Concept

    For those not aware the ESP8266 is a small, quite powerful Wifi microcontroller. It is now able to be programmed via Arduino and has replaced Arduinos in most of my projects (even ones not requiring Wifi).

    There are alot of impressive features that make it ideal for use with the plugin:
    • Wifi!
    • Cheap! ~$5US for dev kit
    • Possible to reload firmware wirelessly.
    • 4M Flash memory
    • Can run a webserver/MQTT/etc.
    • 1 Analog In (poor)
    • PWM support on all pins.
    • I2C, OneWire, 2 UART, SPI
    • 12 GPIO on NodeMCU Dev kit.

    Attached is the plugin sketch i hacked up a bit to run on the ESP8266. To program it via arduino you'll have to add the board/follow the instructions here:
    https://github.com/esp8266/Arduino#i...boards-manager
    Note: At this time due to a bug you must use the "staging" version (http://arduino.esp8266.com/staging/p...com_index.json) Or you will get constant WDT Resets.

    There's alot of different ESP8266 products out there, but for something Arduino like I'd suggest the NodeMCU dev kit (V1.0).


    Keep in mind the ESP8266 is 3.3V I/O, where as most Arduinos are 5V.
    The ESP8266 Analog input is pretty poor (and only 1CH). I'm going to look at using an external ADC instead...

    In the attached sketch OW pin is NOT configurable and hardcoded to 10 (SD3).
    So far I've only tested Digital Input/Output, LCD and OneWire but it seems to work well.

    I thought i'd share this see if there's much interest and possible consideration for official support in the plugin. (I'd be happy to help clean up the Arduino code).
    Attached Files
    Last edited by AllanMar; May 30th, 2016, 12:46 PM.

  • #2
    Absolutely! I've been waiting for you to say this! Really want to be able to use these as nfc scanners and pass the tag Id as a device to homeseer. Was going to code it myself but didn't feel like writing the net plugin

    Comment


    • #3
      Originally posted by kideon View Post
      Absolutely! I've been waiting for you to say this!
      Just to be clear I also have nothing to do with the Arduino Plugin itself. I just liked the idea of a quick config method for these devices.

      For the less standard stuff I use MQTT to get the info from these in to homeseer (which might be better for your NFC idea). You could also just make HTTP calls to the HomeSeer JSON interface from an ESP8266.

      Comment


      • #4
        I was thinking of doing exactly that

        Comment


        • #5
          This is interesting. Nice work!


          Sent from my iPhone
          Tom
          baby steps...starting again with HS3
          HS3Pro: Z-NET & 80 Z wave Devices,
          HSTouch: 4 Joggler (Android Kitkat), 2 iPhone, 3 iPads
          Whole House Audio: 5 SqueezePlay Jogglers w Bose Speakers
          In The Works: 10 Cameras Geovision, new Adecmo/Envisalink Alarm, Arduinos
          System: XP on Fanless Mini-ITX w/ SSD

          Comment


          • #6
            AllanMar

            Thanks for sharing mate, I did a few test compiles modifying the Board code to see what wifi modules would work and I was pleasantly surprised that it worked on lots of them.

            What sort of wifi range are you getting from this board ?

            I have a few of those in the mail to get going on Homeseer....slow boat from China :-)
            HS 2.2.0.11

            Comment


            • #7
              Kideon

              What type of NFC stuff do you want to scan ? I have a wiegand reader on a uno with API code. I've found the samsung phone rolled the NFC id when I scanned it, havent researched as to why it does this...

              I've just got wiegand keyfobs I pass the tag ID to Homeseer and then can unlock doors, works great....

              Pete
              HS 2.2.0.11

              Comment


              • #8
                Originally posted by petez69 View Post
                AllanMar

                Thanks for sharing mate, I did a few test compiles modifying the Board code to see what wifi modules would work and I was pleasantly surprised that it worked on lots of them.

                What sort of wifi range are you getting from this board ?

                I have a few of those in the mail to get going on Homeseer....slow boat from China :-)
                What kind of other WiFi modules? I'll be surprised if it works on much other than ESP8266 very well. It was written with the idea that it by able to use the same file on typical Arduinos though.

                I have no idea on the range, I have had zero problems anywhere I've used them with range so I haven't paid much attention to it (small property though). There are also some modules with ESP-07 which have a connection for an external antenna.

                I'm going to add some support for various I2C expansion, starting with ADS1115 (16bit 4CH ADC, ~$3).
                and possibly:
                PCA9685 (16Channel PWM!, ~$4)
                Any other ideas? One nice thing is there is so much extra flash/memory on these that the default sketch could support alot of devices for this....

                Comment


                • #9
                  Allan

                  I bought:

                  http://goo.gl/ttxIqx

                  http://goo.gl/jrmZZv

                  http://goo.gl/2nGhEU

                  I agree with the API could you can do lots....equally you can have these as standalone devices and do http calls to them to control.. must say its exciting stuff :-)

                  What I'm interested to see after powering them up do they connect nicely to the plugin, I've had all sorts of weirdness with ethernet boards ?? The connect first go after powering on/off ?
                  HS 2.2.0.11

                  Comment


                  • #10
                    Oh, yea. I thought you meant some other Arduino-like WiFi module. Pretty much all the ESP8266 boards should work, just have to watch where the pins are mapped.

                    The NodeMCU board has strange mapping ie. Pin 1 IS NOT D1. If the plugin supports these eventually theres probably better ways to handle that.

                    I have no problems with power up. Sometimes the WiFi can take longer than others to connect. The example i posted doesn't have much in the way of reconnect handling/etc (something i'll add).

                    Comment


                    • #11
                      Allan the stuff on Aliexpress is so darned cheap :-)

                      Had a look at your code, I'm glad the library calls are the same as for ethernet, makes life simpler. Just waiting for these boards to turn up to play. Thanks for posting the code, all makes sense....

                      One idea I've got with the small wifi module is the power meter, reading my smart meter, it has a 1w/h pulsing led on it. I've got the code running on a UNO with a LDR counting pulses. I plan to stick the wifi version into the meter box and send me the kw/hr number after 5 pulses (average time between 5 pulses and convert to kw/hr)

                      Good use of a ESP module I reckon :-)
                      HS 2.2.0.11

                      Comment


                      • #12
                        Originally posted by petez69 View Post
                        Allan the stuff on Aliexpress is so darned cheap :-)

                        Had a look at your code, I'm glad the library calls are the same as for ethernet, makes life simpler. Just waiting for these boards to turn up to play. Thanks for posting the code, all makes sense....

                        One idea I've got with the small wifi module is the power meter, reading my smart meter, it has a 1w/h pulsing led on it. I've got the code running on a UNO with a LDR counting pulses. I plan to stick the wifi version into the meter box and send me the kw/hr number after 5 pulses (average time between 5 pulses and convert to kw/hr)

                        Good use of a ESP module I reckon :-)
                        Sounds interesting, let us know how it works out.
                        Another interesting thing with the ESP8266 is you can enable interrupts on any pin, which is good for pulse applications. It would be nice if the plugin supported pulse inputs without API (wouldn't be too hard i'd think).

                        Comment


                        • #13
                          I had a trawl through the code and thought the same myself.. :-)
                          HS 2.2.0.11

                          Comment


                          • #14
                            @pete looking to do exactly that. I want to get a nfc ring and be able to scan it at different areas of the house to trigger events pretty much what you are doing. How'd you set it up?

                            I like the idea of the esp because it's of course got the wifi and is extremely small, could build very low power and low profile readers.

                            Comment


                            • #15
                              Hiya, well I went looking for the code, think I can find it.....

                              Long story short is....this is the library I installed...

                              https://github.com/monkeyboard/Wiega...ry-for-Arduino

                              wg.getCode in his example gives you the tag string, define it as a long. When it gets a key then send it to HS.

                              Hope that helps :-)
                              HS 2.2.0.11

                              Comment

                              Working...
                              X