100 +/- inputs and outputs (analog?)

Gefu

Member
Hello everyone,

I have been reading a post thread from July 1st, 2019 labeled Best way to expand the number of Digital Outputs on Teensy 3.6 that got me wondering if the MCP23017 - i2c 16 input/output port expander that MichaelMeissner suggested could be used for analog signals too. The signal going to the Teensy in my project come from either phototransistors or photodiodes, so I am not sure how the MCP23017 would do with that kind of signal if anything. The outputs will route out of the Teensy toward small lights, probably 1.1V DC tungstens or similar, so analog again. The output can be amped up to properly illuminate the bulbs. I initially thought I would route all the signals into Logic Pro but it seems that the export/output will be limited and the hardware needed is not realistic for my design, however I am still keen on the possibilities of recording the signals as MIDI. With a DAW in mind, I would like to be able to modify the signal and record it to be worked/modified in other places and times. PaulStroffegen posted something about the code for a Teensy being adjusted to handle lots and lots of audio signals, which might also be a great path to try too. At this point I have the receivers (photodiodes/phototransistors) and emitters (low voltage bulbs with a bit of amp boosting) worked out but I have no idea what signal processing gear would work best in the middle, especially with the desirable side path to a DAW for processing along the way. Any ideas or questions would be greatly helpful and much appreciated.

Cheers,
Gef
 
Hi Gef

Those expansion devices over I2C will not be much good at all for analog signals. They are really suitable for low speed digital IO. There are SPI versions of these devices available that can obviously increase the update bandwidth however this still would be poor.

It looks like you are trying to use this approach for both inputs and outputs, which these devices can support (as digital).

If you can specify your requirements a bit more clearly we can likely assist.
 
Analog multiplexer for the inputs, PWM expander for the bulbs (using white LEDs will greatly simplify driving these lights).
 
Hi Gef

Those expansion devices over I2C will not be much good at all for analog signals. They are really suitable for low speed digital IO. There are SPI versions of these devices available that can obviously increase the update bandwidth however this still would be poor.

It looks like you are trying to use this approach for both inputs and outputs, which these devices can support (as digital).

If you can specify your requirements a bit more clearly we can likely assist.
Hello Strud,

Thanks for the reply. Let me provide some more details. The main function of the system is to capture the movement of hand/arm gestures and replay those in a sort of projection made up of tiny bulbs. So, when I pass a light source such as the average bicycle lamp in front of the receivers (photodiodes or phototransistors) that have been set up in a grid, the motion and intensity of the light will be registered in the signal from all of the inputs. I have been experimenting with the photodiodes and phototransistors set up in stereo and fed into a small mic/line in amplifier to listen the stereo sound different light sources produce through various photo sensors. So, that should give you some idea of the incoming signal characteristics. As for output, I have been using a small breakout headphone amp to change audio out to varying intensities Voltage and micro-amperage) from small incandescent bulbs. There are 2 reasons I prefer incandescent over LED. First, the warm glow and range of intensity is more appealing than any LED I have seen and second the incandescents work very well with all of the photo sensor components I have tried where LEDs are hit and miss and sometimes do not work at all or produce a noisy hum. For reference I am using photo sensors that are sensitive to the visual spectrum, not infrared or ultraviolet.
The next challenge in this system is finding a suitable processor for the reception and distribution of the 100 in and outs. Ideally, I will be able to process the signal(s) for more creative purposes too such as adding delay and the range of standard audio effects, that is why I mention having a way to use a DAW in the signal path to play with and record/send the audio/visual in a platform I am familiar with. As for analog to digital conversion, some small and inexpensive components such as the ADS11115 16-BIT ADC look quite interesting but I am really not sure which of the abundant options would be most effective in handling the large combination of fairly simple signals my project would require.
I hope that clarifies some of the overall goals in this design. Thanks once again for any advice! I am going to keep tinkering and having fun.

Gef
 
Analog multiplexer for the inputs, PWM expander for the bulbs (using white LEDs will greatly simplify driving these lights).
Hello MarkT,

Analog multiplexer... PWM expander.... OK! I will have a look and see what I can find. Thank you for the information.

Gef
 
Hello Strud,

Thanks for the reply. Let me provide some more details. The main function of the system is to capture the movement of hand/arm gestures and replay those in a sort of projection made up of tiny bulbs. So, when I pass a light source such as the average bicycle lamp in front of the receivers (photodiodes or phototransistors) that have been set up in a grid, the motion and intensity of the light will be registered in the signal from all of the inputs. I have been experimenting with the photodiodes and phototransistors set up in stereo and fed into a small mic/line in amplifier to listen the stereo sound different light sources produce through various photo sensors. So, that should give you some idea of the incoming signal characteristics. As for output, I have been using a small breakout headphone amp to change audio out to varying intensities Voltage and micro-amperage) from small incandescent bulbs. There are 2 reasons I prefer incandescent over LED. First, the warm glow and range of intensity is more appealing than any LED I have seen and second the incandescents work very well with all of the photo sensor components I have tried where LEDs are hit and miss and sometimes do not work at all or produce a noisy hum. For reference I am using photo sensors that are sensitive to the visual spectrum, not infrared or ultraviolet.
The next challenge in this system is finding a suitable processor for the reception and distribution of the 100 in and outs. Ideally, I will be able to process the signal(s) for more creative purposes too such as adding delay and the range of standard audio effects, that is why I mention having a way to use a DAW in the signal path to play with and record/send the audio/visual in a platform I am familiar with. As for analog to digital conversion, some small and inexpensive components such as the ADS11115 16-BIT ADC look quite interesting but I am really not sure which of the abundant options would be most effective in handling the large combination of fairly simple signals my project would require.
I hope that clarifies some of the overall goals in this design. Thanks once again for any advice! I am going to keep tinkering and having fun.

Gef
Hi Gef,

Can I suggest that you split your text into paragraphs as I have shown below. Like using the </> button when placing code into a post, it makes what you are saying more manageable to read.

Best of luck with your project.

Thanks for the reply. Let me provide some more details.

The main function of the system is to capture the movement of hand/arm gestures and replay those in a sort of projection made up of tiny bulbs.

So, when I pass a light source such as the average bicycle lamp in front of the receivers (photodiodes or phototransistors) that have been set up in a grid, the motion and intensity of the light will be registered in the signal from all of the inputs.

I have been experimenting with the photodiodes and phototransistors set up in stereo and fed into a small mic/line in amplifier to listen the stereo sound different light sources produce through various photo sensors.

So, that should give you some idea of the incoming signal characteristics.

As for output, I have been using a small breakout headphone amp to change audio out to varying intensities Voltage and micro-amperage) from small incandescent bulbs.

There are 2 reasons I prefer incandescent over LED.

First, the warm glow and range of intensity is more appealing than any LED I have seen and second the incandescents work very well with all of the photo sensor components I have tried where LEDs are hit and miss and sometimes do not work at all or produce a noisy hum.

For reference I am using photo sensors that are sensitive to the visual spectrum, not infrared or ultraviolet.

The next challenge in this system is finding a suitable processor for the reception and distribution of the 100 in and outs.

Ideally, I will be able to process the signal(s) for more creative purposes too such as adding delay and the range of standard audio effects, that is why I mention having a way to use a DAW in the signal path to play with and record/send the audio/visual in a platform I am familiar with.

As for analog to digital conversion, some small and inexpensive components such as the ADS11115 16-BIT ADC look quite interesting but I am really not sure which of the abundant options would be most effective in handling the large combination of fairly simple signals my project would require.

I hope that clarifies some of the overall goals in this design. Thanks once again for any advice! I am going to keep tinkering and having fun.
 
You could consider using an ATtiny 212, one for each channel.
They have A/D and D/A.
At $0.43 they are cheap enough to allow 1 per each of the 100 channels.
See article below:
 

Attachments

  • Getting Started with the New ATtiny Chips.pdf
    360.9 KB · Views: 93
Hello MarkT,

Analog multiplexer... PWM expander.... OK! I will have a look and see what I can find. Thank you for the information.

Gef
I agree with Mark.

For the inputs you'd need A/D, but how fast? What is the 'sample rate'?
Multiplexing should work fine for many inputs: you just basically read them one by one. One A/D could suffice, but that depends on the speed I guess.
The idea is:
  • input 1...n into x multiplexers (the switch towards the inputs of course) . If you use CD4051 (8 to 1), you'll need 13 of these. They cost less than a euro/dollar.
  • steer them with some logic. You will need 4 bits for that.
  • all outputs lead to Rome = the A/D converter. Maybe you'll need 3 other multiplexers to do so in a tidy way. But some R's and one opamp might do the trick as well.
  • For the A/D I would take some SPI or I2C chip, or just use the built in A/D
  • The software must set the input to read, read it and go to the next. 100 cycles should be fast enough to track you movements and have enough time left to do the rest (processing them and whatever you want to do)
For the other side you work with light, and that often must be PWM-ed anyway, so you don't need a D/A there, in the sense that you need 100 different voltages, or?

If you'd need a 100 Voltages, then you would need some analog S&H chips like SMP08, after the D/A. But 100 fastly blinking PWM signals are much easier. (The MCP23017 is basically a sample and hold too, but digital, so only two values.)
 
Agreed, normally lights are driven with PWM (or other pulsing waveform techniques) rather than true analog signals. This is especially true for incandescent bulbs which need more power than LEDs and don't actually blink when the pulse duration is faster than the heating or cooling of the filament.

But high power PWM can cause a lot of headaches for analog signals, especially if you don't plan the ground wiring well. You especially want to keep "analog ground" as separate as possible from the "digital ground" wires that carry those large pulsing currents.
 
Hello Strud,

Thanks for the reply. Let me provide some more details. The main function of the system is to capture the movement of hand/arm gestures and replay those in a sort of projection made up of tiny bulbs. So, when I pass a light source such as the average bicycle lamp in front of the receivers (photodiodes or phototransistors) that have been set up in a grid, the motion and intensity of the light will be registered in the signal from all of the inputs. I have been experimenting with the photodiodes and phototransistors set up in stereo and fed into a small mic/line in amplifier to listen the stereo sound different light sources produce through various photo sensors. So, that should give you some idea of the incoming signal characteristics. As for output, I have been using a small breakout headphone amp to change audio out to varying intensities Voltage and micro-amperage) from small incandescent bulbs. There are 2 reasons I prefer incandescent over LED. First, the warm glow and range of intensity is more appealing than any LED I have seen and second the incandescents work very well with all of the photo sensor components I have tried where LEDs are hit and miss and sometimes do not work at all or produce a noisy hum. For reference I am using photo sensors that are sensitive to the visual spectrum, not infrared or ultraviolet.
The next challenge in this system is finding a suitable processor for the reception and distribution of the 100 in and outs. Ideally, I will be able to process the signal(s) for more creative purposes too such as adding delay and the range of standard audio effects, that is why I mention having a way to use a DAW in the signal path to play with and record/send the audio/visual in a platform I am familiar with. As for analog to digital conversion, some small and inexpensive components such as the ADS11115 16-BIT ADC look quite interesting but I am really not sure which of the abundant options would be most effective in handling the large combination of fairly simple signals my project would require.
I hope that clarifies some of the overall goals in this design. Thanks once again for any advice! I am going to keep tinkering and having fun.

Gef
hi Gef,
I overread your DAW requirement.
You probably think of translating your 100 possible movements into notes, right? Every sensor is one note, and the position to velocity? You would be bound to max 128 positions per sensor and max 128 notes, but that might do. Then you have a (if played as notes) rather cacaphonic piece of music, but you could use some MIDI manipulation maybe.
If you want audio, I am not so sure what to do... Make 100 tracks of it? Because you want to be able to keep them apart... I guess. But maybe not.

I would maybe stay in the Teensy and so some things there... write your own 'effects' on this kind of strange data-medium :)

Or something inbetween. Depends on how many groups of lights you want to control... You can also make them frequency dependent and translate for instance 8 sensor signals into notes spread across the 8 octaves. And then output 13 channels of MIDI-notes.

MIDI is bound to 16 channels I am afraid. Although MIDI 2.0 can maybe handle more. But Paul, can the MIDI libraries already handle that? (Didn't look into it yet, so I am sorry to just bluntly ask.... :) )

So, the MIDI goes into the DAW and plays it into something audible. No matter if it's beautiful, as long as it's kind of spread across the octave (not too sharp tones), you can 'decipher' it later again by filtering (like a vocoder and a frequency graph meter do). Then you can do effects on any channel as you wish.

An audio interface with sufficient channels can then give you the output you need to drive your lights. Then the signal flow is:
  1. sensors multiplexed into Teensy
  2. Teensy converts to MIDI
  3. MIDI into DAW
  4. DAW makes sound of it + effects
  5. Audio interface outputs go to light drivers
Hope that helps. My advice is to draw it...
 
Last edited:
Hi Gef,

Can I suggest that you split your text into paragraphs as I have shown below. Like using the </> button when placing code into a post, it makes what you are saying more manageable to read.

Best of luck with your project.
Hi BriComp,
Yes indeed, paragraphs would be useful. Duly noted.

The ATtiny 212 looks interesting to check out for this and other projects as that price is unbeatable. I'll pick up a few and see what I can do with them. Thanks for the suggestions.
 
hi Gef, did you get any further? Did your advice help?
Hello Mark,
That you for the detailed advice. I have been organizing a move back to the US, so sorry for the delay. I have put the project to the side for a bit. Tomorrow I am going to Akihabara in Tokyo to see what the Teensy prices are and look around at this and that. I will print your 2 most recent posts, read them on the Shinkansen to properly digest that information and reply point by point. I really appreciate the ideas and pointers.

Talk soon~
 
Agreed, normally lights are driven with PWM (or other pulsing waveform techniques) rather than true analog signals. This is especially true for incandescent bulbs which need more power than LEDs and don't actually blink when the pulse duration is faster than the heating or cooling of the filament.

But high power PWM can cause a lot of headaches for analog signals, especially if you don't plan the ground wiring well. You especially want to keep "analog ground" as separate as possible from the "digital ground" wires that carry those large pulsing currents.
Hello Paul,
That you for the comment. Regarding the lights, I can see many LED lights rapidly blinking when I move my eyes quickly, especially horizontally such as when driving at night to check side mirrors before changing lanes. So, although the LED selections are superior in size options, price and power consumption, I have to avoid any of that distracting blinking pattern in this project, as the illumination will be tracking/mimicking gestures, thereby assuring rapid movements of the eye in coordination with the illuminated shapes that those gestures are intended to create.

That said, let me ask a silly question. Are you saying that incandescents can be powered equally well with PWM due to the slow decay of the glowing filament, and so a digital signal can also be used to power incandescents? That would make a lot of this design easier to build. I have analog stuck in mind as the way to go forward, as my experience in electronics is based on audio. Is the output from a phototransistor also analog and in need of a ADC per transistor?

By the way, I am going to check some of the electronic retailers in Tokyo this weekend. Hopefully I can find a Teensy 4 or later. Wish me luck!
 
Not sure if I understand your reasons against LEDs. Using WS2812 or WS2811 LED pixels would be technically much easier than building so many outputs with PWM for analog signals. You could have full control of color, fading times and would be flexible to use simple or more complex effects. Only one data line is necessary to drive a few hundred LEDs.
 
Hello Tom,
Thank you for reply. There are many benefits to using LEDs for sure but I can see a difference in overall warmth, color and smooth transition in glow/intensity compared to incandescents. I guess the best way to see the overall results will be to simply build both systems and compare.
 
Hello Tom,
Thank you for reply. There are many benefits to using LEDs for sure but I can see a difference in overall warmth, color and smooth transition in glow/intensity compared to incandescents. I guess the best way to see the overall results will be to simply build both systems and compare.
I see it as decision about aesthetics. Of course there are differences. If the higher effort is it worth for you that's great. I like that you are putting so much passion in your project.
Looking forward to seeing the result!
 
I see it as decision about aesthetics. Of course there are differences. If the higher effort is it worth for you that's great. I like that you are putting so much passion in your project.
Looking forward to seeing the result!
Aesthetics indeed takes precedence over all for me. Your message is very kind. I'll show you when it's all in order!
 
Sorry for the type errors.

For people learning to write Chinese/Japanese characters, the order and of brush or pen strokes is very important to the production of legible and elegant characters. So when the photosensor array detects the approaching brush (tiny illumination source) some sensors will begin sending a low voltage, which will sort of domino along the single stroke gesture and fade out at the ends. Each single stroke must indicate the speed and pressure sensitivity, achieved by having the lights copy the human gesture as accurately as possible considering the relatively low resolution. Now, assign that first stroke gesture a MIDI group, and it can be likewise made to sound like a sequence counting such as "One, two, three." or nothing at all. When a character needs about 12 strokes (nearing MIDI maximum) to correctly write it, that character's set of gestures can be sent to anyone for study, disassembly and whatever the end user wants. Now, consider that kind of gesture tracking system expanded into the 3D field and used to record the gestures of an orchestral conductor. The applications are limited only by our imaginations.
 
Back
Top