misan / dcservo

Position control of DC motors
315 stars 114 forks source link

two motors one nano #37

Open pppalain opened 7 years ago

pppalain commented 7 years ago

I plan to undertake a two motor / encoder version of the software. Let me know if there are technical issues or if someone tried and failed.

I intend to use the pin change interrupts and the https://github.com/GreyGnome/EnableInterrupt library.

ithinkido commented 4 years ago

Thanks, I had not seen that. One more question please, one of the encoders has been commented out here https://github.com/paukstelis/dcservo/blob/e0c44d8f1fdccdd1aaf51a02abd32566ae486bc2/dcservostm32/dcservostm32.ino#L66 Is that for a particular reason?

paukstelis commented 4 years ago

Thanks, I had not seen that. One more question please, one of the encoders has been commented out here https://github.com/paukstelis/dcservo/blob/e0c44d8f1fdccdd1aaf51a02abd32566ae486bc2/dcservostm32/dcservostm32.ino#L66 Is that for a particular reason?

Because I am not very smart! I poorly selected my pin/timer combinations when designing my PCB, so the motor driver PWM ended up on the same timer channel as my Y encoder. You can't have them both.

ithinkido commented 4 years ago

Which pins would you recommend to use?

paukstelis commented 4 years ago

Honestly, it has been a long time since I worked on that project, but you could put motor driver pwms on timer 2 (PA0, etc.).

ithinkido commented 4 years ago

Perfect, thanks for all your help

happytm commented 4 years ago

@ithinkido I am curiously following your conversation. If you find good pin out solution for STM please keep us posted here.

Thanks.

happytm commented 3 years ago

@ithinkido @paukstelis Can either of you publish diagram (hand drawn OK too) like on main page of this repo with bluepill.

How many motors are controllable with one blupill device using motors with optical encoders ?

Thanks.

paukstelis commented 3 years ago

You can have 3 I believe. Timers 1, 3, and 4. This assumes an open collector type (2 outputs/encoder). You can find the little library here that describes the pins: https://github.com/chrisalbertson/quadratureBluePill Wiring depends on your encoder. Just keep in mind if you want to use PWMs for anything else those must then be on Timer 2. Also, Timer 3 is not 5V-tolerant.

misan commented 3 years ago

@paukstelis That is brilliant, three motors controlled by a single bluepill. IIRC, timer 2 could create up to four PWM signals.

However, the use of Timer1 means USB port cannot be used for comms, leaving only left USART3 for that purpose.

happytm commented 3 years ago

Thanks @paukstelis .

paukstelis commented 3 years ago

However, the use of Timer1 means USB port cannot be used for comms, leaving only left USART3 for that purpose.

Hmm...I need to check that, because I just set up a project that has an encoder on Timer 1 and I have been communicated with USB. I haven't noticed any issues at all.

misan commented 3 years ago

@paukstelis I gathered that insight from STM32CubeMX app for STM32F103C8 chip. image

misan commented 3 years ago

But now that you mention it, I dug a bit deeper and it seems the conflict is only for channel4, which is not needed for TIM1 when used as an Encoder. image

happytm commented 2 years ago

@misan if @paukstelis do not have problem can you upload his sketch (3 motors to on a single Bluepill) ? That way people can find it easily when they visit your repo.

Thanks.

misan commented 2 years ago

@happytm Sure, I can link his project from my README.

happytm commented 2 years ago

Thanks.

misan commented 2 years ago

it's done

On Fri, Nov 26, 2021 at 8:49 AM happytm @.***> wrote:

Thanks.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/misan/dcservo/issues/37#issuecomment-979759466, or unsubscribe https://github.com/notifications/unsubscribe-auth/AADRZSGHGH5SUEXOACMMDATUN43YTANCNFSM4EE2F2SQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.