ESP8266 and Arduino Uno


  • Metal

    @pierre I saw a post in an old thread where yo mentioned you had been using an ESP8266 for some projects. I received an order of a few of the ESP12 variants a while back and just took a look at trying to hook them up with my arduino uno tonight. Sad to say I didn’t get too far. I’m hoping you have some pointers that will get me on that fast track and maybe you can recommend a good arduino library for it?

    My end goal is to have a wifi enabled wood fireplace temperature monitoring system that can send me a text msg alert if the fire gets too hot. I already have the basic temp monitoring system built, and am looking to expand the features.

    Anybody else out there with any experience or interest feel free to chime in :-)



  • I’m running the ESP-03 modules, with the nodemcu firmware. It does not need an arduino in this configuration, since you can program the ESP8266 to run code directly. I get just enough GPIO pins to read a couple of sensors and trigger a relay or something with wifi in a package that will run off a coin cell.

    If you’re running the AT firmware, I can give you some basic pointers, but you will likely have some trouble dealing with the asynchronous event model on the ESP system. There are also typically some very confusing rules about which pins need to be pulled high or low at startup to make it boot in the right mode.

    Can you post up some pictures of your circuit and a bit of sample code?


  • Metal

    At this point i am actually hoping to have it working in conjunction with the arduino as I have already built the temp monitor station and it uses a speaker,8 digit 7-segment display, thermocouple, and IR receiver.
    I don’t have any code written yet as I was looking for a library that would make my life easier. :-)
    I’ll get a photo or diagram of the circuit and post it as soon as i have a chance.
    I’ll do some reading on the nodemcu firmware too, for future reference.
    thanks



  • Nodemcu allows you to program the device in lua. If you can explain what you’d like the board to do, we can just put together a firmware that does that well…

    As in, I’d like to be able to send it text and have it forward that text to a webserver… Or I’d like it to connect to a socket and alert me when the server sends a particular message… Etc.


  • Metal

    As a starting point I’d like it to be able to notify me via text or email when the stove temperature exceeds a certain temp.
    Long term goal is I would like be able to remotely monitor the temperature of the fireplace on my phone or computer. I have a lot of learning to do to make this happen… lol

    right now the way I have it working is the Arduino continuously monitors the temperature and updates the 7-segment display when the temperature changes. When the fireplace reaches a ‘warning’ temperature the device will beep twice to give me an audible indication that its time to turn down the damper. If the temp exceeds the ‘overfire’ value then the alarm will beep continuously until the temp drops below the ‘overifre’ temp, or the alarm is manually ‘hushed’ (like a smoke alarm) wqith the remote control.

    I have my own domain and web hosting, if that makes any difference on how to approach the project.


  • 3D

    Apart from 7-segment display you pretty much can run this off ESP itself. There is an arduino toolchain for it and the most limiting factor here is the amount if GPIO pins. If you figure out a way around if you’re good with whatever’s on ESP - you can implement your whole project withour need in Uno. ESP has nice 72MHz cpu and lots of flash. It can even serve pages with sensor data in them.



  • There are serial or SPI lcd displays. They will run off the serial or a single GPIO pin.



  • @dk if you are free tonight (Wednesday), make sure to come to our hack night any time after 5pm and bring your Arduino and wifi chip so we can work on them together. I have the ESP8266 and have been meaning to set it up to report temperature and humidity for a while now.



  • Loop @hdsheena in on it too. She’s working on wireless temperature monitoring too.



  • The MicroPython for ESP8266 kickstarter was funded, so it won’t be too long before MicroPython will have much better support on the ESP8266.



  • I was under the impression that micropython would work but would remove the wifi feature? Which makes the ESP8266 a shitty AT-Tiny substitute.



  • Oh, @dk you probably won’t be able to send texts directly from the 8266, you’d need to hook up to a service that does that like Twillio, or somehow get a GSM modem talking to your microcontroller.

    I use a usb GSM modem plugged into a linux box to send texts sometimes, and there is no real reason it would be difficult on say a raspberry pi, but I don’t know how hard it would be to make something like this: https://www.arduino.cc/en/Main/ArduinoGSMShield work for your purposes.


  • 3D

    This can be accessed through serial. Means, you can probably send texts right from ESP.


  • Metal

    @toxuin said:

    can run this off ESP itself. There is an arduino toolchain for it and the most limiting factor here is the amount if GPIO pins. If you figure out a way around if you’re good with whatever’s o

    Not sure if I can live without the 7 segment display or not. It’s really nice to be able to just look over from the sofa and see what the temp is. Being able to run the whole thing from the ESP8266 would be nice tho. Once I have a grasp on working with the ESP8266 I will have to start back at square 1 and see how I can revamp things.

    @pierre said:

    There are serial or SPI lcd displays. They will run off the serial or a single GPIO pin.

    That is good to know. If i can find an lcd display that is large enough to be visible across the room and still afffordable that would work well.

    if I can send an email from the ESP8266 I think that would work just as well as sending a text. A service like Twilio is exactly what I was thinking along the lines of for text messaging tho, so if that is doable that’s awesome.

    @arasbm said:

    @dk if you are free tonight (Wednesday), make sure to come to our hack night any time after 5pm and bring your Arduino and wifi chip so we can work on them together. I have the ESP8266 and have been meaning to set it up to report temperature and humidity for a while now.

    If I lived closer to Kamloops I would definitely be at the Wednesday night hack nights. Unfortunately its about a 4 hour round trip for me :-(

    I hope everyone is successful tonight getting their projects going. If you get the 8266 working for temp monitoring I’d love to check out the code and wiring setup.

    I’ll be putting some time in here on my end finding out what I can find out…



  • @pierre

    @pierre said:

    I was under the impression that micropython would work but would remove the wifi feature? Which makes the ESP8266 a shitty AT-Tiny substitute.

    The new port has regular socket support, and a WebREPL (so using a very similar socket model to regular python instead of the ESP8266 OS model which was all async).


  • Metal

    I had a little time last night and played around a bit with the 8266 (its a ESP-12). After getting everything hooked up and figuring out which baud rate would actually result in readable bootup text (115200) I tried everything I could think of to get a reply to simple AT commands to no avail (tried changing the line ending to carriage return and line feed in arduino IDE serial monitor). I eventually turned to nodemcu flasher and flashed the ESP8266 with whatever firmware came with it. Is there a simple way to send commands and receive a response to ensure that it is working properly? BTW I am using and FTDI cable, and powering it from an old computer power supply at 3.3V.

    Hope others were more successful yesterday than i was :-)

    UPDATE: I finally managed to get something to happen.
    it seems the 8266 got caught in a boot loop for a while, but reflashing helped.Using RealTerm @ 9600 I was able to send it a print(“hello world”) command and get a reply :-)
    sending the node.restart() command results in a bunch of gibberish and what appears might be a random boot loop (?) because sometimes i get only about 6 lines of gibberish, other times 30+ before it stabilizes.
    Nowhere near anything usefull yet, but hey, at least its something.

    UPDATE 2: Downloaded a program called LuaLoader. was able to connect to a wifi network, and turn an led on and off. :-) how very exciting!



  • @dk It is possible to directly write your ESP firmware in wiring or C++ and leverage the arduino libraries - this is how I have been programming mine. The instructions for doing so are here. You will need to select ‘Generic ESP8266 Module’ instead. Note that you need to tie GPIO0 and GPIO2 specially in order to program the flash - see this

    I have also used PlatformIO which was really convenient (though I needed more granular selection of the ESP SDK which precluded me using this system).

    Here is an example of a sketch I wrote to log temperature which you can program directly onto your ESP - no arduinos required.


  • Linux

    @dk , I’m spending time in Vernon quite a bit lately if you wanted to meet up and work on ESP things there sometime. Closer for you than Kamloops!

    Learning and working on learning more!

    0

  • Metal

    @Logan that is great info. thank you for the links and the example code :-) I will do some reading and studying and see if that is a good approach to take. I need to spend some time really thinking over how to best approach this now that i am realizing how many options i have.

    @hdsheena I’d definitely be interested in meeting up with you in Vernon sometime. How are you making out with your project?



  • @dk several of my ESP-03 modules came with broken firmware… Using esptool to upload new firmware made them behave better.


  • Metal

    @pierre I have a feeling the first (and so far only) ESP-12 that i tried had a firmware issue as well. Since I flashed the nodemcu firmware to it things are looking up.


Log in to reply