Jump to content

New design


Guest kostix
 Share

Recommended Posts

Hello guys!

well, recently i decided to try and build a midi controller, but starting from zero..

what i wanted is to have 8 knobs, analog ones, and 3 seven segment delays per knob, to show the value

2 additional displays to show which mode the box is in: if they're off, it means that actual midi value is sent

if it display "Ch" then u can change the midi channel on the knob u turn, and the 3rd is "Cc", where u can change the controller number on the knob. the modes are changed when u press 2 buttons, one for channel another one for controller number. and there is a 3rd button available, which is "assign",  when u r pressing "channel" button for example, hold it down , turn a knob to select its channel, and press "assign" , the midi channel will be assigned to the knob. same for cc.

so i designed a board, with the 26 displays, driven by 3 latches (74HC373) and a little main board consisting of a 18F452 , running at 10mhz with 4x PLL option on

i wrote the program on HiTech PIC C18

the display is working great, i put it on the tmr0 interrupt. with the driver i wrote, i only have to fill an array with appropriate data and its displayed.

using the 10bit adc, i connected the 8 pots to the pic directly. i'm using another interrupt to read the knobs, and when knob position has changed then send midi data.

but i am having a BIG problem with jittering

to get a relatively stable value i have to do more than 64 samples averaging, which takes a lot of time, so i'm loosing the speed at which midi is sent.. therefor - resolution.

i am wondering what could anyone suggest me to do to get rid of the jittering.  i've been messing with this 5 days straight non stop, and still no luck :(

what i have is a bidimentional array, one value holding knob index, the other the average index

i tried doing it all the possible ways

first fill in all samples for knob 1, then average and if different than previous averaging, then send data. then go to next knob

also tried filling sample 1 for every knob, then sample 2 for every knob etc, and then average

still no luck

its too slow

i've been considering the idea of writing this in assembler, but i have really little experience with it so i am not sure it will be in any way efficienter.

how do people usually go in these situations ?

i can imagine there are different ways of cleaning up an unstable signal, but i'm running out of ideas...

any suggestion is welcome

cheers

Link to comment
Share on other sites

Hi Kostix,

a simple solution (which I've used in MIOS) is to define a so called "deadband" in within a value change won't trigger a new (MIDI) event. Here the pseudo code (not tested, since the original one is written in assembler)

   if( abs(new_value-value) > deadband)
   {
      value = new_value;
      notify_value_change();
   }

(abs() returns the unsigned absolute value)

of course, the penalty of this solution is a redocued effective resolution - on the other hand it doesn't produce additional delays and is very memory friendly (you only need to store the last sent value once...). A deadband of 1..3 is mostly sufficient, even when multiplexers are used on the analog inputs

Best Regards, Thorsten.

Link to comment
Share on other sites

You are a life saver !

I cannot believe how simple this is, and it works perfectly!

At last it works, i was so desperate.

my ADC reading interrupt now looks like this:

// Take a sample

GODONE=1;

while(GODONE) continue;

// Divide the 10bit value by 4 to get 8bits

newvalue[knob] = ((256*ADRESH)+ADRESL)>>2;

// Check if different than old

if(abs(newvalue[knob] - oldvalue[knob]) > 1)

{

  oldvalue[knob] = newvalue[knob];

  finalvalue[knob] = newvalue[knob]>>1; Shift for 7bits

  newdataready[knob] = 1;

}

// Increment knob, select ADC Channel

knob=(knob+1)&7;    // Increment and rollover

select_chan(knob);

I can go on now and finish the rest of the coding, and build the box :)

I have another question:

my displays datasheet says that they support Forward Peak current of 150mA, and this is at duty cycle of 1:10.

my design has 26 displays , 3 latches and 9 transistors to turn on the common anode, so basically i am lighting 3 displays at once. i believe this gives me a duty cycle of 1:9 moreless. How do I calculate the value of the segment resistors to use on the leds, to have maximum brightness , without damaging them in anyway ?

Thorsten, you've been an inspiration to me over these years. Its great to see the progress you are achieving, and personally, this kind of work just pushes me to do something that i've always liked - the electronics.

thanks for your help :)

and keep up the good work!

Cheers!

Link to comment
Share on other sites

I fear that there is no simple formula to calculate the required resistor values for muliplexed LEDs, because the brightness has a non-linear curve which you maybe can read in a datasheet (if it exists...). So, just try out different values :)

Best Regards, Thorsten.

Link to comment
Share on other sites

Hey, thanks for the quick reply!

alright I'll experiment and see what is good

the board is looking nice :)

http://www.avantel.net/~kostix/display_pcb_finished.jpg

http://www.avantel.net/~kostix/display_pcb_finished_(bottom).jpg

also some pics of the 2 midibox plus i built (slightly outdated,  i added an LCD to the wooden one, and on the metalic, i changed the front panel with one made out of 3mm wood, added the bank selector switches and 8 buttons)

http://www.avantel.net/~kostix/box/

sometimes the images wont open ok from the page, but try several times and they should appear

Thanks again ;)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...