From: Daniel O'Shea (dan_at_ozramp.net.au)
Date: 2007-04-07 04:26:19
...replying to quite an old message here, but it has given me an answer I've been looking for and I'm hoping that someone will be able to elaborate a little! I have a variable voltage of 0 to 5V, and I want to translate this in to a current to simulate the variable resistance of a potentiometer connected to the SID's ADC - Scott suggests using a transistor, but I want to know what kind of transistor and what value would work best to provide a variable current which duplicates the potentiometer's variable current? and do I need any extra components besides just a transistor? thanks! > ----- Original Message ----- > Re: Commodore joystick ports > From: Scott McDonnell (NetSamurai_at_comcast.net) > Date: 2004-10-22 20:44:06 > > Jim, > > As Hársfalvi mentioned, it is current that needs to be generated, not > voltage. A resistor creates a voltage drop across it, which is a function of > current. (Resistance=Current/Voltage) The voltage is 5V, the resitance is a > range that you know from the potentiometer values, you simply need to create > the corresponding current to emulate the resistance you need. > > A transistor in this mode (current source) should be thought of as a valve. > The valve is completely shut off when no voltage is applied to the base. > This allows the SID to discharge the capacitor (when it is shorting for 256 > cycles) without drawing in the 5V. By varying the voltage to the base, you > are opening the valve by a varying degree, varying the amount of current > which is allowed to flow. > > You are correct in assuming that you will need an analog voltage at the base > (but not to bias it, that is for amplication - to carry an AC signal through > the transistor - you are simply using it like a valve.) If your micro does > not have a DAC built in, you can build an R-2R ladder DAC, like the one > showing here: http://www.hut.fi/Misc/Electronics/circuits/r2r.html or a > Summing DAC like here: > http://www.phys.ualberta.ca/~gingrich/phys395/notes/node162.html (without > the op-amp). Obviously, the values of the resistors in the circuit may need > to be altered a bit to get the range of voltages you desire. This will be > based on some calculations, which are not extremely difficult. Here's a page > you can use for reference: > http://www.williamson-labs.com/480_xtor.htm#voltage-current it describes and > explains how a transistor is used to convert voltage to current. If you need > some more help, drop me a line. I would be willing to design the circuit for > you when I have a spare moment, but the true satisfaction comes from > figuring it out yourself, so I won't deprive you of that! > > A FET might actually do a better job, but the calculations get a bit more > complex, the cost increases, and is probably not necessary for the type of > resolution you will need. An 8-bit R-2R ladder DAC would give you 256 > voltage values to feed into the base of your transistor, which would result > in 256 different currents at each axis input. Probably way more resolution > than a commodore mouse provides. > > Scott McDonnell Message was sent through the cbm-hackers mailing list
Archive generated by hypermail pre-2.1.8.