|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools | Rate Thread | Display Modes |
|
#16
|
||||
|
||||
|
Re: Digital to OI Analog
Quote:
|
|
#17
|
||||
|
||||
|
Re: Digital to OI Analog
Quote:
The analog joystick inputs are multiplexed at approximately 38Hz (which is the same as the PWM output period) into what appears to be a current sink, set for about 45uA. When 100K Ohms are presented between the +5Aux pin and the analog input, the resulting voltage will be approximately 0.5V. Although IFI's documentation states that In the event that an analog value is less than 0.05V, a value of 127 will be generated., in reality that voltage is closer to 0.5V (500mV) than 0.05V (50mV). I measured something closer to 632mV. When the 100K pot is at one extreme, the voltage at the analog input is obviously equal to the +5VAux voltage, and at the other extreme, will be in the 500-600mV range. For the sake of this discussion, I'll use round numbers and use 4.5V for the entire input voltage span. Dividing the span by 256 yields approximately 17.6mV per A/D count. I should add a note at this point that unless you utilize something like an accurate oscilloscope to observe the analog inputs with just a pot connected, you won't be able to see how IFI's input circuit works. Given that the analog input is driving a current sink and digitizing the resulting voltage, supplying the analog input with a voltage is relatively straight forward. The primary consideration is that the voltage source be able to handle the multiplexed current sink load, which should be no problem as long as the output impedance of your circuit is sufficently low. How low is good enough you ask? If one A/D count is 17.6mV and the current sink is 45uA, then roughly 391 ohms of series resistance between an ideal voltage source and the analog input will result in one A/D count error. Due to the fact that the +5Aux line is current limited, the other source of potential error comes from any voltage drop introduced by loading this power source. It appears that rather than using the +5Aux line as the upper reference of the A/D conversion, IFI is instead using the voltage from the other side of their current limiting circuit, hence the errors that are introduced when the +5Aux line is externally loaded. By placing a few different resistive loads on this power output, I noted that the current limit may not strictly be something like a current sense resistor coupled with a high side switch, such as a MOSFET, as the impedance appears to vary slightly. Whatever it may be, I measure an effective resistance of 3 to 4 Ohms across a 10 to 100mA range. Assuming a series resistance of 4 ohms, an error of a single A/D count would be introduced with about 4.4mA of loading on the +5Aux pin. Clearly if an external circuit's current demand can be held to something in the 10-30mA range only a few percent of the overall A/D range is sacrificed. The other source of "power" available on some of the joystick interfaces, are the eight outputs intended to be used for lighting LED's. These outputs are current limited outputs but are NOT based on a 5V supply. The unloaded voltage on these outputs is approximately 2.5V less than the voltage supplied to the OI (as measured from the tether input... I didn't check the coaxial input, nor the competition port input). That 2.5V difference tracks fairly linearlly as the power applied to the OI is varied. From a current limiting standpoint, the effective series resistance appears to be on the order of 500 ohms. So if the unloaded voltage were 5V, the short circuit current would indeed be limited to 10mA. With the RC powered from 12V, the voltage at the OI tether input is about 0.5V less, and the unloaded LED output will be about 9V, and the short circuit current was measured at about 18mA. IF a custom interface circuit were designed to power itself from the LED outputs, it would of course become dependant on the limitations of the RC programming to keep the interface powered. Multiple outputs could be combined (used diode blocking just to be safe) to increase the available current. Returning attention to the more practical source of power, the +5V Aux line, one could design a boost supply and then regulate the output back down to +5V in order to drive the analog inputs across their full range... however one still needs to consider the tolerancing of IFI's reference voltage versus the voltage generated by the switching supply. For a one-of-a-kind design, clearly just providing a trim pot, or hand selecting components, to trim the supply to match an individual OI could work just fine, but on a production basis would not be practical. The other potentially tempting method of matching the supply to the OI would be to servo the supply to one or more of the switch contact inputs which are internally pulled to 5V. The problem here is that the +5Aux voltage appears as though it may be seperately derived. The one I was working with measured about 50mV higher on the +5Aux power versus any of the other controller inputs or outputs measured on the other OI connectors. A switching power supply would require some careful design so as not to adversely effect other devices dependant on the +5Aux power, as well as protection from generating voltages high enough to damage other inputs on the OI. Additions and corrections invited. |
|
#18
|
||||
|
||||
|
Re: Digital to OI Analog
Quote:
Here I will save you all the trouble of reading this and the headache of trial and error. Use a 10k ohm Digpot as a voltage divider with a 1k ohm resistor between ground and one leg of the voltage divider. Tie the other lead to 5v. Connect the wiper to the analog input of the O/I. The 1k ohm resistor creates the 500mv drop necessary to offset the input to the O/I. We use the MCP42010 digital pot. This will work perfectly however you will need to play with the input voltage and the R-value to get the correct range and center. Of course since the MCP42010 has a tolerance of %20, the values needed to calibrate are unique to each POT. |
|
#19
|
||||
|
||||
|
Re: Digital to OI Analog
yeah I think were talking about the difference between "a hack" and "a solution".
the Chicklet is a solution that can be mass produced and will always work. the digipot and MC is a hack that you can get to work. |
|
#20
|
||||
|
||||
|
Re: Digital to OI Analog
So..... by your definition, the Chicklet is a hack....... because the above prescribed solution is EXACTLY how the Chicklet interfaces to the O/I.
|
|
#21
|
||||
|
||||
|
Re: Digital to OI Analog
no Im talking about my solution(hack) with the pic and a digi pot only(no voltage devider, or fancy things like that)
this is all in the context of the original question of how to split a analog channel in to more than 1 digital channels Last edited by Stuart : 28-01-2007 at 18:17. |
|
#22
|
||||
|
||||
|
Re: Digital to OI Analog
I know. The digital pot IS the voltage divider. This is exactly what you are trying to accomplish. There is nothing fancy about it. You make a variable voltage divider out of the DIG pot. This is very easy to do.
|
|
#23
|
||||
|
||||
|
Re: Digital to OI Analog
Quote:
Thanks for contininuing the discussion... and perhaps I should appologize for being a bit of a wind bag coupled with the ability to type. ;-) As neither IFI nor, apparently, anyone else had taken the time to provide a complete summary of the joystick interface, I did feel that it was important for anyone considering going down that this path to be aware that there are several things to consider when engineering something that will work, as-is, with this interface, and within FIRST's current rules. Aside from considering how to do the digital to analog conversion, and its pitfalls, the other significant consideration, as I'm certain you will acknowledge, is the question of how to power it. Your situation is unique in that it has been granted an exception to the rule of external power. Clearly any device intending to act as a USB host could not be powered from the OI... it just would not work. For something less complicated that only needs to consume a 10-20mA, the problem is certainly much more manageable/tolerable. Shifting the discussion to/back to, implimentation specific details... As you correctly point out, using a digital pot comprised of a tapped string of polysilicon resistors is succeptable to large errors when used in an application where an absolute resistance value is important. Your solution of adding a series resistor to lift one end of the pot off ground is a good solution for making a 10K pot work, whether it be digital or analog. Perhaps for the benefit of others you could expand upon how you compensate for the poor absolute tolerencing of the digital pot. Polysilicon resistors work well in ratiometric configurations such as a simple voltage divider (as in the case of a digital pot) or R-2R ladder configurations because on any given die, the resistors will be matched well in terms of ratios, even though the absolute values vary over a wide range (from die to die). For my own purposes, I had also considered configuring a pot as you suggested, as well as simply using a 100K pot with only two connections, but decided that I wanted to avoid the tolerancing problem without trading off resolution, or individually compensating each device... which is a valid design descision. Alternately, you could create a common, low impedance, 500mV voltage source to tie the pot to. I then considered using the pot strictly ratiometrically (i.e. tied between +5 and gnd) and using an op-amp to sum the wiper with an offset voltage to push the zero value up without sacrificing resolution, and to have a low impedance output to minimze that error.... but that all took up space I didn't have. A more traditional R-2R, multiplying DAC coupled with an external op-amp and offset voltage would be another way to accomplish the same thing at about the same cost and component count. In the end, I chose to use a 10bit, voltage output, quad DAC. In particular, an Analog Devices AD5314. I chose this part more for size and immediate availability, than for reasons of cost. The higher resolution allows for the 500mV offset to be removed in software without loosing the ability to hit each of the 8 bit A/D converter 'bins' as seen by the OI. Anyone considering designing something that will work within the constraints of IFI's joystick interface is bound to have their own reasons for wanting to do so, and there are a number of ways to solve these interface problems, each with their own set of pro's and con's. Perhaps in the future, FIRST and/or IFI will afford us with a more flexible operator interface. Usable power and a serial port would be excellent additions, but I wouldn't take away the existing interface as it is quite usefull in its own right. Thanks, |
|
#24
|
||||
|
||||
|
Re: Digital to OI Analog
Quote:
What you are doing, and what Mike has done on the Chicklet, are essentially the same except that he's encouraging you to add one resistor (per channel) so that you don't throw away 10% of your pot's resolution. If you make your series resistor a trim pot, or hand select the resistor, you can remove the error introduced due to the absolute value of a given digital pot. The origional poster, Marcan, was interested in the "how-to" aspect of interfacing to the OI, and I think someone else had brought up multiplexing. Marcan was also talking about pulling power from the joystick connector, and I'm not sure anyone had addressed how to calculate the error that will result from doing so... so I elected to explore that topic in a way that hopefully would provide some insight as to how to make a personal decision on how much is too much, and what the tradeoff's are. From my own exploration of this interface, I found some things that disagree with what IFI has documented, and those were included in my posting, and have also been brought to the attention of IFI in case they want to correct, or clarify, those portions of their user manual. Thanks, |
|
#25
|
||||
|
||||
|
Re: Digital to OI Analog
OHHHH ok I see I thought he was saying run the pot from a voltage divider not as part of one.
that makes a lot of sense. and might be a good idea for the next time I build one(the current one Ive got seams to be spot on as far as tolerance so maybe I got lucky). |
|
#26
|
|||
|
|||
|
Re: Digital to OI Analog
Thanks everyone for the comments. This certainly clarifies a lot of the details about the OI.
Right now, I'm considering two options: a 100K digipot in rheostat mode (the "hack") or the 10+1K divider. I'll probably end up trying both, and see how they behave. On the subject of DACs and op-amps (or op-amps with the digipots), how would you deal with the range limitations of the op-amp? Even rail-to-rail op-amps aren't truly rail-to-rail (they just get close). Would you be able to use the full input range using an op-amp? As for the +5V Aux supply, I'm pretty sure it'll meet my needs, based on Dave's info and my own testing, as far as the power required goes. A more important aspect is how the voltage drop due to the current limitation affects the analog inputs when the current is higher and the voltage drops. I'll do some testing once the components arrive. |
|
#27
|
||||
|
||||
|
Re: Digital to OI Analog
QUOTE=Dave K.;567119]A more traditional R-2R, multiplying DAC coupled with an external op-amp and offset voltage would be another way to accomplish the same thing at about the same cost and component count.
In the end, I chose to use a 10bit, voltage output, quad DAC. In particular, an Analog Devices AD5314. I chose this part more for size and immediate availability, than for reasons of cost. The higher resolution allows for the 500mV offset to be removed in software without loosing the ability to hit each of the 8 bit A/D converter 'bins' as seen by the OI.[/quote] Dave, using an ADC is the best way to interface to the O/I. The Rev2 Chicklet will use an ADC. We realized the short commings of using the digpot when we got our first batch of pots in the lower end of the spectrum. Although we anticipated it, we thought the tolerances were on the conservative side. We developed a way to test the pots prior to assembly. We sorted them out into seperate groups based on there A to B resistance. This was tedious and not very cost effective due to the fact that we needed to purchase about 33% more pots than we actually needed in order to get enough that were within our spec. As far as elaborating on the voltage divider. It is very simple to overcome the tolerance issues. The 10k pots are actually a little better than the 100k. They vary from 8k to 12k. The object is to keep the offset resistor value within 10% of the pots AB resistance. One way to do this is to use another 10k pot as the offset resistor. That way you can adjust the offset value in software. The offset resistor is not just for allowing full range, actually it's primary purpose is to prevent the input of the O/I from going to ground. If this condition is allowed the O/I will read 127. Another way to calibrate with software is to use a second digpot to adjust the input voltage to the voltage divider pot. The idea is to make it so the center is 127. That is more important than getting full range. Most digpots have a hardware/software shutdown mode. This puts the wiper to center. This is very usefull. But only if the center is 127 on the O/I. If for some reason your device is not connecting to your controller you need a safe state for the interface to go to. This is an effective way to interface to the O/I. But I would still suggest the 10 bit ADC. |
|
#28
|
||||
|
||||
|
Re: Digital to OI Analog
Quote:
As I think I mentioned earlier, you'd need something capable of handling the dynamic loading presented by the multiplexing that the OI uses to scan the channels. There are of course capacitive loading effects as the analog switch selects the channel, and then the load of the current sink. In the case of the OPA363, it is specified driving a 10k load, which is an order of magnitude greater than the load presented by the OI. Other op-amps that come this close to the rails, are specified at even higher resistances, such as 100k, and may not handle the switched load without introducing some additional error. As I wrote earlier, I chose not to go down this road for different reasons, and you've certainly highlighted one additional concern that further justifies not pursuing this approach. Quote:
For my own interface, I'm faced with powering a 12-13mA device in addition to my interface electronics, so that will already pull the supply down by a few A/D counts. In a practical sense, it doesn't really matter if we loose some resolution in joystick position. Heck we already toss out more bits in the deadband region just to avoid robo-creep when the joystick is a couple knat hairs shy of being truely centered. |
|
#29
|
||||
|
||||
|
Re: Digital to OI Analog
Quote:
Having been at this a while, I've had designs that despite our best efforts to design to worst case tolerances, the manufacturer's let us down and provided parts well outside of their worst case specifications... and these are large, well respected companies that had the pipelines full of parts before we flagged the problem for them. When it comes to semiconductors, design to worst case, and if possible, even a bit beyond that. One of the reasons the AD5314 was a good fit was that its own power on reset set's the output to zero. I'm sure there are other, less costly, devices that would also work well and also provide a power on reset to zero... but this was the one that was available quickly. Thanks, |
|
#30
|
|||
|
|||
|
Re: Digital to OI Analog
Quote:
Quote:
Crazy idea: wonder how much power the Wii controller's rumble uses? Probably too much, but I'll still give it a go for kicks. If anything, we could have some fun out of competition making the rumble activate when the accelerometers on the robot measure acceleration over a certain threshold. |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Analog-to-Digital Converter Code | Kevin Watson | Programming | 29 | 17-02-2008 13:07 |
| Analog to Digital Conversion Help | Der Rowan | Programming | 4 | 23-01-2006 00:17 |
| Accelerometer: Analog or Digital? | psquared | Programming | 2 | 10-02-2005 16:38 |
| Analog / Digital IO Connectors | Aidan F. Browne | Control System | 4 | 06-02-2005 22:26 |
| Analog vs Digital inputs? | f22flyboy | Programming | 8 | 08-11-2002 22:18 |