Allright ! I already had some zeners shipped, I'll read more about how to get a proper voltage reference. I'll look into the LM7805 too.
Thanks a lot for your time and advice, I learned a lot from them. It seems a lot easier now to understand how to achieve this particular need to make Bela and the Euroworld talk to each other.
Eurorack Input
One thing I forgot to mention is that this circuit is far from ideal for serving as a general purpose interface between Bela and a synth (either way), because of many reasons, including that it does not provide any protection to the Bela inputs and it removes the DC component of the original signal, which means that LFO, gate, envelope signals would be badly distorted by passing through it.
Yes, I used it only to get audio from a VCO with a known voltage output. It was really for me to understand how to wire, divide, etc. It serves absolutely no other purpose than that.
I'll get to work to have a proper way to get anything from the euroworld into the Bela once I get components to protect inputs and be able to switch to DC signals.
The idea of listening to the power supply noise is a nice one. Maybe a piece should be done around the concept.
Thank you for the schematics (I saw the update in the other thread), very useful.
I still designing to understand the power consumption of the whole thing. I am considering now to go with an external 12V/2-3A since I am adding an LCD running also from a 5v source.
Do you have an opinion about demultiplexing one of the analog inputs with something like the 74HC4051PW to add extra pots. Or is it better to add an extra mcu. I would like to reserve all the possible cpu for audio.
Hypasus do you mean multiplexing the inputs ? The multiplexer capelet does just that. Schematics are here https://github.com/BelaPlatform/bela-hardware/tree/master/capelets/multiplexer/mux_capelet_A2 .
I have no idea what current is required by your LCD, but 3A seems a bit overkill for this application... Rather, unless you are using an LDO regulator, I would go for 15V AC transformer if you plan to use ±12V DC supply rails. I used to have troubles with 12V AC to be used for 12V DC supply rails because of fluctuations in the power grid in my area. Power outlets are normally rated ±10%.. When I had this issue, my synth would be unstable at random times of the day, or depending on the location, depending to what the mains voltage was in the area at the time.
Using two 1n4007 in a bridge rectifier configuration, you get a combined voltage drop of about 1.4V, so you get an unregulated DC voltage of
(12V - 1.4V)*sqrt(2) = 15 V
But if your mains voltage is 10% below the nominal value, you effectively get 13.5V. Considering the LM78xx/LM79xx series has a dropout of about 2V, an LM7x12 would not be capable of producing a regulated 12V output from an unregulated 13.5V input. 15V AC gives you a better safety margin on this. Again, your power requirements should not be huge and you should be able to comfortably fit in the 500mA provided by standard LM78xx series. Otherwise, I believe there must be a high-current version of these regulators
Yes, the multiplexer of course by 64 inputs is a bit too much for what I had on mind (4 extra pots and 4 encoders).
Well, I will keep playing maybe the 8 analog inputs will be enough for this project.
For the power supply, the real issue is sourcing the Beaglebone rated at 2A and the opamps for the synth level shifting: 500mA will be enough. I am experimenting with a small oled display, so that shouldn't be a big extra load.
That's why I initially thought to start with a strong 5V power supplyy and the boost, invert and regulate the 12/-12v
I am expecting the DC-regulators to make some measurements.
In between I put in a strip board a test circuit for 1v/octave input a trigger input, one unipolar and two bipolar inputs for LFOs, with another technic: generating a negative offset with a MAX1044 from the 3.3v supplied by the beagle, seems to work.
https://drive.google.com/file/d/0BxadeX5mevFULVpfRjFtZDgyT28/view?usp=sharing
The dac outputs are unipolar, will be enough to use a decoupling capacitor for bipolar signals? I tried with a 100uF and got a bit distortion.
Decoupling capacitors are useful for generating audio but not for CVs where you want response down to DC.
One way to get a bipolar output from a unipolar DAC is to use an op-amp mixer circuit. This is an inverting amplifier configuration with one feedback resistor and two input resistors. One of the inputs goes to the DAC, the other goes to a low-noise, regulated negative voltage, say -5V. The op-amp sums the two signals together at the output. Try, say, a 20k feedback resistor, 20k to -5V, and 10k to the DAC. This will turn the 0-5V range of the DAC into +5V to -5V (inverted), i.e. 0V from the DAC = +5V out, 2.5V from the DAC = 0V, 5V from the DAC = -5V out.
Strangely enough,the problem I have with "spikes" in the signal is not bound to the source. I tried a simple connection, taking the 3.3 from the Bela, into a 10k pot, into the analog 0.
The reading is dead flat, until I move the pot. Then some spikes emerges, until I stop making the signal varying. then dead flat again.
What can be the issue here ?
It sounds like a scratchy pot to me. have you tried with different pots?
Can you post a still of the scope? If you set it to single trigger mode you should be able to capture your noise.
Ok I'll do that when I get home
Sorry for the late answer, but I ran in this problem again, not having interfacing anything lately. The spikes are not occurring when I move the pot, but at random. It affects everything. I linked a video of it, the blue line is the sin output from the examples project, the red line is a simple 10k pot into Analog 0 wired to the 3.3v from the Bela. I simply multiply the reading from AnalogIn 0 with the output from the sine wave.
As you can see, the blue waveform is affected without me touching the pot. I tried a lot of them too. And also to change basic settings like sample rate, but it's always like this.
http://ovh.to/iw9ZH5g
Soundwise, you can hear pops now and then when it's strong enough, but you can hear it when modulating, ie using a pot to FM an oscillator in SC can get quite messy.
So I tried with just the simple sinetone project, and added a scope, and there are tiny spikes too:
http://ovh.to/Mkwp775
Is it me not understanding something ?
Interesting.
Where are you taking the ground signal from the board?
Is there anything else connected to the board?
Is your computer powered by battery or power supply?
Can you try instead of using the 3.3V source to use one of the analog outputs as your voltage reference? For instance, add this at the bottom of your render()
function:
analogWrite(context, 0, 0, 0.66)
This should give you 3.3V out of analog 0.
- Edited
For the recording of the two clips, ground was the pin right under the 3.3v supply. Nothing else was connected but 3.3, grd and analo in 0. I tried with my laptop wired or only on battery, and without the battery and only wired, same issue. I used to power it to get the amplifiers, but even without PSU and input/output (so nothing but the patch running), the sine get spikes.
I tried with the 3.3 from analogWrite, same issue. Also I have to write it every frame, only 0 makes it goes back to 0 every other frames. Here with the audio input on, a tiny one
thanks, what is the line in green?
Oh...I'm seeing this also. I thought it was my code or my CV source. I've spent the past 2 days tracking this down.
- Edited
what is that? where does it come from? is it an input ? Could you share your code ?
UlrichH are you using a BeagleBone Black? or a BeagleBone Green? or a BeagleBone Green WiFi?
I'm seeing a semi random spike on the scope and hearing it on the headphone output. Randomly my waveforms just act...weird. I'll record a demo, sounds great. The next day...Noise or random math failures (I'm making an additive synth and the waveforms get funky looking and sounding). All of which I had attributed to noise on the CV input or floating voltages on my Beatstep Pro and/or my Korg SQ1.
We are looking forward to investigate these issues , but we'd need some code and precise setup description in order to be able to reproduce and tackle the issue ourselves.
code can be pasted here if you are ok with sharing it with the web, otherwise email to info@bela.io thanks
giuliomoro the BBB sold with the Bela cape. I'm coming home in a few hours, I'll upload pictures of the setup and the code.
giuliomoro so, the green line is the output of Korg Volca going into the audio in of the Bela. The connections are as follow:
Analog Out 0 to 3.3V as you asked, into a 10k pot, ground to the analog out ground. The output of the pot is going to Analog In 0.
The code is the sinetone example, with a scope on with 3 inputs, red analog 0 reading, green audio in reading and blue sine out reading.
Do you mean you are connecting the analog out 0 to the 3.3V pin on the board? If that is the case, then DON'T ! What I meant was replacing the 3.3V source in your circuit with the output from analog0.
giuliomoro what ? why would I do that ? Sorry, english is not my main language. I meant "set up to output 3.3V". French shortcut, lost in translation I guess.
So I tried again getting audio from my Eurorack, same as before. Adding the output of an analog out from the Bela set around 2V with divided eurorack signal around 1Vpp with Zener for security. So in the limits, maybe not optimal but working with an Arduino for visualisation.
Weird thing: before the input of the Bela, I put a physical high pass filter, around 1500Hz. I output waht comes in, which is a simple sine wave from a Eurorack module, to the scope. I output to the audio out the signal after a software DC filter (and also to the scope to see if there's any difference. There is none). I can hear and see the effect of the hardware low pass filter, but the crackles and spikes are not affected, both sonically and on the scope.
I then tried to see only the output I use for voltage reference: noiseless IF nothing else is added. Things starts to get weird as soon as the outside world tries to communicate with the Bela. Even when only adding the circuitry without cable plugged in or whatever gets the signal to act weird.
Hi UlrichH
I am not sure I understand from your description what the setup is like.
Adding the output of an analog out from the Bela set around 2V with divided eurorack signal around 1Vpp with Zener for security.
Where is the output of the Bela analog out going to ? How is the Zener connected?
I put a physical high pass filter, around 1500Hz.
...
of the hardware low pass filter,
Is it a high-pass or low-pass filter? Are you using an audio or analog input to Bela?
things starts to get weird
in what sense weird?
Ultimately, your setup is not clear to me from the message above. Could you please send a more detailed description, possibly with a circuit diagram, of a minimal setup that showcases the problems you are having?
Also you do not mention anything about ground connections.
All the external circuitry connected to Bela's analog inputs should be referenced to a single ground pin (P9-1) to avoid disturbances from ground loops.
sorry, I wrote it in the subway, not a great place to write such a long post.
I'll check as soon as I get back that the circuitry connected to analog inputs are grounded to the right pin, and get back to you , with schematics and screenshots.
- Edited
So, I finally got it. It's not the circuitry in itself. It's the Eurorack PSU...
This is when the Bela the jack is away from my Eurorack:
http://www.balladeenruaba.fr/blog/wp-content/uploads/2016/09/scopeFar.png
This is when the jack is plugged in, and the PSU is plugged in to the rack.
http://www.balladeenruaba.fr/blog/wp-content/uploads/2016/09/scopeNear.png
With the sine wave coming from the eurorack:
http://www.balladeenruaba.fr/blog/wp-content/uploads/2016/09/on.png
So it actually works perfectly fine, all things considered. The PSU seems to transmit a lot of noise to the Bela. Weird thing is, I don't get it on my computer or the Arduino. It also transmits it if I get the jack CLOSE to the eurorack...
The laptop is on its battery, the Bela is powered only through USB. Is it something you might expect from such an installation ?
hm interesting.
I would see how noisy switching power supplies may induce noise on Bela analog inputs when these are left disconnected (open circuit) or when there is a very long cable carrying the signals to it.
Can you describe what the "jack" you mention is connecting? what are all the connections you have in place ?
- Edited
It's a simple Jack 3.5 TS cable that I use to connect the eurorack to the Bela. The signal then goes to a voltage divider, is added to a voltage reference from Analog Out 0, goes through a Low Pass Filter centred around 15kHz, then into Analog In. That's it. Something like this:
I might add that the first screenshot of the scope has been made while holding the cable in my hand, plugged into this circuitry above but not into the Eurorack. Dead flat.
The third one, the gif, is when the unplugged connection of going NEAR the Eurorack! Not plugged into a module, but just in my hand facing the synth.
I tried some things this morning. First, I don't have to plug a cable at all. Without any cable, just the circuitry, I get the noise by just having the PSU block powered and close enough to the Bela. If I unplug the PSU, the signal slowly gets back to flat. So i guess this is it, but why is it so bad on the Bela ?
I'll try to find an other PSU in the meantime, see if it changes something. The one I am using: http://www.4mspedals.com/powerbrick90.php
Edit: So i guess that solves the problem with the simple circuitry I got, where I got spikes for doing nothing, as the Bela was so close the the Eurorack world at the time...
The analog inputs are very high impedance, therefore they can easily pickup noise interferences from nearby sources if they are left floating, because the small impulsive currents that are induced in the circuit are turned into large voltages by going through the high impedance. But if you connect the analog input to something that is referenced to ground with a relatively small ( < 100k) impedance to ground, then that behaviour should disappear.
So I would expect the signal to be flat as soon as you plug that circuitry to the input, but if the current is impressed on the cable at the output of the circuit, I can see how that would affect the analog input.
I would try to connect a 47k resistor from the analog input to ground as close as possible to Bela (ideally on the cape itself), this would lower the impedance of the inputs and hopefully make the noise disappear.
Also, are you connecting both Bela's and the Eurorack's grounds to your filter above?
PS: I believe you mean "the second one" where you say "the third one"
Ok, so I rewired all grounds, added the resistor, and it works !! The signal is clean!! I get a clean sine wave from the Euro world
nice. Do the rewired grounds fix the issue or do you actually need the resistor?
Seems it works with only the rewired ground. It was stupid of me not to check that out in the first place, I was focused on something else entirely :/
Thank you for your help !
good news. Can you give us and other users a hint to what was wrong with the grounding and how you fixed it so we can all learn from your experience?
- Edited
Pretty straightforward: the ground from the jack socket input, its voltage divider and Zener diodes goes to P9_2, the ground from the circuitry which feeds Analog Input 0 as described above goes to P9_1.
http://www.balladeenruaba.fr/blog/wp-content/uploads/2016/09/2016-09-19-164538_903x556_scrot.png
I think 10k for the divider is too strong, I'll try some other values.
- Edited
Interesting, because P9_2 and P9_1 are actually shorted together on the board.
Can you also describe the configuration that was giving you troubles earlier on?
Ahah that's strange.
It was exactly the same, as the resistor was not needed, but with every ground shorted to ground P9_1.
the analog inputs are said to be 5v tolerant, and a suggestions to use a voltage clamp with schottky diodes to protect.
but the voltage clamp would give VDD + Vfd (forward voltage of diode), so for schottky diode around 5.3v -5.4v, is this 'safe'?
I guess the other option would use the voltage clamp using the 3.3v, such that its 3.7v , given we only measure to 4v no big issue.
(do I then even need schottky diodes?, I could use 'normal' diodes, as the Vfd is higher, but still fine for 5v tolerance pins)
BUT I will I'll still potentially get -0.3v (assuming schottky diodes) , ok?
(actually in my use case the voltage is never goes below zero, so i'll be ok, but for general eurorack protection this is not the case)
- Edited
The datasheet for the AD7699 gives as absolute maximum rating for analog inputs as "GND − 0.3 V to VDD + 0.3 V"
I used an 1n4007 ($V_f ~= 0.7V$
) down to 3.3V as a protection from positive voltages, but then you would need a schottky to ground to protect against negative voltages. I think the 1n4007 to 3.3V is safer than the schottky to 5V and its effect on the input range is minimal (if anything, you get a nice soft clipping).