Notifications
Clear all

Problem uploading sketch.

125 Posts
6 Users
1 Likes
41.1 K Views
(@dorsay)
Member
Joined: 4 years ago
Posts: 57
Topic starter  

@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)
Member
Joined: 5 years ago
Posts: 355
 
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)
Member
Joined: 4 years ago
Posts: 57
Topic starter  

@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)
Member
Joined: 5 years ago
Posts: 95
 

@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)
Member
Joined: 5 years ago
Posts: 355
 
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 : https://noseychef.com/2019/02/27/lapin-a-la-moutarde/

Eric


   
ReplyQuote
(@john40131)
Member
Joined: 5 years ago
Posts: 95
 
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)
Member
Joined: 4 years ago
Posts: 57
Topic starter  

@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)
Member
Joined: 5 years ago
Posts: 355
 
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)
Member
Joined: 5 years ago
Posts: 95
 
This post was modified 4 years ago by John40131

   
ReplyQuote
(@zeferby)
Member
Joined: 5 years ago
Posts: 355
 

@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)
Member
Joined: 5 years ago
Posts: 95
 

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)
Member
Joined: 5 years ago
Posts: 355
 
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()

Eric


   
ReplyQuote
codecage
(@codecage)
Member Admin
Joined: 5 years ago
Posts: 1037
 

@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)
Sorcerers' Apprentice
Joined: 5 years ago
Posts: 923
 

@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!

? ? ? 


   
ReplyQuote
(@zeferby)
Member
Joined: 5 years ago
Posts: 355
 

@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 / 9