<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">I have done a few designs of IR remote controls and receivers in the past. You will not believe how much IR interference you can have from regular lighting inside your home/lab.<div class=""><br class=""></div><div class="">So perhaps you should consider modulating the IR LEDs with a certain carrier frequency. If you use microcontrollers (as I mentioned in the other post) directly connected to each IR phototransistor, carrier detection in software should be possible. At least you have the option to add this in the future.<div class=""><br class=""></div><div class="">Regular IR remote controls usually have a 35-60 kHz carrier wave. There exist all in one IR receiver chips that include a bandpass filter, e.g. <a href="https://www.vishay.com/en/ir-receiver-modules/" class="">https://www.vishay.com/en/ir-receiver-modules/</a></div><div class=""><div><br class=""></div><div>By the way, here is another option you could look at: time-of-flight sensors, e.g. <a href="https://www.st.com/en/imaging-and-photonics-solutions/time-of-flight-sensors.html" class="">https://www.st.com/en/imaging-and-photonics-solutions/time-of-flight-sensors.html</a> Not sure if the resolution is good enough though.</div><div><br class=""></div><div>Ben</div><div><br class=""><blockquote type="cite" class=""><div class="">On 16 Aug 2022, at 15:20, Jean-Pierre Desrochers <<a href="mailto:jpdesroc@oricom.ca" class="">jpdesroc@oricom.ca</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div class="">Thanks Brian for your neat suggestions.<br class="">Yes, my mistake about the 8x8 = 64 reads and...  the 90 PT's I need.. !!!<br class="">The suggestion of using 6 columns of 15 rows (16 bits port) is a good one.<br class="">Much faster response. A PIC18 will do nicely on that.<br class="">And about the IR leds, well They will always be ON, connected on the main VCC.<br class="">I don't need any switching on them..<br class="">I will need a complete row of around 60 of them to spread over all the 88 + 2 = 90 possible paper holes. <br class="">That's around 12 inches long.<br class="">Each IR led will not align correctly to each of the  90 holes<br class="">but that's not a problem. The row of IR overall light is what it's needed over the scrolling paper<br class="">to get through each scrolling paper holes and get 'caught' by the underneath holes<br class="">in the brass reading bar that the paper scrolls on.<br class="">Each of the brass bar holes will house 1mm optic fibers (around 1 foot long)<br class="">That will be glued in place and pushed flush to the bar's front surface.<br class="">The fiber's other end will face a phototransistor. All of this inside black shrinkable tubing.<br class=""><br class=""><br class=""><blockquote type="cite" class="">-----Message d'origine-----<br class="">De : brianw <<a href="mailto:brianw@audiobanshee.com" class="">brianw@audiobanshee.com</a>><br class="">Envoyé : 15 août 2022 21:31<br class="">À : Jean-Pierre Desrochers <<a href="mailto:jpdesroc@oricom.ca" class="">jpdesroc@oricom.ca</a>><br class="">Cc : <a href="mailto:Synth-diy@synth-diy.org" class="">Synth-diy@synth-diy.org</a><br class="">Objet : Re: [sdiy] Reading IR phototransistors in a 8X8 matrix<br class=""><br class="">I've not designed any photosensitive circuits, but my first concern is the<br class="">settling time of the phototransistor after the light source disappears (turns<br class="">off). Perhaps photoresistors are the technology that has a long settling time.<br class="">MIDI optoisolators are based on phototransistors, and they switch very<br class="">quickly, so perhaps it's not an issue.<br class=""><br class="">You'd have to plan for the speed of the piano roll, the spacing between<br class="">notes, and the rate that you'd need to scan in order to catch all transitions.<br class="">Longer settling times will require a slower scan rate, but hopefully the scan<br class="">rate would still be high enough to catch everything.<br class=""><br class="">I see that you mentioned 90 phototransistors, but only described an 8x8<br class="">matrix. You'd only be able to scan 64 PT elements from an 8x8, so you'll need<br class="">12 columns of 8-bit rows. I've done 13x8 and 14x8 matrix designs on a<br class="">Microchip USB-capable PIC18, so there should be no problem. One<br class="">suggestion, rather than have more 8-bit rows, resulting in lots of columns,<br class="">and thus long gaps between updates of the same coordinate; I had good luck<br class="">increasing the row beyond 8 bits to read a pair of ports. That allows 16-bit<br class="">rows (although I happened to choose ports where only 14 pins were<br class="">available, but 14 is still a lot more than 8). You could scan 6 columns of 15 (or<br class="">16) bit rows and reach your 90 PT array. Having only 6 columns means that<br class="">the gap between scans of the same column is much shorter than with 8 or 12<br class="">columns. Once a column is energized, it's fairly quick to read a couple of input<br class="">ports, rather than just one input port, before disabling the column and<br class="">energizing the next.<br class=""><br class="">Another hint is that you only ever need to energize one column at a time, so<br class="">you do not actually need one output port pin per column. With an external<br class="">decoder chip (discrete logic function), you can use just 3 output pins to select<br class="">1 of 8 possible column circuits. Even if you only need 6 columns, you can still<br class="">use the 1-of-8 decoder to control 6 columns from 3 output bits.<br class=""><br class="">Depending upon the current used for the IR LED drivers, you might want a<br class="">4th output pin to disable all columns, otherwise stopping the firmware might<br class="">overdrive the LED. This is only necessary if you're trying to exceed the 20 mA<br class="">limit of the typical LED, and instead using the 1/6 PWM of the column<br class="">scanning to keep the average current within check. If your 10kΩ resistors are<br class="">enough to keep the LED current below the data sheet DC limits, then you can<br class="">leave the decoder enabled at all times and save an output pin.<br class=""><br class="">It's not that I think you'll run out of GPIO pins, necessarily, but the fewer pins<br class="">that you need to update per scan step, the faster your code will run. I've had<br class="">good luck writing the LED matrix driver in a PIC assembly language interrupt<br class="">routine, while the rest of the code was in the C Language for ease of<br class="">development. The assembly interrupt uses the least amount of CPU cycles,<br class="">allowing the main code to run at nearly 100% speed, despite the interrupts.<br class=""><br class="">Brian Willoughby<br class=""><br class=""><br class="">On Aug 15, 2022, at 12:00 PM, Jean-Pierre Desrochers <<a href="mailto:jpdesroc@oricom.ca" class="">jpdesroc@oricom.ca</a>><br class="">wrote:<br class=""><blockquote type="cite" class="">I'm designing a piano Roll reader/player (yes antique paper piano<br class="">rolls !) that will read holes on a scrolling paper and play the actual<br class="">musical notes using MIDI standards..<br class="">This has already been done in the past but with very few<br class="">documentations left for DIYers like me.<br class="">So.. I'm thinking of using IR (940nm) LEDs, phototransistors and<br class="">aligned short optical fibers to read the actual scrolling holes. 90<br class=""></blockquote>phototransistors will be used as 'bit' readers.<br class=""><blockquote type="cite" class="">I would use IR because paper is mostly opaque to 940nm wavelength<br class="">compared to visible light that could get through it.<br class="">Because of that high quantity of PT’s to be read I was thinking of<br class="">using rows/columns matrix of switches like keyboards in synths like this:<br class=""><br class=""><image004.png><br class="">But instead of switches like in this circuit I would use 2 pins phototransistors<br class=""></blockquote>like this one:<br class=""><blockquote type="cite" class=""><image001.png><br class=""><br class="">The resistors could be around 10K and this configuration would use only 2 x<br class=""></blockquote>8 bits ports.<br class=""><blockquote type="cite" class="">But I was wondering about using PT’s in a matrix like that would bring<br class="">glitches or noise In the CPU readings..<br class="">Has anybody used PT’s in such a circuit ?<br class=""></blockquote></blockquote><br class=""><br class="">_______________________________________________<br class="">Synth-diy mailing list<br class=""><a href="mailto:Synth-diy@synth-diy.org" class="">Synth-diy@synth-diy.org</a><br class="">http://synth-diy.org/mailman/listinfo/synth-diy<br class="">Selling or trading? Use marketplace@synth-diy.org<br class=""><br class=""></div></div></blockquote></div><br class=""></div></div></body></html>