PCA9865 16 servo controller board using I2C.
-
- Posts: 847
- Joined: Mon Nov 20, 2017 10:18 am
Re: PCA9865 16 servo controller board using I2C.
@deshipu I don't own the ideas I just have them from time to time. I think it is fine for you to use anyone's idea that they share publicly.
I am at a loss why python would use radians as standards units for trig functions and not degree in the first place.
I am at a loss why python would use radians as standards units for trig functions and not degree in the first place.
Re: PCA9865 16 servo controller board using I2C.
Radians are the only units that make sense from the mathematical point of view. In fact, the definitions of trigonometric functions are such.
- pythoncoder
- Posts: 5956
- Joined: Fri Jul 18, 2014 8:01 am
- Location: UK
- Contact:
Re: PCA9865 16 servo controller board using I2C.
Indeed, radians are exclusively used in science and engineering. Conversion is trivial using math.degrees(value_in_radians) and math.radians(value_in_degrees).
Peter Hinch
Index to my micropython libraries.
Index to my micropython libraries.
-
- Posts: 847
- Joined: Mon Nov 20, 2017 10:18 am
Re: PCA9865 16 servo controller board using I2C.
I suppose I am showing my lack of education as before building this robot I had never heard of radians and neither has spell checker as it is highlighting then as wrong spelling.
Although it is a very easy code math.radians(value_in_degrees) to convert to radians it is another floating point maths to compute. This robot has 12 DOF (some of robots many more DOF) meaning lots of calculations to complete for 3D movement and to get smooth movement with speed control it involves moving each foot a mm at a time. i.e if moving a leg to a new position involves 1 servo moving 100 dregrees and another servo moving 10 degrees you can't do it in one calculated move because the 10 degrees servo will get to the new postion too quickly for the 100 degrees servo, instead you need lots of little steps so 1 servo moves 1 degree and the other moves 10 degrees.
ATM all the drivers calculate the duty from dregrees and just convert radians to degrees. I may rewrite my driver to calculate the duty from radians to reduce the extra conversion.
Although it is a very easy code math.radians(value_in_degrees) to convert to radians it is another floating point maths to compute. This robot has 12 DOF (some of robots many more DOF) meaning lots of calculations to complete for 3D movement and to get smooth movement with speed control it involves moving each foot a mm at a time. i.e if moving a leg to a new position involves 1 servo moving 100 dregrees and another servo moving 10 degrees you can't do it in one calculated move because the 10 degrees servo will get to the new postion too quickly for the 100 degrees servo, instead you need lots of little steps so 1 servo moves 1 degree and the other moves 10 degrees.
ATM all the drivers calculate the duty from dregrees and just convert radians to degrees. I may rewrite my driver to calculate the duty from radians to reduce the extra conversion.
Re: PCA9865 16 servo controller board using I2C.
Hello,
I got also an idea to use the PCA9865 shield with a ESP8266 to make a uPython Version of oTTo DIY.
Since I don't have a 3D printer or a Laser Cutter I used cardboard and tape (so it look very crappy - sorry for that).
While the libraries from adafruit are pretty helpful, I struggled to make my two robot legs move more than up an down.
At oTTo DIY GitHub repository are some Ardurino codes, but I am not able to understand them good enough to turn them into uPython code (at which I am as well only a beginner). Especially the oscilloscope stuff is fare above my understanding.
Thank you in advance for any advises.
[And yes I used degrees instead of radians.]
I got also an idea to use the PCA9865 shield with a ESP8266 to make a uPython Version of oTTo DIY.
Since I don't have a 3D printer or a Laser Cutter I used cardboard and tape (so it look very crappy - sorry for that).
While the libraries from adafruit are pretty helpful, I struggled to make my two robot legs move more than up an down.
Code: Select all
import machine
i2c = machine.I2C(scl=machine.Pin(5), sda=machine.Pin(4))
import servo
import time
s = servo.Servos(i2c)
class Move:
def Jump(self):
s.position(0, 30)
s.position(1, 150)
s.position(2, 90)
s.position(3, 90)
time.sleep(.4)
s.position(0, 90)
s.position(1, 90)
s.position(2, 90)
s.position(3, 90)
time.sleep(.4)
def Stop(self):
s.position(0, 90)
s.position(1, 90)
s.position(2, 90)
s.position(3, 90)
#########################
move=Move()
move.Jump()
Thank you in advance for any advises.
[And yes I used degrees instead of radians.]
- Attachments
-
- photo_2018-03-09_14-21-50.jpg (107.67 KiB) Viewed 38022 times
-
- photo_2018-03-09_14-21-54.jpg (104.19 KiB) Viewed 38022 times
-
- Posts: 847
- Joined: Mon Nov 20, 2017 10:18 am
Re: PCA9865 16 servo controller board using I2C.
Nice project
I make my kids build their projects out of card board first and if they can make therm work but discovering all their mistakes then I let them laser cut them. I get them to print out their designs on paper then stick the printer paper on card board and cut it out.
I clicked on the repository and there is quite a bit of code there. I would assume it has built up over time. It will also take you a fair bit of time to build up your MP code to do the same.
U have a couple of options: 1. try to port across the Arduino code. 2. write your own code by watching the videos to understand the needed behaviors and use the Ardunio code to give you ideas.
I personally like to do the second option, see something someone else created and use it to inspire me to make my own creation.
I do have it on my list to build a humanoid robot but am very busy with other projects ATM so it is likely to be a little while before I get to it. I say the otto and I also saw this https://www.youtube.com/watch?v=0R4U8iCmMJI and planned to make something somewhere between the 2.
I make my kids build their projects out of card board first and if they can make therm work but discovering all their mistakes then I let them laser cut them. I get them to print out their designs on paper then stick the printer paper on card board and cut it out.
I clicked on the repository and there is quite a bit of code there. I would assume it has built up over time. It will also take you a fair bit of time to build up your MP code to do the same.
U have a couple of options: 1. try to port across the Arduino code. 2. write your own code by watching the videos to understand the needed behaviors and use the Ardunio code to give you ideas.
I personally like to do the second option, see something someone else created and use it to inspire me to make my own creation.
I do have it on my list to build a humanoid robot but am very busy with other projects ATM so it is likely to be a little while before I get to it. I say the otto and I also saw this https://www.youtube.com/watch?v=0R4U8iCmMJI and planned to make something somewhere between the 2.
-
- Posts: 847
- Joined: Mon Nov 20, 2017 10:18 am
Re: PCA9865 16 servo controller board using I2C.
Today I sat down and wrote a very light weight and fast PCA9865 driver for Laboris port for my robot purposes. It uses 1Mhz I2C bus speed and also all servo positions and calculations are based upon radians so to be easy and fast(less floating point math) to integrate with Python trigonometry functions. All servo updates are staggered so that multiple servo current spikes don't happen simultaneously.
All feed back especially anything wrong or improvements welcome.
https://github.com/OutOfTheBots/ESP32_PCA9685
All feed back especially anything wrong or improvements welcome.
https://github.com/OutOfTheBots/ESP32_PCA9685
Re: PCA9865 16 servo controller board using I2C.
I just registered to the forum just to thank you for this library, it is all packed in just one file and I couldn't find libraries for PCA9865 anywhere else other than this topic.gcarver wrote: ↑Thu Mar 01, 2018 3:17 pmNothing, other than not knowing it existed. When I wrote this nothing popped up in google searches.deshipu wrote: ↑Thu Mar 01, 2018 1:34 pmWhat's wrong with https://github.com/adafruit/micropython ... it-pca9685 ?
Also I'd like to report the fact the board bootloops if started with PCA9865 VCC's plugged to the same source of ESP32 giving rst:0x1 (POWERON_RESET),boot:0x33 (SPI_FAST_FLASH_BOOT) but connecting it after the board started gives no problems
I'm working on it and other than that everything works perfect, thanks!
Re: PCA9865 16 servo controller board using I2C.
@ OutoftheBots: I am looking for an easy to use driver for ESP32 and PCA9685 and found this thread. When I run your demo, I always get this error message in the last line of the code: "name 'robot' isn't defined". What I am doing wrong?
And, is it possible to use Adafruit-drivers on non-Adafruit modules? Their files end up with 'mpy' instead on 'py'.
And, is it possible to use Adafruit-drivers on non-Adafruit modules? Their files end up with 'mpy' instead on 'py'.