Multiplexing 8 analog inputs using a CD4051B - Page 2
Page 2 of 6 FirstFirst 123456 LastLast
Results 11 to 20 of 57
  1. #11
    Tech Guru Steve Zorilow's Avatar
    Join Date
    Apr 2010
    Location
    Montréal, Québec, Canada
    Posts
    1,233

    Default

    Quote Originally Posted by kilobytekaushik View Post
    Is there any way for multiplexing leds?
    There's quite different ways to do that depending if you want to have only 1 led at the time or a combination of ... even all ON.

  2. #12
    Tech Mentor sidetrakd's Avatar
    Join Date
    Oct 2010
    Location
    Ireland
    Posts
    356

    Default

    Very interested in this! It changes my whole design.

  3. #13
    Tech Mentor sidetrakd's Avatar
    Join Date
    Oct 2010
    Location
    Ireland
    Posts
    356

    Default

    Fatlimey how well is this working in your tests?I should have parts next week for my own expansion project and was wondering if i could get some more info on the firmware changes.My brother whos a software engineer said it wont be any problem but any info you may have would be appreciated
    Thanks

  4. #14
    Tech Guru Fatlimey's Avatar
    Join Date
    Mar 2008
    Location
    Redmond, WA
    Posts
    1,169

    Default

    Quote Originally Posted by sidetrakd View Post
    Fatlimey how well is this working in your tests?I should have parts next week for my own expansion project and was wondering if i could get some more info on the firmware changes.My brother whos a software engineer said it wont be any problem but any info you may have would be appreciated
    Thanks
    The instructions for building the firmware are on a Sticky thread in this forum.

    The changes you need are (I'm remembering the function and variable names off the top of me head here, so check the source):

    1. Change three of the digital input ports to be outputs. You do this using the DDRD register (Data Direction Register for Port D)
    2. You add 8 analog inputs to the g_exp_analog_prev[] array (global, expansion, analog previous value), giving you a total of 11. This array hold the previous analog value so we can see if the knob has moved since we last checked.
    3. To fill the g_exp_analog_prev[] array you need to replace one of the "read_analog(0)" calls with a short loop that sets the PORTD bits to tell the 4051 which input to connect to the output, then executes a read_analog(0).
    4. Finish filling the analog reads using the normal "read_analog(1); read_analog(2); read_analog(3);"
    5. Make the same changes in the main loop where it fills the array "analog_value[]";
    6. In the main loop where it outputs CC values for analog changes, alter any loop from 0..4 to a loop over 0..NUM_ANALOG, where you define a global NUM_ANALOG to be 11.
    7. erm, that's it.


    That's pretty much it. You'll be generating CCs in groups of two per knob starting from CC16. Oh, and you have to make sure the MIDI NoteOn numbers for your smart faders don't clash with any notes used by the keypad.

  5. #15
    Tech Mentor sidetrakd's Avatar
    Join Date
    Oct 2010
    Location
    Ireland
    Posts
    356

    Default

    Thanks a million!! Im getting excited and cant wait for my parts to arrive

  6. #16
    Tech Mentor sidetrakd's Avatar
    Join Date
    Oct 2010
    Location
    Ireland
    Posts
    356

    Default

    Fatlimey i was wondering whats the easiest way to add more leds to the midifighter?With the extra buttons im adding i could really use a few more leds? Any suggestions?

  7. #17
    Tech Guru Fatlimey's Avatar
    Join Date
    Mar 2008
    Location
    Redmond, WA
    Posts
    1,169

    Default

    We have four techniques:

    1. add another LED controller to the chain. Some tricky resoldering in there.

    2. Use the digital inputs also as outputs. For most of the time you output the LED state through the pin, remembering to set the PORTD and DDRD registers to enable the internal pull-up resistor. When it comes time to poll the switch, the output is turned into an input, the switch is read then the port is switched back to output. Do this quick enough and the LED will appear constantly on.

    3. Add another small microcontroller that will read the button states and set the LED itself, independent of what the main CPU is doing. The main CPU never sees or knows anything about these LEDs, and their state is updated by the second micro. Cheaper than you might imagine.

    4. Do option 3, but but the micro on an SPI or I2C bus as a slave, so that it reads instructions sent by the main controller. This way the main machine controls the lights indirectly by sending instructions to a slave processor. The protocol need not be complex, just send bytes with a bit set for each LED.

  8. #18
    Tech Guru MiL0's Avatar
    Join Date
    May 2009
    Location
    Brighton / Bangkok
    Posts
    1,386

    Default

    what's the theoretical maximum number of analogues using a multiplexer?

    also, is encoder support possible? this teensyduino-based controller looks like it uses one: http://www.noisybox.net/electronics/dickhole_keypiss/

  9. #19
    Tech Mentor sidetrakd's Avatar
    Join Date
    Oct 2010
    Location
    Ireland
    Posts
    356

    Default

    Quote Originally Posted by MiL0 View Post
    what's the theoretical maximum number of analogues using a multiplexer?
    8 per multiplexer,1 multiplexer per analogue input so 32 in total.as far as I can figure that's it for the simple solution.as for encoders I have no idea

    I'm still waiting on a few parts and need to re-order my multiplexers(accidentally got the wrong ones and they're so small its hard to see them LOL) and then we'll see what mad controller the midifighter can morph into!

  10. #20
    Tech Mentor sidetrakd's Avatar
    Join Date
    Oct 2010
    Location
    Ireland
    Posts
    356

    Default

    ok so i have multiplexers wired up and am getting some odd results,seems like im getting notes of F-1, F#-1 G-1. If i turn on midi learn in traktor it seems like its constantly scrolling through the notes.Have i missed something? Any advice?

Page 2 of 6 FirstFirst 123456 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •