16 channel servo driver
Moderators: adafruit_support_bill, adafruit

16 channel servo driver

by test-rc on Fri Dec 07, 2012 8:05 pm

Hi,

I want to use the servo driver with the arduino due. The due is running with 3,3V. I read in another forum, that on the yellow signal line of a servo, it is possible that the 5V of which the servo is running, can appear and destroy the due. Thats a reason why it's maybe not that save to run servos with extern powersupply directly on the arduino due.

Now i found the adafruit 16 channel servo driver. As it can work with 3,3V it seems to be perfect for the due, but since i'm new at programming microcontrolers, i'm not sure if i understood that really right.

So is the due really safe using this servo driver with 5 or 6V for the servos?

Thanks for the infos. B.R. Dieter
test-rc
 
Posts: 5
Joined: Fri Dec 07, 2012 7:45 pm

Re: 16 channel servo driver

by adafruit_support_bill on Sat Dec 08, 2012 8:01 am

on the yellow signal line of a servo, it is possible that the 5V of which the servo is running, can appear and destroy the due

This signal is an input to the servo. I would be surprised to see a servo output anything to it, but it may be possible with some servos.

So is the due really safe using this servo driver with 5 or 6V for the servos?

The servo power for the 16 channel servo controller is completely separate from the logic signals, so it is safe to use with any 3.3v processor.
User avatar
adafruit_support_bill
 
Posts: 31866
Joined: Sat Feb 07, 2009 10:11 am

Re: 16 channel servo driver

by test-rc on Sun Dec 09, 2012 7:11 am

Thanks! :D
test-rc
 
Posts: 5
Joined: Fri Dec 07, 2012 7:45 pm

Re: 16 channel servo driver

by JAD on Sat Dec 15, 2012 4:36 pm

HI,

I just got the 16 channel servo driver. It looks like an awesome board for the Raspberry Pi project that I'm working on. I believe that I'll be using all 16 channels. I'm fairly good at mechanical engineering aspects but when it comes to the electronic aspects, I still have much to learn.

In the description of the board under "Nice Extras" it makes note of this feature:

"A spot to place a big capacitor on the V+ line (in case you need it)"

The tutorial in the "AWESOME" Adafriut Learning System looks like it is going to do a great job walking me through hooking up this board and getting it to work. I did notice that it didn't make mention of adding a capacitor or why I may need one. I do see where I can attach one at C2 but I have no idea why I may need one or what size I would need.

I have been stocking up on parts in the lab but I do not have any capacitors. I guess it wouldn't hurt to get some seeing how I'm trying to make electronics more of a learn/build hobby instead of just a tinker and repair deal. I didn't see any on your site but I'll ask if you guys carry them just incase I over looked them. Would not be the first time today something like that happened. :)

Most importantly I need to ask. Why might I need a capacitor?

Thanks
JAD
 
Posts: 3
Joined: Tue Mar 20, 2012 2:58 am

Re: 16 channel servo driver

by adafruit_support_rick on Sat Dec 15, 2012 5:05 pm

DC motors can inject a lot of electrical noise back into the controller. It doesn't damage anything, but it can make the control erratic. A cap will smooth out the noise.

adafruit_support_rick
 
Posts: 13869
Joined: Tue Mar 15, 2011 11:42 am
Location: Buffalo, NY

Re: 16 channel servo driver

by JAD on Sat Dec 15, 2012 7:54 pm

@ Driverblock

Thanks for your reply. I did have a thought that it was being used as a filter of some sort. After reading your post I googled it and watched far to many clips on it. I learned some cool stuff about capacitors. I think far more than I will end up retaining but oh well. It was both an informative and neat tromp around the net.

What I found:
How to make them.
Adafruit does in fact carry a small selection of capacitors.
Capacitors can serve many purposes which means for me I should buy an assortment on them.
And lastly that capacitors are your friend unless you charge it up one and touch the leads which could be potentially lethal. :shock:

For the this project I think I want to just go ahead and use one. I plan on it being wirelessly controlled so I think it may be a good precaution. I'm thinking that the value of the capacitor is going to be based on the amount of noise that may exist.

1. Is there some basic value I should start with for minimal noise filtering and what would be the largest value I should use?

2. What type of capacitor should I use?

Thanks
JAD
 
Posts: 3
Joined: Tue Mar 20, 2012 2:58 am

Re: 16 channel servo driver

by FoxFireX on Sun Dec 16, 2012 12:00 am

Sorry for a minor threadjack, but if we're already talking about this here, I figure I may as well toss my questions in.

I'm trying to use this board to drive some LEDs via a Netduino, and it seems like it's being more difficult than intended. I'll save the various permutations I've gone through and hopefully cover the questions I'm struggling with right now.

1. Should I be able to drive LEDs by connecting the V+ and PWM pins? This would obviously be inverse of the normal expected values, but since I already have quite a few common anode RGB LEDs set up, and would rather not have to swap them out. Another thread mentioned those not working well on this board.

2. Should the board's logic VIn come from the 3.3v rail or the 5v rail? I initially used 5v, as that was in the examples, but the only time I managed to get it to work (using GND and PWM) was when I switched down to the 3.3v input for logic.

3. Is it possible to get the board into a state where it stops working altogether? If so, is there a simple fix? As mentioned, I did get it working right the once, but after that I can't seem to recreate the working scenario, despite being reasonably sure I reconnected everything the same.
FoxFireX
 
Posts: 9
Joined: Sat Dec 15, 2012 11:51 pm

Re: 16 channel servo driver

by adafruit_support_bill on Sun Dec 16, 2012 8:32 am

1. Is there some basic value I should start with for minimal noise filtering and what would be the largest value I should use?

Noise can usually be tamed with a relatively small value, but startup current demands can be a problem too. Something like 1000uF with a voltage rating equal or greater than your V+ is a good starting value.

2. What type of capacitor should I use?

An electrolytic capacitor - these are polarized, so be sure to align the + lead with the marking on the board.

1. Should I be able to drive LEDs by connecting the V+ and PWM pins? This would obviously be inverse of the normal expected values

The LEDs should be connected between the V+ and PWM pins. This is the normal configuration. See page 34-36 of the data sheet http://www.adafruit.com/datasheets/PCA9685.pdf

Should the board's logic VIn come from the 3.3v rail or the 5v rail?

For 5v micros (such as an Arduino) use 5v. For 3.3v micros (Raspberry Pi) use 3.3v.

3. Is it possible to get the board into a state where it stops working altogether? If so, is there a simple fix?

Logic signals should not exceed Vin. If you feed 5v logic into the board when it is 3.3v powered, you can damage the chip.
User avatar
adafruit_support_bill
 
Posts: 31866
Joined: Sat Feb 07, 2009 10:11 am

Re: 16 channel servo driver

by FoxFireX on Sun Dec 16, 2012 6:45 pm

adafruit_support wrote:For 5v micros (such as an Arduino) use 5v. For 3.3v micros (Raspberry Pi) use 3.3v.

Well, that's good to know. It looks like the Netduino is actually a 3.3v board, so I can easily switch that up. However...

adafruit_support wrote:
3. Is it possible to get the board into a state where it stops working altogether? If so, is there a simple fix?

Logic signals should not exceed Vin. If you feed 5v logic into the board when it is 3.3v powered, you can damage the chip.

Unfortunately this is still fouling me up. As best as I can tell, I have everything wired up correctly, and since the Netduino only outputs 3.3v logic, I don't think I've had excess voltage coming over the pins. Regardless, the board still doesn't do what I expect it to. (I won't say it doesn't work, because I can't swear that I've configured and wired everything up.)

Here's where I am: I've got a translation of the library on Git loaded up, and by snooping the I2C traffic with an analyzer I can see that it's issuing what look like correct commands, and it looks like the Ack bit is being held low by the board. (I'm assuming this since the sender is supposed to let the line float.) (Side question, do I need to include pull-up resistors on SDA and SLC? I know they're needed, but don't know if they're on the board already.)

The analyzer shows that I'm sending command 0x80 (address 0x40, write), starting at register 0x06 and moving up, and setting all the "on" values to 0x0000, and setting the "off" values to alternately 0x0000 and 0x0FA0. My expectation is that if I set on and off both to 0x0000, it'll be off for the full duty cycle, while the other setting would leave it on virtually the whole cycle. I'm leaving the default clock frequency of 200kHz in place, and setting a PWM frequency of 50 Hz.

With this in place, if I connect the LEDs across V+ and PWM, they appear to be steady on. If I connect the LEDs across GND and PWM, they appear to be steady off. Only once did I see the behavior I expected, and no amount of rewiring seems to be able to recover it. Can you give me any suggestions about how to salvage this? I'm really hoping I can get this to work, because my own design attempts with the TLC594x series have been somewhat less than successful. Almost got it working, but it ended up being flakey when I started chaining several chips together. At this point, I just want a solution that works.
FoxFireX
 
Posts: 9
Joined: Sat Dec 15, 2012 11:51 pm

Re: 16 channel servo driver

by adafruit_support_bill on Mon Dec 17, 2012 8:34 am

Logic signals should not exceed Vin.

On closer inspection, it looks like these are 5v tolerant - even if powered at 3.3v. But your Netdino is 3.3v anyway.

Do you have an Arduino to test with? If you can get it to work with the library, we can rule out a board problem.

Post a photo or diagram of how you have everything wired up (including the LEDs).
User avatar
adafruit_support_bill
 
Posts: 31866
Joined: Sat Feb 07, 2009 10:11 am

Re: 16 channel servo driver

by FoxFireX on Mon Dec 17, 2012 3:55 pm

No Arduino on hand, as far as I can remember. I've got all manner of stuff crammed away, though, so it's possible. Heck, if that made it work I'd just switch since I don't have any real code invested yet. :) (Edited to add: Looks like I do have an Arduino laying around; it's part of an unfinished project to convert an XBox 360 Rock Band guitar controller signal to be usable on a PS2 GuitarFreaks/Drummania game. Got it mostly working with the wired version, but was trying to make wireless work using the USB PC dongle. Not really relevant to this discussion, but figured it might score some geek points. :) I'm not sure where the code for that is living right now; I'll need to track it down so I know I can go back to that project in the future before I rip it apart to do testing on this one.)

Ultimately, I'll be including an XBee shield in this part of the project, but that's not necessary at the moment, so I've removed it just to eliminate another variable. I'm including photos as links so I don't overload the forum with huge pictures.

Power Connections: I've got four D cells (6V total) providing power to both the Netduino and the PWM board. Grounds connected to grounds, hot line going to VIn on the Netduino and screw terminal V+ on the PWM board.

Netduino Connections: Pins from the Netduino are connecting to the PWM board through an 8 position ribbon cable I had on hand. Connections are as follows: 3.3V -> Pin 5 (Vcc), GND -> Pin 1 (GND), A6 -> Pin 3 (SCL), A5 -> Pin 4 (SDA). Incoming battery connections are also visible on another GND pin and VIn.

PWM Board Connections: Incoming ribbon cable connected to one of the side headers, terminal block wired to battery. Two ribbon cables lead to the LEDs, one connected to the PWM positions, one connected to V+. (Note that two of the interior wires on each cable are disconnected because of the spacing of the pins.

LED Connections: The ribbon cable connected to V+ is connected by jumper wire to the + rail of a protoboard. The PWM ribbon cable is connected to one leg of the LEDs, with the other leg on the + rail.

All LEDs On: When everything is powered up, all seven LEDs are on constantly, where I would expect them to blink on and off, switching state each second.

After staging the setup for these photos, I put the analyzer on the wires again to verify it was still acting as before. I was able to capture two full sets of commands. The first set started at 80ms into my trace, ending at 150ms. The second set started 1150ms, ending at 1220ms. That lines up nicely with the 1000ms sleep between commands. First set all were of the form S, 0x80, A, 0x06, A, 0x00, A, P, for registers 0x06 through 0x45. (The trace actually seemed to miss quite a few of the clock pulses; may have been due to my sampling rate, as it got many cleanly, then started missing several before picking them up again.) Second set sets registers 0x06 through 0x09 to 0x00, 0x00, 0xA0, and 0x0F, respectively, then repeats that pattern through the remaining registers.
FoxFireX
 
Posts: 9
Joined: Sat Dec 15, 2012 11:51 pm

Re: 16 channel servo driver

by FoxFireX on Mon Dec 17, 2012 5:57 pm

Okay, further update. I found all my old code, so I broke the Arduino out and set up the sample. I did change it around a bit to range each output from 0 to 4000, stepping by 500. With that in place, I actually saw the LEDs go from all bright to having one dim in sequence. This tells me that it's entirely possible the old one was working, but since these are connected through PWM and V+, the numbers really are inverted. To get "off", I'll have to send 4095. The value I was sending may not have been sufficiently high to actually overcome persistance of vision. Off to do more testing with the Netduino.

Edit: On review, the "off" type value I was specifying was 4000 anyway, so that may not explain it.

Edit again: Last update for the night. I got the board working as desired with the Arduino, so I probably will just use it and move on with life. I did initially have a problem with the LEDs not going out fully, but finally figured out from the datasheet that to truly turn an LED hooked up on PWM/V+ off, you have to send a "full on" command of 4096 on, 0 off. That finally gets rid of the tiny bit of leftover voltage that was showing up when I tried to send an "on" command like 0, 4095. Because these are hooked up on PWM/V+, that does mean that on and off are reversed; if I tell it "full on", that means full off, and likewise "full off" of the chip means the LED is on full strength.

The only difference between wiring of the Arduino and Netduino versions is that I hooked it to the 5v logic rail.

(Now I just wish they were in stock so I could get the 10 I need for this project.)
FoxFireX
 
Posts: 9
Joined: Sat Dec 15, 2012 11:51 pm

Re: 16 channel servo driver

by adafruit_support_bill on Tue Dec 18, 2012 7:14 am

the 10 I need for this project

160 channels? Be sure to post photos when you get it working. :D
User avatar
adafruit_support_bill
 
Posts: 31866
Joined: Sat Feb 07, 2009 10:11 am

Re: 16 channel servo driver

by FoxFireX on Tue Dec 18, 2012 10:47 am

Well, actually "just" 143. I can get by with 9, and have one on hand that I've been testing with, but since there's a price break at 10 units, I figured it'd be worth having a couple of spares in case I majorly botch one. And if not, there's always another project to come.

I've been running a small site documenting my progress so far, but this is probably the best way to see exactly what I'm planning.

Anyway, did anything look wrong in the Netduino wiring? I'm guessing not, since the Arduino handled it okay. But I'm curious as to why I'm not getting the same results out of both microcontrollers. Almost starting to wonder if something is flaky with the Netduino itself, since I was having other problems with the TLC5941s.
FoxFireX
 
Posts: 9
Joined: Sat Dec 15, 2012 11:51 pm

Re: 16 channel servo driver

by adafruit_support_bill on Tue Dec 18, 2012 11:43 am

Very cool! For future projects, you might consider the digital addressable pixel strands. https://www.adafruit.com/index.php?main ... xel+strand

Not sure what was wrong with the Netduino implementation. I haven't done any I2C on the Netduino so I'm not that familiar with it.
User avatar
adafruit_support_bill
 
Posts: 31866
Joined: Sat Feb 07, 2009 10:11 am