Jump to content

[solved] Encoder problem and other "scratch box" issues


Simson91

Recommended Posts

Hi everyone,

I am trying to build rasteris scratch controller(http://www.midibox.org/forum/index.php/topic,11167.0.html) (I'm amazed by it, respect!) I'm using the first c code he posted (can't use the other new one because of my PIC18F452). I'm almost done and

I just build my encoder with a dual IR photodiode and an IR LED but the only MIDI output (after the one upload request in the beginning that shows that my PIC is up and running) I get is

"CC Bank Select Value: 64"

"CC Bank Select Value: 0 " 

"CC Bank Select Value: 64"

"CC Bank Select Value: 0 "

....when I let the encoder wheel (the one rasteri has avaliable to download in his thread) spin through my encoder.

So in Traktor I can only spin in one direction.

I guess its a problem with the quadrature but I don't know what possibly could be wrong with my encoder, I took a picture of it maybe it can help to find the problem.

http://foto.arcor-online.net/palb/alben/45/749645/1280_6331653336346461.jpg

Here is the link to rasteris wiki to show how my module is build: http://www.midibox.org/dokuwiki/scratchcontroller

I attached the code I am using right now too(thanks for sharing all this rasteri!). I hope this is all the information you guys need.

Thanks for your time,

Simon

main.c

Link to comment
Share on other sites

  • Replies 52
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Posted Images

You were right, I connected pin 2 to ground and the Bank Select disappears. Now I don't get any midi signal. I thought about it and I forgot to ask if the encoder even sends a signal without a crossfader? Because I don't have one connected right now  ::)

Link to comment
Share on other sites

Hi everyone,

All right so I tested a little bit more and I noticed that the voltage at both pins (3 & 4) from 0V when its "off"(the IR LED is covered) only goes up to 0.02V when its "on". Is that even enough for the PIC to notice a change and send data? I accedently connected the 5V in of the photodiode with one of the out pins and I got midi signals like:

"CC Modulation Wheel value: 63

CC Modulation Wheel value: 64

CC Modulation Wheel value: 65

..."

I don't get these just with the encoder wheel though (maybe the low voltage difference from on and off?).

Thanks, Simon

Link to comment
Share on other sites

The voltage should go up a lot more than that, in my case low is 1.5v and high is 4v.

I don't really know what the problem could be. Try it in a bunch of different test circuits and stuff - e.g. maybe it wants ground instead of 5v at its common pin (i.e. stick it in the bottom half of the voltage divider), maybe it wants a different resistor value, etc. It's weird though, it looks IDENTICAL to the one I'm using...

EDIT: Also check the LED is working and wired up properly

Link to comment
Share on other sites

Try it with some other value resistors in a circuit on its own - 500, 1k, 50k, 100k, etc. Try connecting it the other way round (with the common pin to ground and the resistors going to +5v). Or try another photodiode (if you're anything like me you have dozens of old mice lying around).

Just try stuff! That's what I did :P

Link to comment
Share on other sites

I just built a fairly lofi version - printed out 12cm diameter gap thingie (180 evenly spaced gaps), put that between two CDs (removed the metal coating first ;)) and used it with an LED and ptohodiode from an old logitech mouse. Works like a charm. Since I don't have any hardware lying around that I could use to build it into a box, I just stuck the screw that's holding the CDs into a drill :-) Now I can fast forward songs. I can only get the "old" version without the touch sensor to work though. The new one (the Pins 4+5 version) doesn't output anything. I'll have to find out why - this is really fun without it though, too ;D

Link to comment
Share on other sites

I dunno why the new version isn't working, maybe the voltage reference is not suitable for your photodiodes?

Grab the newest (0.025) version of the code, it lets you adjust the voltage reference at the top of the source (COMPARATOR_THRESHOLD). Maybe try setting it to 0x07?

If you just can't get pins 4/5 working at all, the new version also lets you revert to the old ADC behaviour (i.e. using pins 3/4) but still use the touch sensor. Uncomment the line that says #define USE_ADC_ENCODER. (you can also change the threshold for that should you so desire)

Check the other thread http://www.midibox.org/forum/index.php/topic,11167.msg97390.html#msg97390 for the new code

Link to comment
Share on other sites

stryd_one is partially correct. I used the mouse wheel in the first version and the voltags were in a 0.7...3.2V range. With the printed out wheel I get 0.7V and 4.2V so I guess that's not the problem. I'll try the new code and let you know what the results are! Thanks rasteri this thing is fun ;D

Link to comment
Share on other sites

I was afraid mine wouldn't be dark enough, so I printed the whole thing twice :-) That way I can layer them and get it to be darker and by rotating the discs against each other I can also change the gap width.

Link to comment
Share on other sites

Since there wasn't a pdf or anything I just did some math, which seems to have been sorta correct. Rasteri used a disv about the size of a CD I think so the diameter was ~12cm, and he mentioned a number of gaps. So I calculated the width of his gaps from that info, and made my gaps the same width. That way I would have needed ~173 gaps. So I upped that to 180 to make it easier to draw - done. The gaps are evenly spaced (black bars are the same width as the transparent ones) which seems to work nicely.

Link to comment
Share on other sites

There's a double-res encoder wheel here : http://www.midibox.org/forum/index.php/topic,11167.msg97570.html#msg97570

Inkscape is great for drawing this stuff.

I have a bunch more wheels of different sizes + resolutions, just went to a print shop one day and printed out loads. I really need to make a website to hold all these files and stuff. Or get wiki upload access...

Link to comment
Share on other sites

Hihi, yeah the simplicity of that thing totally threw me off as well. But since I couldn't get the updated version to work in the first pace (I even changed the source to ouput any changes from the wheel to the MIDI Out no matter if it was touched or not) I can't really tell you if my touch sensor works...

Link to comment
Share on other sites

I tried a couple more things with my touch sensor but it probaly can't work like it is now. I measured 4.15 V at RD1 which is connected through a 47k resistor to RD4 (J14) behind the 47k resistor I measured only 0.01V  ??? which is probaly not enough to get any signal out of the PIC. Does anyone know what voltage it has to be on RD4 and how it should change if I touch the little wire I put behind the 47k resistor to get a signal?

Thanks

Simon

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...

×
×
  • Create New...