Help with my first project, sinewave generator

Status
Not open for further replies.

eduds

New member
Hi everyone, I'm new here and new with teensy
I want to start a project, a sinewave instrument "theremin like", but controlling the pitch with a softpot and the volume with a distance sensor.
I don't know almost anything about programming and electronics buy I want to learn and I think this project is what I need to start, sorry if I ask stupid questions:

Could teensy audio library generate a continuos pitch glide?
Do I need the audio board or could be done without it? I read something about teensy having a ADC 12bits, can I just connect a female TS jack to it?
Wich distance sensor would be better for this kind of project, IR or ultrasonic?
I want this to be power by a 5v usb plug directly to the teensy, is this possible?
Is Teensy 3.2 the best choice?
Do I need more components like resistances?

Thanks!
 
Hi everyone, I'm new here and new with teensy
I want to start a project, a sinewave instrument "theremin like", but controlling the pitch with a softpot and the volume with a distance sensor.
I don't know almost anything about programming and electronics buy I want to learn and I think this project is what I need to start, sorry if I ask stupid questions:

Could teensy audio library generate a continuos pitch glide?
Yes
Do I need the audio board or could be done without it? I read something about teensy having a ADC 12bits, can I just connect a female TS jack to it?
Can be done without the audio board. The internal DAC and ADCs have 12bit resolution which gives a signal to noise ratio of ~72dB which might be sufficient for several use cases. You can't just connect a female TS jack to it, as for every digital-to-analog conversion, you'll need a Nyquist low pass filter and to remove the DAC's DC offset of 0.3V or 1.65V (depending on the selected reference voltage. On the ADC input side, filtering and biasing will be needed, too.
Wich distance sensor would be better for this kind of project, IR or ultrasonic?
It's up to you to decide that on the planned use case. IR might not work correctly under heavy stage lightness, ultrasonic needs a lot of additional filtering circuit to work correctly in a noisy environment. BTW, that's why Leon Theremin decided for heterodyning RF circuits as pitch and volume controllers for his instruments.
I want this to be power by a 5v usb plug directly to the teensy, is this possible?
Yes
Is Teensy 3.2 the best choice?
It's for sure not the worst choice, but that's the wrong question. Serious engineering consists in defining the exact technical specifications of your project first, then drawing and calculating all the needed analog and digital peripheral circuits, developing the abstract algorithm (flow diagram) of what you intend the MCU to do. Then, and only then, you'd study and compare data sheets and reference manuals to find the embedded processor which meets all your requirements. Same before buying a car. You'd define the size of the car depending on the number and age of your children and other things you plan to transport, think about the need to pull occasionally or regularly a trailer, and so on. Only after you'd have answered these questions, you would start to compare different brands and car models to see which one meets best your needs at an acceptable price.
Do I need more components like resistances?
Yes. When it comes to using peripherals and analog signal processing, passive components like resistors and capacitors and active components like opAmps will be needed for filtering, buffering and amplifying.
 
Could teensy audio library generate a continuos pitch glide?

Yes. Or "yes, mostly". Technically the pitch will update every 128 samples (~2.9ms). For practical human listening, that's pretty smooth, even if not technically continuous change in pitch.

Do I need the audio board or could be done without it?

This can be done without the audio shield. You can use the DAC to output the signal, if 12 bits is good enough quality for your needs.

But if you're a beginner, having the audio board is probably much better for learning, since the tutorials are all designed around the audio shield.

I read something about teensy having a ADC 12bits, can I just connect a female TS jack to it?

The short answer is no, almost certainly not. But the correct answer really depends on the details of your signal or whatever other gear you're going to connect. Those details matter, and aren't in your question...

For example, look at this documentation page (right side panel) and scroll down to "Hardware" for a circuit that couples ordinary consumer "line level" audio to the ADC pin.

https://www.pjrc.com/teensy/gui/?info=AudioInputAnalog

Wich distance sensor would be better for this kind of project, IR or ultrasonic?
I want this to be power by a 5v usb plug directly to the teensy, is this possible?
Is Teensy 3.2 the best choice?
Do I need more components like resistances?

Similarly, how can you expect anyone to be able to answer these questions without more understanding of what you're actually trying to build?

But on which board, if it's just a single sine wave then Teensy 3.2 is probably a safe bet. Even 8 or a dozen sine waves would probably be fine with Teensy 3.2. Unless there's some other feature not mentioned in this first question, it seems unlikely you'd need the more powerful Teensy 3.5 or 3.6. Teensy LC isn't compatible with the audio lib, so you'd need at least 3.2.

On the subject of USB power, one very common problem (in all audio systems) is called "ground loop" noise. It's so common when you have multiple grounded connections that we sell this isolator product.

https://www.pjrc.com/store/audio_ground_isolator.html

Usually USB power is earth grounded by your PC. Whether that causes a ground loop depends on whatever other gear you're connecting. It's almost impossible to predict in advance, but it's easy to at least warn you of this common issue.
 
Thank you so much to both of you for answering so nicely and quickly to my questions.
Theremingenieur, your clarification about the distance sensors was very helpful, is the "Nyquist low pass filter" intended to use to avoid aliasing? would it be necessary if only using sinewaves from 100hz to 1khz maybe less?

My first choise was the Teensy 3.2 because I think is powerful enough, has the audio library available and I don't need SD card reader

PaulStoffregen Sorry I thought I was being clear enough, I just want the teensy to make a simple sinewave sound between 100hz to 1khz or less, I think 12 bit audio would be enough even "prettier" sounding maybe, and my intention is to connect it by an audio ts jack to a guitar amp, line level or D.I. Working as an individual instrument connected to a power wall socket (no computer) and controlling the volumen by an ultrasonic sensor and the pitch by a softpot (touch stripe).

If it's harder for a beginner to use the Teensy on board ADC (need more components and knowledge) instead of the "Audio Board" I will buy it too

Thank you again!
 
Status
Not open for further replies.
Back
Top