Hi My CV19 isolation project!
I’m in the design stage of an animated model and have reach the point where i need to start pinning down control options. How many steppers and servos can a Mega 2560 control simultaneously? Also is there any way of returning a flag or function to indicate that a stepper move has been completed? I would welcome any ideas or suggestions
I’m modelling something inspired by this Dinorwic Vivian Quarry incline V2 - YouTube
The first minute of video covers it. I’m using moving magnets under the trucks. So far I have a total of about 10 steppers 11 servos, 12 micro switches, 2 DC motors with shaft encoders on both and a rotary calibration encoder. I will also need some control switches - maybe 3 or 4
I’m thinking of using 4 bit latches to switch between steppers and or servos It’s probable that only one servo and stepper needs to work at any one time but it would improve visual flow if preparation positioning movements could be carried out in the background.
Would multiple pro minis be better linked via I2c?
Please, I’m not asking for someone to design or code this, just a few suggestions.
I’ve included some screen grabs of the model design (for 3D printer)
Hi My CV19 isolation project!
Using multiple Arduino in a project is a mistake beginners often make. Its rarely a good choice, even for experts.
Any Arduino can control a large number of motors of any kind. Its about choosing the right motor controllers. Some are very basic and require a lot of Arduino pins and complex code, and a lot of the Arduino's CPU time to run them. More intelligent controllers offload more of the work from the Arduino, use fewer pins, or share the same pins, so that even a pro mini can run a large number of motors.
As for feedback on completion, the usual way is what you already know about: position or rotary encoders and limit switches. Hall sensors and optical sensors are another way to do the same thing. Often, timing is a reliable enough option.
So start by describing what type and how many motors you plan to use and what the purpose of each will be, in detail. It's surprising how often beginners don't know which type of motor is appropriate for which situation.
Really a fun project. I've seen that video before. Use as much ready parts as You can find. Split all the movements of wagons into parts and design each part at the time.
Using detectors conforming that a move is done and ready is more safe then just letting things run for a certain time.
Keep it simple! The art of railroading is to cut corners, using the most unexpected stuff in the design.
Don't start thinking out of this and that motor, stepper, servo, DC.... Start solving the different parts of the moves.
Steppers make a little jump each time coil current is removed and the applied.
So far I have a total of about 10 steppers 11 servos, 12 micro switches, 2 DC motors with shaft encoders on both and a rotary calibration encoder. I will also need some control switches - maybe 3 or 4
What are all the steppers and servos going to do? I have seen a model railway with a working incline and it was a great deal simpler.
If you just want to be able to choose between steppers that use drivers with step and direction inputs then one way might be send the same step and direction signals to several stepper drivers with a separate connection to the enable pin for each. However when a stepper is disabled it won't hold its position against a load.
I have a more open mind to multiple Arduinos than some of the other regulars here. If using a single Arduino requires extra hardware to extend its capabilities then multiple Arduinos may actually be simpler. Simpler even than using latches. I much prefer programming to soldering.
The video you posted reminds me of the Centre for Alternative Technology near Machynlleth, that I visited a few years back. A
fernicula funicular (thanks Paul__B) railway takes you up from the car park to the centre, and I'm pretty certain that was originally for the slate, like in the video.
Thanks for replies.
The three attached files show the motor arrangements. The model is 3D printed and I already have an initial mock-up print of a runner pair working. The 5 wire 28BYJ-48 stepper runs a rack and pinion to 4 positions under each of 4 tracks. There is a cross shuttle slider that allows full or empty trucks to switch between the 4 tracks. This is driven by a M3 machine screw thread directly from a 12V motor with an shaft encoder salvaged from an inkjet printer.
Position 3 is a lift waiting stub and position 4 is the lift platform. the platform is driven by a servo and drum winch. A magnet on a servo driven scissor lift at the end of each rack raises to attract the steel wheels of the truck which is pulled or pushed by the rack stepper. There is a small notch in the tracks to hold the trucks in position when the magnet scissor drops.
The 28BYJ-48 steppers are geared down to 2048 steps per revolution . These motors are cheap but AFAIK there is no off the shelf enable-fwd/rev drivers, they come with a ULN2003 driver module which needs 4 control pins. They work well with the standard Arduino stepper library.
I've never had any issues running multiple (7) Arduinos over I2C One master pro mini sends or requests status bytes from or to 6 other pro minis. I don't have a spare Mega2560, and I was wondering if the CPU may be swamped counting stepper steps, monitoring 3 encoder positions ( 2 at 400kHz) and timing a dozen servos. Of course, not all motors will run concurrently.
Images from Original Post so we don't have to download them. See this Simple Image Posting Guide
I've never had any issues running multiple (7) Arduinos over I2C
My suggestion is that you stick with what you are familiar with. I don't think anyone here is going to give you a guarantee that an alternative will definitely work with less overall effort, and without experiment.
Reading encoders is hard work for an Arduino - although the mind boggles at how an encoder could be producing 400,000 steps per second while moving slate wagons slowly. I imagine that 40 steps per second would be sufficient
Thank you Robin,
I didn't know about the image post. I thought they were going to automatically appear.
the 400kHz was the oscilloscope trace on the motor at full no load speed. It's from a HP inkjet and my original plan was to use the worm drive that 'came' with the motor. This drives an M3 thread which moves the shuttle truck across the 4 lines. the M3 thread has to spin quite fast, so the motor is spinning it's socks off. I've ditched the worm drive and although still fast, it's down to about 10kHz now, the encoder print on the optical disc is really fine - I need a loupe to see it! I will change this if it can't cope.
I've decided to try the Mega. The plan at the moment is to use ten 4 bit latches to drive the steppers, 8 'data ' lines and 10 strobe outputs, the servos are all individual, and the limit switches for homing the steppers are all connected together. I don't know if it;s 'proper' but I'm using 2x 6 way rotary wafer switches at different voltages to select the steppers for calibration on two analog inputs. with a calibration encoder and a couple of 7 segment displays, I can do it all in about 48 pins.
I've ditched the worm drive and although still fast, it's down to about 10kHz now,
Even at 10kHz the interval between pulses will only be about 100µsecs. And that's for a single motor. An Arduino could cope with one but it doesn't leave much processing capacity for other parts of the project.
My suggesting would be to ignore the printer's encoder disk. You don't need that sort of precision. If you use an reflective optical sensor you could print a disc in black and white with 4 or maybe 8 segments and I reckon that would give you ample precision. The QRE1113 reflective optical sensor is very small but big enough for hand-soldering. Or Sparkfun make a breakout board with the QRE and other components on it. If you are working with a bare chip I suggest you use the Sparkfun analog schematic but treat it as a digital input to the Arduino.
And taking your suggestion further, I could just print a new discs on inkjet transparency film and swap them over.