Getting started with ESP-12S

All ESP8266 boards running MicroPython.
Official boards are the Adafruit Huzzah and Feather boards.
Target audience: MicroPython users with an ESP8266 board.
Post Reply
fma
Posts: 164
Joined: Wed Jan 01, 2014 5:38 pm
Location: France

Getting started with ESP-12S

Post by fma » Mon Mar 25, 2019 8:23 am

Hi!

I will soon drive my 24DoF hexapod using my Python framework¹ on a RPi, with a custom shield using 2 PCA9685; all movements (synchronized) are done in Python.

But I would like to test another solution : having a node per leg, to drive the 4 servos, and also read some inputs to detect the ground. As I would like to use Python here too, the idea is to deploy micropython on ESP-12S. But before I start, I have a few questions:

- is the duty() method of PWM class takes an integer or a float? In the first case, I could only have 115-40=75 positions for 180°C, which is not enough;

- I plan to communicate between the RPi and the ESPs through I²C. But I read on Adafruit site that I²c on ESP8266 can only be master, not slave (https://learn.adafruit.com/micropython- ... /i2c-slave); is it true? I can't find the information on micropython doc...

- on ESP-12S doc, I can see a table showing GPIO0, 2 and 15 setting modes (UART or FLASH_BOOT); does it mean that it is not possible to use these pins for other usages?

Thanks for your help.

Best,

¹ http://www.py4bot.org
Frédéric

User avatar
mattyt
Posts: 410
Joined: Mon Jan 23, 2017 6:39 am

Re: Getting started with ESP-12S

Post by mattyt » Mon Mar 25, 2019 11:33 am

Hi fma,
fma wrote:
Mon Mar 25, 2019 8:23 am
I will soon drive my 24DoF hexapod using my Python framework¹ on a RPi, with a custom shield using 2 PCA9685; all movements (synchronized) are done in Python.
Looks like a neat project!

Unfortunately I don't have the best news for you if you're planning on using an ESP8266...
fma wrote:
Mon Mar 25, 2019 8:23 am
- is the duty() method of PWM class takes an integer or a float? In the first case, I could only have 115-40=75 positions for 180°C, which is not enough;
Integer. The PWM capabilities of the ESP8266 are quite weak; a maximum base frequency of 1KHz and 10bits of duty (ie 1024 levels).

That said, I don't understand your math; how did you arrive at 75 positions?
fma wrote:
Mon Mar 25, 2019 8:23 am
- I plan to communicate between the RPi and the ESPs through I²C. But I read on Adafruit site that I²c on ESP8266 can only be master, not slave (https://learn.adafruit.com/micropython- ... /i2c-slave); is it true? I can't find the information on micropython doc...
True. The ESP8266 can currently only act as an I2C master. In fact, to the best of my knowledge, the only MicroPython port that can act as an I2C slave is the PyBoard. Though it ought to be relatively easy to extend the ESP32 port to do so (especially since the Loboris fork has shown us how).
fma wrote:
Mon Mar 25, 2019 8:23 am
- on ESP-12S doc, I can see a table showing GPIO0, 2 and 15 setting modes (UART or FLASH_BOOT); does it mean that it is not possible to use these pins for other usages?
On the ESP8266 those pins (and pin 0) are bootstrap pins. Their state at boot determines certain behaviour of the chip; whether it boots from flash, SD card or is in program mode. After the bootloader is complete they can be used as regular pins but this is usually inconvenient since it's common to pull them up or down to set the right bootstrap configuration. You can find ways to work around that limitation but it sounds like a more powerful micro might be an easier path to take...

Hope that helps,
Matt

fma
Posts: 164
Joined: Wed Jan 01, 2014 5:38 pm
Location: France

Re: Getting started with ESP-12S

Post by fma » Mon Mar 25, 2019 1:17 pm

Hi Matt,
mattyt wrote:
Mon Mar 25, 2019 11:33 am
Integer. The PWM capabilities of the ESP8266 are quite weak; a maximum base frequency of 1KHz and 10bits of duty (ie 1024 levels).

That said, I don't understand your math; how did you arrive at 75 positions?
For servos, you have to set the period to 50Hz. So, max value, 1023, is 20ms. As the pulse must be between ~1000µs and ~2000µs, it means values between ~50 and ~100 (doc says 40 to 115: https://docs.micropython.org/en/latest/ ... obby-servo).
True. The ESP8266 can currently only act as an I2C master. In fact, to the best of my knowledge, the only MicroPython port that can act as an I2C slave is the PyBoard. Though it ought to be relatively easy to extend the ESP32 port to do so (especially since the Loboris fork has shown us how).
Is it a hardware issue?
On the ESP8266 those pins (and pin 0) are bootstrap pins. Their state at boot determines certain behaviour of the chip; whether it boots from flash, SD card or is in program mode. After the bootloader is complete they can be used as regular pins but this is usually inconvenient since it's common to pull them up or down to set the right bootstrap configuration. You can find ways to work around that limitation but it sounds like a more powerful micro might be an easier path to take...
Got it.

Thanks for you answer!
Frédéric

Post Reply