G+_James Hughes Posted April 14, 2017 Share Posted April 14, 2017 I need some help to modify some arduino code. I found a great website that has a sketch to control a stepper motor with two buttons for direction and a potentiometer to adjust the speed. I want to replace the potentiometer with a resistor so that the speed remains constant (and to save a few dollars and keep things a bit smaller). I've googled making this change and haven't had much success. The link has the sketch at the bottom. Thanks in advance. http://tinkbox.ph/learn/tutorial/control-direction-and-speed-stepper-motor-using-arduino Link to comment Share on other sites More sharing options...
G+_James Hughes Posted April 14, 2017 Author Share Posted April 14, 2017 Was watching KH and saw the trimpots and the lights went off. So I bought some trimpots that should be arriving Saturday. Link to comment Share on other sites More sharing options...
G+_Ben Reese Posted April 14, 2017 Share Posted April 14, 2017 I haven't checked out the code yet, but most likely if you remove the pot, you won't need to replace it with a resistor. If you do want to replicate the potentiometer code/circuit, you'll need 2 resistors. Link to comment Share on other sites More sharing options...
G+_James Hughes Posted April 14, 2017 Author Share Posted April 14, 2017 I'm working on wiring it up. One thing that I'm not sure about is the stepper. They show using a bipolar and I'm using a 28BYJ-48. I've found a pinout diagram so I think that it will work. Uploading the code in a few so I'll let you know if I have any success. Link to comment Share on other sites More sharing options...
G+_James Hughes Posted April 14, 2017 Author Share Posted April 14, 2017 I must have something wired incorrectly on the L293D. I'll have to check in the morning. It appears to upload and I'm getting feedback on the serial monitor from the potentiometer. If anyone can help with the pinouts and wiring I would really appreciate it. Fr. Robert Ballecer, SJ Bryan Burnett Link to comment Share on other sites More sharing options...
G+_James Hughes Posted April 17, 2017 Author Share Posted April 17, 2017 Trim pots arrived yesterday. I've tried to rework the circuit. I found the pinout for the L293d and have double checked to make sure that it's wired correctly. I put together a second breadboard this morning before church and have been working on this for the past few hours. I have been scouring the internet and doing a lot of searches, none of which have been very helpful. I have made a little progress by trying a simple sketch that doesn't use buttons or a potentiometer. Did you ever get a chance to look at the code Ben Reese? Link to comment Share on other sites More sharing options...
G+_Ben Reese Posted April 17, 2017 Share Posted April 17, 2017 I just looked through the code and, to be honest, I'm a bit confused by some of it. For example, he has 2 for loops that have no body to them - just the loops. And in at least one of the loops, he's turns the pin on, pausing, turns it off, pauses then does the same with the next pin. The logic of stepping through each pin makes sense, but I don't think you necessarily want to pause between turning one off and the next on. If you still want to get rid of the potentiometer, you can set time static to something like 10, 100, 1000... Depending on how much time you want between steps. Since you already have it functioning, it should be somewhat simple to modify it to use either the pot or the buttons. Link to comment Share on other sites More sharing options...
G+_James Hughes Posted April 17, 2017 Author Share Posted April 17, 2017 Thanks for looking at the code. I'm okay with using a potentiometer as the trim pots I found are small (important) and inexpensive (more important). I'm a total nube at programming and the code for this is confusing. I've been searching for sample code that I can modify or use to figure out how to make the setup I have work. Thanks again. I guess I'll keep on searching. Link to comment Share on other sites More sharing options...
G+_Ben Reese Posted April 17, 2017 Share Posted April 17, 2017 Welcome to Arduino/programming than! More and more, I'm thinking the Arduino is one if the best places to start learning to program just because you can visualize everything in the physical world. This code should work, even if it does have unnecessary pieces. I also thought the breadboard wiring diagram was difficult to follow, but if you can understand how it's wired up I think it would probably work too. Link to comment Share on other sites More sharing options...
G+_James Hughes Posted April 17, 2017 Author Share Posted April 17, 2017 I was having a hard time following the breadboard wiring diagram which is why I found a pin out of the l293 chip. I wish he had commented the code even a little bit. I'll keep working on this, maybe put each line into Google to search for reference. I tried to reach out to the op of the code and have not heard back. Chug, chug, chug... Link to comment Share on other sites More sharing options...
Recommended Posts