1. Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.
    Dismiss Notice

Interfacing Arduino with LM3915

Discussion in 'Arduino' started by ClydeCrashKop, Apr 8, 2016.

  1. ClydeCrashKop

    ClydeCrashKop Well-Known Member

    Joined:
    Apr 28, 2005
    Messages:
    1,018
    Likes:
    171
    Location:
    Florida
    ONLINE
    After searching the internet, I got a lot of clues but no answer. Here is the answer.

    The LM3915 bar / dot display driver wants an analog input up to 1.25 volts where the tenth LED comes on.
    Arduino analog output is actually PWM at 5 volts, using a 5 volt supply.
    This gets a smooth voltage between 0 v. & 1.25 volts.
    If it matters, I am using a 1K resistor between the pins 6&7 pair and ground on the LM3915.

    Arduino PWM RC filter.jpg
     
    Last edited: Apr 8, 2016
    • Informative Informative x 1
  2. fezder

    fezder Well-Known Member

    Joined:
    Dec 11, 2011
    Messages:
    1,665
    Likes:
    100
    Location:
    Mikkeli, Finland
    DAC would be another option but perhaps overkill :D
     
  3. MikeMl

    MikeMl Well-Known Member Most Helpful Member

    Joined:
    Mar 17, 2009
    Messages:
    11,049
    Likes:
    541
    Location:
    AZ 86334
    A more detailed analysis:

    I account for the Atmega328's Digital Port Pin output impedance and the LM3915's input bias current. If the PWM frequency is 490Hz, here is the startup (full scale pwm=255) settling time and final value (a bit too high if pwm=255). A pwm value = 202 gets above V(in)=1.25V:

    364.gif

    Here is the ripple after settling with pwm=127 (half scale, worst case):

    364a.gif
     
    Last edited: Apr 11, 2016
  4. dave

    Dave New Member

    Joined:
    Jan 12, 1997
    Messages:
    -
    Likes:
    0


     
  5. ClydeCrashKop

    ClydeCrashKop Well-Known Member

    Joined:
    Apr 28, 2005
    Messages:
    1,018
    Likes:
    171
    Location:
    Florida
    ONLINE

    Thanks MikeMI
    25mV ripple is pretty good. Does the LM3915 mind getting 1.6 volt input?
    "Input Signal Overvoltage ±35V. Pin 5 input current must be limited to ±3 mA. The addition of a 39k resistor in series with pin 5 allows ±100V signals without damage."
    Am I okay there?

    I am using a MSGEQ7 connected to the analog 0 input of a Arduino Uno. I am sending the 5 lower frequency volume signals with PWM to 5 LM3915 chips which drive 5 columns of bright white 10 LED bar graph displays. It looks great with fast flashes to the beat and notes. The 50 LEDs are mounted in holes from the back of a 8" wide X 10" high sheet of Plexiglas. I intend to add colors when I find tinted plexi, plastic or cellophane. It will fit into a clear box type picture frame.
     
    Last edited: Apr 11, 2016
  6. MikeMl

    MikeMl Well-Known Member Most Helpful Member

    Joined:
    Mar 17, 2009
    Messages:
    11,049
    Likes:
    541
    Location:
    AZ 86334
    Measure the ripple with pwm=128?

    Write a test program that slowly changes the pwm value from 0 to 255 in steps of 1 { for(pwm=0;pwm<256;pwm++}, dwelling on each value about 1sec {millis(1000) so it takes 256 sec to cycle from zero back to zero}. Watch the LEDs. How long do two adjacent LEDs overlap before you get only one on?
     
  7. ClydeCrashKop

    ClydeCrashKop Well-Known Member

    Joined:
    Apr 28, 2005
    Messages:
    1,018
    Likes:
    171
    Location:
    Florida
    ONLINE
    Filter ripple test.

    LED 1 comes on at PWM 6
    LED 2 comes on at PWM 10, two LEDs are on for 1 second.
    LED 3 comes on at PWM 16, two LEDs are on for 1 second.
    LED 4 comes on at PWM 24, two LEDs are on for 1 second.
    LED 5 comes on at PWM 35, two LEDs are on for 1 second.
    LED 6 comes on at PWM 50, two LEDs are on for 1 second.
    LED 7 comes on at PWM 70, two LEDs are on for 1 second.
    LED 8 comes on at PWM 100, two LEDs are on for 1 second.
    LED 9 comes on at PWM 140, two LEDs are on for 3 seconds.
    LED 10 comes on at PWM 200, two LEDs are on for 5 seconds.

    The last 2 fade in and out gradually.
    It looks good this way in dot mode but LED #1 stays on dim when higher ones are lit.
    I have pin 9 wired to pin 11 as per the data sheet for dot mode.
    I may go back to bar mode but that abuses my 7805 1 amp regulator with a lot of LEDs lit.
     
    Last edited: Apr 19, 2016
  8. MikeMl

    MikeMl Well-Known Member Most Helpful Member

    Joined:
    Mar 17, 2009
    Messages:
    11,049
    Likes:
    541
    Location:
    AZ 86334
    Read through this forum thread for an idea how to create a better filter (which would have just one LED on at a time)...
     
    • Informative Informative x 1

Share This Page