Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 4829

Automation, sensing and robotics • Re: Raspberry Zero 2W serial communication to ESP8266

$
0
0
Okay, I've got an ESP8266 module (an Adafruit HUZZAH ESP8266 breakout) flashed with MicroPython 1.23.0. Its quite hard to brick these, but ESP8266 can be hard to flash. The Deploying the firmware tutorial linked from the ESP8266 firmware download page was what I followed to get MicroPython working.

On my Raspberry Pi Zero 2W, i enabled serial using sudo raspi-config → 3 Interface Options → I6 Serial Port: Login Shell accessible over serial port? no Would you like the serial port hardware to be enabled? yes. I then rebooted to make sure the changes were set.

ESP8266 modules can draw quite a lot of current, maybe too much for the Raspberry Pi's 3v3 lines. The Adafruit module I have accepts 5 V power, so I'm powering it from the Raspberry Pi's Zero 2W's 5 V pin. The connections are (left: Raspberry Pi; right: ESP8266):
  • 5V → V+
  • GND → GND
  • 14 (TX0) → RX
  • 15 (RX0) → TX
Note that RX and TX are swapped.

I connect to the ESP8266 module using mpremote. This is best installed via pipx (which can be installed from the repos: sudo apt install pipx).

I connect to the board like this: mpremote connect /dev/ttyS0, and after hitting return and/or Ctrl-D, I get this output:

Code:

Connected to MicroPython at /dev/ttyS0Use Ctrl-] or Ctrl-x to exit this shell>>> MPY: soft rebootMicroPython v1.23.0 on 2024-06-02; ESP module with ESP8266Type "help()" for more information.>>> 
You can exit mpremote using Ctrl-X

mpremote allows you to upload and edit MicroPython scripts, run them, modify them and download the data. You can also install MicroPython packages with it too.

Hope this helps.

Statistics: Posted by scruss — Wed Oct 23, 2024 1:53 am



Viewing all articles
Browse latest Browse all 4829

Trending Articles