Close

'STEPPER POSITIONING ROUTINE'

A project log for 'Thor' robot with addons and GUI

Thor robot based on the author AngelLM

dannyvandenheuveldannyvandenheuvel 12/30/2016 at 16:535 Comments

Worked hard on the stepper positioning routines, used freeRTOS for multitasking so that all steppers can work at the same time! access time 1ms! for all steppers. Arduino due has a lot of power against arduino mega. running on 80mhz. This video clip gives a brief overview of what I maked so far. I have a long way to go, every week a step forwards :)
Go to my page at https://hackaday.io/project/16665-thor-robot-with-addons-and-gui to follow me. 'Like me' if you Like it!

Now it's working with 4 motors, very stable! before continue the next step I gone integrate wifi to connect with a gamepad to move all steppers with the analog sticks and buttons. I am very happy with the result at the moment.

Discussions

Olaf Baeyens wrote 12/30/2016 at 18:31 point

Just a question: is it possible to use hardware counters to perform the steps so your software is free to do other things?

  Are you sure? yes | no

dannyvandenheuvel wrote 12/30/2016 at 18:44 point

What you mean? Encoders to give feedback of the position? I started from the standard library Basicstepper and made some function to get a real positioning system. Every millisecond I can move 1 degree of the motor. The positioning module looks at the asked position and runs to it. So I can jog with a joystick to add or degrease the position, the stepper will follow at a given speed. For now I don't have feedback from my stepper motors, but so long there is no obstruction It will be correct. By adding FreeRTOS I have the possibility to run multiple tasks at the same time, I tried it with 3 motors for the moment and it is working well, no lags when moving and stopping motors.
Look at FreeRTOS, you will see there are a lot of possiblities to work and start tasks, even with interrupts. Every task can have it's own cycli time.

  Are you sure? yes | no

dannyvandenheuvel wrote 12/30/2016 at 18:52 point

Something you must know, I searched for it 3 days. When using serial 1 or 2 for a display or something else and your usb programming port is connected and serial monitor debugging is on the run you will notice a lot of garbage in the serial monitor screen, also serial 1 and 2 is not functioning very well. I searched for it a long while and nothing usefull was found. Until a moment I was looking at my board and saw there are jumpers at the usb place called USBP and USB, if you remove jumper USBP everything works fantastic! I was so happy, the only thing what happen, you will have to power supply the board with your supply because the usb will not feed the board anymore, but no problem for me! Just to let you know and will be running in the same issue :)

  Are you sure? yes | no

Olaf Baeyens wrote 12/30/2016 at 20:21 point

I was thinking about Timers/Counters that are on the Atmel Chip. If they can be used to generate stepper pulse signals. 

I am looking into FreeRTOS now. 

Thanks for the heads-up of the USB settings :-)

  Are you sure? yes | no

Olaf Baeyens wrote 12/30/2016 at 18:23 point

This is suprisingly fast!

  Are you sure? yes | no