| Main > Project Announcements |
| Stepper motor mechanism for animated cab topper |
| << < (4/8) > >> |
| jennifer:
Well you wouldn't need to use scary ghosts, It was more about being less mechanical and complex, and still maintaining the same effect with illusion...We don't got many secrets around here, Do not be afraid to document a build for everyone to enjoy and get some ideas from. |
| PL1:
Progress update. Switching power supply arrived. Thanks, Josh. ;D Spent several hours slogging through tutorials on YouTube. Found a video that shows the basic motion and controls that we need for this project. :applaud: The video description has a link to Maker Tutor's blog post here where she posted the related code. --- Code: ---// defines pins numbers const int stepPin = 5; const int dirPin = 2; const int enPin = 8; const int LimitSwitch_LEFT_Pin = 10; const int LimitSwitch_RIGHT_Pin = 11; void setup() { Serial.begin(9600); pinMode(LimitSwitch_LEFT_Pin , INPUT); pinMode(LimitSwitch_RIGHT_Pin , INPUT); // Sets the two pins as Outputs pinMode(stepPin,OUTPUT); pinMode(dirPin,OUTPUT); pinMode(enPin,OUTPUT); digitalWrite(enPin,LOW); // Set Dir to Home switch digitalWrite(dirPin,HIGH); // Enables the motor to move in a particular direction } void loop() { int leftSw = digitalRead( LimitSwitch_LEFT_Pin); int rightSw = digitalRead( LimitSwitch_RIGHT_Pin); if( (leftSw == HIGH && (digitalRead(dirPin) == HIGH)) || (rightSw == HIGH && (digitalRead(dirPin) == LOW)) ){ motorStep(1); } else if( leftSw == LOW && (digitalRead(dirPin) == HIGH) ){ digitalWrite(dirPin,LOW); delay(2000); } else if( rightSw == LOW && (digitalRead(dirPin) == LOW ) ){ digitalWrite(dirPin,HIGH); delay(2000); } } void motorStep( int MAX){ for(int x = 0; x < MAX; x++) { digitalWrite(stepPin,HIGH); delayMicroseconds(500); digitalWrite(stepPin,LOW); delayMicroseconds(500); } } --- End code --- One possible concern is that the code is written for and tested on a TB6560 driver board and uses proximity switches instead of physical switches. The good news is that the basic inputs on an A4988 and a TB6560 appear to be the same. If so, with a few minor edits this code should do exactly what we need. ;D Found several other neat videos by Maker Tutor. This may come in handy if you want to test which wire pair goes to the same coil. - Turning the shaft induces an alternating electrical charge as the north and south poles of the magnetic field pass through the coil. How much of an electrical charge does it generate? Enough to do this. :lol Scott |
| mrclean:
--- Quote from: PL1 on August 18, 2019, 03:32:00 am ---Progress update. Switching power supply arrived. Thanks, Josh. ;D --- End quote --- No problemo! Watched all the videos, excited to see some of those techniques applied to this particular project. :cheers: |
| PL1:
Finished initial design for the test frame. The left half is pretty well locked in position. - Attach the PSU on the top/back of the 2x2x8 pieces. - Attach the 1x4x24 on the top/front of the 2x2x8 pieces. The right half may need to move right/left, depending on the design and placement of the moving platfrom and lifting arm. For now, I'll use some bar clamps to hold the 1x4x24 assembly to the 1x8x12 assembly. - Attach the 1x8x12 to the back of the 2x2x4 pieces. (NOTE: This must form a 90 degree angle so the face of the test ramp is perpendicular to the 1x4x24.) - The 24mm tall spacer blocks create a space for the platform bearing to roll. (a 608 bearing has a 22mm o.d.) -- It rolls between the top of the 1x4x24 and the bottom of the test ramp. -- The bearing keeps the platform level, preventing it from rotating around the x-axis as the stepper motor drives the lead screw nut. -- Depending on the amount of wiggle/slop in the platform drive mech, I might need to add two 608 bearings to prevent z-axis rotataion of the platform or (worst case scenario) upgrade to optical guide rod and two LM8UU bearings. (adds about $15 to the build cost) - The test ramp rests on top of the spacer blocks. -- It guides the lifting arm bearing, allowing you to test different arm lengths, track patterns, "trapdoor" designs, etc. -- Include clamp arms in your test ramp so you can secure it to the 1x8x12. The power distribution harness, Pro Micro, and A4988 drive board mount on a piece of 1x2x8 between the PSU and 1x4x24. The stepper motor, lead screw, pillow bearings, directional switches and emergency stop switches mount on the 1x4x24. (stepper motor on the left) Scott |
| mrclean:
Where it says PSU I'm assuming that's the switching Power Supply Unit ? I'm confused by that typically I place them inside cabinets as opposed to ontop, figured I would just run the Ground / voltage from the Switching Power Supply with wires up to the top of the cabinet retaining the power supply on the inside of the cabinet. |
| Navigation |
| Message Index |
| Next page |
| Previous page |