Shop OBEX P1 Docs P2 Docs Learn Events
ESP8266 and MacOSX — Parallax Forums

ESP8266 and MacOSX

I thought I'd experiment with an ESP8266 (SparkFun's ESP8266 Thing) as the WiFi interface for a Propeller. I use a Mac desktop with Mac OS 10.11 so some of the tools aren't available. There's an add-on for the Arduino IDE and a Python download tool (esptool.py) for NodeMCU (Lua) that are supposed to work. You need to install pyserial for serial I/O but none of the installation suggestions I found seemed to work. I found out that the version of Python installed on the Mac OS is only 2.5 while the current version 2 is 2.7. Once I downloaded and installed 2.7 from python.org, I was able to install pyserial and esptool.py worked as described to install NodeMCU.

I haven't had any luck yet with ESP-Basic. The flasher is for Windows only and the official website doesn't have a precompiled binary. I tried compiling it from source using the Arduino IDE, but I keep running into errors with the libraries. If anyone has had luck with this under Mac OS, let me know.
«1

Comments

  • Hi Mike,

    I haven't tried ESP-Basic but I have been working with an ESP8266-01 module for loading a Propeller. Here is a link to my code in github:

    https://github.com/dbetz/esp8266-loader

    I'm doing this work on the Mac and have had pretty good luck with the ESP8266 Arduino tools. Is ESP-Basic available in source form or just as a binary installer?

    David
  • There's a page on GitHub here with the source. The main website is here.
  • Mike Green wrote: »
    There's a page on GitHub here with the source. The main website is here.
    Thanks! I guess I did look at that a while back. It seems to have an odd dialect of BASIC. Maybe you can compile FemtoBASIC with spin2cpp and get that running on the ESP8266? :-)

  • Heater.Heater. Posts: 21,230
    Are there any not "odd dialects" of BASIC?

    There is no standard that anyone adheres to. Bit like Forth.
  • Heater. wrote: »
    Are there any not "odd dialects" of BASIC?

    There is no standard that anyone adheres to. Bit like Forth.
    True but some are odder than others. For example, I think the docs for this version say that you can't have spaces in parameter lists of functions. Seems like bad parser design to me.

  • Mike Green wrote: »
    I tried compiling it from source using the Arduino IDE, but I keep running into errors with the libraries. If anyone has had luck with this under Mac OS, let me know.

    Even after installing all of the libraries included with the ESP Basic git sources, I could not compile with Arduino IDE 1.6.6. Many functions show up as "not declared in scope", though the project includes the function sources. Not sure if it is a difference in the Arduino IDE version used by the project owner than I did or what. Perhaps the README needs to contain more useful information for those that want to build their own.

    Also: Including versions of actual Arduino libraries in a git project is not really a good idea. The owner of the project should use links (git sub-modules?) for the libraries to make sure that git cloners are getting the libraries from their original source. Who knows what version of these libraries the project owner has included.

    All-in-all, I think the project is rather immature (of course, this is just my thinking at this point of frustration)...


    dgately
  • What is your goal here? Do you want to play with interfacing to the Propeller using BASIC on the ESP8266? Or do you want the ESP8266 to host a BASIC compiler that can target the Propeller? In fact, I'd like to see both. Or maybe use Javascript on the ESP8266 and some flavor of BASIC on the Propeller?
  • Mike GreenMike Green Posts: 23,101
    edited 2016-01-15 18:47
    I became interested in this Basic because, by default, it establishes an access point and uses that for its console via a web browser window. This could be accessed and used with an iPad or iPhone to create interfaces for an attached Propeller also using a web browser window. Even though the Basic interpreter is a "work in progress", it seems to be well enough along for me to use it "as is" for what I want ... assuming I can get it to compile and download on my Mac.

    Plan B would be to use NodeMCU ... more work on my part and more to learn.
  • Mike Green wrote: »
    I became interested in this Basic because, by default, it establishes an access point and uses that for its console via a web browser window. This could be accessed and used with an iPad or iPhone to create interfaces for an attached Propeller also using a web browser window. Even though the Basic interpreter is a "work in progress", it seems to be well enough along for me to use it "as is" for what I want ... assuming I can get it to compile and download on my Mac.

    Plan B would be to use NodeMCU ... more work on my part and more to learn.
    That makes sense. I would try it on my Mac but I'm also running version 1.6.6 of the Arduino IDE.

  • dgatelydgately Posts: 1,630
    edited 2016-01-15 19:30
    Mike,

    I was able to build on Mac OS X 10.11.2 with the Arduino IDE (v1.6.6 & v1.6.7) after placing prototypes of all the following functions into the top of the ESP8266Basic.ino file. I also resolved all of the libraries issues, by copying the git project's versions of the libs into my Arduino libraries directory (Hopefully, my other Arduino projects will still build):
    void PrintAndWebOut(String);
    String LoadDataFromFile(String);
    String RunningProgramGui();
    String GetRidOfurlCharacters(String);
    void SaveDataToFile(String, String);
    bool CheckIfLoggedIn();
    void handleFileUpdate();
    void DoSomeFileManagerCode();
    String BasicProgram(int);
    void ExicuteTheCurrentLine();
    void SaveDataToFile(String, String);
    void BasicProgramWriteLine(int, String);
    void runTillWaitPart2();
    String getContentType(String);
    bool ConnectToTheWIFI(String, String, String, String, String);
    void CreateAP(String, String);
    void StartUp_OLED();
    void StartUpProgramTimer();
    void RunBasicTillWait();
    float UniversalPinIO(String, String, float);
    String GetMeThatVar(String);
    void PrintAllMyVars();
    static void sendStrXY(char *, int, int);
    static void clear_display(void);
    static void sendcommand(unsigned char);
    String GenerateIDtag(String);
    void SetMeThatVar(String, String);
    byte sendEmail(String, String, String, String);
    String VarialbeLookup(String);
    String Mid(String, int, int);
    String Left(String, int);
    String Right(String, int);
    int StrToHex(String);
    void displayOn(void);
    void displayOff(void);
    static void init_OLED(void);
    static void setXY(unsigned char, unsigned char);
    static void SendChar(unsigned char);;
    static void sendCharXY(unsigned char, int, int);
    void SetThePinMode(String, byte);
    void servoWrite(byte, int);
    byte eRcv();
    String GetMeBase64(String);
    void CheckFOrWebVarInput();
    byte CheckFOrWebGOTO();
    String BasicGraphics();
    

    Not sure why the Arduino IDE is not seeing the function prototypes "as-is", but the above fix allows the build to complete. I did read that the IDE tends to not see declarations that include more than one argument, but many of these functions include 1 or no arguments.

    Another EDIT: BTW, I used XCode to help find the missing prototypes. I just opened all of the .ino files in XCode to do multi-searching. It sure helps having a 'real' IDE to edit large projects. I know that the Propeller community has been interested in all of the "simple" editing solutions, but a full-featured IDE can sure make these kinds of task easier...

    dgately
  • dgately,
    Thanks for the prototypes. I was able to get ESP8266Basic to compile and download, but it doesn't seem to work. The ESP8266 creates an access point which I can access, but no data is transmitted to the browser (either Safari or Chrome). Off to Plan B.
  • I thought I had downloaded a binary from github (e.g. https://github.com/esp8266/Basic/tree/master/Flasher/Build/4M) and flashed it using esptool.py on OS X. But the Basic didn't seem to work properly. I could see the GUI from a browser, but wasn't able to get it to save programs.
  • Mike Green wrote: »
    The ESP8266 creates an access point which I can access, but no data is transmitted to the browser (either Safari or Chrome). Off to Plan B.

    I'll also give it a try on an ESP8266-11, if I can get a chance.

    What's your plan B?

    dgately
  • Plan B is to use NodeMCU (Lua) in much the same way. I may start with a Telnet server since there's an example of that in Lua and I have a Telnet app for my iPad.
  • I got this far...
    <..............ESP Basic 1.76
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    
    Failed Wifi Connect 
    Creating WIFI access point
    ESP
    APname
    APpass
    Starting Default Program
    Done...
    

    After building the ESP8266 Basic project with Arduino IDE, I was not able to upload within the IDE. I found the built "ESP8266Basic.ino.bin" file deep inside the /var/folders/.. directory and uploaded it with esptool.py. I used CoolTerm to connect the esp8266-11 and on reset, I get the above output.

    dgately
  • Try connecting to the "ESP" access point and use a browser to access "http://192.168.4.1/edit". You might get the ESP8266 Basic editor webpage.
  • Cluso99Cluso99 Posts: 18,069
    NodeMCU works nicely. I was up and running in no time at all (long time ago).
  • Mike Green wrote: »
    Try connecting to the "ESP" access point and use a browser to access "http://192.168.4.1/edit". You might get the ESP8266 Basic editor webpage.

    Yeah, I didn't mention that I had tried that. The "ESP" AP shows up and I can connect to that as a network, but the webpage never appears at "http://192.168.4.1/edit". Must be something about the binary built via the Arduino IDE...


    dgately


  • Hello,

    I hope you have not been discouraged by the results so far.

    The precompiled working binaries are available for download from
    https://github.com/esp8266/Basic/tree/master/Flasher/Build

    You must take care and use the proper one for your devices memory size.

    The esp-12 modules normally have a 4m size.
    The esp-01 can vary from 512k (blue ones) to 1m (black ones).

    I have never tested the basic personally on any other flash sizes.

    If you have connected to the device via wifi the http://192..168.4.1/edit link should work and bring up the editor page. It might take a little while while saving programs but it should finish. I have done most of my testing with google chrome and the browsers on android phones. Because chrome and safari both use the web kit engine i would see no complications arising with usage on a mac.

    If you are compiling from source you may have some trouble if you are not using the same version of the esp8266 arduino package. I am using an older staging version. Have not moved to the latest but still am not using the "stable" one.

    Hopefully the precompile bins from the git hub repository will help.
  • MMISCOOL wrote: »
    The precompiled working binaries are available for download from
    https://github.com/esp8266/Basic/tree/master/Flasher/Build

    If you are compiling from source you may have some trouble if you are not using the same version of the esp8266 arduino package. I am using an older staging version. Have not moved to the latest but still am not using the "stable" one.

    Hopefully the precompile bins from the git hub repository will help.

    Thanks for the precompiled binaries... Should make this easier for Linux & Mac users!

    BTW: If you put the Flasher source up on github, interested Linux or Mac users just might create versions for those computers (hint, hint) :cool:

    dgately
  • MMISCOOL,
    Thanks for the precompiled binaries. Are the sizes you indicate in terms of bits or bytes? The SparkFun Thing uses a 25SF041 which is 4Mbit. I downloaded the 4M binary and the save button doesn't work properly. It indicates "saved" in the small window below the text window, but nothing runs and opening the default file shows a blank window.
  • KeithEKeithE Posts: 957
    edited 2016-01-19 00:11
    @Mike Green - this is the same problem that I had and referred to above. So you're not alone. I'm using the SparkFun thing Dev with the built-in FTDI circuit. I think that David Betz also has some of these.
  • KeithE wrote: »
    @Mike Green - this is the same problem that I had and referred to above. So you're not alone. I'm using the SparkFun thing Dev with the built-in FTDI circuit. I think that David Betz also has some of these.
    I have two but I'm not using them anymore. It's nice that they have on-board FTDI but that means you can't really use the RX/TX pins for anything else. I wanted to use them to load a Propeller. Anyway, I'm now just using the cheapo ESP8266-01 board with my own cobbled together interface to a PropMini to test loading.

  • To use with the the sparkfun thing you need to flash the 512k version of the interpreter.

    I found the thing board to be a bit lack luster. It only has half a meg of flash. The node mcu boards available on line for less than 10$ with built in usb to serial converter come with 4 megs of flash.
  • I wrote the flasher in a version of basic only available for windows. Been a bit reluctant to put it out there as the instructions to compile and package the bin files in to the exe is a bit involved. The flasher is also only a wrapper for the esptool command line program also. The same one distributed with the esp8266 arduino project.

    The source code for every thing else is available in the repository.
    dgately wrote: »
    MMISCOOL wrote: »
    The precompiled working binaries are available for download from
    https://github.com/esp8266/Basic/tree/master/Flasher/Build

    If you are compiling from source you may have some trouble if you are not using the same version of the esp8266 arduino package. I am using an older staging version. Have not moved to the latest but still am not using the "stable" one.

    Hopefully the precompile bins from the git hub repository will help.

    Thanks for the precompiled binaries... Should make this easier for Linux & Mac users!

    BTW: If you put the Flasher source up on github, interested Linux or Mac users just might create versions for those computers (hint, hint) :cool:

    dgately
  • MMISCOOL,
    Thanks. The 512K version of the interpreter downloaded with esptool and worked fine with my iPad
  • MMISCOOL wrote: »
    The flasher is also only a wrapper for the esptool command line program also. The same one distributed with the esp8266 arduino project.

    Ah, good to know! With the binaries now available, esptool.py works just fine on Linux & Mac OS X boxes.

    Oh, and look what just showed up in my mailbox:

    WeeESP8266SerialWiFiModule.pngIteadStudioWeeESP8266.png

    It's a 'Bee' format ESP8266 board from Itead Studio (http://wiki.iteadstudio.com/Wee_Serial_WIFI_Module)

    purchase: https://www.itead.cc/wee-serial-wifi-module.html

    Not sure how much flash memory is available (looks like a Winbond 25Q808VSIG). Anyone know how to decode that ID?

    Thanks,
    dgately
    289 x 331 - 208K
    353 x 385 - 305K
  • A websearch for that part number indicates that it's 8Mbit (1MByte)
  • Mike Green wrote: »
    A websearch for that part number indicates that it's 8Mbit (1MByte)

    Thanks Mike!


    Dave Betz: Which GPIO pin on the ESP8266 will you be using to reset the prop?


    dgately
  • dgately wrote: »
    Mike Green wrote: »
    A websearch for that part number indicates that it's 8Mbit (1MByte)

    Thanks Mike!


    Dave Betz: Which GPIO pin on the ESP8266 will you be using to reset the prop?


    dgately
    GPIO0 has to be tied low to program the ESP. I used GPIO2 to reset the Prop.

Sign In or Register to comment.