Shop OBEX P1 Docs P2 Docs Learn Events
Digital potentiometer from a shift register and resistor ladder? — Parallax Forums

Digital potentiometer from a shift register and resistor ladder?

MarkSMarkS Posts: 342
edited 2008-06-18 21:55 in General Discussion
I need a digital potentiometer for the contrast control for a LCD module. The module's data sheet calls for a pot between 10K and 20K. The problem is that the only digital pots I'm finding are in SMD packages, unless I want to order them in large quantities and wait weeks. I do not care to do either and I'd like to stick with through hole components for this project.

It came to mind that I could use a shift register with latched outputs and a resistor ladder to approximate a digital pot. This would be extremely cheap and easy to do, but would it work? This is what I have in mind...
DigitalPotentiometer.jpg
This would give a range of 2.2K Ohms to 17.6K Ohms.

Pay no attention to the shift register value as it was the first 8-bit shift register in the Eagle library. The contrast schematic can be seen on page 9 of the LCD module's technical specification data sheet.

I think this would work. Yes? No?

Comments

  • LeonLeon Posts: 7,620
    edited 2008-06-13 03:02
    I don't think it will work. You could use something like a 4066 analogue switch controlled digitally.

    Leon

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Amateur radio callsign: G1HSM
    Suzuki SV1000S motorcycle
  • TCTC Posts: 1,019
    edited 2008-06-13 03:09
    This should work.

    http://www.maxim-ic.com/quick_view2.cfm/qv_pk/2780

    digi-key part number

    http://search.digikey.com/scripts/DkSearch/dksus.dll?Detail?name=DS1804-010%2B-ND




    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    We all make mistakes when we are young………That’s why paste is edible!
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2008-06-13 14:35
    I'm not clear on whether you're really looking for a variable resistance on the output or a variable voltage. If the latter (or should I say, LADDER?) try this...

    http://en.wikipedia.org/wiki/Resistor_Ladder

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
  • MarkSMarkS Posts: 342
    edited 2008-06-13 15:07
    I need to control the contrast of the LCD via software. The data sheet recommends a pot to control the contrast. Since I really don't want to use a tiny stepper motor, I figured a digital pot would be the best method. lol.gif
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2008-06-13 15:13
    Okay, so that translates to a voltage on the VEE pin, and the link I sent you is exactly what I have used in older designs to add this effect through digital control. I hope this helps. Take care.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
  • LeonLeon Posts: 7,620
    edited 2008-06-13 22:53
    You could use PWM and control the voltage directly with software. That's the way it's usually done.

    Leon

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Amateur radio callsign: G1HSM
    Suzuki SV1000S motorcycle
  • TCTC Posts: 1,019
    edited 2008-06-14 01:15
    Leon said...
    You could use PWM and control the voltage directly with software. That's the way it's usually done.

    Leon

    I think it would be better to have hardware control insted of software. and with the DS1804 it stores the wiper setting, so if power is removed then applied readjustment is not needed.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    We all make mistakes when we are young………That’s why paste is edible!
  • MarkSMarkS Posts: 342
    edited 2008-06-14 02:42
    TC said...
    Leon said...

    You could use PWM and control the voltage directly with software. That's the way it's usually done.

    Leon

    I think it would be better to have hardware control insted of software. and with the DS1804 it stores the wiper setting, so if power is removed then applied readjustment is not needed.

    What I meant by software control is that the user will have a contrast setting in the menu. There will be a brightness setting as well, which will be done via PWM. I like the DS1804. It has just enough to get the job done.
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2008-06-16 15:51
    I had an 8-slot gang programmer some years ago that could copy data from a source ZIF socket to up to eight target ZIF sockets. It’s LCD had software control of the contrast and the piezo speaker had volume control. Both came from a single 8-bit latch split into two 4-bit DACs. One for each device. The user would adjust the settings from a menu on the LCD.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
  • MarkSMarkS Posts: 342
    edited 2008-06-17 03:14
    Chris Savage (Parallax) said...
    I had an 8-slot gang programmer some years ago that could copy data from a source ZIF socket to up to eight target ZIF sockets. It’s LCD had software control of the contrast and the piezo speaker had volume control. Both came from a single 8-bit latch split into two 4-bit DACs. One for each device. The user would adjust the settings from a menu on the LCD.

    That's a thought...
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2008-06-17 17:55
    What I was getting at is that the concept of using the shift register would work just fine for the LCD contrast if you build an R2R ladder on the outputs. You would additionally have 4 bits left for other uses or additional outputs. Take care.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
  • MarkSMarkS Posts: 342
    edited 2008-06-18 02:20
    Chris Savage (Parallax) said...
    What I was getting at is that the concept of using the shift register would work just fine for the LCD contrast if you build an R2R ladder on the outputs. You would additionally have 4 bits left for other uses or additional outputs. Take care.

    I was only looking for that as an option because I couldn't find a suitable digital potentiometer. However, I really like the DAC idea. That wouldn't have occurred to me. Thank you for that. That may be the most elegant solution.
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2008-06-18 14:19
    I think the idea is quite brilliant.
    After all, instead of being limited to available digital potentiometers, all sorts of resistance ranges can be employed.

    Regardless of what you use, greater power levels may be managed through driver chips, like UNL2003 darlington array or transistors. The backlighting on an LCD can be a very power thirsty beast and might burn up a digital pot if directly connected, though I believe the control line is not high power..

    For a long time now, I've felt intuitively there is a better way to manage latched incremental power increases than to have the microprocessor busy all the time with PWM. In this scheme to can send a level to the outputs, latch it, and have the microprocessor do some other task.

    In some cases an R2R ladder is appropriate -- maybe most, but in other cases one might consider a voltage divider scheme.

    And one doesn't have to use a shift register. A 4-bit to decimal chip might be a better fit if you can afford the I/O pins. In this way, you use the microprocessors I/O ports as your latches.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    PLEASE CONSIDER the following:

    Do you want a quickly operational black box solution or the knowledge included therein?······
    ···················· Tropically,····· G. Herzog [noparse][[/noparse]·黃鶴 ]·in Taiwan

    Post Edited (Kramer) : 6/19/2008 9:39:06 AM GMT
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2008-06-18 16:17
    I have a few projects that don’t really need this but have an LCD and SPI interfaces on them already. I may do something with it just to have an example using the BASIC Stamp.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
  • MarkSMarkS Posts: 342
    edited 2008-06-18 21:55
    Chris Savage (Parallax) said...
    I have a few projects that don’t really need this but have an LCD and SPI interfaces on them already. I may do something with it just to have an example using the BASIC Stamp.

    Could you do an example with the Prop instead? All of the examples seem to be for the BASIC Stamp and there are enough differences between the two to require separate examples.
Sign In or Register to comment.