DougWilkinson / balance-robot

balancing robot stepper esp32 mpu6050 A4988
3 stars 0 forks source link

I need help #1

Open w1c1y1 opened 1 year ago

w1c1y1 commented 1 year ago

Hey, I found your github with this program, just now I'm trying to make a 3d printer based on esp 8266 and all this on Nema 17 stepper motors. I would be glad of any help, whether it's an explanation of how your code works or how you connected the motors, I am particularly interested in this question. Thank you very much in advance and sorry for the trouble. My telegram: @SeeThroughDreams Email: akulov.max3003@gmail.com

DougWilkinson commented 1 year ago

Hi, This was based on the esp32 because of the code size and GPIO pins needed. If you only have an esp8266, I don't think you will have enough pins to do this with steppers. The steppers are connected using a standard stepper motor driver (A4988) As for the code, the main "balancing" part is in the balance() function. I had several versions that I was using to get the response I wanted and was never really happy with it. n7.py was one of the last ones I think. The balancing code itself was taken from another project (I'd have to go looking for it) and adapted to micropython. It uses the MPU values to drive a PID loop to keep the robot upright. I had looked at 2 approaches to driving the steppers, one with stepping being done in the loop itself and the other using PWM (and adjusting the frequency to change the speed). The 3d printed design was taken from jjrobots https://www.jjrobots.com/much-more-than-a-self-balancing-robot/ If you have any specific questions about the code or construction, I'd be happy to answer them.