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
Getting started with ESP-12S
Getting started with ESP-12S
Frédéric
Re: Getting started with ESP-12S
Hi fma,
Unfortunately I don't have the best news for you if you're planning on using an ESP8266...
That said, I don't understand your math; how did you arrive at 75 positions?
Hope that helps,
Matt
Looks like a neat project!
Unfortunately I don't have the best news for you if you're planning on using an ESP8266...
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?
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- 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 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
Re: Getting started with ESP-12S
Hi Matt,
Thanks for you answer!
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).
Is it a hardware issue?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).
Got it.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...
Thanks for you answer!
Frédéric