Announcement

Collapse
No announcement yet.

4Duino and ESP8266

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

  • 4Duino and ESP8266

    I want to be able to remotely send commands to my application running on the 4Duino and I thought that I could do that over wi-fi with the ESP8266 that is on the board. This isn't something I've done before but I have looked around at tried various samples on this forum, none of which worked - they just reported station + softap error, Join AP failure, multiple error, start TCP server err and so on.

    From the datasheet:

    On the 4Duino the ATmega32U4 is offloading the Wi- Fi networking functions to the ESP8266, however it is capable of hosting an application by itself as it has a powerful processor and storage capability.
    From this, I'd imagined that I'd be able to upload an application to the ESP8266 module - say to serve a webpage at a specific URL that I could type a command in that would be passed, over a serial communication, from the ESP8266 to the ATMega, running my application, that could process it and respond. Running the comms part of an app on the ESP8266 would make use of its processor and memory, rather than that of the ATMega.

    The iTead library seems very old - last updated 4 years ago - so I don't even know if it's still valid or not. I thought I'd at least start off with something that acted as a server in the first instance and see if I could connect to it but as I say, nothing I found worked.

    Are there any app notes or working examples that could get me started?

  • #2
    Hi Andrew,

    Could you please try the NTP clock example. You can find it by clicking File, then Samples and then double click 4Duino, then Basic Graphics and finally NTP_Clock

    Add your SSID and Password in the code at the top and could you please let me know how it runs.

    Best regards

    Paul

    Comment


    • #3
      Thanks Paul,

      that's a cleaner example. I don't know how I missed that sample code - I did check around and looked at other forum entries.

      I tried running it and I'm not getting anywhere - it seems the ESP module isn't responding to anything. I also added a couple of commands into the sample code and turned on the debug. Here is the output from the terminal:

      Start...

      ESP8266 version info:
      CMD to run>
      AT+GMR
      >TIMEOUT

      Set operating mode:
      CMD to run>
      AT+CWMODE_CUR=1
      >TIMEOUT

      Enumerate available APs:
      CMD to run>
      AT+CWLAP
      >TIMEOUT

      CMD to run>
      AT+CWJAP_CUR="Home Wireless","MYPASSWORDNOSPACESSPECIALCHARS"
      >TIMEOUT

      CMD to run>
      AT+CWJAP_CUR="Home Wireless","MYPASSWORDNOSPACESSPECIALCHARS"
      >TIMEOUT

      CMD to run>
      AT+CWJAP_CUR="Home Wireless","MYPASSWORDNOSPACESSPECIALCHARS"
      >TIMEOUT

      CMD to run>
      AT+CWJAP_CUR="Home Wireless","MYPASSWORDNOSPACESSPECIALCHARS"
      >TIMEOUT

      CMD to run>
      AT+CWJAP_CUR="Home Wireless","MYPASSWORDNOSPACESSPECIALCHARS"
      >TIMEOUT

      At this point, the code has the 4Duino halt in a permanent loop. I initially thought that maybe it didn't like the space in the SSID (I can't change that!) but it would seem all the commands are timing out, even the simple one to get version info so whilst the SSID maybe a problem at some point, it's not relevant right now. The wireless access point (my router) is approximately 3metres away from the 4duino with a clear line of sight and the antenna pointed straight at it.

      I considered doing a AT+RESTORE but I don't know if that would wipe the AT command set from it. Is there another way of testing this module is actually powering on?

      Comment


      • #4
        Hi Andrew,

        Thanks for trying and I am sorry you are still having a problem. Can you confirm that there is nothing attached to the didgital pins of the 4Duino while testing especially D8 & D9

        Best regards

        Paul

        Comment


        • #5
          Yes, nothing connected at all.

          Comment


          • #6
            Thank you.

            I tried the NTP_Clock here and it worked fine and because of the timeout, it looks like the ESP8266 isn't communicating as it should. I will write a test program to diagnose what the ESP8266 does at power up.

            Best regards

            Paul

            Comment


            • #7
              Thanks Paul - given the issue I'm also having with pin D10, I'm wondering now if there's something more going on with the board. Other things seem fine though - the display/Picaso, the SD card, the main processor.

              Comment


              • #8
                Now that the ESP8266 is working, I can't work out how to upload a compiled sketch to it. I have the ESP8266 package installed in the Arduino IDE and have selected Generic ESP8266 module. Sketch compiles ok. I have the settings show in the image - based on the espresso loader that is used to reflash AT firmware, and the 4Duino is connected to the PC via USB and the programmer onto the 5-pin ESP header (oriented correctly.) I've tried with different reset methods. I try the 'put into boot loader mode' described in the datasheet: Press and hold Wifi Flash, press Wifi reset for about 1 second then let go, wait about a second then let go of Wifi Flash. Whatever I try, I get a timeout waiting for packet header. Arduino IDE is using esptool.py v2.8 - even though the image shows AVRISP mkII (esptool is not on option on that menu.)

                I'm sure there's a simple way of doing this. Could someone point me in the right direction.

                Thanks,

                Andrew

                Click image for larger version

Name:	Screenshot 2020-04-01 at 19.09.04.png
Views:	55
Size:	20.9 KB
ID:	71709
                Last edited by AndrewJ; 2nd April 2020, 04:15 AM.

                Comment


                • #9
                  Hi Andrew,

                  The method I use for getting flash mode is press & hold reset, press & hold flash, release reset, release flash.

                  Best regards

                  Paul

                  Comment


                  • #10
                    Thanks Paul - that, or changing the atmel loaded sketch to disconnect D8 and D9 did it. Thanks for your help.

                    Comment

                    Working...
                    X