RMweb Premium melmerby Posted April 23, 2017 RMweb Premium Share Posted April 23, 2017 Hi all Not DCC per se but part of a wider DCC set up using an Arduino. I have an Arduino Uno and an Adafruit 16-servo driver board. I'm a bit of a novice when it comes to servos so I had two questions about operating the servos: A) What figure control the start and end positions? - I seem to have got this one sorted with suitable start and end values. B) What figure controls the speed that the servo moves between these points? - I can't seem to change this and it is much too fast. Any help appreciated Cheers Keith Edit: Having another think about it suggests that maybe I should be using an incremental increase in pulse width from the minimum to the maximum rather than a sudden step? Link to post Share on other sites More sharing options...
BG John Posted April 23, 2017 Share Posted April 23, 2017 My project for today is to learn all about using servos, so I can't answer that question yet! Hopefully someone else will, so I can learn from it too . I've got a couple of cheapy Chinese 16 servo boards ambling across the globe at the moment, but don't know if they're much different to the Adafruit ones. Link to post Share on other sites More sharing options...
Tricky Dicky Posted April 23, 2017 Share Posted April 23, 2017 Hi all Not DCC per se but part of a wider DCC set up using an Arduino. I have an Arduino Uno and an Adafruit 16-servo driver board. I'm a bit of a novice when it comes to servos so I had two questions about operating the servos: A) What figure control the start and end positions? - I seem to have got this one sorted with suitable start and end values. B) What figure controls the speed that the servo moves between these points? - I can't seem to change this and it is much too fast. Any help appreciated Cheers Keith Edit: Having another think about it suggests that maybe I should be using an incremental increase in pulse width from the minimum to the maximum rather than a sudden step? When I did it with a PICAXE I used a counter to step through from the start position to the end position, I included a short pause in the loop this had the effect of slowing the motion down. Richard Link to post Share on other sites More sharing options...
RMweb Premium nick_bastable Posted April 23, 2017 RMweb Premium Share Posted April 23, 2017 VarSpeedServo.h sets servo speed as a example Nick Link to post Share on other sites More sharing options...
BG John Posted April 23, 2017 Share Posted April 23, 2017 Investigate this link: http://mrrwa.org/2016/07/09/arduino-dcc-15-servo-decoder-project/ I see those SG90s are driving one or two microswitches, and presumably switch the point as well. Do they have enough power to switch Peco OO points with two microswitches? And will they also operate one microswitch and a handmade EM point? I'm intending to try it soon, but it would be helpful to have the answer first! Link to post Share on other sites More sharing options...
RMweb Premium Al51 Posted April 24, 2017 RMweb Premium Share Posted April 24, 2017 I see those SG90s are driving one or two microswitches, and presumably switch the point as well. Do they have enough power to switch Peco OO points with two microswitches? And will they also operate one microswitch and a handmade EM point? I'm intending to try it soon, but it would be helpful to have the answer first! Instead of driving a microswitch with the servo, I think that using a relay, controlled by the Arduino, to change the frog polarity would be a better solution. Al Link to post Share on other sites More sharing options...
BG John Posted April 24, 2017 Share Posted April 24, 2017 Instead of driving a microswitch with the servo, I think that using a relay, controlled by the Arduino, to change the frog polarity would be a better solution. Al I've been wondering which is best. I suppose a relay is technically better, but it needs extra wiring. A switch on the servo is close to the point, so just needs three short wires, while relays will either be on a board close to the Arduino, needing longer runs of wire from each point, or individual ones near each point needing at extra long control wire to each. Link to post Share on other sites More sharing options...
RMweb Premium melmerby Posted April 24, 2017 Author RMweb Premium Share Posted April 24, 2017 Instead of driving a microswitch with the servo, I think that using a relay, controlled by the Arduino, to change the frog polarity would be a better solution. Al I would stick with a microswitch as John says. Using a relay is probably electrically more elegant but a microswitch would be neater and the force required to operate is minimal, so not a problem with a servo. (I would remove the Peco over-centre springs from the points, the servo will keep the blades in place.) Keith Link to post Share on other sites More sharing options...
BG John Posted April 24, 2017 Share Posted April 24, 2017 I would stick with a microswitch as John says. Using a relay is probably electrically more elegant but a microswitch would be neater and the force required to operate is minimal, so not a problem with a servo. (I would remove the Peco over-centre springs from the points, the servo will keep the blades in place.) Keith They're both mechanical switches, so the only real difference is that one is operated electrically and the other mechanically. But the relay needs more connections to the Arduino, and extra programming. I'm just trying to get my head round a very simple way to mount servos and switches, as the few brackets available seem far more expensive than the servo. The only exception I've found is somewhere on the high seas, and I need it now! I'll have to set up a Peco point, and one of my handbuilt ones, on a test board, and try out combinations of springs/no springs, and microswitches/slide switches. Did you find the answer to your original question? Link to post Share on other sites More sharing options...
RMweb Premium melmerby Posted April 24, 2017 Author RMweb Premium Share Posted April 24, 2017 They're both mechanical switches, so the only real difference is that one is operated electrically and the other mechanically. But the relay needs more connections to the Arduino, and extra programming. I'm just trying to get my head round a very simple way to mount servos and switches, as the few brackets available seem far more expensive than the servo. The only exception I've found is somewhere on the high seas, and I need it now! I'll have to set up a Peco point, and one of my handbuilt ones, on a test board, and try out combinations of springs/no springs, and microswitches/slide switches. Did you find the answer to your original question? Can't you make up a bracket from scrap brass or aluminium? (< this merkin spill chucker thinks this ally is wrong ) Re OP: I came to realise that the pulse width determines where the servo moves to. The speed it gets there is inherent in it's design so I need to put a loop in that increments the pulse width from the min to the max (or reverse), giving the appearance of a continuous but slower movement. Cheers keith Link to post Share on other sites More sharing options...
BG John Posted April 24, 2017 Share Posted April 24, 2017 Can't you make up a bracket from scrap brass or aluminium? (< this merkin spill chucker thinks this ally is wrong ) Re OP: I came to realise that the pulse width determines where the servo moves to. The speed it gets there is inherent in it's design so I need to put a loop in that increments the pulse width from the min to the max (or reverse), giving the appearance of a continuous but slower movement. Cheers keith I can, but I'm looking for a quick and cheap solution, as life's too short to do everything! I've got some on the way from China that I think will do what I want, at 30 something pence each, but I need some right now! I've just got servos working with the Arduino for the first time, and the demo program used a loop to set the speed, using the Servo > Sweep sketch in the Arduino program. Someone seems to have developed a library with a speed control, but I don't know if it does anything different to writing a loop yourself. I only read the first page, so don't know where the discussion went after that! http://forum.arduino.cc/index.php?topic=61586.0 Link to post Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.