misan / dcservo

Position control of DC motors
315 stars 114 forks source link

nodemcu motordriver shield #51

Open PierreAuge opened 6 years ago

PierreAuge commented 6 years ago

Miguel,

I've got a few of these laying around (nodemcu v1 motor shield) they are a couple dollars and sport an l293dd full bridge driver with two 1.2amp peak DC output lines.

I've been wanting to implement your dcservo driver library on this thing for a bit to see how it would drive two little dcservos.

I'd like your help, I'm not much of a coder, but I'd be happy to send you a nodemcu with a shield for you to play with if you help me out.

Thanks Pierre

PierreAuge commented 6 years ago

The difficulty I'm having is conceptually implementing the two pid loops.

misan commented 6 years ago

Do you mean ypu want to control two motors with a single nodemcu?

El dom., 5 ago. 2018 22:26, PierreAuge notifications@github.com escribió:

The difficulty I'm having is conceptually implementing the two pid loops.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/misan/dcservo/issues/51#issuecomment-410545615, or mute the thread https://github.com/notifications/unsubscribe-auth/AAccyKI_-xa3VeEBKJhtlcOJcKSahlS0ks5uN1TygaJpZM4VvhRv .

PierreAuge commented 6 years ago

That's the concept, thoughts? I've mostly been playing with large h-bridges like the ibt-2 to drive big brushed motors so this is new to me.

PierreAuge commented 6 years ago

I'd like to maximize the use of the board if that makes sense.

misan commented 6 years ago

The L293 is a weak dual h-bridge that is ok for small motors (<1A). First thing is to adapt the pwmOut function to the new h-bridge (in fact you'll want to have two of them, one acting upon each motor).

Next, you'll need to have two PID objects instead of one, with a duplicated set of variables (setpoint, output, etc).

Finally, you'll need to handle the second encoder too, so two new input pins for the two encoder signals and a new interrupt for counting their pulses. And if you are using external step/dir pins for motor control then you'll need to add two additional pins. Otherwise, you will need to add a new set of commands on the serial port for setting up the new PID parameters plus new instructions for causing motion on the second motor.

PierreAuge commented 6 years ago
                                                                                  Miguel,Thanks, yes the idea is to use it with very small motors in a robotics application so the l293dd should work as expected. I'm already using it, so the closed loop control is really all I'm looking for.‎I appreciate the feedback. I'm pretty sure I can work from there, I'll plot out the workflow and try putting something together. Thank you,Pierre                                                                                                                                                                                                                                                                                                                                        Sent from my BlackBerry 10 smartphone on the Rogers network.                                                                                                                                                                                                                From: Miguel SanchezSent: Monday, August 6, 2018 3:28 AMTo: misan/dcservoReply To: misan/dcservoCc: PierreAuge; AuthorSubject: Re: [misan/dcservo] nodemcu motordriver shield (#51)The L293 is a weak dual h-bridge that is ok for small motors (<1A).

First thing is to adapt the pwmOut function to the new h-bridge (in fact you'll want to have two of them, one acting upon each motor). Next, you'll need to have two PID objects instead of one, with a duplicated set of variables (setpoint, output, etc). Finally, you'll need to handle the second encoder too, so two new input pins for the two encoder signals and a new interrupt for counting their pulses. And if you are using external step/dir pins for motor control then you'll need to add two additional pins. Otherwise, you will need to add a new set of commands on the serial port for setting up the new PID parameters plus new instructions for causing motion on the second motor.

—You are receiving this because you authored the thread.Reply to this email directly, view it on GitHub, or mute the thread. {"api_version":"1.0","publisher":{"api_key":"05dde50f1d1a384dd78767c55493e4bb","name":"GitHub"},"entity":{"external_key":"github/misan/dcservo","title":"misan/dcservo","subtitle":"GitHub repository","main_image_url":"https://assets-cdn.github.com/images/email/message_cards/header.png","avatar_image_url":"https://assets-cdn.github.com/images/email/message_cards/avatar.png","action":{"name":"Open in GitHub","url":"https://github.com/misan/dcservo"}},"updates":{"snippets":[{"icon":"PERSON","message":"@misan in #51: The L293 is a weak dual h-bridge that is ok for small motors (\u003c1A). \r\nFirst thing is to adapt the pwmOut function to the new h-bridge (in fact you'll want to have two of them, one acting upon each motor). \r\n\r\nNext, you'll need to have two PID objects instead of one, with a duplicated set of variables (setpoint, output, etc).\r\n\r\nFinally, you'll need to handle the second encoder too, so two new input pins for the two encoder signals and a new interrupt for counting their pulses. And if you are using external step/dir pins for motor control then you'll need to add two additional pins. Otherwise, you will need to add a new set of commands on the serial port for setting up the new PID parameters plus new instructions for causing motion on the second motor.\r\n"}],"action":{"name":"View Issue","url":"https://github.com/misan/dcservo/issues/51#issuecomment-410614062"}}} [ { "@context": "http://schema.org", "@type": "EmailMessage", "potentialAction": { "@type": "ViewAction", "target": "https://github.com/misan/dcservo/issues/51#issuecomment-410614062", "url": "https://github.com/misan/dcservo/issues/51#issuecomment-410614062", "name": "View Issue" }, "description": "View this Issue on GitHub", "publisher": { "@type": "Organization", "name": "GitHub", "url": "https://github.com" } }, { "@type": "MessageCard", "@context": "http://schema.org/extensions", "hideOriginalBody": "false", "originator": "AF6C5A86-E920-430C-9C59-A73278B5EFEB", "title": "Re: [misan/dcservo] nodemcu motordriver shield (#51)", "sections": [ { "text": "", "activityTitle": "Miguel Sanchez", "activityImage": "https://assets-cdn.github.com/images/email/message_cards/avatar.png", "activitySubtitle": "@misan", "facts": [

] } ], "potentialAction": [ { "name": "Add a comment", "@type": "ActionCard", "inputs": [ { "isMultiLine": true, "@type": "TextInput", "id": "IssueComment", "isRequired": false } ], "actions": [ { "name": "Comment", "@type": "HttpPOST", "target": "https://api.github.com", "body": "{\n\"commandName\": \"IssueComment\",\n\"repositoryFullName\": \"misan/dcservo\",\n\"issueId\": 51,\n\"IssueComment\": \"{{IssueComment.value}}\"\n}" } ] }, { "name": "Close issue", "@type": "HttpPOST", "target": "https://api.github.com", "body": "{\n\"commandName\": \"IssueClose\",\n\"repositoryFullName\": \"misan/dcservo\",\n\"issueId\": 51\n}" }, { "targets": [ { "os": "default", "uri": "https://github.com/misan/dcservo/issues/51#issuecomment-410614062" } ], "@type": "OpenUri", "name": "View on GitHub" }, { "name": "Unsubscribe", "@type": "HttpPOST", "target": "https://api.github.com", "body": "{\n\"commandName\": \"MuteNotification\",\n\"threadId\": 364778607\n}" } ], "themeColor": "26292E" } ]

Kadah commented 6 years ago

The L293 is quite outdated, I'd got for a more modern high efficiency driver instead.

I've been using the DRV8833 recently on other projects and I quite like it. Its dual channel full H-bridge, 1.2A per channel with settable current limiting, but it is limited to 2.7V-10.8V. Adafruit has a $5 breakout for it, plus one for the higher power and voltage single channel DRV8871.

PierreAuge commented 6 years ago
                                                                                  It's just an exercise in building an affordable servo driver with parts I already have. The nodemcu shields, I've been using as a STEM tool to engage my kids. So far so good. It's good exercise for myself as well.Thanks                                                                                                                                                                                                                                                                                                                                        Sent from my BlackBerry 10 smartphone on the Rogers network.                                                                                                                                                                                                                From: KadahSent: Monday, August 6, 2018 5:45 PMTo: misan/dcservoReply To: misan/dcservoCc: PierreAuge; AuthorSubject: Re: [misan/dcservo] nodemcu motordriver shield (#51)The L293 is quite outdated, I'd got for a more modern high efficiency driver instead.

I've been using the DRV8833 recently on other projects and I quite like it. Its dual channel full H-bridge, 1.2A per channel with settable current limiting, but it is limited to 2.7V-10.8V. Adafruit has a $5 breakout for it, plus one for the higher power and voltage single channel DRV8871.

—You are receiving this because you authored the thread.Reply to this email directly, view it on GitHub, or mute the thread. {"api_version":"1.0","publisher":{"api_key":"05dde50f1d1a384dd78767c55493e4bb","name":"GitHub"},"entity":{"external_key":"github/misan/dcservo","title":"misan/dcservo","subtitle":"GitHub repository","main_image_url":"https://assets-cdn.github.com/images/email/message_cards/header.png","avatar_image_url":"https://assets-cdn.github.com/images/email/message_cards/avatar.png","action":{"name":"Open in GitHub","url":"https://github.com/misan/dcservo"}},"updates":{"snippets":[{"icon":"PERSON","message":"@Kadah in #51: The L293 is quite outdated, I'd got for a more modern high efficiency driver instead.\r\n\r\nI've been using the DRV8833 recently on other projects and I quite like it. Its dual channel full H-bridge, 1.2A per channel with settable current limiting, but it is limited to 2.7V-10.8V. Adafruit has a $5 breakout for it, plus one for the higher power and voltage single channel DRV8871."}],"action":{"name":"View Issue","url":"https://github.com/misan/dcservo/issues/51#issuecomment-410862772"}}} [ { "@context": "http://schema.org", "@type": "EmailMessage", "potentialAction": { "@type": "ViewAction", "target": "https://github.com/misan/dcservo/issues/51#issuecomment-410862772", "url": "https://github.com/misan/dcservo/issues/51#issuecomment-410862772", "name": "View Issue" }, "description": "View this Issue on GitHub", "publisher": { "@type": "Organization", "name": "GitHub", "url": "https://github.com" } }, { "@type": "MessageCard", "@context": "http://schema.org/extensions", "hideOriginalBody": "false", "originator": "AF6C5A86-E920-430C-9C59-A73278B5EFEB", "title": "Re: [misan/dcservo] nodemcu motordriver shield (#51)", "sections": [ { "text": "", "activityTitle": "Kadah", "activityImage": "https://assets-cdn.github.com/images/email/message_cards/avatar.png", "activitySubtitle": "@Kadah", "facts": [

] } ], "potentialAction": [ { "name": "Add a comment", "@type": "ActionCard", "inputs": [ { "isMultiLine": true, "@type": "TextInput", "id": "IssueComment", "isRequired": false } ], "actions": [ { "name": "Comment", "@type": "HttpPOST", "target": "https://api.github.com", "body": "{\n\"commandName\": \"IssueComment\",\n\"repositoryFullName\": \"misan/dcservo\",\n\"issueId\": 51,\n\"IssueComment\": \"{{IssueComment.value}}\"\n}" } ] }, { "name": "Close issue", "@type": "HttpPOST", "target": "https://api.github.com", "body": "{\n\"commandName\": \"IssueClose\",\n\"repositoryFullName\": \"misan/dcservo\",\n\"issueId\": 51\n}" }, { "targets": [ { "os": "default", "uri": "https://github.com/misan/dcservo/issues/51#issuecomment-410862772" } ], "@type": "OpenUri", "name": "View on GitHub" }, { "name": "Unsubscribe", "@type": "HttpPOST", "target": "https://api.github.com", "body": "{\n\"commandName\": \"MuteNotification\",\n\"threadId\": 364778607\n}" } ], "themeColor": "26292E" } ]