[Retired] MiniESPEasy = ESPEasy for modules with limited I/O pins.

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
User avatar
costo
Normal user
Posts: 500
Joined: 21 Nov 2015, 15:03
Location: NL, zw-NB

[Retired] MiniESPEasy = ESPEasy for modules with limited I/O pins.

#1 Post by costo » 08 Feb 2016, 03:37

I made a fork of stable version ESPEasy R78 on github : https://github.com/costonisp/MiniESPEasy

It is meant for small boards like ESP-01 , ESP-02 and gadget boards like the Sonoff WiFi switch which have limited IO-pins.

The idea is that for a working project you do not need Serial input/output because everything can be done by the webinterface. So the use of 2 dedicated pins for Tx & Rx data is not necessary anymore.

These 2 pins called Rxd & Txd which are also known as GPIO-1 and GPIO-3 can be used as general purpose I/O if there is no Serial communication in ESPEasy any more.
But the Serial communication is heavily embedded in ESPEasy and cannot easily be removed but there is a alternative way to remove the Serial communications from ESPEasy.

There is this command in the ArduinoESP8266 library called Serial.swap() it swaps UART Pins 1/3 with Pins 13/15. This makes it possible to free the Rxd and Txd pins from the UART and make the pins available as GPIO and also for the I2C bus.
The Serial communication is swapped to GPIO 13&15 which are not available on small modules like ESP-01 and ESP-02 but we do not really need the Serial communications in most working projects, we want just as much GPIO pins as possible.

Offcourse flashing the ESP8266 is still done over the UART in flash-mode. When the flashed program starts up it swaps the UART pins, freeing these for other purposes.

I tested it sofar on several boards including a ESP-201 and the NodeMCU and it is stable.
OTA is still possible because everything ESPEasy has is also working in MiniESPEasy.

edit: renamed the fork from MiniESP to MiniESPEasy and corrected the link
Last edited by costo on 24 Feb 2016, 21:26, edited 4 times in total.

tozett
Normal user
Posts: 734
Joined: 22 Dec 2015, 15:46
Location: Germany

Re: MiniESP = ESPEasy for modules with limited I/O pins.

#2 Post by tozett » 08 Feb 2016, 11:52


User avatar
costo
Normal user
Posts: 500
Joined: 21 Nov 2015, 15:03
Location: NL, zw-NB

Re: MiniESP = ESPEasy for modules with limited I/O pins.

#3 Post by costo » 08 Feb 2016, 17:00

Why do it the hard way if you can do it the easy way ? :lol:
I mean, not everybody has the skills to solder tiny wires on a SMD chip with 0.5mm grid.

My fork transforms the programming bus into a I2C bus or 2 easy GPIO pins.

bennybubble
Normal user
Posts: 44
Joined: 31 Jan 2016, 21:05

Re: MiniESPEasy = ESPEasy for modules with limited I/O pins.

#4 Post by bennybubble » 18 Feb 2016, 11:24

Hi Costo,

Nice work !

Could you provide binaries as the original R78 does (512 / 1024 / 4096) ?
I cannot get your version compiled ..... :twisted:

-ben

User avatar
costo
Normal user
Posts: 500
Joined: 21 Nov 2015, 15:03
Location: NL, zw-NB

Re: MiniESPEasy = ESPEasy for modules with limited I/O pins.

#5 Post by costo » 18 Feb 2016, 16:48

bennybubble wrote:Hi Costo,

Nice work !

Could you provide binaries as the original R78 does (512 / 1024 / 4096) ?
I cannot get your version compiled ..... :twisted:

-ben
Probably you have the wrong library somewhere. What is the errormessage you get ?

But if you like I can sent it to you, if you sent me a P.M. I will sent it by email to you.

tozett
Normal user
Posts: 734
Joined: 22 Dec 2015, 15:46
Location: Germany

Re: MiniESPEasy = ESPEasy for modules with limited I/O pins.

#6 Post by tozett » 20 Feb 2016, 08:53

costo wrote:I made a fork of stable version ESPEasy R78 on github : https://github.com/costonisp/MiniESPEasy
It is meant for small boards like ESP-01 , ESP-02 and gadget boards like the Sonoff WiFi switch which have limited IO-pins.
...
This makes it possible to free the Rxd and Txd pins from the UART and make the pins available as GPIO and also for the I2C bus.
i found more information and wiring diagramms about pins and pullups here (and maybe worth a quick look :roll: )

http://www.forward.com.au/pfod/ESP8266/ ... magic.html

User avatar
costo
Normal user
Posts: 500
Joined: 21 Nov 2015, 15:03
Location: NL, zw-NB

Re: MiniESPEasy = ESPEasy for modules with limited I/O pins.

#7 Post by costo » 21 Feb 2016, 00:21

tozett wrote:
costo wrote:I made a fork of stable version ESPEasy R78 on github : https://github.com/costonisp/MiniESPEasy
It is meant for small boards like ESP-01 , ESP-02 and gadget boards like the Sonoff WiFi switch which have limited IO-pins.
...
This makes it possible to free the Rxd and Txd pins from the UART and make the pins available as GPIO and also for the I2C bus.
i found more information and wiring diagramms about pins and pullups here (and maybe worth a quick look :roll: )

http://www.forward.com.au/pfod/ESP8266/ ... magic.html
The mentioned site claims:
How to get the most out of the limited pins
on the inexpensive ESP8266-01 WiFi Module


It is an omission that the command Serial.swap() is not mentioned in the article at forward.com.au/pfod/
This command disables the UART on Rx and Tx and makes these pins usable as GPIO 1&3 without interference of any excisting Serial.read/write/print etc. commands. There is no need to disable these commands.

In ESPEasy Serial communication is heavily used in the code. Therefore it is not easy to disable the Serial communication.
Using Serial.swap() enables the use of GPIO 1&3 with only some minor code modification. So the stability of MiniESPEasy is (as far as I know) as good as ESPEasy itself

asm7100
Normal user
Posts: 96
Joined: 13 Sep 2015, 21:45
Location: Denmark

Re: MiniESPEasy = ESPEasy for modules with limited I/O pins.

#8 Post by asm7100 » 21 Feb 2016, 10:59

How about just using i2c devices like MCP23017 (2x8 I/o) and mcp3428 (4 channels adc 18 Bit) Only 2 pin to use.
Also i2c O_led display and so on.
5xESP-01 - 3xESP-12 - 2xESP-12E 3xRPIb+ - 1xBPIm1 - 3xACTi DOME - 7xACTi Indoor cam. Lot off cisco equ.

tozett
Normal user
Posts: 734
Joined: 22 Dec 2015, 15:46
Location: Germany

Re: MiniESPEasy = ESPEasy for modules with limited I/O pins.

#9 Post by tozett » 21 Feb 2016, 13:04

costo wrote: Offcourse flashing the ESP8266 is still done over the UART in flash-mode. When the flashed program starts up it swaps the UART pins, freeing these for other purposes.
i only cheched the github readme, but is there a (hidden?) trick, to swap serial back gpio1/3 ?

as fas as i understand, after flashing the usr-serial is on Pins (13/15) which are not broken out on an ESP01.
so one could never flash again over serial pins, only OTA. (or first solder 13/15 :( )

has the firmware some tricks, like crossing some pins, to reset/re-swap UART back to GPIO1/3?

User avatar
costo
Normal user
Posts: 500
Joined: 21 Nov 2015, 15:03
Location: NL, zw-NB

Re: MiniESPEasy = ESPEasy for modules with limited I/O pins.

#10 Post by costo » 21 Feb 2016, 13:38

tozett wrote:
costo wrote: Offcourse flashing the ESP8266 is still done over the UART in flash-mode. When the flashed program starts up it swaps the UART pins, freeing these for other purposes.
i only cheched the github readme, but is there a (hidden?) trick, to swap serial back gpio1/3 ?

as fas as i understand, after flashing the usr-serial is on Pins (13/15) which are not broken out on an ESP01.
so one could never flash again over serial pins, only OTA. (or first solder 13/15 :( )

has the firmware some tricks, like crossing some pins, to reset/re-swap UART back to GPIO1/3?

This reference document states:
http://esp8266.github.io/Arduino/versio ... rence.html
Serial uses UART0, which is mapped to pins GPIO1 (TX) and GPIO3 (RX). Serial may be remapped to GPIO15 (TX) and GPIO13 (RX) by calling Serial.swap() after Serial.begin. Calling swap again maps UART0 back to GPIO1 and GPIO3.
Flashing is a independent process that takes place during bootup.
When you boot up in flash mode GPIO 1/3 are used for flashing. When you reset (cold or warm) the ESP8266, a bootup routine (like the bios in a PC) connects GPIO 1/3 to UART and also checks GPIO 0, 2 &15 to determine in which mode the ESP8266 will start up.
So flashing, during bootup, will always be done over the original Txd and Rxd pins.
Last edited by costo on 21 Feb 2016, 14:33, edited 1 time in total.

User avatar
costo
Normal user
Posts: 500
Joined: 21 Nov 2015, 15:03
Location: NL, zw-NB

Re: MiniESPEasy = ESPEasy for modules with limited I/O pins.

#11 Post by costo » 21 Feb 2016, 14:02

asm7100 wrote:How about just using i2c devices like MCP23017 (2x8 I/o) and mcp3428 (4 channels adc 18 Bit) Only 2 pin to use.
Also i2c O_led display and so on.
Using I2C is a smart way to connect multiple devices to a small device like ESP-01.
Also it is possible to use GPIO 0 and GPIO 2 as I2C_SDA and I2C_SCL, so using Serial.swap is not necessary for using I2C on the ESP-01.

The problem is in I2C devices that talk and are in a undefined state after a software reset. The chance that a I2C device holds down GPIO 0 is real, which would cause the ESP8266 to come up again in flash mode after a reboot.
You can only avoid that by also (hardware) resetting all the I2C devices together with the ESP at the same time. (Or remove power).
That is not always possible because many I2C modules do not have a reset pin on the board.
So Serial.swap() is a reliable way to use I2C on a ESP-01. The only drawback is that Serial communication is not possible anymore.

In practice you make heavily use of Serial communication for debugging while developing a application. Developing can best be done on a NodeMCU or a special board. It is unwisely to use a ESP-01 for that.
After you have a stable program you flash your ESP-01 and you usually can omit the Serial stuff

User avatar
costo
Normal user
Posts: 500
Joined: 21 Nov 2015, 15:03
Location: NL, zw-NB

Re: MiniESPEasy = ESPEasy for modules with limited I/O pins.

#12 Post by costo » 22 Feb 2016, 16:46

Late last night when I looked in github, after the release of stable R78 I had not done that for some time, I found R80 the latest beta version. (Just had overlooked R79)
To my joy I found a some nice new features.

Included the long desired feature of I2C on GPIO 1&3 was included, so that makes my fork MiniESPEasy almost superfluous.
I still use it on a ESP-01 to control a relais directly with a transistor on GPIO-1 because there is no other simple way to do this.

But as soon as GPIO 1&3 can be selected in the Hardware tab as normal I/O, I will close this topic :D

asm7100
Normal user
Posts: 96
Joined: 13 Sep 2015, 21:45
Location: Denmark

Re: MiniESPEasy = ESPEasy for modules with limited I/O pins.

#13 Post by asm7100 » 22 Feb 2016, 21:40

5xESP-01 - 3xESP-12 - 2xESP-12E 3xRPIb+ - 1xBPIm1 - 3xACTi DOME - 7xACTi Indoor cam. Lot off cisco equ.

tozett
Normal user
Posts: 734
Joined: 22 Dec 2015, 15:46
Location: Germany

Re: MiniESPEasy = ESPEasy for modules with limited I/O pins.

#14 Post by tozett » 22 Feb 2016, 21:52

Hey, cool link, ;)
i had it a page before in this thread, here:
http://www.esp8266.nu/forum/viewtopic.p ... =784#p4367
:mrgreen:

Deennoo
Normal user
Posts: 158
Joined: 07 Sep 2015, 13:03

Re: [Retired] MiniESPEasy = ESPEasy for modules with limited I/O pins.

#15 Post by Deennoo » 21 Mar 2016, 18:37

Got it to works fine on a Sonoff just facing an issue :

I use the switch "normal" input on GPIO 1.

If gpio 1 isn't to gnd it boot, if gpio1 is to gnd it doesn't, what can i do ?

edit : solve GPIO1 can't be set to gnd for a boot. But GPIO3 can be

below my setting :
Capture.JPG
Capture.JPG (41.97 KiB) Viewed 14092 times

User avatar
costo
Normal user
Posts: 500
Joined: 21 Nov 2015, 15:03
Location: NL, zw-NB

Re: [Retired] MiniESPEasy = ESPEasy for modules with limited I/O pins.

#16 Post by costo » 22 Mar 2016, 00:28

The reason ESP can not boot normal when GPIO-1 is on ground is unknown to me. I found this behaviour is typical for a ESP independant of the flashed software.

During bootup GPIO1 is connected to the UART and configured as output TX1 and always sends some cryptic data like:
tail 0, chksum0x42, csum 0x42. before it executes any code from flash memory.

Directly connecing a GPIO_pin to ground or to Vcc is not advicable. Better always use serie resistors. That will prevent that excessive current can flow when accidentally or (like in this case) during bootup a pin is configured as output.

Deennoo
Normal user
Posts: 158
Joined: 07 Sep 2015, 13:03

Re: [Retired] MiniESPEasy = ESPEasy for modules with limited I/O pins.

#17 Post by Deennoo » 22 Mar 2016, 09:12

ok thx ;-)

Post Reply

Who is online

Users browsing this forum: No registered users and 17 guests