[Home]ESP01

HomePage | RecentChanges | Preferences | My Website home page

ESP01

eBay suggested the ESP and and these esp8226 modules using ESP8226.

https://jpralves.net/post/2016/11/15/esp8266.html - loads of useful information

ebay suggested the ESP01 which support WiFi and Serial.

I brought a few with the blue adaptor plate.

Later on I decided to buy the little USB programmer adaptors.

The pin out.

It is possible to reprogram them with the Arduino IDE and other tools.

Using MicroPython and Thorny

Thorny is a Python IDE that is shipped with the Raspberry Pi and available for Windows.

It can be used with other Python REPL and it has the ability to upload MicroPython onto the ESP01.

Open Thorny->options-Interpreter-Install or update firmware. You need to download the latest firmware.

See https://micropython.org/download/esp8266/

It looks like a really good way to do a bit of tinkering that does not need the full reprogram cycle.

This provides a different way to explore the WiFi API.

See: https://docs.micropython.org/en/latest/esp8266/quickref.html

Thorny and MicroPython can be used with the ESP32 and Raspberry Pi PICO as well.

Using the AT commnads and a Web browser

This page captures some of this.

The ESP01 allows WiFi connectivity for the Internet of Things.

They come programmed for the AT commands firmware using the Arduino IDE yet.

This web page provides a simple overview: https://www.addicore.com/ESP8266-ESP-01-p/130.htm

Using Putty I needed to do <Cntl-J> to get the OK

Using the Arduino IDE serial monitor was best.

It is possible to use the Edge or Chrome web browser to connect to the serial port:

AT commands - Serial Using Web Browser

The Raspberry Pi Foundation's Hackspace Issue 44 https://hackspace.raspberrypi.org/issues/44 had a really interesting article.

See: https://www.connectedlittleboxes.com/gettingstarted.html

I have this to send AT commands to the ESP01 :

  https://homepages.plus.net/dougrice./dev/DigiSpark/simpleterm/simpletermESP01.html

AT commands for ESP01 and 8226

The ESP01 has a sister the ESP01S and Wikipedia lists a large list of ESP8266 modules.

The ESP01 and ESP01S differ by the number of LED and pull up resistors.

eBAY suggested a couple of USB ESP01 programmers. One has a switch.

The ESP01 on eBay seems to have many different firmware.

It has not been possible to find the original firmware to restore ESP01 to the supplied firmware. However They can be updated to a later version.

I use a wire to put the ESP01 into boot mode. Connect RST and GP0 to GND and ensure GP0 is held at GND after RST is pulled high.

  RST:  - -_ _ _ _ _- - - - - -
  GP0:  - - -_ _ _ _ _ _- - - -

I can reprogram the ESP01 using flash_download_tool_v3.8.8

  ============================================
  UPDATED: ESP8266_AT_Bin_V1.6.2
  https://www.instructables.com/Flash-or-Upgrade-Firmware-on-ESP8266-ESP-01-Module/
  ============================================
  AT+GMR
  AT version:1.6.2.0(Apr 13 2018 11:10:59)
  SDK version:2.2.1(6ab97e9)
  compile time:Jun  7 2018 19:34:26
  Bin version(Wroom 02):1.6.2
  OK

  https://diyprojects.io/esp-01-reinstalling-original-firmware-esp8266/#.YMmWB_KSk2w
mlwmlw / esp8266-workshop

  https://www.instructables.com/Flash-or-Upgrade-Firmware-on-ESP8266-ESP-01-Module/

ESP01 and 8226 is supported on the Arduino IDE

Arduino IDE can be configured. Use:

  http://arduino.esp8266.com/stable/package_esp8266com_index.json

ESP8266-IDF-AT_V2.1.0.0.zip changes hardware pins used for RX & TX making my hardware obsolete.

I have not found out how to re-build the AT commands.

There are other IDE platforms, see wikipedia.

ulisp & Arduino IDE for ESP01 and 8226

http://www.ulisp.com allows the ESP boards to run lisp. Use the Arduino IDE to build the sketch.

I needed to patch the sketch and added cast (builtin_t)

    //apply(0, autorun, NULL, NULL);
    apply( (builtin_t) 0, autorun, NULL, NULL);

ESP01 and the Internet of Things

Here are a few notes.

The Arduino IDE has loads of examples that can be uploaded that allow simple web clients and servers and ntp clients. These do not need a serial ports and AT commands.

The Clients are similar to a command line WEB tool like wget and curl. Commands wget and curl seem to be available on Win 10 and allow command line tools to get web pages and do web gets.

The ESP01 server examples are very simple TCP/IP servers that allow a list of GET commands that are interpreted without a cgi script.

https://www.instructables.com/ESP0101S-RELAY-MODULE-TUTORIAL/ - a web page about relay module and ESP01. It works with some retiming of the code to move the relay control code after the WiFi code has finished, so the power supply is clean.

http://www.dougrice.plus.com/dev/tcpip/IOT/relayExample.ino

https://www.binarytides.com/python-socket-programming-tutorial/ -

I have been told that it is possible to build a simple Webserver using a simple TCP/IP example that waits for a connection that reads the first line and interprets the GET command.

When A web browser connects to a webserver it connects with TCP/IP and issues a get for the URL and one for favicon e.g


GET /favicon.ico HTTP/1.1
Host: ccgi.dougrice.plus.com
Connection: keep-alive
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.164 Safari/537.36 Edg/91.0.864.71
Accept: image/webp,image/apng,image/svg+xml,image/*,*/*;q=0.8
Referer: http://ccgi.dougrice.plus.com/cgi-bin/wiki.pl
Accept-Encoding: gzip, deflate
Accept-Language: en-GB,en;q=0.9,en-US;q=0.8,da;q=0.7

HTTP/1.1 404 Not Found
Date: Sat, 24 Jul 2021 06:31:55 GMT
Content-Type: text/html; charset=iso-8859-1
Content-Length: 21
Connection: keep-alive

Not Found [CFN #0005] 

http://www.dougrice.plus.com/dev/tcpip/ has some dabbles

Using ESP01 with relay Module to learn about IOT

http://www.dougrice.plus.com/dev/tcpip/tcpip_perl/relayIOTprototype.html

http://www.dougrice.plus.com/dev/tcpip/tcpip_perl/server_iot.pl

It seems "Keep It Simple" rules. Simple GET commands and possibly inline icons or use SVG. Use python to allow GPIO support.

https://www.instructables.com/ESP0101S-RELAY-MODULE-TUTORIAL/ - a web page about relay module and ESP01. It works with some retiming of the code to move the relay control code after the WiFi

http://www.dougrice.plus.com/dev/tcpip/IOT/relayExample.ino - SSID and password need setting

The module connects to my hub and DHCP allocatated the IP address 192.168.1.92

It is controlled using:

http://192.168.1.92/RELAY=OFF

http://192.168.1.92/RELAY=ON

It does not provide and default or help.

It seems to time out the connection and does not seem to try to keep connected, so needs more work.

Use inline icons prepared using:

https://www.w3docs.com/snippets/html/how-to-display-base64-images-in-html.html

as used in:

http://www.dougrice.plus.com/dev/tcpip/tcpip_perl/relayIOTprototype.html

Simple TCP/IP examples

Can I do a really simple Webserver without Appache?

https://www.tutorialspoint.com/perl/perl_socket_programming.htm has a simple introduction.

They have this diagram that explains TCP/IP client server.

Staring with a simple TCP/IP server example with http://www.dougrice.plus.com/dev/tcpip/tcpip_perl/server.pl Normally tested with Client example http://www.dougrice.plus.com/dev/tcpip/tcpip_perl/client.pl

Add code to repond and serve some HTML:

http://www.dougrice.plus.com/dev/tcpip/IOT/

This perl script can be run from the command line and it accepts a TCP/IP connection from a web browser and prints out what is going on.

Download http://www.dougrice.plus.com/dev/tcpip/IOT/server_iot_log.pl

Then use:

 perl server_iot_log.pl 

Use this Page: http://www.dougrice.plus.com/dev/tcpip/IOT/iot_try.htm to GET from the perl script, or POST a Form to the perl script.

The Perl Script reports what the browser sends. IT sends back some HTML and some graphics using SVG.

These site show doing WiFi on bards like the ESP01.

https://docs.micropython.org/en/latest/esp8266/tutorial/network_basics.html

http://www.ulisp.com/show?2B22

If you install support for the ESP01 into the Arduoino IDE, there are loads of examples.

more info:

https://zetcode.com/perl/socket/

https://www.perl.com/pub/2002/08/20/perlandlwp.html/

http://www.wellho.net/resources/ex.php4?item=y303/server.py

ESP and Smart Light bulbs

I brought a Smart bulb and took the globe off.

WARNING there is 400 volts DC between V+ and V- even when the bulb is plugged in and the LEDs are off or DIM


HomePage | RecentChanges | Preferences | My Website home page
This page is read-only | View other revisions
Last edited October 2, 2023 7:19 am by dougrice.plus.com
Search: