Recently stumbled across an interesting open source project ESP-Link. Its main purpose is to network-enable a non-network microcontroller (MCU) such as Arduino Uno, Pro mini or Nano using ESP8266. The author termed it as "Transparent Bridge". The ESP and MCU communicate via the serial link and there is a companion Arduino library EL-Client for the MCU to connect up the network using MQTT, REST, TCP and UDP.
Setup
I have put together an ESP-01 and an Arduino Pro Mini for this experiment. I have chosen a 3.3 version Pro mini so that I do not need to do any voltage level shifting between the I/O pins. In order to have a stable voltage source, the ESP8266 is powered by Pro Mini and the Pro Mini "RAW" pin is connected to a 5v USB power source. The RAW pin can take voltage up to 12V. The reset pin of Pro Mini is connected to GPIO 0 of ESP-01. This enables the ESP-01 to reset the Pro Mini.
I have linked up an APDS 9960 sensor to it and periodically send the luminosity and RGB colour level to an MQTT server. APDS 9960 is a very interesting sensor, it is a luminosity, colour, proximity and gesture sensor (All in one). The source code can be downloaded from GitHub.
Flashing the ESP
The flashing parameters for ESP-01 are:
esptool --port com26 --baud 230400 write_flash -fm qio -fs detect -ff 40m
0x0 boot_v1.6.bin 0x1000 user1.bin 0xfc000 esp_init_data_default.bin 0xfe000 blank.bin
After successful flashing the ESP, it will start up as AP mode. I need to join the computer to 192.168.4.1 to configure the ESP to join to my home network.OTA
There are many methods of OTA mentioned in the documentation. The one I am using is avr-link which can upload the Arduino compiled sketch to the MCU. To do this, compile the Arduino sketch as normal and upload the .hex file using avr-link. In the Arduino output directory, there are 2 .hex files, "samplesketch.ino.with_bootloader.hex" and "samplesketch.ino.hex", upload the file without the bootloader.
e.g avr-link flash --esp 192.168.0.50 --file samplesketch.ino.hex -v
Wrapped up Thoughts
This is an interesting concept from a technical standpoint but there are many competing solutions such as ESP32 family that can do more on a single board and lower cost. On the other hand, if you have invested in many of the Arduino shields, this is a viable alternative to network enables the existing microcontrollers.Update: I have another setup using the integrated ESP8266 and Mega2560 board using the similar setup without messy wiring between ESP8266 and the microcontroller.
Update: I have created a touch control panel to control my smart home using this board and ESP-Link.
I have tried doing something similiar, but i am having big problems...
ReplyDeleteinstead of having the VCC(of arduino) connected to the VCC and CHPD of the ESP-01, I have a MCP1700 LDO voltage regulator to feed the ESP-01 because the power consumption of the ESP-01 could be to big for the arduinos VREG. My idea was to use a a BJT or MOSFET(or another VREG with enable pin) to be able to cut of the of the power to the ESP-01 completely because my power supply is a 18650 cell.
But I am having trouble getting stable voltage after the MCP1700 may times it drops below 3v and that means the ESP-01 does not boot up.
Did you not have any problem with supplying enough power to the ESP-01?
When i do get the power to work, I have trouble sync:ing with ESP-01, did you not have of those problems.
my goal is to have the Arduino mostly sleeping and on wake up, somehow get the ESP-01 to start either thru completely controlling the power or by at least be able to use the CHPD and RST pins on the ESP-01 to lower the power consumption.
From some forum discussions, the ESP8266 peak consumption is 320mA at bootup. You may want to see if the LDO can supply this current requirement.
Delete