misan / dcservo

Position control of DC motors
312 stars 113 forks source link

2 pin IR phototransiator in place of 3 pin Receivers with ATTiny85 #81

Open alifilhan0 opened 2 years ago

alifilhan0 commented 2 years ago

Hello, sorry to disturb. I just want to see the possiblities with the ATTiny85, that is how low I can go. I am trying to make an encoder with 2 receivers and 2 transistors each, the disk having 4 divisions(2 whites and 2 blacks) and the motor will have gear reduction to make it more accurate. Is it possible to use an IR photo transistor(two pins) with the attiny? The phototransistor's off and on state determines the direction/step of the motor. Is the already given code compatible or not? Actually it is no big deal to get 3 pin receivers, but I have a lot of 2 pin receivers lying around and I am thinking to put them to use.

misan commented 2 years ago

You can do that, but you need to check whether all the code can fit on the ATTiny85. OTOH, if you are not going to use the serial communication you can get rid of a significant amount of code associated with that. However, as calibration is needed I think setting it up might be a bit annoying with ATTiny85. At any rate, please note you'll need to adapt the I/O code to the new pins used in your setup.

alifilhan0 commented 2 years ago

In the present code, the Tiny85 supports 2 receivers right? For step and direction? Or only one? And I don't think I need to change the code significantly because I am just going to connect the emitter pin to the Tiny85's already confihured pins in the code(following the schematics in README.md and in the .ino file) and the gnd pins to gnd(as the phototransistor has only two pins). And before I set the PID values so that it doesn't get annoying to program the chip again and again, I will test it with my arduino uno. Is my approach correct?

misan commented 2 years ago

Yes, it uses 2 control inputs (step and direction) plus two inputs for the AB encoder. If you calibrate the PID using an Arduino and then use the values for the ATTiny85 it will be much more convenient.

On Sat, Nov 13, 2021 at 9:56 AM alifilhan0 @.***> wrote:

In the present code, the Tiny85 supports 2 receivers right? For step and direction? Or only one? And I don't think I need to change the code significantly because I am just going to connect the emitter pin to the Tiny85's already confihured pins in the code(following the schematics in README.md and in the .ino file) and the gnd pins to gnd(as the phototransistor has only two pins). And before I set the PID values so that it doesn't get annoying to program the chip again and again, I will test it with my arduino uno. Is my approach correct?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/misan/dcservo/issues/81#issuecomment-967857684, or unsubscribe https://github.com/notifications/unsubscribe-auth/AADRZSBPV52D27NONRDUIDTULYRZXANCNFSM5H6JCYDA . 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.