Problem uploading sketch.  

Page 6 / 6
  RSS

dorsay
(@dorsay)
Trusted Member
Joined: 2 months ago
Posts: 67
2020-02-21 12:26 pm  

@zeferby

Posted by: @zeferby

Going back to this, I'm wondering if you plugged 2 servos into a single output port of the PCA9685.

Yes, I used a Y connector to join 2 servos together, both driven by pin 4 on the PCA9685.  Not a good idea?  Ok, that might explain why 4 and 5 are acting up, but would that explain the action of 1, 2 and 3?

David


ReplyQuote
ZeFerby
(@zeferby)
Reputable Member
Joined: 6 months ago
Posts: 348
2020-02-21 12:28 pm  
Posted by: @dorsay

but would that explain the action of 1, 2 and 3?

If the PCA has issues with one port, it may affect it's whole behaviour ?

Eric


ReplyQuote
dorsay
(@dorsay)
Trusted Member
Joined: 2 months ago
Posts: 67
2020-02-21 12:33 pm  

@zeferby

Ah, I see.  Ok I'll modify and try again tomorrow (it's 11pm here) and let you know.  I hope you're right.  I'd really like to get this solved and move on.  It's driving me bonkers ? 

David


ReplyQuote
John40131
(@john40131)
Trusted Member
Joined: 10 months ago
Posts: 77
2020-02-21 2:08 pm  

@zeferby

I use One switch to switch 2 servos but they are on different channels on the PCA9685 i.e as I have a scissor crossing which has 4 points so  to swap track in one direction I have 2 points and same for the other way ... so on my sketch the scissor data input pins are 27,28,29,30 and output channel is 5, 6, 7 and 8 and I have 4 microswitches on point mounts to lock One switch  if 1 scissor is open in One direction  it wont allow the other to open... I can only switch when all are in straight ahead mode..

Just having another go at checking things ... having to re-make 2 ribbon cables a 25way and a 9 way as this house rabbit we have had a chew at the ribbon cables yesterday ... anybody like rabbit casserole.. LOL

John


ReplyQuote
ZeFerby
(@zeferby)
Reputable Member
Joined: 6 months ago
Posts: 348
2020-02-21 2:12 pm  
Posted by: @john40131

this house rabbit we have had a chew at the ribbon cables

 ?  Sadly I don't find any spec on the PCA9685 datasheet about rabbit resiliency !

EDIT: But I found the rabbit's datasheet :

Lapin à la moutarde

This post was modified 1 month ago by ZeFerby

Eric


ReplyQuote
John40131
(@john40131)
Trusted Member
Joined: 10 months ago
Posts: 77
2020-02-21 4:23 pm  
Posted by: @zeferby

 ?  Sadly I don't find any spec on the PCA9685 datasheet about rabbit resiliency !

That looks nice, but only jokeing about rabbit we love her she does have a health problem not sure what happened but she has a cist or lump full of puss on her forehead we think dog may have bit her and we press on it and comes down her rigth nostral problem is rabbits breath through their nose ... anyway back to trains just finish test on the points on PCA9685 all know work but had another bad one was jammed think these SG90 servo's are crap but other are double the price see how it goes on that... so will put your newest sketch on Polarity Mega tomorrow and see if everything switches the correct direction and LED's on Mimic panel..


ReplyQuote
dorsay
(@dorsay)
Trusted Member
Joined: 2 months ago
Posts: 67
2020-02-22 10:57 am  

@zeferby

Posted by: @zeferby

If the PCA has issues with one port, it may affect it's whole behaviour ?

It appears that you are correct.  Even my sketch worked correctly after I separated servos 4 and 5.  But I'm stil having issues with the PCA9685.

I've discovered another sketch on the Arduino forum originally by PaulDMV, then modified by Anders53 and Septillion called MultiServo4-2-2.ino.  It doesn't use the PCA9685 but it limited to 8 servos.  I'm evaluating that one now, with success.  Maybe the best solution is to give up on the PCA9685 and just use 2 Arduinos where I'm using 16 servos. I could paste the sketch here, if you like.  Or I could paste a link, if I knew how.

How many servos with the Arduino Uno handle without needing a separate power supply?  Does the same gos for a Mega?

 

David


ReplyQuote
ZeFerby
(@zeferby)
Reputable Member
Joined: 6 months ago
Posts: 348
2020-02-25 6:15 pm  
Posted by: @dorsay

How many servos with the Arduino Uno handle without needing a separate power supply? 

For power I would go for 0 = none = nada !

A servo may use current in hundreds of mA while the Arduinos can only give 40mA absolute max (recommended = 20mA !) on each pin, with a total maximum which depends on model.

You can check the specs of each model here.

Beware of sketches using the original Servo library : IIRC, the library uses at least one of the 2 timers available on the Uno (the Mega has more timers).

Eric


ReplyQuote
John40131
(@john40131)
Trusted Member
Joined: 10 months ago
Posts: 77
2020-02-26 2:55 pm  
#define NB_OF_SERVOS        4

// Let's have arrays so we can adjust the nb. of servos
int switchPins[NB_OF_SERVOS]      = { 2, 3, 4, 5,  };
int switchStates[NB_OF_SERVOS]    = { LOW, LOW, LOW, LOW,  };
int leftPWM[NB_OF_SERVOS]         = { 370, 370, 370, 370,  };  //adjust limits per servo as required
int rightPWM[NB_OF_SERVOS]        = { 290, 290, 290, 290,  };  //adjust limits per servo as required
bool bRightIsMinPWM[NB_OF_SERVOS];  //Manage servo orientation (rightPWM < leftPWM or leftPWM > rightPWM)

//variabes for timed movement
int currentPWM[NB_OF_SERVOS];
int targetPWM[NB_OF_SERVOS];
unsigned long prevMillis[NB_OF_SERVOS] = { 0UL, 0UL, 0UL, 0UL, }; //
Hi Eric,
I am considering trying the Servo sketch you did for David because I have some issues with the one
I did A the Servo's are buzzing and B I think the movement is to fast and they are jamming had 4 so far,
but I want 16 servo's so if I change NB_OF_SERVOS (to) 16 and like wise the servo LOW and Limits to my limits
but do I need to
change ...
unsigned long prevMillis[NB_OF_SERVOS] = { 0UL, 0UL, 0UL, 0UL, }; //
and addd 10 more 0UL,
Regards John
PS
Had my nasal Op nostrals Tues, now totally blocked and prob for a week blood every where nightmare
as I don't normally breath through my mouth normally..
This post was modified 1 month ago by John40131

ReplyQuote
ZeFerby
(@zeferby)
Reputable Member
Joined: 6 months ago
Posts: 348
2020-02-28 2:02 pm  

@john40131

Yes as discussed through another channel, the use of arrays enables to go up to the 16 ports of a PCA9685.

The initialized arrays MUST have the exact number of values per servo (nb.=NUMBER_OF SERVOS).

Here is a small variation of the sketch where the prevMillis[] array does not need to be statically initialized :

 

Eric


ReplyQuote
John40131
(@john40131)
Trusted Member
Joined: 10 months ago
Posts: 77
2020-02-29 10:10 am  

Hi Eric,

Yes I understand about changing to 16 channels and the pin No need adding and the left and Right limits need adding for each ... but a few lines down you have this ...

unsigned long prevMillis[NB_OF_SERVOS] = { 0UL, 0UL, 0UL, 0UL, }; // 
so does this need extending as well another 12 times i.e the 0UL..
John

ReplyQuote
ZeFerby
(@zeferby)
Reputable Member
Joined: 6 months ago
Posts: 348
2020-02-29 1:25 pm  
Posted by: @john40131

does this need extending as well

Not with the V2 of the sketch, it is now just a declaration as the initialization is done by setup()

This post was modified 4 weeks ago by ZeFerby

Eric


ReplyQuote
codecage
(@codecage)
Member Admin
Joined: 10 months ago
Posts: 507
2020-02-29 2:25 pm  

@zeferby

Sad to say but on that stay in England during the mid 50s where I got to learn the skill of pin setting at the local bowling alley, I also got to see plenty of the rabbits afflicted with Myxomatosis as referenced in your link to 'Lapin à la moutarde' above.

SteveG


ReplyQuote
Pugwash
(@pugwash)
Prominent Member
Joined: 10 months ago
Posts: 969
2020-02-29 3:06 pm  

@codecage @zeferby @john40131

I spotted this in a high street butcher's shop in Newport, Gwent, just after the film "Watership Down" had hit the cinemas.

You've read the book!
You've seen the film!
Now, EAT the cast!

? ? ? 

This post was modified 4 weeks ago by Pugwash

SteveC - Topple Rudd Poltman


ReplyQuote
ZeFerby
(@zeferby)
Reputable Member
Joined: 6 months ago
Posts: 348
2020-02-29 4:12 pm  

@codecage

Yes I remember the same sorry sight from 30-40 years ago when hunting we killed the poor beasts and burned them, while other guys were busy re-inoculating the disease all the while for money !

/hate

 

Eric


ReplyQuote
Page 6 / 6

Please Login or Register